Browse Source

库存调拨修改

28169 1 year ago
parent
commit
9375b4fad0

+ 4 - 4
controllers/data_api_controller.go View File

@@ -61,7 +61,7 @@ func DataApiRegistRouters() {
61 61
 
62 62
 }
63 63
 
64
-//GetPatientsList 取配置信息列表
64
+// GetPatientsList 取配置信息列表
65 65
 func (c *DataApiController) GetConfigList() {
66 66
 	adminUserInfo := c.GetAdminUserInfo()
67 67
 	configList, _ := service.GetConfigList(adminUserInfo.CurrentOrgId)
@@ -72,7 +72,7 @@ func (c *DataApiController) GetConfigList() {
72 72
 
73 73
 }
74 74
 
75
-//CreateConfig  创建配置信息
75
+// CreateConfig  创建配置信息
76 76
 func (c *DataApiController) CreateConfig() {
77 77
 	adminUserInfo := c.GetAdminUserInfo()
78 78
 
@@ -318,7 +318,7 @@ func (c *DataApiController) DeleteChildConfig() {
318 318
 	return
319 319
 }
320 320
 
321
-//CreateChildConfig  创建子配置信息
321
+// CreateChildConfig  创建子配置信息
322 322
 func (c *DataApiController) CreateChildConfig() {
323 323
 	adminUserInfo := c.GetAdminUserInfo()
324 324
 
@@ -400,7 +400,7 @@ func configFormData(dataconfig *models.Dataconfig, data []byte) (code int) {
400 400
 	}
401 401
 	dataconfig.Module = module
402 402
 
403
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" {
403
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" {
404 404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405 405
 			utils.ErrorLog("title")
406 406
 			code = enums.ErrorCodeParamWrong

+ 4 - 0
controllers/dialysis_record_api_controller.go View File

@@ -805,6 +805,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
805 805
 	nuclein_date := this.GetString("nuclein_date")
806 806
 	schedule_remark := this.GetString("schedule_remark")
807 807
 	order_remark := this.GetString("order_remark")
808
+	catheter_operation := this.GetString("catheter_operation")
808 809
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
809 810
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
810 811
 		return
@@ -1020,6 +1021,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1020 1021
 		NucleinDate:            theNucleinDate,
1021 1022
 		ScheduleRemark:         schedule_remark,
1022 1023
 		OrderRemark:            order_remark,
1024
+		CatheterOperation:      catheter_operation,
1023 1025
 	}
1024 1026
 
1025 1027
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
@@ -1604,6 +1606,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1604 1606
 	nuclein_date := this.GetString("nuclein_date")
1605 1607
 	schedule_remark := this.GetString("schedule_remark")
1606 1608
 	order_remark := this.GetString("order_remark")
1609
+	catheter_operation := this.GetString("catheter_operation")
1607 1610
 	if record_id == 0 {
1608 1611
 		this.ErrorLog("id:%v", record_id)
1609 1612
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1769,6 +1772,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1769 1772
 		NucleinDate:            theNucleinDate,
1770 1773
 		ScheduleRemark:         schedule_remark,
1771 1774
 		OrderRemark:            order_remark,
1775
+		CatheterOperation:      catheter_operation,
1772 1776
 	}
1773 1777
 
1774 1778
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)

+ 86 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -2086,6 +2086,86 @@ func (c *DialysisAPIController) Finish() {
2086 2086
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderNoEND)
2087 2087
 		return
2088 2088
 	}
