浏览代码

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 7 个月前
父节点
当前提交
40d07f93ee

二进制
XT_New.exe 查看文件


+ 6 - 6
controllers/base_api_controller.go 查看文件

72
 	this.BaseAPIController.Prepare()
72
 	this.BaseAPIController.Prepare()
73
 	if this.GetAdminUserInfo() == nil {
73
 	if this.GetAdminUserInfo() == nil {
74
 		var userAdmin models.AdminUser
74
 		var userAdmin models.AdminUser
75
-		userAdmin.Id = 4608
75
+		userAdmin.Id = 5386
76
 		userAdmin.Mobile = "13318599895"
76
 		userAdmin.Mobile = "13318599895"
77
 
77
 
78
-		userAdmin.Id = 4608 //4,809
78
+		userAdmin.Id = 5386 //4,809
79
 		userAdmin.Mobile = "12222222222"
79
 		userAdmin.Mobile = "12222222222"
80
 		userAdmin.IsSuperAdmin = true
80
 		userAdmin.IsSuperAdmin = true
81
 		userAdmin.Status = 1
81
 		userAdmin.Status = 1
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
 		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
96
 		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 7421  //4
97
+		adminUserInfo.CurrentAppId = 18470 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
100
 		this.SetSession("admin_user_info", &adminUserInfo)
100
 		this.SetSession("admin_user_info", &adminUserInfo)
318
 	this.BaseAPIController.Prepare()
318
 	this.BaseAPIController.Prepare()
319
 	if this.GetAdminUserInfo() == nil {
319
 	if this.GetAdminUserInfo() == nil {
320
 		var userAdmin models.AdminUser
320
 		var userAdmin models.AdminUser
321
-		userAdmin.Id = 4608
321
+		userAdmin.Id = 5386
322
 		userAdmin.Mobile = "13318599895"
322
 		userAdmin.Mobile = "13318599895"
323
 
323
 
324
-		userAdmin.Id = 4608 //4,809
324
+		userAdmin.Id = 5386 //4,809
325
 		userAdmin.Mobile = "12222222222"
325
 		userAdmin.Mobile = "12222222222"
326
 		userAdmin.IsSuperAdmin = false
326
 		userAdmin.IsSuperAdmin = false
327
 		userAdmin.Status = 1
327
 		userAdmin.Status = 1
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
 		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
342
 		adminUserInfo.CurrentOrgId = 10206 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 7421  //4
343
+		adminUserInfo.CurrentAppId = 18470 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes
346
 		this.SetSession("admin_user_info", &adminUserInfo)
346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 34 - 2
controllers/dialysis_api_controller.go 查看文件

151
 
151
 
152
 	beego.Router("/api/schedule/getdialysisproject", &DialysisApiController{}, "Get:GetDialysisProject")
152
 	beego.Router("/api/schedule/getdialysisproject", &DialysisApiController{}, "Get:GetDialysisProject")
153
 
153
 
154
+	beego.Router("/api/schedule/getpatientbefor", &DialysisApiController{}, "Get:GetPatientBefor")
155
+
154
 }
156
 }
155
 
157
 
156
 func (c *DialysisApiController) GetQueueCall() {
158
 func (c *DialysisApiController) GetQueueCall() {
3178
 		}
3180
 		}
3179
 
3181
 
3180
 		//针对孝昌康桥超滤率计算问题
3182
 		//针对孝昌康桥超滤率计算问题
3181
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 {
3183
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 {
3182
 			if assessmentBeforeDislysis.ID == 0 {
3184
 			if assessmentBeforeDislysis.ID == 0 {
3183
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3185
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3184
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3186
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
5614
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
5616
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
5615
 
5617
 
5616
 		//康桥
5618
 		//康桥
5617
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
5619
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
5618
 			timeNowStr := time.Now().Format("2006-01-02")
5620
 			timeNowStr := time.Now().Format("2006-01-02")
5619
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5621
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5620
 
5622
 
6177
 	gansuna_set, _ := this.GetInt64("gansuna_set")
6179
 	gansuna_set, _ := this.GetInt64("gansuna_set")
6178
 	zhetangtie_set, _ := this.GetInt64("zhetangtie_set")
6180
 	zhetangtie_set, _ := this.GetInt64("zhetangtie_set")
6179
 	niaojimei_set, _ := this.GetInt64("niaojimei_set")
6181
 	niaojimei_set, _ := this.GetInt64("niaojimei_set")
6182
+	dialysis_strainer_set, _ := this.GetInt64("dialysis_strainer_set")
6180
 	dialysisSetting := models.XtDialysisSetting{
6183
 	dialysisSetting := models.XtDialysisSetting{
6181
 		Sodium:                     sodium_set,
6184
 		Sodium:                     sodium_set,
6182
 		Calcium:                    calcium_set,
6185
 		Calcium:                    calcium_set,
6215
 		GansunaSet:                 gansuna_set,
6218
 		GansunaSet:                 gansuna_set,
6216
 		ZhetangtieSet:              zhetangtie_set,
6219
 		ZhetangtieSet:              zhetangtie_set,
6217
 		NiaojimeiSet:               niaojimei_set,
6220
 		NiaojimeiSet:               niaojimei_set,
6221
+		DialysisStrainerSet:        dialysis_strainer_set,
6218
 	}
6222
 	}
6219
 	err := service.SaveDialysisSetting(dialysisSetting)
6223
 	err := service.SaveDialysisSetting(dialysisSetting)
6220
 	if err == nil {
6224
 	if err == nil {
7959
 		"order": order,
7963
 		"order": order,
7960
 	})
7964
 	})
7961
 }
7965
 }
7966
+
7967
+func (this *DialysisApiController) GetPatientBefor() {
7968
+
7969
+	timeLayout := "2006-01-02"
7970
+	loc, _ := time.LoadLocation("Local")
7971
+
7972
+	record_date := this.GetString("record_date")
7973
+
7974
+	patient_id, _ := this.GetInt64("patient_id")
7975
+
7976
+	user_org_id := this.GetAdminUserInfo().CurrentOrgId
7977
+
7978
+	var startdateunix int64
7979
+	if len(record_date) > 0 {
7980
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7981
+		if err != nil {
7982
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7983
+			return
7984
+		}
7985
+		startdateunix = theTime.Unix()
7986
+	}
7987
+
7988
+	patientBefor, _ := service.GetPatientBefor(patient_id, startdateunix, user_org_id)
7989
+
7990
+	this.ServeSuccessJSON(map[string]interface{}{
7991
+		"patientBefor": patientBefor,
7992
+	})
7993
+}

+ 5 - 1
controllers/doctors_api_controller.go 查看文件

109
 	config, _ := service.GetHisDoctorConfig(orgID)
109
 	config, _ := service.GetHisDoctorConfig(orgID)
110
 	project_config, _ := service.GetHisProjectConfig(orgID)
110
 	project_config, _ := service.GetHisProjectConfig(orgID)
111
 
111
 
112
+	drugs, _ := service.GetAllBaseDrugLibListTwo(orgID)
113
+
112
 	if config.IsOpen == 0 || config.IsOpen == 2 {
114
 	if config.IsOpen == 0 || config.IsOpen == 2 {
113
 		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency, keyword)
115
 		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency, keyword)
114
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
116
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
127
 				"adminUser":      adminUser,
129
 				"adminUser":      adminUser,
128
 				"config":         config,
130
 				"config":         config,
129
 				"project_config": project_config,
131
 				"project_config": project_config,
132
+				"drugs":          drugs,
130
 			})
133
 			})
131
 		}
134
 		}
132
 	}
135
 	}
167
 				"project_config": project_config,
170
 				"project_config": project_config,
168
 				"project":        project,
171
 				"project":        project,
169
 				"drug":           drug,
172
 				"drug":           drug,
173
+				"drugs":          drugs,
170
 			})
174
 			})
171
 		}
175
 		}
172
 	}
176
 	}
349
 	}
353
 	}
350
 
354
 
351
 	//康桥
355
 	//康桥
352
-	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
356
+	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
353
 		timeNowStr := time.Now().Format("2006-01-02")
357
 		timeNowStr := time.Now().Format("2006-01-02")
354
 		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
358
 		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
355
 
359
 

+ 442 - 8
controllers/his_api_controller.go 查看文件

3385
 	var adviceList []models.HisDoctorAdviceInfo
3385
 	var adviceList []models.HisDoctorAdviceInfo
3386
 	var projectList []models.HisPrescriptionProject
3386
 	var projectList []models.HisPrescriptionProject
3387
 
3387
 
