Browse Source

库存调拨修改

28169 1 year ago
parent
commit
9375b4fad0

+ 4 - 4
controllers/data_api_controller.go View File

61
 
61
 
62
 }
62
 }
63
 
63
 
64
-//GetPatientsList 取配置信息列表
64
+// GetPatientsList 取配置信息列表
65
 func (c *DataApiController) GetConfigList() {
65
 func (c *DataApiController) GetConfigList() {
66
 	adminUserInfo := c.GetAdminUserInfo()
66
 	adminUserInfo := c.GetAdminUserInfo()
67
 	configList, _ := service.GetConfigList(adminUserInfo.CurrentOrgId)
67
 	configList, _ := service.GetConfigList(adminUserInfo.CurrentOrgId)
72
 
72
 
73
 }
73
 }
74
 
74
 
75
-//CreateConfig  创建配置信息
75
+// CreateConfig  创建配置信息
76
 func (c *DataApiController) CreateConfig() {
76
 func (c *DataApiController) CreateConfig() {
77
 	adminUserInfo := c.GetAdminUserInfo()
77
 	adminUserInfo := c.GetAdminUserInfo()
78
 
78
 
318
 	return
318
 	return
319
 }
319
 }
320
 
320
 
321
-//CreateChildConfig  创建子配置信息
321
+// CreateChildConfig  创建子配置信息
322
 func (c *DataApiController) CreateChildConfig() {
322
 func (c *DataApiController) CreateChildConfig() {
323
 	adminUserInfo := c.GetAdminUserInfo()
323
 	adminUserInfo := c.GetAdminUserInfo()
324
 
324
 
400
 	}
400
 	}
401
 	dataconfig.Module = module
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
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405
 			utils.ErrorLog("title")
405
 			utils.ErrorLog("title")
406
 			code = enums.ErrorCodeParamWrong
406
 			code = enums.ErrorCodeParamWrong

+ 4 - 0
controllers/dialysis_record_api_controller.go View File

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

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

2086
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderNoEND)
2086
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderNoEND)
2087
 		return
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
 	if dialysisOrder.Stage == 1 {
2169
 	if dialysisOrder.Stage == 1 {
2090
 		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
2170
 		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
2091
 
2171
 
2126
 		}
2206
 		}
2127
 
2207
 
2128
 	}
2208
 	}
2209
+
2129
 }
2210
 }
2130
 
2211
 
2131
 func (c *DialysisAPIController) GetAllZone() {
2212
 func (c *DialysisAPIController) GetAllZone() {
2188
 	nuclein_date_str := this.GetString("nuclein_date_str")
2269
 	nuclein_date_str := this.GetString("nuclein_date_str")
2189
 	schedule_remark := this.GetString("schedule_remark")
2270
 	schedule_remark := this.GetString("schedule_remark")
2190
 	order_remark := this.GetString("order_remark")
2271
 	order_remark := this.GetString("order_remark")
2272
+	catheter_operation := this.GetString("catheter_operation")
2273
+
2191
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
2274
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
2192
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2275
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2193
 		return
2276
 		return
2389
 		NucleinDate:            theNucleinDate,
2472
 		NucleinDate:            theNucleinDate,
2390
 		ScheduleRemark:         schedule_remark,
2473
 		ScheduleRemark:         schedule_remark,
2391
 		OrderRemark:            order_remark,
2474
 		OrderRemark:            order_remark,
2475
+		CatheterOperation:      catheter_operation,
2392
 	}
2476
 	}
2393
 	//查询该床位是否有人用了
2477
 	//查询该床位是否有人用了
2394
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
2478
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
3246
 	nuclein_date_str := this.GetString("nuclein_date_str")
3330
 	nuclein_date_str := this.GetString("nuclein_date_str")
3247
 	order_remark := this.GetString("order_remark")
3331
 	order_remark := this.GetString("order_remark")
3248
 	schedule_remark := this.GetString("schedule_remark")
3332
 	schedule_remark := this.GetString("schedule_remark")
3333
+	catheter_operation := this.GetString("catheter_operation")
3249
 	if record_id == 0 {
3334
 	if record_id == 0 {
3250
 		this.ErrorLog("id:%v", record_id)
3335
 		this.ErrorLog("id:%v", record_id)
3251
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3336
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3410
 		NucleinDate:            theNucleinDate,
3495
 		NucleinDate:            theNucleinDate,
3411
 		OrderRemark:            order_remark,
3496
 		OrderRemark:            order_remark,
3412
 		ScheduleRemark:         schedule_remark,
3497
 		ScheduleRemark:         schedule_remark,
3498
+		CatheterOperation:      catheter_operation,
3413
 	}
3499
 	}
3414
 
3500
 
3415
 	//修改床位号需要重新消毒
3501
 	//修改床位号需要重新消毒

+ 2 - 1
models/dialysis.go View File

347
 	return "xt_assessment_before_dislysis"
347
 	return "xt_assessment_before_dislysis"
348
 }
348
 }
349
 
349
 
350
-//更改的地方
350
+// 更改的地方
351
 type DoctorAdvices struct {
351
 type DoctorAdvices struct {
352
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
352
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
353
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
353
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
850
 	ScheduleRemark             string        `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
850
 	ScheduleRemark             string        `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
851
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
851
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
852
 	DialysisTotal              int64         `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
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
 func (DialysisOrder) TableName() string {
856
 func (DialysisOrder) TableName() string {

+ 1 - 1
service/mobile_dialysis_service.go View File

2214
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2214
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2215
 	tx := writeDb.Begin()
2215
 	tx := writeDb.Begin()
2216
 	updateTime := time.Now().Unix()
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
 	if err != nil {
2218
 	if err != nil {
2219
 		tx.Rollback()
2219
 		tx.Rollback()
2220
 		return err
2220
 		return err