2089
+
2090
+	//下机完自动消毒,针对长沙南雅
2091
+	if dialysisOrder.Stage == 1 {
2092
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
2093
+			//根据床位号获取设备型号
2094
+			unitType, _ := service.GetUnitType(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2095
+			//查询使用消毒最后一条消毒记录
2096
+			_, err := service.GetLaseDeviceInfomation(dialysisOrder.UserOrgId, dialysisOrder.BedID, dialysisOrder.DialysisDate, dialysisOrder.SchedualType)
2097
+			fmt.Println("err", err)
2098
+			if err == gorm.ErrRecordNotFound {
2099
+				//查找排班
2100
+				scheduleByPatient, _ := service.GetScheduleByPatient(dialysisOrder.PatientId, dialysisOrder.DialysisDate, dialysisOrder.UserOrgId)
2101
+				//查询改设备是否有消毒计划
2102
+				plan, errcode := service.GetDisInfectionTime(dialysisOrder.UserOrgId, unitType.UnitType, dialysisOrder.SchedualType, scheduleByPatient.ScheduleWeek)
2103
+
2104
+				//根据床位号获取设备id
2105
+				addmacher, _ := service.GetEquimentIDTwo(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2106
+
2107
+				//查询病人信息
2108
+				patients, _ := service.GetPatientInfoMation(dialysisOrder.PatientId)
2109
+				var con = ""
2110
+				if patients.IsInfectious == 0 {
2111
+					con = ""
2112
+				}
2113
+				if patients.IsInfectious == 1 {
2114
+					con = "无"
2115
+				}
2116
+				if patients.IsInfectious == 2 {
2117
+					con = "有"
2118
+				}
2119
+
2120
+				//如果没有消毒计划,去查询该设备的上次消毒时间
2121
+				if errcode == gorm.ErrRecordNotFound {
2122
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2123
+					return
2124
+				}
2125
+				if errcode == nil {
2126
+					var end_time int64
2127
+					end_time = endDate.Unix() + plan.DisinfecTime*60
2128
+					//新增消毒
2129
+					information := models.DeviceInformation{
2130
+						Date:                  dialysisOrder.DialysisDate,
2131
+						Zone:                  dialysisOrder.ZoneId,
2132
+						Class:                 dialysisOrder.SchedualType,
2133
+						BedNumber:             dialysisOrder.BedID,
2134
+						PatientId:             dialysisOrder.PatientId,
2135
+						DialysisMode:          scheduleByPatient.ModeId,
2136
+						LongTime:              strconv.FormatInt(plan.DisinfecTime, 10),
2137
+						Disinfection:          1,
2138
+						DialysisConcentration: 1,
2139
+						DisinfectionStatus:    1,
2140
+						Move:                  1,
2141
+						UserOrgId:             dialysisOrder.UserOrgId,
2142
+						DisinfectType:         plan.Way,
2143
+						DisinfectantType:      plan.MachineDisinfectant,
2144
+						FluidPath:             plan.DisinfectanWay, //液路消毒方式
2145
+						Disinfectant:          plan.Disinfectant,
2146
+						Ctime:                 time.Now().Unix(),
2147
+						Status:                1,
2148
+						SignName:              dialysisOrder.FinishNurse,
2149
+						EquimentId:            addmacher.ID,
2150
+						DisinfectionResidue:   2,
2151
+						Bed:                   addmacher.BedNumber,
2152
+						StartTime:             dialysisOrder.StartTime,
2153
+						EndTime:               dialysisOrder.EndTime,
2154
+						Contagion:             con,
2155
+						WeightLoss:            0,
2156
+						Hyperfiltratio:        0,
2157
+						DialysisHour:          "",
2158
+						MachineRun:            1,
2159
+						DisinfecStartime:      endDate.Unix(),
2160
+						DisinfecEndtime:       end_time,
2161
+					}
2162
+					err := service.CreateInformationTwo(&information)
2163
+					fmt.Println("报错", err)
2164
+				}
2165
+			}
2166
+		}
2167
+	}
2168
+
2089 2169
 	if dialysisOrder.Stage == 1 {
2090 2170
 		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
2091 2171
 
@@ -2126,6 +2206,7 @@ func (c *DialysisAPIController) Finish() {
2126 2206
 		}
2127 2207
 
2128 2208
 	}
2209
+
2129 2210
 }
2130 2211
 
2131 2212
 func (c *DialysisAPIController) GetAllZone() {
@@ -2188,6 +2269,8 @@ func (this *DialysisAPIController) StartDialysis() {
2188 2269
 	nuclein_date_str := this.GetString("nuclein_date_str")
2189 2270
 	schedule_remark := this.GetString("schedule_remark")
2190 2271
 	order_remark := this.GetString("order_remark")
2272
+	catheter_operation := this.GetString("catheter_operation")
2273
+
2191 2274
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
2192 2275
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2193 2276
 		return
@@ -2389,6 +2472,7 @@ func (this *DialysisAPIController) StartDialysis() {
2389 2472
 		NucleinDate:            theNucleinDate,
2390 2473
 		ScheduleRemark:         schedule_remark,
2391 2474
 		OrderRemark:            order_remark,
2475
+		CatheterOperation:      catheter_operation,
2392 2476
 	}
2393 2477
 	//查询该床位是否有人用了
2394 2478
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
@@ -3246,6 +3330,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
3246 3330
 	nuclein_date_str := this.GetString("nuclein_date_str")
3247 3331
 	order_remark := this.GetString("order_remark")
3248 3332
 	schedule_remark := this.GetString("schedule_remark")
3333
+	catheter_operation := this.GetString("catheter_operation")
3249 3334
 	if record_id == 0 {
3250 3335
 		this.ErrorLog("id:%v", record_id)
3251 3336
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -3410,6 +3495,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
3410 3495
 		NucleinDate:            theNucleinDate,
3411 3496
 		OrderRemark:            order_remark,
3412 3497
 		ScheduleRemark:         schedule_remark,
3498
+		CatheterOperation:      catheter_operation,
3413 3499
 	}
3414 3500
 
3415 3501
 	//修改床位号需要重新消毒

+ 2 - 1
models/dialysis.go View File

@@ -347,7 +347,7 @@ func (PredialysisEvaluationList) TableName() string {
347 347
 	return "xt_assessment_before_dislysis"
348 348
 }
349 349
 
350
-//更改的地方
350
+// 更改的地方
351 351
 type DoctorAdvices struct {
352 352
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
353 353
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
@@ -850,6 +850,7 @@ type DialysisOrder struct {
850 850
 	ScheduleRemark             string        `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
851 851
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
852 852
 	DialysisTotal              int64         `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
853
+	CatheterOperation          string        `gorm:"column:catheter_operation" json:"catheter_operation" form:"catheter_operation"`
853 854
 }
854 855
 
855 856
 func (DialysisOrder) TableName() string {

+ 1 - 1
service/mobile_dialysis_service.go View File

@@ -2214,7 +2214,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
2214 2214
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2215 2215
 	tx := writeDb.Begin()
2216 2216
 	updateTime := time.Now().Unix()
2217
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark}).Error
2217
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark, "catheter_operation": order.CatheterOperation}).Error
2218 2218
 	if err != nil {
2219 2219
 		tx.Rollback()
2220 2220
 		return err