3388
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 {
3388
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 {
3389
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3389
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3390
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3390
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3391
 
3391
 
3967
 									storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
3967
 									storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
3968
 									if p.Type == 3 {
3968
 									if p.Type == 3 {
3969
 										lastWarehouse, _ := service.FindFirstWarehousingInfoByStockThree(p.ProjectId, storeConfig.DrugStorehouseOut)
3969
 										lastWarehouse, _ := service.FindFirstWarehousingInfoByStockThree(p.ProjectId, storeConfig.DrugStorehouseOut)
3970
+
3970
 										if p.Price != lastWarehouse.PackingPrice {
3971
 										if p.Price != lastWarehouse.PackingPrice {
3971
 											p.Price = lastWarehouse.PackingPrice
3972
 											p.Price = lastWarehouse.PackingPrice
3972
 										}
3973
 										}
4012
 
4013
 
4013
 								//查询保存耗材出库开关是否打开
4014
 								//查询保存耗材出库开关是否打开
4014
 								if p.PatientId != 30038 {
4015
 								if p.PatientId != 30038 {
4015
-									if goodOutConfig.IsOpen == 1 {
4016
+
4017
+									//用机构ID区分
4018
+									if adminInfo.CurrentOrgId != 10721 && adminInfo.CurrentOrgId != 10164 {
4019
+										if goodOutConfig.IsOpen == 1 {
4020
+											//耗材出库
4021
+											if p.Type == 3 {
4022
+
4023
+												//对比当前数据和历史出库数据
4024
+
4025
+												historyProject, _ := service.GetHistoryProject(p.PatientId, p.UserOrgId, p.RecordDate, p.ID, p.ProjectId, tx)
4026
+
4027
+												historyCount, _ := strconv.ParseInt(historyProject.Count, 10, 64)
4028
+
4029
+												nowCount, _ := strconv.ParseInt(p.Count, 10, 64)
4030
+
4031
+												//如果当前处方数量大于历史数据,则需要出库
4032
+												if nowCount > historyCount {
4033
+
4034
+													var cha_count int64
4035
+													cha_count = nowCount - historyCount
4036
+
4037
+													timeStr := time.Now().Format("2006-01-02")
4038
+													timeArr := strings.Split(timeStr, "-")
4039
+													total, _ := service.FindAllWarehouseOut(adminInfo.CurrentOrgId)
4040
+
4041
+													total = total + 1
4042
+													warehousing_out_order := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
4043
+													number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
4044
+													number = number + total
4045
+													warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
4046
+
4047
+													operation_time := time.Now().Unix()
4048
+													creater := c.GetAdminUserInfo().AdminUser.Id
4049
+
4050
+													recordDateStr := time.Now().Format("2006-01-02")
4051
+													recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
4052
+													nowtime := recordDate.Unix()
4053
+													warehouseOut := models.WarehouseOut{
4054
+														WarehouseOutOrderNumber: warehousing_out_order,
4055
+														OperationTime:           operation_time,
4056
+														OrgId:                   adminInfo.CurrentOrgId,
4057
+														Creater:                 creater,
4058
+														Ctime:                   time.Now().Unix(),
4059
+														Status:                  1,
4060
+														WarehouseOutTime:        nowtime,
4061
+														Type:                    1,
4062
+														StorehouseId:            storeConfig.StorehouseOutInfo,
4063
+														IsCheck:                 1,
4064
+														IsSys:                   1,
4065
+													}
4066
+													//查询是否生成出库单
4067
+													out, _ := service.FindNewPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
4068
+													if out.ID == 0 {
4069
+														service.AddNewSigleWarehouseOut(&warehouseOut, tx)
4070
+													}
4071
+
4072
+													lastOut, _ := service.FindNewLastPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
4073
+
4074
+													goodObj, _ := service.GetNewGoodInformationByGoodIdThirty(p.ProjectId, tx)
4075
+													houseConfig, _ := service.GetNewAllStoreHouseConfig(p.UserOrgId, tx)
4076
+
4077
+													dialyPrepareOne := models.DialysisBeforePrepare{
4078
+														GoodTypeId:   goodObj.GoodTypeId,
4079
+														GoodId:       p.ProjectId,
4080
+														PatientId:    p.PatientId,
4081
+														RecordDate:   p.RecordDate,
4082
+														UserOrgId:    adminInfo.CurrentOrgId,
4083
+														Count:        cha_count,
4084
+														Ctime:        time.Now().Unix(),
4085
+														Creater:      creater,
4086
+														Status:       1,
4087
+														StorehouseId: houseConfig.StorehouseOutInfo,
4088
+														ProjectId:    p.ID,
4089
+													}
4090
+													//出库
4091
+													service.ConsumableNewHisPrescriptionDelivery(adminInfo.CurrentOrgId, p.PatientId, p.RecordDate, &dialyPrepareOne, &lastOut, creater, tx)
4092
+
4093
+												}
4094
+
4095
+												//如果当前处方数量小于历史数据,怎需要退库
4096
+												if nowCount < historyCount {
4097
+
4098
+													var cha_count int64
4099
+													cha_count = historyCount - nowCount
4100
+													goodObj, _ := service.GetNewGoodInformationByGoodIdThirty(p.ProjectId, tx)
4101
+													creater := c.GetAdminUserInfo().AdminUser.Id
4102
+
4103
+													newPrescriptionProject := &models.HisPrescriptionProject{
4104
+														ID:                   p.ID,
4105
+														ProjectId:            p.ProjectId,
4106
+														Price:                p.Price,
4107
+														UserOrgId:            p.UserOrgId,
4108
+														Status:               1,
4109
+														Ctime:                time.Now().Unix(),
4110
+														Mtime:                time.Now().Unix(),
4111
+														PatientId:            p.PatientId,
4112
+														HisPatientId:         p.HisPatientId,
4113
+														RecordDate:           p.RecordDate,
4114
+														PrescriptionId:       p.PrescriptionId,
4115
+														Count:                p.Count,
4116
+														FeedetlSn:            p.FeedetlSn,
4117
+														MedListCodg:          p.MedListCodg,
4118
+														SingleDose:           p.SingleDose,
4119
+														DeliveryWay:          p.DeliveryWay,
4120
+														ExecutionFrequency:   p.ExecutionFrequency,
4121
+														Day:                  p.Day,
4122
+														HisProject:           models.HisProject{},
4123
+														GoodInfo:             models.GoodInfo{},
4124
+														Remark:               p.Remark,
4125
+														Unit:                 p.Unit,
4126
+														Type:                 p.Type,
4127
+														Doctor:               p.Doctor,
4128
+														ExecutionTime:        p.ExecutionTime,
4129
+														ExecutionStaff:       p.ExecutionStaff,
4130
+														ExecutionState:       p.ExecutionState,
4131
+														CheckTime:            p.CheckTime,
4132
+														CheckState:           p.CheckState,
4133
+														Checker:              p.Checker,
4134
+														StartTime:            p.StartTime,
4135
+														TeamId:               p.TeamId,
4136
+														XtHisProjectTeam:     models.XtHisProjectTeam{},
4137
+														FrequencyType:        p.FrequencyType,
4138
+														DayCount:             p.DayCount,
4139
+														WeekDay:              p.WeekDay,
4140
+														IsCheckTeam:          p.IsCheckTeam,
4141
+														HisOrderInfo:         models.HisOrderInfo{},
4142
+														ExecutionFrequencyId: p.ExecutionFrequencyId,
4143
+														IsOut:                p.IsOut,
4144
+														YbSyncStatus:         p.YbSyncStatus,
4145
+													}
4146
+
4147
+													service.NewHisGoodCancelInfo(adminInfo.CurrentOrgId, creater, newPrescriptionProject, cha_count, goodObj, tx)
4148
+
4149
+													service.NewHisGoodAutoCancelInfo(adminInfo.CurrentOrgId, creater, newPrescriptionProject, cha_count, goodObj, tx)
4150
+
4151
+												}
4152
+
4153
+												if nowCount == historyCount {
4154
+													if historyCount == 0 {
4155
+														recordDateStr := time.Now().Format("2006-01-02")
4156
+														recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
4157
+														nowtime := recordDate.Unix()
4158
+														lastOut, _ := service.FindNewLastPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
4159
+														goodObj, _ := service.GetNewGoodInformationByGoodIdThirty(p.ProjectId, tx)
4160
+														houseConfig, _ := service.GetNewAllStoreHouseConfig(p.UserOrgId, tx)
4161
+														creater := c.GetAdminUserInfo().AdminUser.Id
4162
+														dialyPrepareOne := models.DialysisBeforePrepare{
4163
+															GoodTypeId:   goodObj.GoodTypeId,
4164
+															GoodId:       p.ProjectId,
4165
+															PatientId:    p.PatientId,
4166
+															RecordDate:   p.RecordDate,
4167
+															UserOrgId:    adminInfo.CurrentOrgId,
4168
+															Count:        nowCount,
4169
+															Ctime:        time.Now().Unix(),
4170
+															Creater:      creater,
4171
+															Status:       1,
4172
+															StorehouseId: houseConfig.StorehouseOutInfo,
4173
+															ProjectId:    p.ID,
4174
+														}
4175
+														//出库
4176
+														service.ConsumableNewHisPrescriptionDelivery(adminInfo.CurrentOrgId, p.PatientId, p.RecordDate, &dialyPrepareOne, &lastOut, creater, tx)
4177
+													}
4178
+												}
4179
+
4180
+												lastHisProject, _ := service.GetLastHisProject(p.PatientId, p.UserOrgId, p.RecordDate, tx, p.ProjectId)
4181
+												//查询历史出库数据
4182
+												flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)
4183
+
4184
+												var out_count_five int64
4185
+												for _, item := range flowGood {
4186
+													out_count_five += item.Count
4187
+												}
4188
+												parseIntCount, _ := strconv.ParseInt(p.Count, 10, 64)
4189
+
4190
+												//如果当前处方的出库数量和已经出库的数量不一致,需要进行退库或者出库
4191
+												if out_count_five != parseIntCount {
4192
+													service.UpdateNewAutomaticReduce(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
4193
+													detail := models.AutomaticReduceDetail{
4194
+														WarehouseOutId:          0,
4195
+														WarehouseOutOrderNumber: "",
4196
+														PatientId:               p.PatientId,
4197
+														Ctime:                   time.Now().Unix(),
4198
+														Mtime:                   0,
4199
+														Status:                  1,
4200
+														RecordTime:              p.RecordDate,
4201
+														OrgId:                   p.UserOrgId,
4202
+														GoodId:                  p.ProjectId,
4203
+														GoodTypeId:              0,
4204
+														Count:                   parseIntCount,
4205
+														Type:                    0,
4206
+														ProjectId:               lastHisProject.ID,
4207
+														StorehouseId:            0,
4208
+													}
4209
+
4210
+													service.CreateNewAutoDetail(detail, tx)
4211
+												}
4212
+												//	//查询耗材最后一次出库记录
4213
+												//	wareOut, _ := service.GetLastGoodWarehouseOutInfoByProjectId(p.ProjectId, patient_id, recordDateTime, lastHisProject.ID)
4214
+												//	//查询默认出库仓库库存
4215
+												//	storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
4216
+												//	if len(wareOut) > 0 {
4217
+												//
4218
+												//		for _, it := range wareOut {
4219
+												//			//回退库存
4220
+												//			service.ModifyGoodWarehouseInfo(it.GoodId, it.WarehouseInfotId, it.OrgId, it.Count)
4221
+												//
4222
+												//			//删除出库记录
4223
+												//			service.DeleteGoodWarehouseOutInfo(it.GoodId, it.SysRecordTime, it.OrgId, it.ProjectId)
4224
+												//
4225
+												//		}
4226
+												//	}
4227
+												//
4228
+												//	timeStr := time.Now().Format("2006-01-02")
4229
+												//	timeArr := strings.Split(timeStr, "-")
4230
+												//	total, _ := service.FindAllWarehouseOut(adminInfo.CurrentOrgId)
4231
+												//
4232
+												//	total = total + 1
4233
+												//	warehousing_out_order := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
4234
+												//	number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
4235
+												//	number = number + total
4236
+												//	warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
4237
+												//
4238
+												//	operation_time := time.Now().Unix()
4239
+												//	creater := c.GetAdminUserInfo().AdminUser.Id
4240
+												//
4241
+												//	recordDateStr := time.Now().Format("2006-01-02")
4242
+												//	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
4243
+												//	nowtime := recordDate.Unix()
4244
+												//	warehouseOut := models.WarehouseOut{
4245
+												//		WarehouseOutOrderNumber: warehousing_out_order,
4246
+												//		OperationTime:           operation_time,
4247
+												//		OrgId:                   adminInfo.CurrentOrgId,
4248
+												//		Creater:                 creater,
4249
+												//		Ctime:                   time.Now().Unix(),
4250
+												//		Status:                  1,
4251
+												//		WarehouseOutTime:        nowtime,
4252
+												//		Type:                    1,
4253
+												//		StorehouseId:            storeConfig.StorehouseOutInfo,
4254
+												//		IsCheck:                 1,
4255
+												//		IsSys:                   1,
4256
+												//	}
4257
+												//	//查询是否生成出库单
4258
+												//	out, _ := service.FindNewPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
4259
+												//	if out.ID == 0 {
4260
+												//		service.AddNewSigleWarehouseOut(&warehouseOut, tx)
4261
+												//	}
4262
+												//
4263
+												//	lastOut, _ := service.FindNewLastPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
4264
+												//
4265
+												//	goodObj, _ := service.GetNewGoodInformationByGoodIdThirty(p.ProjectId, tx)
4266
+												//	houseConfig, _ := service.GetNewAllStoreHouseConfig(p.UserOrgId, tx)
4267
+												//
4268
+												//	dialyPrepareOne := models.DialysisBeforePrepare{
4269
+												//		GoodTypeId:   goodObj.GoodTypeId,
4270
+												//		GoodId:       p.ProjectId,
4271
+												//		PatientId:    p.PatientId,
4272
+												//		RecordDate:   p.RecordDate,
4273
+												//		UserOrgId:    adminInfo.CurrentOrgId,
4274
+												//		Count:        parseIntCount,
4275
+												//		Ctime:        time.Now().Unix(),
4276
+												//		Creater:      creater,
4277
+												//		Status:       1,
4278
+												//		StorehouseId: houseConfig.StorehouseOutInfo,
4279
+												//		ProjectId:    lastHisProject.ID,
4280
+												//	}
4281
+												//	//判断是否是零用耗材(非零用)
4282
+												//	if goodObj.IsUse == 2 || goodObj.IsUse == 0 {
4283
+												//
4284
+												//		//查询历史出库数据
4285
+												//		flowGood, _ := service.GetNewStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
4286
+												//		var out_count int64
4287
+												//		for _, item := range flowGood {
4288
+												//			out_count += item.Count
4289
+												//		}
4290
+												//		//如果历史数和当前数据不想等才进行退库出库
4291
+												//		if out_count != parseIntCount {
4292
+												//			service.ConsumableNewPrescriptionDelivery(adminInfo.CurrentOrgId, p.PatientId, p.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount, tx)
4293
+												//
4294
+												//			service.UpdateNewAutomaticReduce(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
4295
+												//			detail := models.AutomaticReduceDetail{
4296
+												//				WarehouseOutId:          0,
4297
+												//				WarehouseOutOrderNumber: "",
4298
+												//				PatientId:               p.PatientId,
4299
+												//				Ctime:                   time.Now().Unix(),
4300
+												//				Mtime:                   0,
4301
+												//				Status:                  1,
4302
+												//				RecordTime:              p.RecordDate,
4303
+												//				OrgId:                   p.UserOrgId,
4304
+												//				GoodId:                  p.ProjectId,
4305
+												//				GoodTypeId:              0,
4306
+												//				Count:                   parseIntCount,
4307
+												//				Type:                    0,
4308
+												//				ProjectId:               lastHisProject.ID,
4309
+												//				StorehouseId:            0,
4310
+												//			}
4311
+												//
4312
+												//			service.CreateNewAutoDetail(detail, tx)
4313
+												//
4314
+												//			//查询剩余库存
4315
+												//			goodList, _ := service.GetNewAllGoodSumCount(p.ProjectId, adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, tx)
4316
+												//			var sum_count int64
4317
+												//			for _, item := range goodList {
4318
+												//				sum_count += item.StockCount
4319
+												//			}
4320
+												//
4321
+												//			//更新剩余库存
4322
+												//			service.UpdateNewGoodFlushCount(houseConfig.StorehouseOutInfo, p.ProjectId, adminInfo.CurrentOrgId, sum_count, tx)
4323
+												//
4324
+												//			//耗材
4325
+												//			service.UpdateNewGoodSumCountSeven(sum_count, p.ProjectId, adminInfo.CurrentOrgId, tx)
4326
+												//
4327
+												//		}
4328
+												//		//判断是否是零用耗材(零用但是是出库耗材)
4329
+												//		if goodObj.IsUse == 1 && goodObj.IsWarehouse == 1 {
4330
+												//
4331
+												//			//查询历史出库数据
4332
+												//			flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)
4333
+												//			var out_count int64
4334
+												//			for _, item := range flowGood {
4335
+												//				out_count += item.Count
4336
+												//			}
4337
+												//			//如果历史数和当前数据不想等才进行退库出库
4338
+												//			if out_count != parseIntCount {
4339
+												//				service.ConsumableNewPrescriptionDelivery(adminInfo.CurrentOrgId, p.PatientId, p.RecordDate, &dialyPrepareOne, &lastOut, creater, parseIntCount, tx)
4340
+												//
4341
+												//				service.UpdateNewAutomaticReduce(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
4342
+												//				detail := models.AutomaticReduceDetail{
4343
+												//					WarehouseOutId:          0,
4344
+												//					WarehouseOutOrderNumber: "",
4345
+												//					PatientId:               p.PatientId,
4346
+												//					Ctime:                   time.Now().Unix(),
4347
+												//					Mtime:                   0,
4348
+												//					Status:                  1,
4349
+												//					RecordTime:              p.RecordDate,
4350
+												//					OrgId:                   p.UserOrgId,
4351
+												//					GoodId:                  p.ProjectId,
4352
+												//					GoodTypeId:              0,
4353
+												//					Count:                   parseIntCount,
4354
+												//					Type:                    0,
4355
+												//					ProjectId:               p.ID,
4356
+												//					StorehouseId:            0,
4357
+												//				}
4358
+												//
4359
+												//				service.CreateNewAutoDetail(detail, tx)
4360
+												//
4361
+												//				//查询剩余库存
4362
+												//				goodList, _ := service.GetNewAllGoodSumCount(p.ProjectId, adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, tx)
4363
+												//				var sum_count int64
4364
+												//				for _, item := range goodList {
4365
+												//					sum_count += item.StockCount
4366
+												//				}
4367
+												//
4368
+												//				//更新剩余库存
4369
+												//				service.UpdateNewGoodFlushCount(houseConfig.StorehouseOutInfo, p.ProjectId, adminInfo.CurrentOrgId, sum_count, tx)
4370
+												//
4371
+												//				//耗材
4372
+												//				service.UpdateNewGoodSumCountSeven(sum_count, p.ProjectId, adminInfo.CurrentOrgId, tx)
4373
+												//			}
4374
+												//
4375
+												//		}
4376
+												//
4377
+												//	}
4378
+												//
4379
+												//}
4380
+
4381
+												//记录日志
4382
+												byterequest, _ := json.Marshal(p)
4383
+												adviceLog := models.XtDoctorAdviceLog{
4384
+													UserOrgId:   p.UserOrgId,
4385
+													PatientId:   p.PatientId,
4386
+													AdminUserId: adminInfo.AdminUser.Id,
4387
+													Module:      1,
4388
+													ErrLog:      string(byterequest),
4389
+													Status:      1,
4390
+													Ctime:       time.Now().Unix(),
4391
+													Mtime:       0,
4392
+													Source:      "电脑端新建his项目",
4393
+													RecordDate:  p.RecordDate,
4394
+												}
4395
+												service.CreateDoctorAdviceLog(adviceLog)
4396
+
4397
+												projectList = append(projectList, p)
4398
+
4399
+												if p.Type == 2 { //因为项目和耗材的基础库存在id相同的情况,所以需要根据该字段来判断,type为2的话为从项目开出来的
4400
+													//新增或者编辑项目,修改对应的标签数据
4401
+													labelOrigin, _ := service.GetProjectById(p.UserOrgId, p.ID, patient_id, recordDateTime)
4402
+													if labelOrigin.ID == 0 { //当天某个人的处方中的项目不存在
4403
+														var label models.HisLabelPrintInfo
4404
+														project, _ := service.GetProjectDetail(p.ProjectId)
4405
+														if project.CostClassify == 3 { //类别为检验检查
4406
+															if p.TeamId > 0 { //检验检查组套
4407
+																tempLabel, _ := service.GetProjectByTeamId(p.UserOrgId, p.TeamId, patient_id, recordDateTime)
4408
+																if tempLabel.ID == 0 {
4409
+																	team, _ := service.GetProjectTeamDetail(p.TeamId)
4410
+																	label.Number = tempPrescription.PrescriptionNumber
4411
+																	label.ProjectId = project.ID
4412
+																	label.Status = 1
4413
+																	label.IsPrint = 2
4414
+																	label.DoctorId = info.DoctorId
4415
+																	label.UserOrgId = p.UserOrgId
4416
+																	label.PatientId = patient_id
4417
+																	label.RecordDate = recordDateTime
4418
+																	label.Ctime = time.Now().Unix()
4419
+																	label.Mtime = time.Now().Unix()
4420
+																	label.ItemId = p.TeamId
4421
+																	label.FeedetlSn = p.FeedetlSn
4422
+																	label.PProjectId = p.ID
4423
+																	label.ProjectName = team.ProjectTeam
4424
+																	label.PatientName = patient.Name
4425
+																	service.CreateNewHisLabelRecord(&label, tx)
4426
+																}
4427
+															} else { //单条检验检查项目
4428
+																label.Number = tempPrescription.PrescriptionNumber
4429
+																label.ProjectId = project.ID
4430
+																label.Status = 1
4431
+																label.DoctorId = info.DoctorId
4432
+																label.UserOrgId = p.UserOrgId
4433
+																label.PatientId = patient_id
4434
+																label.RecordDate = recordDateTime
4435
+																label.IsPrint = 2
4436
+																label.Ctime = time.Now().Unix()
4437
+																label.Mtime = time.Now().Unix()
4438
+																label.FeedetlSn = p.FeedetlSn
4439
+																label.PProjectId = p.ID
4440
+																label.ItemId = p.TeamId
4441
+																label.ProjectName = project.ProjectName
4442
+																label.PatientName = patient.Name
4443
+																service.CreateNewHisLabelRecord(&label, tx)
4444
+															}
4445
+														}
4446
+													}
4447
+												}
4448
+
4449
+											}
4450
+										}
4451
+									}
4452
+
4453
+									if adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10164 {
4454
+
4016
 										//耗材出库
4455
 										//耗材出库
4017
 										if p.Type == 3 {
4456
 										if p.Type == 3 {
4018
 
4457
 
4024
 
4463
 
4025
 											nowCount, _ := strconv.ParseInt(p.Count, 10, 64)
4464
 											nowCount, _ := strconv.ParseInt(p.Count, 10, 64)
4026
 
4465
 
4027
-											//fmt.Println("p----------------------------------------------------", p.ProjectId)
4028
-											//fmt.Println("p----------------------------------------------------", nowCount)
4029
-											//fmt.Println("p----------------------------------------------------", historyCount)
4030
 											//如果当前处方数量大于历史数据,则需要出库
4466
 											//如果当前处方数量大于历史数据,则需要出库
4031
 											if nowCount > historyCount {
4467
 											if nowCount > historyCount {
4032
 
4468
 
4186
 											}
4622
 											}
4187
 											parseIntCount, _ := strconv.ParseInt(p.Count, 10, 64)
4623
 											parseIntCount, _ := strconv.ParseInt(p.Count, 10, 64)
4188
 
4624
 
4189
-											//fmt.Println("p.ProjectId-----------------", p.ProjectId)
4190
-											//fmt.Println("out_count_five===============", out_count_five)
4191
-											//fmt.Println("parseIntCount===============", parseIntCount)
4192
 											//如果当前处方的出库数量和已经出库的数量不一致,需要进行退库或者出库
4625
 											//如果当前处方的出库数量和已经出库的数量不一致,需要进行退库或者出库
4193
 											if out_count_five != parseIntCount {
4626
 											if out_count_five != parseIntCount {
4194
 												service.UpdateNewAutomaticReduce(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
4627
 												service.UpdateNewAutomaticReduce(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
4450
 
4883
 
4451
 										}
4884
 										}
4452
 									}
4885
 									}
4886
+
4453
 								}
4887
 								}
4454
 
4888
 
4455
 								//插入检验数据
4889
 								//插入检验数据

+ 1 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go 查看文件

960
 		}
960
 		}
961
 
961
 
962
 		//针对患者称重两次没有数据的问题
962
 		//针对患者称重两次没有数据的问题
963
-		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10723 {
963
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10721 {
964
 
964
 
965
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
965
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
966
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
966
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)

+ 32 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

118
 				dobulecheck, _ := service.GetAllDobuleCheckList(orgID, date.Unix())
118
 				dobulecheck, _ := service.GetAllDobuleCheckList(orgID, date.Unix())
119
 
119
 
120
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
120
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
121
+
121
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
122
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
122
 
123
 
123
 				//monitor, _ := service.GetMonitorByListSix(orgID, date.Unix())
124
 				//monitor, _ := service.GetMonitorByListSix(orgID, date.Unix())
561
 
562
 
562
 	projects, _ = service.GetHisPrescriptionProjects(adminInfo.Org.Id, patientID, date.Unix())
563
 	projects, _ = service.GetHisPrescriptionProjects(adminInfo.Org.Id, patientID, date.Unix())
563
 
564
 
564
-	fmt.Print("projectOne------------------------", projectsOne)
565
-
566
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
565
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
567
 
566
 
568
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
567
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
2803
 			tempassessmentAfterDislysis.ActualUltrafiltration = UltrafiltrationVolumeOne
2802
 			tempassessmentAfterDislysis.ActualUltrafiltration = UltrafiltrationVolumeOne
2804
 		}
2803
 		}
2805
 
2804
 
2805
+		if adminUserInfo.Org.Id == 10721 {
2806
+			tempassessmentAfterDislysis.DiastolicBloodPressure = 0
2807
+			tempassessmentAfterDislysis.SystolicBloodPressure = 0
2808
+		}
2809
+
2806
 		if adminUserInfo.Org.Id == 10697 {
2810
 		if adminUserInfo.Org.Id == 10697 {
2807
 			lastWeightAfter, _ := service.GetLastWeightAfter(tempassessmentAfterDislysis.PatientId, tempassessmentAfterDislysis.AssessmentDate, adminUserInfo.Org.Id)
2811
 			lastWeightAfter, _ := service.GetLastWeightAfter(tempassessmentAfterDislysis.PatientId, tempassessmentAfterDislysis.AssessmentDate, adminUserInfo.Org.Id)
2808
 			floatAfeter := strconv.FormatFloat(lastWeightAfter.WeightAfter, 'f', -1, 64)
2812
 			floatAfeter := strconv.FormatFloat(lastWeightAfter.WeightAfter, 'f', -1, 64)
3080
 		lastWeightAfter.LastAfterWeight = floatAfeter
3084
 		lastWeightAfter.LastAfterWeight = floatAfeter
3081
 	}
3085
 	}
3082
 
3086
 
3087
+	if adminUserInfo.Org.Id == 10721 {
3088
+		tempassessmentAfterDislysis.DiastolicBloodPressure = 0
3089
+		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3090
+	}
3091
+
3083
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
3092
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
3084
 
3093
 
3085
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
3094
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
3630
 
3639
 
3631
 	var ultrafiltration_rate float64
3640
 	var ultrafiltration_rate float64
3632
 	var ultrafiltration_rate_one string
3641
 	var ultrafiltration_rate_one string
3642
+	var replacement_rate float64
3633
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3643
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3634
 	//后期预增脱水量
3644
 	//后期预增脱水量
3635
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3645
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
3769
 		CreatedTime:            time.Now().Unix(),
3779
 		CreatedTime:            time.Now().Unix(),
3770
 		UpdatedTime:            time.Now().Unix(),
3780
 		UpdatedTime:            time.Now().Unix(),
3771
 		UltrafiltrationRateOne: ultrafiltration_rate_one,
3781
 		UltrafiltrationRateOne: ultrafiltration_rate_one,
3782
+		ReplacementRate:        replacement_rate,
3772
 	}
3783
 	}
3773
 
3784
 
3774
 	//只针对广慈医院
3785
 	//只针对广慈医院
4921
 		}
4932
 		}
4922
 
4933
 
4923
 	}
4934
 	}
4935
+
4936
+	if adminInfo.Org.Id == 10721 {
4937
+		var replacement_rate float64
4938
+		var displacement_quantity float64
4939
+		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4940
+		replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*60) / 1000
4941
+		fmt.Println("replacement_rate-----------------", replacement_rate)
4942
+		record.ReplacementRate = replacement_rate
4943
+
4944
+		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
4945
+		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
4946
+		fmt.Println("displacement_quantity-----------------", displacement_quantity)
4947
+		record.DisplacementQuantity = displacement_quantity
4948
+
4949
+	}
4950
+
4924
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
4951
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
4925
 
4952
 
4926
 	this.ServeSuccessJSON(map[string]interface{}{
4953
 	this.ServeSuccessJSON(map[string]interface{}{
6164
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
6191
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
6165
 
6192
 
6166
 		//康桥
6193
 		//康桥
6167
-		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 {
6194
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 10721 {
6168
 			timeNowStr := time.Now().Format("2006-01-02")
6195
 			timeNowStr := time.Now().Format("2006-01-02")
6169
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
6196
 			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
6170
 
6197
 
6469
 			}
6496
 			}
6470
 		}
6497
 		}
6471
 
6498
 
6499
+		fmt.Println("active-----------------------", active)
6500
+		fmt.Println("len(goods)-----------------------", len(goods))
6472
 		//新增
6501
 		//新增
6473
 		if active == 1 && len(goods) > 0 {
6502
 		if active == 1 && len(goods) > 0 {
6474
 			for _, item := range dialysisBefor {
6503
 			for _, item := range dialysisBefor {

+ 7 - 7
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

1418
 											//查询今日是否出库
1418
 											//查询今日是否出库
1419
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1419
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1420
 											if drugOutInfo.ID == 0 {
1420
 											if drugOutInfo.ID == 0 {
1421
-												if item.UserOrgId != 10644 {
1421
+												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1422
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1422
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1423
 												}
1423
 												}
1424
 
1424
 
1428
 										if pharmacyConfig.IsOpen != 1 {
1428
 										if pharmacyConfig.IsOpen != 1 {
1429
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1429
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1430
 											if drugOutInfo.ID == 0 {
1430
 											if drugOutInfo.ID == 0 {
1431
-												if item.UserOrgId != 10644 {
1431
+												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1432
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1432
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1433
 												}
1433
 												}
1434
 
1434
 
1455
 									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1455
 									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1456
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1456
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1457
 										if drugOutInfo.ID == 0 {
1457
 										if drugOutInfo.ID == 0 {
1458
-											if item.UserOrgId != 10644 {
1458
+											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1459
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1459
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1460
 											}
1460
 											}
1461
 
1461
 
1479
 										service.CreateDrugError(drugError)
1479
 										service.CreateDrugError(drugError)
1480
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1480
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1481
 										if drugOutInfo.ID == 0 {
1481
 										if drugOutInfo.ID == 0 {
1482
-											if item.UserOrgId != 10644 {
1482
+											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1483
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1483
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1484
 											}
1484
 											}
1485
 
1485
 
1591
 									//查询今日是否出库
1591
 									//查询今日是否出库
1592
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1592
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1593
 									if drugOutInfo.ID == 0 {
1593
 									if drugOutInfo.ID == 0 {
1594
-										if item.UserOrgId != 10644 {
1594
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1595
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1595
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1596
 										}
1596
 										}
1597
 
1597
 
1601
 									//查询今日是否出库
1601
 									//查询今日是否出库
1602
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1602
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1603
 									if drugOutInfo.ID == 0 {
1603
 									if drugOutInfo.ID == 0 {
1604
-										if item.UserOrgId != 10644 {
1604
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1605
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1605
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1606
 										}
1606
 										}
1607
 
1607
 
4207
 	}
4207
 	}
4208
 
4208
 
4209
 	//针对孝昌康桥超滤率计算问题
4209
 	//针对孝昌康桥超滤率计算问题
4210
-	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 {
4210
+	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 {
4211
 		if evaluation.ID == 0 {
4211
 		if evaluation.ID == 0 {
4212
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4212
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4213
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4213
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {

+ 10 - 1
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go 查看文件

46
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
46
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
47
 		var vlist []interface{}
47
 		var vlist []interface{}
48
 		var elist []interface{}
48
 		var elist []interface{}
49
+
49
 		for _, item := range patient {
50
 		for _, item := range patient {
50
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
51
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
52
+			solution, _ := service.GetDialysisSolution(orgid, item.PatientId, item.ModeId)
53
+			item.DialysisSolution = solution
51
 			vlist = append(vlist, prescription)
54
 			vlist = append(vlist, prescription)
55
+
52
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
56
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
53
 
57
 
54
 			elist = append(elist, dialysis)
58
 			elist = append(elist, dialysis)
68
 		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
72
 		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
69
 		//查询今日排班的病人
73
 		//查询今日排班的病人
70
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
74
 		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
75
+
71
 		var vlist []interface{}
76
 		var vlist []interface{}
72
 		var elist []interface{}
77
 		var elist []interface{}
78
+
73
 		for _, item := range patient {
79
 		for _, item := range patient {
74
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
80
 			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
75
 			vlist = append(vlist, prescription)
81
 			vlist = append(vlist, prescription)
76
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
82
 			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
77
-			fmt.Println("dialysis-------------------------------------------", dialysis)
78
 			elist = append(elist, dialysis)
83
 			elist = append(elist, dialysis)
84
+
85
+			solution, _ := service.GetDialysisSolution(orgid, item.PatientId, item.ModeId)
86
+			item.DialysisSolution = solution
87
+
79
 		}
88
 		}
80
 		if err == nil {
89
 		if err == nil {
81
 			this.ServeSuccessJSON(map[string]interface{}{
90
 			this.ServeSuccessJSON(map[string]interface{}{

+ 12 - 8
controllers/patient_api_controller.go 查看文件

231
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
231
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
232
 	isprescription, _ := c.GetInt64("isprescription", 0)
232
 	isprescription, _ := c.GetInt64("isprescription", 0)
233
 	patientSoureType, _ := c.GetInt64("patientSoureType")
233
 	patientSoureType, _ := c.GetInt64("patientSoureType")
234
+	patient_type, _ := c.GetInt64("patient_type")
234
 	nurse, _ := c.GetInt64("nurse")
235
 	nurse, _ := c.GetInt64("nurse")
235
 	if page <= 0 {
236
 	if page <= 0 {
236
 		page = 1
237
 		page = 1
270
 
271
 
271
 	var patients []*models.Patients
272
 	var patients []*models.Patients
272
 	var total int64
273
 	var total int64
273
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse)
274
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type)
274
 
275
 
275
 	c.ServeSuccessJSON(map[string]interface{}{
276
 	c.ServeSuccessJSON(map[string]interface{}{
276
 		"patients": patients,
277
 		"patients": patients,
2613
 
2614
 
2614
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2615
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2615
 									if drugOutInfo.ID == 0 {
2616
 									if drugOutInfo.ID == 0 {
2616
-										if item.UserOrgId != 10644 {
2617
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
2617
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2618
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2618
 										}
2619
 										}
2619
 
2620
 
2625
 
2626
 
2626
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2627
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2627
 									if drugOutInfo.ID == 0 {
2628
 									if drugOutInfo.ID == 0 {
2628
-										if item.UserOrgId != 10644 {
2629
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
2629
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2630
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2630
 										}
2631
 										}
2631
 
2632
 
2681
 
2682
 
2682
 								drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2683
 								drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2683
 								if drugOutInfo.ID == 0 {
2684
 								if drugOutInfo.ID == 0 {
2684
-									if item.UserOrgId != 10644 {
2685
+									if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
2685
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2686
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2686
 									}
2687
 									}
2687
 
2688
 
2692
 
2693
 
2693
 								drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2694
 								drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
2694
 								if drugOutInfo.ID == 0 {
2695
 								if drugOutInfo.ID == 0 {
2695
-									if item.UserOrgId != 10644 {
2696
+									if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
2696
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2697
 										service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
2697
 									}
2698
 									}
2698
 
2699
 
4689
 
4690
 
4690
 	adminInfo := c.GetAdminUserInfo()
4691
 	adminInfo := c.GetAdminUserInfo()
4691
 	records, total, _ := service.GetPatientDialysisRecord(adminInfo.CurrentOrgId, patientID, page, limit, theStartTIme, theEndtTIme, mode_id)
4692
 	records, total, _ := service.GetPatientDialysisRecord(adminInfo.CurrentOrgId, patientID, page, limit, theStartTIme, theEndtTIme, mode_id)
4692
-
4693
+	fmt.Println("长度", len(records))
4693
 	if len(records) == 0 {
4694
 	if len(records) == 0 {
4694
-		list, _ := service.GetAllDialysisOrder(patientID)
4695
+		list, _ := service.GetAllDialysisOrder(patientID, theStartTIme, theEndtTIme)
4695
 		for _, item := range list {
4696
 		for _, item := range list {
4696
 			schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType)
4697
 			schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType)
4697
-			service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
4698
+			prescribeOne, _ := service.GetDialysisPrescribeOne(adminInfo.CurrentOrgId, item.PatientId, item.DialysisDate)
4699
+
4700
+			service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, adminInfo.CurrentOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID, prescribeOne.ModeId)
4698
 		}
4701
 		}
4699
 	}
4702
 	}
4703
+
4700
 	c.ServeSuccessJSON(map[string]interface{}{
4704
 	c.ServeSuccessJSON(map[string]interface{}{
4701
 		"total":   total,
4705
 		"total":   total,
4702
 		"records": records,
4706
 		"records": records,

+ 18 - 19
controllers/patient_dataconfig_api_controller.go 查看文件

262
 	}
262
 	}
263
 
263
 
264
 	adminUserInfo := this.GetAdminUserInfo()
264
 	adminUserInfo := this.GetAdminUserInfo()
265
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
266
-	if getPatientErr != nil {
267
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
268
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
269
-		return
270
-	} else if patient == nil {
271
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
272
-		return
273
-	}
265
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
266
+	//if getPatientErr != nil {
267
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
268
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
269
+	//	return
270
+	//} else if patient == nil {
271
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
272
+	//	return
273
+	//}
274
 
274
 
275
 	recordIDStrs := strings.Split(idsStr, ",")
275
 	recordIDStrs := strings.Split(idsStr, ",")
276
 	recordIDs := make([]int64, 0, len(recordIDStrs))
276
 	recordIDs := make([]int64, 0, len(recordIDStrs))
312
 	//loc, _ := time.LoadLocation("Local")
312
 	//loc, _ := time.LoadLocation("Local")
313
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
313
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
314
 
314
 
315
-	fmt.Println("checkDate--------------", checkDate)
316
 	adminUserInfo := this.GetAdminUserInfo()
315
 	adminUserInfo := this.GetAdminUserInfo()
317
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
318
-	if getPatientErr != nil {
319
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
320
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
321
-		return
322
-	} else if patient == nil {
323
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
324
-		return
325
-	}
316
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
317
+	//if getPatientErr != nil {
318
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
319
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
320
+	//	return
321
+	//} else if patient == nil {
322
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
323
+	//	return
324
+	//}
326
 
325
 
327
 	now := time.Now().Unix()
326
 	now := time.Now().Unix()
328
 
327
 

+ 13 - 7
controllers/sign_api_controller.go 查看文件

1227
 
1227
 
1228
 func (this *SignApiController) ToAutoDiagnose() {
1228
 func (this *SignApiController) ToAutoDiagnose() {
1229
 
1229
 
1230
-	orgId := this.GetAdminUserInfo().CurrentOrgId
1230
+	//orgId := this.GetAdminUserInfo().CurrentOrgId
1231
 
1231
 
1232
 	//order, _ := service.GetDialysisOrderTotalCount()
1232
 	//order, _ := service.GetDialysisOrderTotalCount()
1233
 	//
1233
 	//
1242
 	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1242
 	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1243
 	//}
1243
 	//}
1244
 
1244
 
1245
-	list, _ := service.GetAllDialysisOrderTwo(10892)
1246
-	fmt.Println("list=============", list)
1247
-	for _, item := range list {
1248
-		schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1249
-		service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
1250
-	}
1245
+	//list, _ := service.GetAllDialysisOrderTwo(10340)
1246
+	//
1247
+	//for _, item := range list {
1248
+	//	schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1249
+	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
1250
+	//}
1251
 
1251
 
1252
 	//drugList, _ := service.GetAllBaseDrugList(10318)
1252
 	//drugList, _ := service.GetAllBaseDrugList(10318)
1253
 	//for _, item := range drugList {
1253
 	//for _, item := range drugList {
1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1261
 	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1262
 	//}
1262
 	//}
1263
 
1263
 
1264
+	list, _ := service.GetAllDialysisPrescription(29190)
1265
+
1266
+	for _, item := range list {
1267
+		service.UpdateSchedulePrescrition(item.PatientId, item.RecordDate, item.UserOrgId, item.ModeId)
1268
+	}
1269
+
1264
 	this.ServeSuccessJSON(map[string]interface{}{
1270
 	this.ServeSuccessJSON(map[string]interface{}{
1265
 		"msg": "ok",
1271
 		"msg": "ok",
1266
 	})
1272
 	})

+ 516 - 8
controllers/sign_weigh_api_controller.go 查看文件

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
 	"encoding/json"
4
 	"encoding/json"
8
 	"fmt"
5
 	"fmt"
9
-	"github.com/astaxie/beego"
10
-	"github.com/jinzhu/gorm"
11
 	"reflect"
6
 	"reflect"
12
 	"strconv"
7
 	"strconv"
13
 	"time"
8
 	"time"
9
+
10
+	"XT_New/enums"
11
+	"XT_New/models"
12
+	"XT_New/service"
13
+	"github.com/astaxie/beego"
14
+	"github.com/jinzhu/gorm"
14
 )
15
 )
15
 
16
 
16
 func SignWeighAPIControllerRegistRouters() {
17
 func SignWeighAPIControllerRegistRouters() {
490
 func (c *SignWeighAPIController) UpdateSignweight() {
491
 func (c *SignWeighAPIController) UpdateSignweight() {
491
 	patientID, _ := c.GetInt64("patient_id", 0)
492
 	patientID, _ := c.GetInt64("patient_id", 0)
492
 	dateTime := c.GetString("date_time")
493
 	dateTime := c.GetString("date_time")
493
-	fmt.Println("病人ID", patientID, dateTime)
494
 	timeLayout := "2006-01-02"
494
 	timeLayout := "2006-01-02"
495
 	loc, _ := time.LoadLocation("Local")
495
 	loc, _ := time.LoadLocation("Local")
496
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", dateTime+" 00:00:00", loc)
496
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", dateTime+" 00:00:00", loc)
506
 	weight_before, _ := c.GetFloat("weight_before", 0)
506
 	weight_before, _ := c.GetFloat("weight_before", 0)
507
 	dry_weight, _ := c.GetFloat("dry_weight", 0)
507
 	dry_weight, _ := c.GetFloat("dry_weight", 0)
508
 	temperature, _ := c.GetFloat("temperature", 0)
508
 	temperature, _ := c.GetFloat("temperature", 0)
509
-	fmt.Println("温度", temperature)
510
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
509
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
511
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
510
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
512
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
511
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
513
-	fmt.Println("dry_weight", dry_weight)
514
 	var predialysisevaluation models.PredialysisEvaluation
512
 	var predialysisevaluation models.PredialysisEvaluation
515
 	predialysisevaluation.PatientId = patientID
513
 	predialysisevaluation.PatientId = patientID
516
 	predialysisevaluation.UserOrgId = adminUserInfo.CurrentOrgId
514
 	predialysisevaluation.UserOrgId = adminUserInfo.CurrentOrgId
527
 	predialysis, errcode := service.GetDislysisBerfore(adminUserInfo.CurrentOrgId, dateTimeStam, patientID)
525
 	predialysis, errcode := service.GetDislysisBerfore(adminUserInfo.CurrentOrgId, dateTimeStam, patientID)
528
 	fmt.Println("sigh", predialysis)
526
 	fmt.Println("sigh", predialysis)
529
 	fmt.Println("错误:", errcode)
527
 	fmt.Println("错误:", errcode)
528
+
529
+	lastPredialysisEvaluation, _ := service.MobileGetLastTimePredialysisEvaluationOne(adminUserInfo.CurrentOrgId, patientID, dateTimeStam)
530
+
531
+	if lastPredialysisEvaluation != nil {
532
+		predialysisevaluation.DryWeight = lastPredialysisEvaluation.DryWeight
533
+		predialysisevaluation.InternalFistula = lastPredialysisEvaluation.InternalFistula
534
+		predialysisevaluation.InternalFistulaSkin = lastPredialysisEvaluation.InternalFistulaSkin
535
+		predialysisevaluation.VenousCatheterization = lastPredialysisEvaluation.VenousCatheterization
536
+		predialysisevaluation.Catheter = lastPredialysisEvaluation.Catheter
537
+		predialysisevaluation.CatheterBend = lastPredialysisEvaluation.CatheterBend
538
+		predialysisevaluation.PunctureNeedle = lastPredialysisEvaluation.PunctureNeedle
539
+		predialysisevaluation.PunctureNeedleDirection = lastPredialysisEvaluation.PunctureNeedleDirection
540
+		predialysisevaluation.PunctureWay = lastPredialysisEvaluation.PunctureWay
541
+		predialysisevaluation.PointPuncture = lastPredialysisEvaluation.PointPuncture
542
+		predialysisevaluation.IsHemorrhage = lastPredialysisEvaluation.IsHemorrhage
543
+		predialysisevaluation.ThromubusType = lastPredialysisEvaluation.ThromubusType
544
+		predialysisevaluation.Skin = lastPredialysisEvaluation.Skin
545
+		predialysisevaluation.Complication = lastPredialysisEvaluation.Complication
546
+		predialysisevaluation.SymptomBeforeDialysis = lastPredialysisEvaluation.SymptomBeforeDialysis
547
+		predialysisevaluation.LastPostDialysisOther = lastPredialysisEvaluation.LastPostDialysisOther
548
+	}
549
+
530
 	if errcode == gorm.ErrRecordNotFound {
550
 	if errcode == gorm.ErrRecordNotFound {
551
+
531
 		service.SaveDislysisiBefore(&predialysisevaluation)
552
 		service.SaveDislysisiBefore(&predialysisevaluation)
532
 	} else if errcode == nil {
553
 	} else if errcode == nil {
533
 
554
 
537
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
558
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
538
 	}
559
 	}
539
 
560
 
561
+	// 计算透析处方的相关超滤量
562
+	schedual, _ := service.MobileGetSchedualDetailSix(adminUserInfo.CurrentOrgId, patientID, dateTimeStam)
563
+
564
+	var lastDialysisPrescribe *models.DialysisPrescription
565
+	var dialysisSolution *models.DialysisSolution
566
+	var dialysisPrescribe *models.DialysisPrescription
567
+	var system_dialysisPrescribe *models.SystemPrescription
568
+
569
+	dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.CurrentOrgId, patientID, dateTimeStam)
570
+
571
+	var dewater_amount float64
572
+
573
+	dewater_amount = predialysisevaluation.WeightBefore - predialysisevaluation.DryWeight - predialysisevaluation.AdditionalWeight
574
+
575
+	dialysisSolution, _ = service.MobileGetDialysisSolutionByModeIdSix(adminUserInfo.CurrentOrgId, patientID, schedual.ModeId)
576
+
577
+	// 插入透析处方
578
+	if dialysisPrescribe == nil && dialysisSolution != nil {
579
+		var newprescribe models.DialysisPrescription
580
+		newprescribe.UserOrgId = dialysisSolution.UserOrgId
581
+		newprescribe.PatientId = dialysisSolution.PatientId
582
+		newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
583
+		newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
584
+		newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
585
+		newprescribe.AnticoagulantZongliang = dialysisSolution.AnticoagulantZongliang
586
+		newprescribe.AnticoagulantGaimingcheng = dialysisSolution.AnticoagulantGaimingcheng
587
+		newprescribe.AnticoagulantGaijiliang = dialysisSolution.AnticoagulantGaijiliang
588
+		newprescribe.ModeId = dialysisSolution.ModeId
589
+		newprescribe.DialysisDuration = dialysisSolution.DialysisDuration
590
+		newprescribe.ReplacementWay = dialysisSolution.ReplacementWay
591
+		newprescribe.HemodialysisMachine = dialysisSolution.HemodialysisMachine
592
+		newprescribe.BloodFilter = dialysisSolution.BloodFilter
593
+		newprescribe.PerfusionApparatus = dialysisSolution.PerfusionApparatus
594
+		newprescribe.BloodFlowVolume = dialysisSolution.BloodFlowVolume
595
+		newprescribe.DisplaceLiqui = dialysisSolution.DisplaceLiqui
596
+		newprescribe.Glucose = dialysisSolution.Glucose
597
+		newprescribe.DialysateFlow = dialysisSolution.DialysateFlow
598
+		newprescribe.Kalium = dialysisSolution.Kalium
599
+		newprescribe.Sodium = dialysisSolution.Sodium
600
+		newprescribe.Calcium = dialysisSolution.Calcium
601
+		newprescribe.Bicarbonate = dialysisSolution.Bicarbonate
602
+		newprescribe.DialysateTemperature = dialysisSolution.DialysateTemperature
603
+		newprescribe.Conductivity = dialysisSolution.Conductivity
604
+		newprescribe.BodyFluid = dialysisSolution.BodyFluid
605
+		newprescribe.SpecialMedicine = dialysisSolution.SpecialMedicine
606
+		newprescribe.SpecialMedicineOther = dialysisSolution.SpecialMedicineOther
607
+		newprescribe.DisplaceLiquiPart = dialysisSolution.DisplaceLiquiPart
608
+		newprescribe.DisplaceLiquiValue = dialysisSolution.DisplaceLiquiValue
609
+		newprescribe.BloodAccess = dialysisSolution.BloodAccess
610
+		newprescribe.Ultrafiltration = dialysisSolution.Ultrafiltration
611
+		newprescribe.DialysisDurationHour = dialysisSolution.DialysisDurationHour
612
+		newprescribe.DialysisDurationMinute = dialysisSolution.DialysisDurationMinute
613
+		newprescribe.TargetUltrafiltration = dialysisSolution.TargetUltrafiltration
614
+		newprescribe.DialysateFormulation = dialysisSolution.DialysateFormulation
615
+		newprescribe.Dialyzer = dialysisSolution.Dialyzer
616
+		newprescribe.ReplacementTotal = dialysisSolution.ReplacementTotal
617
+		newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
618
+		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
619
+		newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
620
+		newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
621
+		newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
622
+		newprescribe.TargetKtv = dialysisSolution.TargetKtv
623
+
624
+		newprescribe.CreatedTime = time.Now().Unix()
625
+		newprescribe.UpdatedTime = time.Now().Unix()
626
+		newprescribe.RecordDate = dateTimeStam
627
+		newprescribe.DewaterAmount = dewater_amount
628
+		newprescribe.TargetUltrafiltration = dewater_amount
629
+		newprescribe.PrescriptionWater = dewater_amount
630
+		newprescribe.Chaptalization = dialysisSolution.Chaptalization
631
+		newprescribe.PrescribingNumber = 1
632
+		newprescribe.BloodAccessPartId = dialysisSolution.BloodAccessPartId
633
+		newprescribe.Status = 1
634
+		if adminUserInfo.CurrentOrgId != 10013 && adminUserInfo.CurrentOrgId != 10014 && adminUserInfo.CurrentOrgId != 10016 {
635
+			newprescribe.Remark = dialysisSolution.Remark
636
+		}
637
+
638
+		if adminUserInfo.CurrentOrgId == 10340 {
639
+			newprescribe.TargetUltrafiltration = 0
640
+			newprescribe.Sodium = 138
641
+			newprescribe.Bicarbonate = 31.1
642
+			newprescribe.DialysateFlow = 500
643
+			newprescribe.TargetUltrafiltration = 0
644
+		}
645
+		// 针对新化博翔
646
+		if adminUserInfo.CurrentOrgId == 10447 {
647
+			newprescribe.DisplaceLiquiPart = 1
648
+			newprescribe.DisplaceLiquiValue = 32
649
+			newprescribe.DialysateFlow = 500
650
+		}
651
+
652
+		if adminUserInfo.CurrentOrgId == 10121 {
653
+			newprescribe.DialysisDurationHour = 4
654
+			newprescribe.DialysisDurationMinute = 0
655
+			newprescribe.BloodAccess = dialysisSolution.BloodAccess
656
+		}
657
+
658
+		if adminUserInfo.CurrentOrgId == 10445 {
659
+			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminUserInfo.CurrentOrgId)
660
+			newprescribe.Remark = lastDialysisPrescription.Remark
661
+		}
662
+
663
+		//恒泰
664
+		if adminUserInfo.CurrentOrgId == 10490 || adminUserInfo.CurrentOrgId == 10016 {
665
+			newprescribe.Remark = ""
666
+		}
667
+
668
+		if adminUserInfo.CurrentOrgId == 10599 {
669
+			// 获取透析模版
670
+			solutionone, _ := service.MobileGetDialysisSolutionByModeIdSevenTwety(adminUserInfo.CurrentOrgId, patientID, schedual.ModeId)
671
+			if solutionone.Anticoagulant > 0 {
672
+				newprescribe.Anticoagulant = solutionone.Anticoagulant
673
+				newprescribe.AnticoagulantShouji = solutionone.AnticoagulantShouji
674
+				newprescribe.AnticoagulantWeichi = solutionone.AnticoagulantWeichi
675
+				newprescribe.AnticoagulantZongliang = solutionone.AnticoagulantZongliang
676
+				newprescribe.BloodAccess = solutionone.BloodAccess
677
+				newprescribe.DialysisDurationHour = solutionone.DialysisDurationHour
678
+				newprescribe.DialysisDurationMinute = solutionone.DialysisDurationMinute
679
+				newprescribe.DialysisIrrigation = solutionone.DialysisIrrigation
680
+				newprescribe.DialysisDialyszers = solutionone.DialysisDialyszers
681
+				newprescribe.DialysisStrainer = solutionone.DialysisStrainer
682
+
683
+			}
684
+
685
+		}
686
+
687
+		//针对普宁和揭阳
688
+		if adminUserInfo.CurrentOrgId == 10597 || adminUserInfo.CurrentOrgId == 10599 {
689
+			prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
690
+			if prescriptionTwenty.ID == 0 {
691
+				//插入透析处方
692
+				service.AddSigleRecord(&newprescribe)
693
+			} else {
694
+				//插入透析处方
695
+				service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
696
+			}
697
+		} else {
698
+			//插入透析处方
699
+			service.AddSigleRecord(&newprescribe)
700
+		}
701
+
702
+		//记录日志
703
+		byterequest, _ := json.Marshal(newprescribe)
704
+		prescriptionLog := models.XtDialysisPrescriptionLog{
705
+			UserOrgId:   newprescribe.UserOrgId,
706
+			Ctime:       time.Now().Unix(),
707
+			Mtime:       0,
708
+			ErrLog:      string(byterequest),
709
+			AdminUserId: adminUserInfo.AdminUser.Id,
710
+			RecordDate:  newprescribe.RecordDate,
711
+			PatientId:   newprescribe.PatientId,
712
+			Source:      "物联网上传",
713
+			Status:      1,
714
+		}
715
+
716
+		service.CreatePrescriptionLog(prescriptionLog)
717
+
718
+		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":" + strconv.FormatInt(schedual.ModeId, 10) + ":dialysis_prescribe"
719
+		redis := service.RedisClient()
720
+		//清空key 值
721
+		redis.Set(key, "", time.Second)
722
+		keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":prescriptions_list_all"
723
+		redis.Set(keyTwo, "", time.Second)
724
+		thisTime := time.Now()
725
+		scheduleDateStartOne := thisTime.Format("2006-01-02")
726
+		keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
727
+		redis.Set(keyThree, "", time.Second)
728
+		defer redis.Close()
729
+	}
730
+
731
+	if dialysisPrescribe == nil && dialysisSolution == nil {
732
+		if lastDialysisPrescribe != nil {
733
+			var newprescribe models.DialysisPrescription
734
+			newprescribe.UserOrgId = lastDialysisPrescribe.UserOrgId
735
+			newprescribe.PatientId = lastDialysisPrescribe.PatientId
736
+			newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
737
+			newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
738
+			newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi
739
+			newprescribe.AnticoagulantZongliang = lastDialysisPrescribe.AnticoagulantZongliang
740
+			newprescribe.AnticoagulantGaimingcheng = lastDialysisPrescribe.AnticoagulantGaimingcheng
741
+			newprescribe.AnticoagulantGaijiliang = lastDialysisPrescribe.AnticoagulantGaijiliang
742
+			newprescribe.ModeId = lastDialysisPrescribe.ModeId
743
+			newprescribe.DialysisDuration = lastDialysisPrescribe.DialysisDuration
744
+			newprescribe.ReplacementWay = lastDialysisPrescribe.ReplacementWay
745
+			newprescribe.HemodialysisMachine = lastDialysisPrescribe.HemodialysisMachine
746
+			newprescribe.BloodFilter = lastDialysisPrescribe.BloodFilter
747
+			newprescribe.PerfusionApparatus = lastDialysisPrescribe.PerfusionApparatus
748
+			newprescribe.BloodFlowVolume = lastDialysisPrescribe.BloodFlowVolume
749
+			newprescribe.DisplaceLiqui = lastDialysisPrescribe.DisplaceLiqui
750
+			newprescribe.Glucose = lastDialysisPrescribe.Glucose
751
+			newprescribe.DialysateFlow = lastDialysisPrescribe.DialysateFlow
752
+			newprescribe.Kalium = lastDialysisPrescribe.Kalium
753
+			newprescribe.Sodium = lastDialysisPrescribe.Sodium
754
+			newprescribe.Calcium = lastDialysisPrescribe.Calcium
755
+			newprescribe.Bicarbonate = lastDialysisPrescribe.Bicarbonate
756
+			newprescribe.DialysateTemperature = lastDialysisPrescribe.DialysateTemperature
757
+			newprescribe.Conductivity = lastDialysisPrescribe.Conductivity
758
+			newprescribe.BodyFluid = lastDialysisPrescribe.BodyFluid
759
+			newprescribe.SpecialMedicine = lastDialysisPrescribe.SpecialMedicine
760
+			newprescribe.SpecialMedicineOther = lastDialysisPrescribe.SpecialMedicineOther
761
+			newprescribe.DisplaceLiquiPart = lastDialysisPrescribe.DisplaceLiquiPart
762
+			newprescribe.DisplaceLiquiValue = lastDialysisPrescribe.DisplaceLiquiValue
763
+			newprescribe.BloodAccess = lastDialysisPrescribe.BloodAccess
764
+			newprescribe.Ultrafiltration = lastDialysisPrescribe.Ultrafiltration
765
+			newprescribe.DialysisDurationHour = lastDialysisPrescribe.DialysisDurationHour
766
+			newprescribe.DialysisDurationMinute = lastDialysisPrescribe.DialysisDurationMinute
767
+			newprescribe.DialysateFormulation = lastDialysisPrescribe.DialysateFormulation
768
+			newprescribe.Dialyzer = lastDialysisPrescribe.Dialyzer
769
+			newprescribe.ReplacementTotal = lastDialysisPrescribe.ReplacementTotal
770
+			newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
771
+			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
772
+			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
773
+			newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
774
+			newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
775
+			newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
776
+			newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
777
+			newprescribe.CreatedTime = time.Now().Unix()
778
+			newprescribe.UpdatedTime = time.Now().Unix()
779
+			newprescribe.RecordDate = dateTimeStam
780
+			newprescribe.DewaterAmount = dewater_amount
781
+			newprescribe.TargetUltrafiltration = dewater_amount
782
+			newprescribe.PrescriptionWater = dewater_amount
783
+			newprescribe.Status = 1
784
+
785
+			if adminUserInfo.CurrentOrgId == 10490 || adminUserInfo.CurrentOrgId == 10016 {
786
+				newprescribe.Remark = ""
787
+			}
788
+
789
+			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
790
+			newprescribe.PrescribingNumber = 1
791
+			if adminUserInfo.CurrentOrgId == 10340 {
792
+				newprescribe.TargetUltrafiltration = 0
793
+			}
794
+			if adminUserInfo.CurrentOrgId == 10121 {
795
+				newprescribe.DialysisDurationHour = 4
796
+				newprescribe.DialysisDurationMinute = 0
797
+				newprescribe.BloodAccess = dialysisSolution.BloodAccess
798
+			}
799
+
800
+			if adminUserInfo.CurrentOrgId == 10445 {
801
+				lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminUserInfo.CurrentOrgId)
802
+				newprescribe.Remark = lastDialysisPrescription.Remark
803
+			}
804
+			//err := service.AddSigleRecord(&newprescribe)
805
+			var err error
806
+			if adminUserInfo.CurrentOrgId == 10597 || adminUserInfo.CurrentOrgId == 10599 || adminUserInfo.CurrentOrgId == 3877 {
807
+				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
808
+				if prescriptionTwenty.ID == 0 {
809
+					//插入透析处方
810
+					service.AddSigleRecord(&newprescribe)
811
+				} else {
812
+					//插入透析处方
813
+					service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
814
+				}
815
+			} else {
816
+				//插入透析处方
817
+				err = service.AddSigleRecord(&newprescribe)
818
+			}
819
+			//记录日志
820
+			byterequest, _ := json.Marshal(newprescribe)
821
+			prescriptionLog := models.XtDialysisPrescriptionLog{
822
+				UserOrgId:   adminUserInfo.CurrentOrgId,
823
+				Ctime:       time.Now().Unix(),
824
+				Mtime:       0,
825
+				ErrLog:      string(byterequest),
826
+				AdminUserId: adminUserInfo.AdminUser.Id,
827
+				RecordDate:  newprescribe.RecordDate,
828
+				PatientId:   patientID,
829
+				Source:      "物联网上传",
830
+				Status:      1,
831
+			}
832
+
833
+			service.CreatePrescriptionLog(prescriptionLog)
834
+
835
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":" + strconv.FormatInt(schedual.ModeId, 10) + ":dialysis_prescribe"
836
+			redis := service.RedisClient()
837
+			//清空key 值
838
+			redis.Set(key, "", time.Second)
839
+			keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":prescriptions_list_all"
840
+			redis.Set(keyTwo, "", time.Second)
841
+			thisTime := time.Now()
842
+			scheduleDateStartOne := thisTime.Format("2006-01-02")
843
+			keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
844
+			redis.Set(keyThree, "", time.Second)
845
+			defer redis.Close()
846
+			if err != nil {
847
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
848
+			}
849
+		} else if system_dialysisPrescribe != nil {
850
+			var newprescribe models.DialysisPrescription
851
+			newprescribe.UserOrgId = system_dialysisPrescribe.UserOrgId
852
+			newprescribe.PatientId = patientID
853
+			newprescribe.Anticoagulant = system_dialysisPrescribe.Anticoagulant
854
+			newprescribe.AnticoagulantShouji = system_dialysisPrescribe.AnticoagulantShouji
855
+			newprescribe.AnticoagulantWeichi = system_dialysisPrescribe.AnticoagulantWeichi
856
+			newprescribe.AnticoagulantZongliang = system_dialysisPrescribe.AnticoagulantZongliang
857
+			newprescribe.AnticoagulantGaimingcheng = system_dialysisPrescribe.AnticoagulantGaimingcheng
858
+			newprescribe.AnticoagulantGaijiliang = system_dialysisPrescribe.AnticoagulantGaijiliang
859
+			newprescribe.ModeId = system_dialysisPrescribe.ModeId
860
+			newprescribe.DialysisDuration = system_dialysisPrescribe.DialysisDuration
861
+			newprescribe.ReplacementWay = system_dialysisPrescribe.ReplacementWay
862
+			newprescribe.HemodialysisMachine = system_dialysisPrescribe.HemodialysisMachine
863
+			newprescribe.BloodFilter = system_dialysisPrescribe.BloodFilter
864
+			newprescribe.PerfusionApparatus = system_dialysisPrescribe.PerfusionApparatus
865
+			newprescribe.BloodFlowVolume = system_dialysisPrescribe.BloodFlowVolume
866
+			newprescribe.DisplaceLiqui = system_dialysisPrescribe.DisplaceLiqui
867
+			newprescribe.Glucose = system_dialysisPrescribe.Glucose
868
+			newprescribe.DialysateFlow = system_dialysisPrescribe.DialysateFlow
869
+			newprescribe.Kalium = system_dialysisPrescribe.Kalium
870
+			newprescribe.Sodium = system_dialysisPrescribe.Sodium
871
+			newprescribe.Calcium = system_dialysisPrescribe.Calcium
872
+			newprescribe.Bicarbonate = system_dialysisPrescribe.Bicarbonate
873
+			newprescribe.DialysateTemperature = system_dialysisPrescribe.DialysateTemperature
874
+			newprescribe.Conductivity = system_dialysisPrescribe.Conductivity
875
+			newprescribe.BodyFluid = system_dialysisPrescribe.BodyFluid
876
+			newprescribe.SpecialMedicine = system_dialysisPrescribe.SpecialMedicine
877
+			newprescribe.SpecialMedicineOther = system_dialysisPrescribe.SpecialMedicineOther
878
+			newprescribe.DisplaceLiquiPart = system_dialysisPrescribe.DisplaceLiquiPart
879
+			newprescribe.DisplaceLiquiValue = system_dialysisPrescribe.DisplaceLiquiValue
880
+			newprescribe.BloodAccess = system_dialysisPrescribe.BloodAccess
881
+			newprescribe.Ultrafiltration = system_dialysisPrescribe.Ultrafiltration
882
+			newprescribe.DialysisDurationHour = system_dialysisPrescribe.DialysisDurationHour
883
+			newprescribe.DialysisDurationMinute = system_dialysisPrescribe.DialysisDurationMinute
884
+			newprescribe.DialysateFormulation = system_dialysisPrescribe.DialysateFormulation
885
+			newprescribe.Dialyzer = system_dialysisPrescribe.Dialyzer
886
+			newprescribe.ReplacementTotal = system_dialysisPrescribe.ReplacementTotal
887
+			newprescribe.DialyzerPerfusionApparatus = system_dialysisPrescribe.DialyzerPerfusionApparatus
888
+			newprescribe.DialysisIrrigation = system_dialysisPrescribe.DialysisIrrigation
889
+			newprescribe.DialysisDialyszers = system_dialysisPrescribe.DialysisDialyszers
890
+			newprescribe.BodyFluidOther = system_dialysisPrescribe.BodyFluidOther
891
+			newprescribe.TargetKtv = system_dialysisPrescribe.TargetKtv
892
+			newprescribe.CreatedTime = time.Now().Unix()
893
+			newprescribe.UpdatedTime = time.Now().Unix()
894
+			newprescribe.RecordDate = dateTimeStam
895
+			newprescribe.DewaterAmount = dewater_amount
896
+			newprescribe.TargetUltrafiltration = dewater_amount
897
+			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
898
+			newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
899
+			newprescribe.Status = 1
900
+			newprescribe.PrescribingNumber = 1
901
+
902
+			if adminUserInfo.CurrentOrgId == 10340 {
903
+				newprescribe.TargetUltrafiltration = 0
904
+			}
905
+			if adminUserInfo.CurrentOrgId == 10121 {
906
+				newprescribe.DialysisDurationHour = 4
907
+				newprescribe.DialysisDurationMinute = 0
908
+				newprescribe.BloodAccess = dialysisSolution.BloodAccess
909
+			}
910
+			if adminUserInfo.CurrentOrgId == 10445 {
911
+				lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminUserInfo.CurrentOrgId)
912
+				newprescribe.Remark = lastDialysisPrescription.Remark
913
+			}
914
+
915
+			if adminUserInfo.CurrentOrgId == 10597 || adminUserInfo.CurrentOrgId == 10599 || adminUserInfo.CurrentOrgId == 3877 {
916
+				prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
917
+				if prescriptionTwenty.ID == 0 {
918
+					//插入透析处方
919
+					service.AddSigleRecord(&newprescribe)
920
+				} else {
921
+					//插入透析处方
922
+					service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
923
+				}
924
+			} else {
925
+				service.AddSigleRecord(&newprescribe)
926
+			}
927
+
928
+			//记录日志
929
+			byterequest, _ := json.Marshal(newprescribe)
930
+			prescriptionLog := models.XtDialysisPrescriptionLog{
931
+				UserOrgId:   adminUserInfo.CurrentOrgId,
932
+				Ctime:       time.Now().Unix(),
933
+				Mtime:       0,
934
+				ErrLog:      string(byterequest),
935
+				AdminUserId: adminUserInfo.AdminUser.Id,
936
+				RecordDate:  newprescribe.RecordDate,
937
+				PatientId:   patientID,
938
+				Source:      "物联网上传",
939
+				Status:      1,
940
+			}
941
+
942
+			service.CreatePrescriptionLog(prescriptionLog)
943
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":" + strconv.FormatInt(schedual.ModeId, 10) + ":dialysis_prescribe"
944
+			redis := service.RedisClient()
945
+			//清空key 值
946
+			redis.Set(key, "", time.Second)
947
+			keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":prescriptions_list_all"
948
+			redis.Set(keyTwo, "", time.Second)
949
+			thisTime := time.Now()
950
+			scheduleDateStartOne := thisTime.Format("2006-01-02")
951
+			keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
952
+			redis.Set(keyThree, "", time.Second)
953
+			defer redis.Close()
954
+
955
+		} else {
956
+			var newprescribe models.DialysisPrescription
957
+			newprescribe.UserOrgId = adminUserInfo.CurrentOrgId
958
+			newprescribe.PatientId = patientID
959
+			newprescribe.ModeId = schedual.ModeId
960
+			newprescribe.CreatedTime = time.Now().Unix()
961
+			newprescribe.UpdatedTime = time.Now().Unix()
962
+			newprescribe.RecordDate = dateTimeStam
963
+			newprescribe.DewaterAmount = dewater_amount
964
+			newprescribe.TargetUltrafiltration = dewater_amount
965
+			newprescribe.Status = 1
966
+			if adminUserInfo.CurrentOrgId == 10445 {
967
+				lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminUserInfo.CurrentOrgId)
968
+				newprescribe.Remark = lastDialysisPrescription.Remark
969
+			}
970
+			err := service.AddSigleRecord(&newprescribe)
971
+			//记录日志
972
+			byterequest, _ := json.Marshal(newprescribe)
973
+			prescriptionLog := models.XtDialysisPrescriptionLog{
974
+				UserOrgId:   adminUserInfo.CurrentOrgId,
975
+				Ctime:       time.Now().Unix(),
976
+				Mtime:       0,
977
+				ErrLog:      string(byterequest),
978
+				AdminUserId: adminUserInfo.AdminUser.Id,
979
+				RecordDate:  newprescribe.RecordDate,
980
+				PatientId:   patientID,
981
+				Source:      "物联网上传",
982
+				Status:      1,
983
+			}
984
+
985
+			service.CreatePrescriptionLog(prescriptionLog)
986
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":" + strconv.FormatInt(schedual.ModeId, 10) + ":dialysis_prescribe"
987
+			redis := service.RedisClient()
988
+			//清空key 值
989
+			redis.Set(key, "", time.Second)
990
+			keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":prescriptions_list_all"
991
+			redis.Set(keyTwo, "", time.Second)
992
+			thisTime := time.Now()
993
+			scheduleDateStartOne := thisTime.Format("2006-01-02")
994
+			keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
995
+			redis.Set(keyThree, "", time.Second)
996
+			defer redis.Close()
997
+			if err != nil {
998
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
999
+			}
1000
+		}
1001
+	}
1002
+
1003
+	if dialysisPrescribe != nil && dialysisPrescribe.TargetUltrafiltration == 0 {
1004
+		dialysisPrescribe.UpdatedTime = time.Now().Unix()
1005
+		dialysisPrescribe.RecordDate = dateTimeStam
1006
+		dialysisPrescribe.DewaterAmount = dewater_amount
1007
+		dialysisPrescribe.TargetUltrafiltration = dewater_amount
1008
+		dialysisPrescribe.Status = 1
1009
+		if adminUserInfo.CurrentOrgId == 10340 {
1010
+			dialysisPrescribe.TargetUltrafiltration = 0
1011
+		}
1012
+		if adminUserInfo.CurrentOrgId == 10445 {
1013
+			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminUserInfo.CurrentOrgId)
1014
+			dialysisPrescribe.Remark = lastDialysisPrescription.Remark
1015
+		}
1016
+		updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
1017
+		//记录日志
1018
+		byterequest, _ := json.Marshal(dialysisPrescribe)
1019
+		prescriptionLog := models.XtDialysisPrescriptionLog{
1020
+			UserOrgId:   adminUserInfo.CurrentOrgId,
1021
+			Ctime:       time.Now().Unix(),
1022
+			Mtime:       0,
1023
+			ErrLog:      string(byterequest),
1024
+			AdminUserId: adminUserInfo.AdminUser.Id,
1025
+			RecordDate:  dialysisPrescribe.RecordDate,
1026
+			PatientId:   patientID,
1027
+			Source:      "物联网上传",
1028
+			Status:      1,
1029
+		}
1030
+
1031
+		service.CreatePrescriptionLog(prescriptionLog)
1032
+		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":" + strconv.FormatInt(schedual.ModeId, 10) + ":dialysis_prescribe"
1033
+		redis := service.RedisClient()
1034
+		//清空key 值
1035
+		redis.Set(key, "", time.Second)
1036
+		keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(dateTimeStam, 10) + ":prescriptions_list_all"
1037
+		redis.Set(keyTwo, "", time.Second)
1038
+		thisTime := time.Now()
1039
+		scheduleDateStartOne := thisTime.Format("2006-01-02")
1040
+		keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1041
+		redis.Set(keyThree, "", time.Second)
1042
+		defer redis.Close()
1043
+		if updateErr != nil {
1044
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
1045
+		}
1046
+	}
1047
+
540
 	//透后
1048
 	//透后
541
 	weight_after, _ := c.GetFloat("weight_after", 0)
1049
 	weight_after, _ := c.GetFloat("weight_after", 0)
542
 	temperatureafter, _ := c.GetFloat("temperatureafter", 0)
1050
 	temperatureafter, _ := c.GetFloat("temperatureafter", 0)

+ 1 - 0
models/device_models.go 查看文件

518
 	LastAfterWeight     AssessmentAfterDislysis `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
518
 	LastAfterWeight     AssessmentAfterDislysis `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
519
 	DialysisMachineName string                  `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
519
 	DialysisMachineName string                  `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
520
 	MaxId               int64                   `gorm:"column:max_id" json:"max_id" form:"max_id"`
520
 	MaxId               int64                   `gorm:"column:max_id" json:"max_id" form:"max_id"`
521
+	Remark              string                  `gorm:"column:remark" json:"remark" form:"remark"`
521
 }
522
 }
522
 
523
 
523
 func (XtSchedule) TableName() string {
524
 func (XtSchedule) TableName() string {

+ 5 - 4
models/dialysis_parameter_models.go 查看文件

104
 }
104
 }
105
 
105
 
106
 type XtScheduleTwo struct {
106
 type XtScheduleTwo struct {
107
-	ID        int64  `gorm:"column:id" json:"id" form:"id"`
108
-	ModeId    int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
109
-	PatientId int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
110
-	Name      string `gorm:"column:name" json:"name" form:"name"`
107
+	ID               int64            `gorm:"column:id" json:"id" form:"id"`
108
+	ModeId           int64            `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
109
+	PatientId        int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
110
+	Name             string           `gorm:"column:name" json:"name" form:"name"`
111
+	DialysisSolution DialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
111
 }
112
 }
112
 
113
 
113
 func (XtScheduleTwo) TableName() string {
114
 func (XtScheduleTwo) TableName() string {

+ 1 - 0
models/new_stock_models.go 查看文件

220
 	GansunaSet                 int64 `gorm:"column:gansuna_set" json:"gansuna_set" form:"gansuna_set"`
220
 	GansunaSet                 int64 `gorm:"column:gansuna_set" json:"gansuna_set" form:"gansuna_set"`
221
 	ZhetangtieSet              int64 `gorm:"column:zhetangtie_set" json:"zhetangtie_set" form:"zhetangtie_set"`
221
 	ZhetangtieSet              int64 `gorm:"column:zhetangtie_set" json:"zhetangtie_set" form:"zhetangtie_set"`
222
 	NiaojimeiSet               int64 `gorm:"column:niaojimei_set" json:"niaojimei_set" form:"niaojimei_set"`
222
 	NiaojimeiSet               int64 `gorm:"column:niaojimei_set" json:"niaojimei_set" form:"niaojimei_set"`
223
+	DialysisStrainerSet        int64 `gorm:"column:dialysis_strainer_set" json:"dialysis_strainer_set" form:"dialysis_strainer_set"`
223
 }
224
 }
224
 
225
 
225
 func (XtDialysisSetting) TableName() string {
226
 func (XtDialysisSetting) TableName() string {

+ 17 - 5
models/stock_models.go 查看文件

344
 }
344
 }
345
 
345
 
346
 type WarehouseOutInfoSeven struct {
346
 type WarehouseOutInfoSeven struct {
347
-	ID            int64 `gorm:"column:id" json:"id"`
348
-	Count         int64 `gorm:"column:count" json:"count"`
349
-	SysRecordTime int64 `gorm:"column:sys_record_time" json:"sys_record_time"`
350
-	PatientId     int64 `gorm:"column:patient_id" json:"patient_id"`
351
-	GoodId        int64 `gorm:"column:good_id" json:"good_id"`
347
+	ID            int64                  `gorm:"column:id" json:"id"`
348
+	Count         int64                  `gorm:"column:count" json:"count"`
349
+	SysRecordTime int64                  `gorm:"column:sys_record_time" json:"sys_record_time"`
350
+	PatientId     int64                  `gorm:"column:patient_id" json:"patient_id"`
351
+	GoodId        int64                  `gorm:"column:good_id" json:"good_id"`
352
+	GoodInfo      XtGoodInformationTenty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
352
 }
353
 }
353
 
354
 
354
 func (WarehouseOutInfoSeven) TableName() string {
355
 func (WarehouseOutInfoSeven) TableName() string {
355
 	return "xt_warehouse_out_info"
356
 	return "xt_warehouse_out_info"
356
 }
357
 }
357
 
358
 
359
+type XtGoodInformationTenty struct {
360
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
361
+	GoodTypeId int64 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
362
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
363
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
364
+}
365
+
366
+func (XtGoodInformationTenty) TableName() string {
367
+	return "xt_good_information"
368
+}
369
+
358
 type SalesReturn struct {
370
 type SalesReturn struct {
359
 	ID           int64  `gorm:"column:id" json:"id"`
371
 	ID           int64  `gorm:"column:id" json:"id"`
360
 	OrderNumber  string `gorm:"column:order_number" json:"order_number"`
372
 	OrderNumber  string `gorm:"column:order_number" json:"order_number"`

+ 6 - 3
service/dialysis_parameter_service.go 查看文件

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/models"
5
 	"fmt"
4
 	"fmt"
5
+
6
+	"XT_New/models"
6
 	"github.com/jinzhu/gorm"
7
 	"github.com/jinzhu/gorm"
7
 )
8
 )
8
 
9
 
63
 	AssessmentBeforeDislysis models.PredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
64
 	AssessmentBeforeDislysis models.PredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
64
 	AssessmentAfterDislysis  models.AssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
65
 	AssessmentAfterDislysis  models.AssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
65
 	MonitoringRecord         []models.MonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
66
 	MonitoringRecord         []models.MonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
67
+	DialysisSolution         models.DialysisSolution        `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
66
 }
68
 }
67
 
69
 
68
 func (MonitorDialysisSchedule) TableName() string {
70
 func (MonitorDialysisSchedule) TableName() string {
70
 }
72
 }
71
 
73
 
72
 func GetDialysisParametersByKeyword(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, schedulDate int64) ([]*VMDialysisSchedule, error, int64) {
74
 func GetDialysisParametersByKeyword(orgID int64, keyword string, schedulType int64, partitionType int64, page int64, limit int64, schedulDate int64) ([]*VMDialysisSchedule, error, int64) {
73
-	fmt.Println("scheduletye ======================", schedulType)
75
+
74
 	var patients []*models.Patients
76
 	var patients []*models.Patients
75
 	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
77
 	getPatientErr := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND (name like ? OR dialysis_no like ?)", orgID, "%"+keyword+"%", "%"+keyword+"%").Find(&patients).Error
76
 	if getPatientErr != nil {
78
 	if getPatientErr != nil {
118
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, schedulDate).
120
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, schedulDate).
119
 		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, schedulDate).
121
 		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, schedulDate).
120
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, schedulDate).
122
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, schedulDate).
121
-		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
123
+		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
124
+		Preload("DialysisSolution", "status=1 and user_org_id = ? and solution_status = 1", orgID)
122
 	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
125
 	db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
123
 	if schedulDate > 0 {
126
 	if schedulDate > 0 {
124
 		db = db.Where("schedule_date = ?", schedulDate)
127
 		db = db.Where("schedule_date = ?", schedulDate)

+ 59 - 18
service/mobile_dialysis_service.go 查看文件

2754
 	return &record, nil
2754
 	return &record, nil
2755
 }
2755
 }
2756
 
2756
 
2757
+func GetDialysisPrescribeOne(orgID int64, patientID int64, recordDate int64) (models.DialysisPrescription, error) {
2758
+	var record models.DialysisPrescription
2759
+	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, recordDate).First(&record).Error
2760
+
2761
+	return record, err
2762
+}
2763
+
2757
 // 透析方案
2764
 // 透析方案
2758
 func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2765
 func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2759
 	var record models.DialysisSolution
2766
 	var record models.DialysisSolution
3127
 
3134
 
3128
 func GetAllWarehouseOutSumList(patient_id int64, orgID int64, record_time int64) (info []*models.WarehouseOutInfoSeven, err error) {
3135
 func GetAllWarehouseOutSumList(patient_id int64, orgID int64, record_time int64) (info []*models.WarehouseOutInfoSeven, err error) {
3129
 
3136
 
3130
-	err = XTReadDB().Where("patient_id = ? and org_id = ? and sys_record_time = ? and status = 1", patient_id, orgID, record_time).Find(&info).Error
3137
+	err = XTReadDB().Where("patient_id = ? and org_id = ? and sys_record_time = ? and status = 1", patient_id, orgID, record_time).Preload("GoodInfo", "status=1 and org_id = ?", orgID).Find(&info).Error
3131
 	return info, err
3138
 	return info, err
3132
 }
3139
 }
3133
 
3140
 
3279
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(recorddate, 10) + ":his_doctor_advice"
3286
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(recorddate, 10) + ":his_doctor_advice"
3280
 	his_doctor_advice_str, _ := redis.Get(key).Result()
3287
 	his_doctor_advice_str, _ := redis.Get(key).Result()
3281
 	redis.Set(key, "", time.Second)
3288
 	redis.Set(key, "", time.Second)
3282
-	if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3283
-		err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3284
-		if err != nil {
3285
-			if err == gorm.ErrRecordNotFound {
3286
-				if len(his) <= 0 {
3289
+	if orgid != 10721 {
3290
+		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3291
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3292
+			if err != nil {
3293
+				if err == gorm.ErrRecordNotFound {
3294
+					if len(his) <= 0 {
3295
+						redis.Set(key, "null", time.Second*60*60*18)
3296
+					}
3297
+					return his, nil
3298
+				} else {
3299
+					return his, err
3300
+				}
3301
+			} else {
3302
+				if len(his) > 0 {
3303
+					//缓存数据
3304
+					his_doctor_advice_str, err := json.Marshal(his)
3305
+					if err == nil {
3306
+						redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3307
+					}
3308
+				} else {
3287
 					redis.Set(key, "null", time.Second*60*60*18)
3309
 					redis.Set(key, "null", time.Second*60*60*18)
3288
 				}
3310
 				}
3289
 				return his, nil
3311
 				return his, nil
3290
-			} else {
3291
-				return his, err
3292
 			}
3312
 			}
3293
-		} else {
3294
-			if len(his) > 0 {
3295
-				//缓存数据
3296
-				his_doctor_advice_str, err := json.Marshal(his)
3297
-				if err == nil {
3298
-					redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3313
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
3314
+			json.Unmarshal([]byte(his_doctor_advice_str), &his)
3315
+			return his, nil
3316
+		}
3317
+	}
3318
+
3319
+	if orgid == 10721 {
3320
+		if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
3321
+			err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? and execution_frequency!='上机前' and delivery_way!='口服' ", patientid, orgid, recorddate).Order("created_time asc").Find(&his).Error
3322
+			if err != nil {
3323
+				if err == gorm.ErrRecordNotFound {
3324
+					if len(his) <= 0 {
3325
+						redis.Set(key, "null", time.Second*60*60*18)
3326
+					}
3327
+					return his, nil
3328
+				} else {
3329
+					return his, err
3299
 				}
3330
 				}
3300
 			} else {
3331
 			} else {
3301
-				redis.Set(key, "null", time.Second*60*60*18)
3332
+				if len(his) > 0 {
3333
+					//缓存数据
3334
+					his_doctor_advice_str, err := json.Marshal(his)
3335
+					if err == nil {
3336
+						redis.Set(key, his_doctor_advice_str, time.Second*60*60*18)
3337
+					}
3338
+				} else {
3339
+					redis.Set(key, "null", time.Second*60*60*18)
3340
+				}
3341
+				return his, nil
3302
 			}
3342
 			}
3343
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
3344
+			json.Unmarshal([]byte(his_doctor_advice_str), &his)
3303
 			return his, nil
3345
 			return his, nil
3304
 		}
3346
 		}
3305
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
3306
-		json.Unmarshal([]byte(his_doctor_advice_str), &his)
3307
-		return his, nil
3308
 	}
3347
 	}
3348
+
3349
+	return his, nil
3309
 }
3350
 }
3310
 
3351
 
3311
 func GetLastDialysisPrescriptionByPatientId(orgid int64, patientid int64, recorddate int64) (*models.DialysisPrescription, error) {
3352
 func GetLastDialysisPrescriptionByPatientId(orgid int64, patientid int64, recorddate int64) (*models.DialysisPrescription, error) {

+ 82 - 25
service/patient_service.go 查看文件

14
 )
14
 )
15
 
15
 
16
 // GetPatientList 返回患者的列表
16
 // GetPatientList 返回患者的列表
17
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64) (patients []*models.Patients, total int64, err error) {
17
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64) (patients []*models.Patients, total int64, err error) {
18
 
18
 
19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
20
 	if orgID > 0 {
20
 	if orgID > 0 {
73
 	if nurse > 0 {
73
 	if nurse > 0 {
74
 		db = db.Where("p.head_nurse_id = ?", nurse)
74
 		db = db.Where("p.head_nurse_id = ?", nurse)
75
 	}
75
 	}
76
+	if patient_type > 0 {
77
+		db = db.Where("p.patient_type = ?", patient_type)
78
+	}
76
 
79
 
77
 	offset := (page - 1) * limit
80
 	offset := (page - 1) * limit
78
 	if lapseto == 2 || lapseto == 3 {
81
 	if lapseto == 2 || lapseto == 3 {
472
 	defer redis.Close()
475
 	defer redis.Close()
473
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":his_advices_list_all"
476
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":his_advices_list_all"
474
 	his_advices_all, _ := redis.Get(key).Result()
477
 	his_advices_all, _ := redis.Get(key).Result()
475
-
476
-	if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
477
-		err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).Find(&hisAdvices).Error
478
-		if err != nil {
479
-			if err == gorm.ErrRecordNotFound {
480
-				if len(hisAdvices) <= 0 {
478
+	redis.Set(key, "", time.Second)
479
+	if orgID != 10721 {
480
+		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
481
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).Find(&hisAdvices).Error
482
+			if err != nil {
483
+				if err == gorm.ErrRecordNotFound {
484
+					if len(hisAdvices) <= 0 {
485
+						redis.Set(key, "null", time.Second*60*60*18)
486
+					}
487
+					return nil, nil
488
+				} else {
489
+					return nil, err
490
+				}
491
+			} else {
492
+				if len(hisAdvices) > 0 {
493
+					//缓存数据
494
+					his_advices_all, err := json.Marshal(&hisAdvices)
495
+					if err == nil {
496
+						redis.Set(key, his_advices_all, time.Second*60*60*18)
497
+					}
498
+				} else {
481
 					redis.Set(key, "null", time.Second*60*60*18)
499
 					redis.Set(key, "null", time.Second*60*60*18)
482
 				}
500
 				}
501
+				return hisAdvices, nil
502
+			}
503
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
504
+			if his_advices_all == "null" {
483
 				return nil, nil
505
 				return nil, nil
484
 			} else {
506
 			} else {
485
-				return nil, err
507
+				json.Unmarshal([]byte(his_advices_all), &hisAdvices)
508
+				return hisAdvices, nil
486
 			}
509
 			}
487
-		} else {
488
-			if len(hisAdvices) > 0 {
489
-				//缓存数据
490
-				his_advices_all, err := json.Marshal(&hisAdvices)
491
-				if err == nil {
492
-					redis.Set(key, his_advices_all, time.Second*60*60*18)
510
+
511
+		}
512
+	}
513
+
514
+	if orgID == 10721 {
515
+
516
+		if len(his_advices_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
517
+			err = readDb.Model(&VMHisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? AND advice_date = ? and execution_frequency !='上机前' and delivery_way!='口服' ", orgID, scheduleDate).Find(&hisAdvices).Error
518
+			if err != nil {
519
+				if err == gorm.ErrRecordNotFound {
520
+					if len(hisAdvices) <= 0 {
521
+						redis.Set(key, "null", time.Second*60*60*18)
522
+					}
523
+					return nil, nil
524
+				} else {
525
+					return nil, err
493
 				}
526
 				}
494
 			} else {
527
 			} else {
495
-				redis.Set(key, "null", time.Second*60*60*18)
528
+				if len(hisAdvices) > 0 {
529
+					//缓存数据
530
+					his_advices_all, err := json.Marshal(&hisAdvices)
531
+					if err == nil {
532
+						redis.Set(key, his_advices_all, time.Second*60*60*18)
533
+					}
534
+				} else {
535
+					redis.Set(key, "null", time.Second*60*60*18)
536
+				}
537
+				return hisAdvices, nil
538
+			}
539
+		} else { //缓存数据了数据,将redis缓存的json字符串转为map
540
+			if his_advices_all == "null" {
541
+				return nil, nil
542
+			} else {
543
+				json.Unmarshal([]byte(his_advices_all), &hisAdvices)
544
+				return hisAdvices, nil
496
 			}
545
 			}
497
-			return hisAdvices, nil
498
-		}
499
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
500
-		if his_advices_all == "null" {
501
-			return nil, nil
502
-		} else {
503
-			json.Unmarshal([]byte(his_advices_all), &hisAdvices)
504
-			return hisAdvices, nil
505
-		}
506
 
546
 
547
+		}
507
 	}
548
 	}
549
+
550
+	return hisAdvices, nil
508
 }
551
 }
509
 
552
 
510
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {
553
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {
2174
 }
2217
 }
2175
 
2218
 
2176
 func UpdateScheduleByDeathTime(patientid int64, shcheduledate int64) error {
2219
 func UpdateScheduleByDeathTime(patientid int64, shcheduledate int64) error {
2177
-	err := XTWriteDB().Model(models.XtSchedule{}).Where("patient_id = ? and schedule_date > ? and status=1", patientid, shcheduledate).Updates(map[string]interface{}{"status": 0}).Error
2220
+	var err error
2221
+	if shcheduledate > 0 {
2222
+		err = XTWriteDB().Model(models.XtSchedule{}).Where("patient_id = ? and schedule_date > ? and status=1", patientid, shcheduledate).Updates(map[string]interface{}{"status": 0, "remark": "转出删除排班"}).Error
2223
+	}
2224
+
2178
 	return err
2225
 	return err
2226
+
2179
 }
2227
 }
2180
 
2228
 
2181
 func UpdatePatientLapsetoByPatientId(patient_id int64, record_date int64, lapse_reason string) error {
2229
 func UpdatePatientLapsetoByPatientId(patient_id int64, record_date int64, lapse_reason string) error {
4283
 
4331
 
4284
 	return lapseto, err
4332
 	return lapseto, err
4285
 }
4333
 }
4334
+
4335
+func GetPatientBefor(patient_id int64, record_date int64, user_org_id int64) (models.XtAssessmentBeforeDislysis, error) {
4336
+
4337
+	beforeDislysis := models.XtAssessmentBeforeDislysis{}
4338
+
4339
+	err := XTReadDB().Where("patient_id = ? and assessment_date= ? and user_org_id = ? and status=1", patient_id, record_date, user_org_id).Find(&beforeDislysis).Error
4340
+
4341
+	return beforeDislysis, err
4342
+}

+ 7 - 0
service/self_drug_service.go 查看文件

600
 	return
600
 	return
601
 }
601
 }
602
 
602
 
603
+func GetAllBaseDrugLibListTwo(org_id int64) (drugs []*Drugs, err error) {
604
+
605
+	err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ?  AND status = 1", org_id).Find(&drugs).Error
606
+
607
+	return drugs, err
608
+}
609
+
603
 type PrivateDrug struct {
610
 type PrivateDrug struct {
604
 	DrugName           string         `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
611
 	DrugName           string         `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
605
 	ID                 int64          `gorm:"column:id" json:"id" form:"id"`
612
 	ID                 int64          `gorm:"column:id" json:"id" form:"id"`

+ 22 - 7
service/sign_service.go 查看文件

2110
 	return err
2110
 	return err
2111
 }
2111
 }
2112
 
2112
 
2113
-func GetAllDialysisOrderTwo(patient_id int64) (list []*models.XtDialysisOrder, err error) {
2113
+func GetAllDialysisOrderTwo(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
2114
 
2114
 
2115
-	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1696089600", patient_id).Find(&list).Error
2115
+	err = XTReadDB().Where("user_org_id = ? and status =1 and dialysis_date=1730736000", user_org_id).Find(&list).Error
2116
 
2116
 
2117
 	return list, err
2117
 	return list, err
2118
 }
2118
 }
2119
 
2119
 
2120
-func GetAllDialysisOrder(patient_id int64) (list []*models.XtDialysisOrder, err error) {
2120
+func GetAllDialysisPrescription(patient_id int64) (list []*models.XtDialysisPrescription, err error) {
2121
 
2121
 
2122
-	err = XTReadDB().Where("patient_id = ? and status =1", patient_id).Find(&list).Error
2122
+	err = XTReadDB().Where("patient_id = ? and status=1", patient_id).Find(&list).Error
2123
+
2124
+	return list, err
2125
+}
2126
+func UpdateSchedulePrescrition(patient_id int64, record_date int64, user_org_id int64, mode_id int64) (models.XtSchedule, error) {
2127
+
2128
+	schedule := models.XtSchedule{}
2129
+
2130
+	err := XTWriteDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and status=1 and user_org_id =?", patient_id, record_date, user_org_id).Updates(map[string]interface{}{"mode_id": mode_id}).Error
2131
+
2132
+	return schedule, err
2133
+}
2134
+
2135
+func GetAllDialysisOrder(patient_id int64, start_time int64, end_time int64) (list []*models.XtDialysisOrder, err error) {
2136
+
2137
+	err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1541001600 and dialysis_date<=?", patient_id, end_time).Find(&list).Error
2123
 
2138
 
2124
 	return list, err
2139
 	return list, err
2125
 }
2140
 }
2127
 func GetLastScheduleByUserOrg(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) (models.Schedule, error) {
2142
 func GetLastScheduleByUserOrg(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) (models.Schedule, error) {
2128
 
2143
 
2129
 	schedule := models.Schedule{}
2144
 	schedule := models.Schedule{}
2130
-	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and status=0", patient_id, schedule_date).First(&schedule).Error
2145
+	err := XTReadDB().Where("patient_id = ? and schedule_date = ?", patient_id, schedule_date).First(&schedule).Error
2131
 
2146
 
2132
 	return schedule, err
2147
 	return schedule, err
2133
 }
2148
 }
2134
 
2149
 
2135
-func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64) error {
2150
+func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64, mode_id int64) error {
2136
 
2151
 
2137
-	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1}).Error
2152
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1, "mode_id": mode_id}).Error
2138
 	return err
2153
 	return err
2139
 }
2154
 }
2140
 
2155
 

+ 2 - 2
service/statistis_qc_service.go 查看文件

126
         JOIN
126
         JOIN
127
             xt_treatment_mode t ON p.mode_id = t.mode_id
127
             xt_treatment_mode t ON p.mode_id = t.mode_id
128
         WHERE
128
         WHERE
129
-            FROM_UNIXTIME(p.record_date) >= ? AND FROM_UNIXTIME(p.record_date) <= ? AND p.user_org_id = ? and p.mode_id = ?
129
+            FROM_UNIXTIME(p.record_date) >= ? AND FROM_UNIXTIME(p.record_date) <= ? AND p.user_org_id = ? and p.mode_id = ? and p.status=1
130
         GROUP BY
130
         GROUP BY
131
            日期
131
            日期
132
     `, strings.Join(selectClauses, ", "))
132
     `, strings.Join(selectClauses, ", "))
141
         JOIN
141
         JOIN
142
             xt_treatment_mode t ON p.mode_id = t.mode_id
142
             xt_treatment_mode t ON p.mode_id = t.mode_id
143
         WHERE
143
         WHERE
144
-            FROM_UNIXTIME(p.record_date) >= ? AND FROM_UNIXTIME(p.record_date) <= ? AND p.user_org_id = ? 
144
+            FROM_UNIXTIME(p.record_date) >= ? AND FROM_UNIXTIME(p.record_date) <= ? AND p.user_org_id = ? and p.status=1
145
         GROUP BY
145
         GROUP BY
146
            日期
146
            日期
147
     `, strings.Join(selectClauses, ", "))
147
     `, strings.Join(selectClauses, ", "))

+ 1 - 1
service/stock_service.go 查看文件

9796
 		db = db.Where("is_upload = 2 or is_upload =0")
9796
 		db = db.Where("is_upload = 2 or is_upload =0")
9797
 	}
9797
 	}
9798
 	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&list).Error
9798
 	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&list).Error
9799
-
9799
+	fmt.Println("totla====================", total)
9800
 	return list, total, err
9800
 	return list, total, err
9801
 }
9801
 }
9802
 
9802