瀏覽代碼

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

陈少旭 2 週之前
父節點
當前提交
4a3c0c83e2

二進制
XT_New.exe 查看文件


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

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10702 //机构id
86
+		subscibe.OrgId = 10644 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,7 +93,7 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10702 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 12123 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10702 //机构id小英9675或4
332
+		subscibe.OrgId = 10644 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10702 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 12123 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 11 - 0
controllers/data_api_controller.go 查看文件

@@ -1023,6 +1023,10 @@ func (c *DataApiController) CreateAdviceTemplate() {
1023 1023
 
1024 1024
 				way := int64(items["way"].(float64))
1025 1025
 
1026
+				remark := items["remark"].(string)
1027
+
1028
+				fmt.Println("remark--------------------------", remark)
1029
+
1026 1030
 				subTemps := &models.DoctorAdviceTemplate{
1027 1031
 					AdviceName:            advice_name,
1028 1032
 					Status:                1,
@@ -1047,6 +1051,7 @@ func (c *DataApiController) CreateAdviceTemplate() {
1047 1051
 					Way:                   way,
1048 1052
 					DrugId:                drug_id,
1049 1053
 					DrugNameId:            0,
1054
+					Remark:                remark,
1050 1055
 				}
1051 1056
 				subTemplate = append(subTemplate, subTemps)
1052 1057
 
@@ -1128,6 +1133,8 @@ func (c *DataApiController) UpdateAdviceTemplate() {
1128 1133
 	template.DrugId = template.DrugId
1129 1134
 	template.Way = template.Way
1130 1135
 
1136
+	template.Remark = templatedata.Remark
1137
+
1131 1138
 	err = service.UpdateAdviceTemplate(template)
1132 1139
 	if err != nil {
1133 1140
 		utils.ErrorLog("%v", err)
@@ -1295,6 +1302,7 @@ func (c *DataApiController) DeleteParentAdviceTemplate() {
1295 1302
 }
1296 1303
 
1297 1304
 func (c *DataApiController) CreateSubAdviceTemplate() {
1305
+
1298 1306
 	drug_spec := c.GetString("drug_spec")
1299 1307
 	drug_spec_unit := c.GetString("drug_spec_unit")
1300 1308
 	advice_name := c.GetString("advice_name")
@@ -1309,6 +1317,8 @@ func (c *DataApiController) CreateSubAdviceTemplate() {
1309 1317
 	parent_id, _ := c.GetInt64("parent_id", 0)
1310 1318
 	drug_id, _ := c.GetInt64("drug_id")
1311 1319
 	way, _ := c.GetInt64("way")
1320
+	remark := c.GetString("remark")
1321
+
1312 1322
 	adminUserInfo := c.GetAdminUserInfo()
1313 1323
 
1314 1324
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -1343,6 +1353,7 @@ func (c *DataApiController) CreateSubAdviceTemplate() {
1343 1353
 		ParentId:              parent_id,
1344 1354
 		DrugId:                drug_id,
1345 1355
 		Way:                   way,
1356
+		Remark:                remark,
1346 1357
 	}
1347 1358
 
1348 1359
 	if template.AdviceName == "" {

+ 13 - 5
controllers/dialysis_api_controller.go 查看文件

@@ -2331,7 +2331,7 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
2331 2331
 	patient, _ := c.GetInt64("patient", 0)
2332 2332
 	recordDateStr := c.GetString("record_date")
2333 2333
 	record_time := c.GetString("record_time")
2334
-	fmt.Println(recordDateStr)
2334
+
2335 2335
 	if patient <= 0 {
2336 2336
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2337 2337
 		return
@@ -2355,8 +2355,6 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
2355 2355
 
2356 2356
 	startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_time)
2357 2357
 
2358
-	fmt.Println("startDate0000000000000000000000000000", startDate.Unix())
2359
-
2360 2358
 	// data := make(map[string]interface{}, 0)
2361 2359
 	var data models.AssessmentAfterDislysis
2362 2360
 	var err error
@@ -5877,9 +5875,19 @@ func (this *DialysisApiController) GetTodayMonitor() {
5877 5875
 
5878 5876
 	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 {
5879 5877
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
5880
-			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5881 5878
 
5882
-			record.UltrafiltrationVolume = ultrafiltration_volume
5879
+			if adminInfo.CurrentOrgId != 10735 {
5880
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5881
+				record.UltrafiltrationVolume = ultrafiltration_volume
5882
+			}
5883
+
5884
+			if adminInfo.CurrentOrgId == 10735 {
5885
+
5886
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+1800-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5887
+				record.UltrafiltrationVolume = ultrafiltration_volume
5888
+
5889
+			}
5890
+
5883 5891
 		}
5884 5892
 
5885 5893
 	}

+ 1 - 1
controllers/dialysis_record_api_controller.go 查看文件

@@ -1842,7 +1842,7 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1842 1842
 		service.CreateDialysisFinish(finishS)
1843 1843
 	}
1844 1844
 
1845
-	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 9829 || adminUserInfo.CurrentOrgId == 10440 {
1845
+	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 9829 || adminUserInfo.CurrentOrgId == 10440 || adminUserInfo.CurrentOrgId == 10735 {
1846 1846
 
1847 1847
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1848 1848
 		if evaluation.SystolicBloodPressure == 0 {

+ 13 - 3
controllers/drug_stock_api_contorller.go 查看文件

@@ -1180,7 +1180,12 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
1180 1180
 	}
1181 1181
 
1182 1182
 	if warehouse_out_id == 0 {
1183
-		service.AddSigleDrugWarehouseOut(&warehouseOut)
1183
+		//查询是否生成出库单
1184
+		outIsExit, _ := service.GetDrugWarehouseOutIsExit(adminUserInfo.CurrentOrgId, 0, operation_time, warehousing_out_order)
1185
+		if outIsExit.ID == 0 {
1186
+			service.AddSigleDrugWarehouseOut(&warehouseOut)
1187
+		}
1188
+
1184 1189
 	}
1185 1190
 	if warehouse_out_id > 0 {
1186 1191
 		service.UpdateSingleDrugWarehouseOut(warehouse_out_id, storehouse_id)
@@ -1329,8 +1334,13 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
1329 1334
 	//调用出库逻辑
1330 1335
 	for _, item := range warehousingOutInfo {
1331 1336
 		if item.ID == 0 {
1332
-			errOne := service.AddSigleDrugWarehouseOutInfo(item)
1333
-			fmt.Println(errOne)
1337
+			//查询改耗材是否出库
1338
+			outInfo, _ := service.GetDrugsIsExsit(item.DrugId, item.SysRecordTime, item.OrgId, lastWarehouseOut.ID)
1339
+			if outInfo.ID == 0 {
1340
+				errOne := service.AddSigleDrugWarehouseOutInfo(item)
1341
+				fmt.Println(errOne)
1342
+			}
1343
+
1334 1344
 		}
1335 1345
 		if item.ID > 0 {
1336 1346
 			service.UpdatedDrugWarehouseInfo(item, item.ID)

+ 1 - 1
controllers/his_api_controller.go 查看文件

@@ -3479,7 +3479,7 @@ func (c *HisApiController) CreateHisPrescription() {
3479 3479
 	var adviceList []models.HisDoctorAdviceInfo
3480 3480
 	var projectList []models.HisPrescriptionProject
3481 3481
 
3482
-	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 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 || adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10653 {
3482
+	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 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 || adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10653 || adminInfo.CurrentOrgId == 10567 {
3483 3483
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3484 3484
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3485 3485
 

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

@@ -985,7 +985,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
985 985
 		}
986 986
 
987 987
 		//针对古镇乐生
988
-		if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10731 {
988
+		if adminUserInfo.Org.Id == 10731 {
989 989
 
990 990
 			dewater_amount = (evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight) * 1000
991 991
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)

+ 41 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -3047,7 +3047,7 @@ func (c *DialysisAPIController) Finish() {
3047 3047
 
3048 3048
 	}
3049 3049
 
3050
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 {
3050
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10735 {
3051 3051
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3052 3052
 
3053 3053
 		if adminUserInfo.Org.Id != 10702 {
@@ -3189,6 +3189,12 @@ func (c *DialysisAPIController) Finish() {
3189 3189
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
3190 3190
 		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
3191 3191
 	}
3192
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10735 {
3193
+		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
3194
+		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
3195
+		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
3196
+		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
3197
+	}
3192 3198
 
3193 3199
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10598 {
3194 3200
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
@@ -3329,6 +3335,8 @@ func (c *DialysisAPIController) Finish() {
3329 3335
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3330 3336
 	}
3331 3337
 
3338
+	tempassessmentAfterDislysis.RecordTime = dialysisOrder.EndTime
3339
+
3332 3340
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
3333 3341
 
3334 3342
 	key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis"
@@ -4186,6 +4194,16 @@ func (this *DialysisAPIController) StartDialysis() {
4186 4194
 			record.BloodFlowVolume = prescription.BloodFlowVolume
4187 4195
 		}
4188 4196
 
4197
+		//胶州少海医院
4198
+		if adminUserInfo.Org.Id == 10735 {
4199
+			befor, _ := service.GetAssessmentBeforThrity(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4200
+			dialysisPrescription, _ := service.GetDialysisPrescription(patientID, adminUserInfo.Org.Id, recordDate.Unix())
4201
+			record.BreathingRate = befor.BreathingRate
4202
+			record.BloodFlowVolume = dialysisPrescription.BloodFlowVolume
4203
+			record.Temperature = befor.Temperature
4204
+			record.PulseFrequency = befor.PulseFrequency
4205
+		}
4206
+
4189 4207
 		if adminUserInfo.Org.Id != 10683 {
4190 4208
 			err = service.CreateMonitor(&record)
4191 4209
 		}
@@ -5267,7 +5285,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5267 5285
 
5268 5286
 			if adminInfo.Org.Id == 10206 {
5269 5287
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
5270
-				fmt.Println("ultrafiltration_rate------------------", ultrafiltration_rate)
5288
+
5271 5289
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5272 5290
 			}
5273 5291
 			//if template.TemplateId == 47 {
@@ -5289,8 +5307,27 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5289 5307
 
5290 5308
 	if template.TemplateId == 6 || template.TemplateId == 65 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 || adminInfo.Org.Id == 10599 { //adminInfo.Org.Id == 9538
5291 5309
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5292
-			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5293
-			record.UltrafiltrationVolume = ultrafiltration_volume
5310
+
5311
+			if adminInfo.Org.Id != 10735 {
5312
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5313
+				record.UltrafiltrationVolume = ultrafiltration_volume
5314
+			}
5315
+			//胶州少海医院
5316
+			if adminInfo.Org.Id == 10735 {
5317
+
5318
+				lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5319
+				if lastMonitorRecordList.ID > 0 {
5320
+					record.UltrafiltrationRate = lastMonitorRecordList.UltrafiltrationRate
5321
+					ultrafiltration_volume := math.Floor(float64(record.OperateTime+1800-fristrecord.OperateTime) / 3600 * lastMonitorRecordList.UltrafiltrationRate)
5322
+
5323
+					record.UltrafiltrationVolume = ultrafiltration_volume
5324
+				} else {
5325
+					ultrafiltration_volume := math.Floor(float64(record.OperateTime+1800-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5326
+
5327
+					record.UltrafiltrationVolume = ultrafiltration_volume
5328
+				}
5329
+
5330
+			}
5294 5331
 
5295 5332
 		}
5296 5333
 	}

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

@@ -4301,6 +4301,17 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4301 4301
 
4302 4302
 	}
4303 4303
 
4304
+	//揭阳
4305
+	if adminUserInfo.Org.Id == 10597 {
4306
+		if evaluation.ID == 0 {
4307
+			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4308
+			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4309
+				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4310
+				service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
4311
+			}
4312
+		}
4313
+	}
4314
+
4304 4315
 	err = service.UpadatePredialysisEvaluation(&evaluation)
4305 4316
 
4306 4317
 	//记录日志
@@ -7082,7 +7093,7 @@ func (c *PatientApiController) CheckProject() {
7082 7093
 			for _, items := range ps {
7083 7094
 				ids = append(ids, items.ID)
7084 7095
 			}
7085
-			err := service.UpdateTeamProjectCheckStatus(ids, project.PatientId, project.RecordDate, project.UserOrgId, adminInfo.AdminUser.Id, time.Now().Unix())
7096
+			err := service.UpdateTeamProjectCheckStatus(ids, patient_id, record_date, adminInfo.Org.Id, adminInfo.AdminUser.Id, time.Now().Unix())
7086 7097
 			if err == nil {
7087 7098
 				c.ServeSuccessJSON(map[string]interface{}{
7088 7099
 					"project": project,

+ 122 - 2
controllers/patient_api_controller.go 查看文件

@@ -202,6 +202,14 @@ func PatientApiRegistRouters() {
202 202
 
203 203
 	beego.Router("/api/patient/deletecourestempalte", &PatientApiController{}, "Get:DeleteCouseTemplate")
204 204
 
205
+	beego.Router("/api/patient/getautopatientcontent", &PatientApiController{}, "Get:GetAutoPatientContent")
206
+
207
+	beego.Router("/api/patient/getpatientrescuerecord", &PatientApiController{}, "Get:GetPatientRescueRecord")
208
+
209
+	beego.Router("/api/patient/modifycourseprint", &PatientApiController{}, "Post:ModifyCoursePrint")
210
+
211
+	beego.Router("/api/patient/getpatientrescuerecordlist", &PatientApiController{}, "Get:GetPatientRescureRecordList")
212
+
205 213
 }
206 214
 func (c *PatientApiController) GetExportList() {
207 215
 	startTime := c.GetString("start_time")
@@ -4522,7 +4530,7 @@ func (c *PatientApiController) DeleteGroupAdvice() {
4522 4530
 		}
4523 4531
 	}
4524 4532
 
4525
-	err := service.DeleteGroupAdviceOne(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
4533
+	err := service.DeleteGroupAdvice(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
4526 4534
 
4527 4535
 	byterequest, _ := json.Marshal(advice)
4528 4536
 	doctorAdviceLog := models.XtDoctorAdviceLog{
@@ -8518,7 +8526,6 @@ func (this *PatientApiController) DeleteCouseTemplate() {
8518 8526
 
8519 8527
 	id, _ := this.GetInt64("id")
8520 8528
 
8521
-	fmt.Println("id==================", id)
8522 8529
 	service.DeleteCouseTemplate(id)
8523 8530
 
8524 8531
 	this.ServeSuccessJSON(map[string]interface{}{
@@ -8526,3 +8533,116 @@ func (this *PatientApiController) DeleteCouseTemplate() {
8526 8533
 	})
8527 8534
 
8528 8535
 }
8536
+
8537
+func (this *PatientApiController) GetAutoPatientContent() {
8538
+
8539
+	timeLayout := "2006-01-02"
8540
+	loc, _ := time.LoadLocation("Local")
8541
+
8542
+	start_time := this.GetString("start_time")
8543
+	end_time := this.GetString("end_time")
8544
+	patient_id, _ := this.GetInt64("patient_id")
8545
+
8546
+	fmt.Println("patinet_id ===========================", patient_id)
8547
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8548
+	var startTime int64
8549
+	if len(start_time) > 0 {
8550
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8551
+		if err != nil {
8552
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8553
+			return
8554
+		}
8555
+		startTime = theTime.Unix()
8556
+	}
8557
+
8558
+	var endTime int64
8559
+	if len(end_time) > 0 {
8560
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
8561
+		if err != nil {
8562
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8563
+			return
8564
+		}
8565
+		endTime = theTime.Unix()
8566
+	}
8567
+
8568
+	//获取透析处方
8569
+	prescription, _ := service.GetAutoDialysisPrescription(patient_id, startTime, endTime, orgId)
8570
+
8571
+	maxPrescription, _ := service.GetAutoMaxDialysisPrescription(patient_id, startTime, endTime, orgId)
8572
+
8573
+	minPrescription, _ := service.GetAutoMinDialysisPrescription(patient_id, startTime, endTime, orgId)
8574
+
8575
+	berfor, _ := service.GetAutoAssessmentBefor(patient_id, startTime, endTime, orgId)
8576
+
8577
+	monitorList, _ := service.GetAutoMonitorList(patient_id, startTime, endTime, orgId)
8578
+
8579
+	dryweightList, _ := service.GetAutoPatientDryWeight(patient_id, startTime, endTime, orgId)
8580
+
8581
+	inpectionList, _ := service.GetAutoInspectionList(patient_id, startTime, endTime, orgId)
8582
+
8583
+	dialysisOrder, _ := service.GetAutoDialysisOrder(patient_id, startTime, endTime, orgId)
8584
+
8585
+	patient, _ := service.GetPatientByIDOne(orgId, patient_id)
8586
+
8587
+	longAdvice, _ := service.GetLongDoctorAdvice(orgId, patient_id, startTime, endTime)
8588
+
8589
+	this.ServeSuccessJSON(map[string]interface{}{
8590
+		"prescription":    prescription,
8591
+		"berfor":          berfor,
8592
+		"monitorList":     monitorList,
8593
+		"dryweightList":   dryweightList,
8594
+		"inpectionList":   inpectionList,
8595
+		"dialysisOrder":   dialysisOrder,
8596
+		"patient":         patient,
8597
+		"longAdvice":      longAdvice,
8598
+		"maxPrescription": maxPrescription,
8599
+		"minPrescription": minPrescription,
8600
+	})
8601
+
8602
+}
8603
+
8604
+func (this *PatientApiController) GetPatientRescueRecord() {
8605
+
8606
+	id, _ := this.GetInt64("id")
8607
+
8608
+	rescueRecord, _ := service.GetPatientRescueRecord(id)
8609
+
8610
+	this.ServeSuccessJSON(map[string]interface{}{
8611
+		"rescueRecord": rescueRecord,
8612
+	})
8613
+}
8614
+
8615
+func (this *PatientApiController) ModifyCoursePrint() {
8616
+
8617
+	dataBody := make(map[string]interface{}, 0)
8618
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8619
+	fmt.Println("err", err)
8620
+	id := int64(dataBody["id"].(float64))
8621
+	content := dataBody["content"].(string)
8622
+
8623
+	coursePrint, _ := service.ModifyCoursePrint(id, content)
8624
+
8625
+	this.ServeSuccessJSON(map[string]interface{}{
8626
+		"coursePrint": coursePrint,
8627
+	})
8628
+}
8629
+
8630
+func (this *PatientApiController) GetPatientRescureRecordList() {
8631
+
8632
+	id, _ := this.GetInt64("id")
8633
+	patient_id, _ := this.GetInt64("patient_id")
8634
+
8635
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8636
+	appId := this.GetAdminUserInfo().CurrentAppId
8637
+	patient, _ := service.GetPatientByIDOne(orgId, patient_id)
8638
+
8639
+	rescueRecordList, _ := service.GetPatientRescureRecordList(id)
8640
+
8641
+	operators, _ := service.GetAdminUserEsTwo(orgId, appId)
8642
+
8643
+	this.ServeSuccessJSON(map[string]interface{}{
8644
+		"rescueRecordList": rescueRecordList,
8645
+		"patient":          patient,
8646
+		"operators":        operators,
8647
+	})
8648
+}

+ 7 - 0
controllers/pharmacy_controller.go 查看文件

@@ -576,6 +576,13 @@ func (this *PharmacyController) DrugWithdrawal() {
576 576
 	}
577 577
 	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
578 578
 
579
+	prescriptionList, _ := service.GetHisPrescriptionByStartTime(orgid, patient_id, stime, etime)
580
+	if len(prescriptionList) > 0 {
581
+		for _, item := range prescriptionList {
582
+			service.ModiftyPrescpiton(item.ID)
583
+		}
584
+	}
585
+
579 586
 	if err != nil {
580 587
 		utils.ErrorLog(err.Error())
581 588
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())

+ 0 - 5
controllers/self_drug_api_congtroller.go 查看文件

@@ -3880,10 +3880,6 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3880 3880
 	}
3881 3881
 	var ids []int64
3882 3882
 	var goodIds []int64
3883
-	//infoList, _ := service.GetGoodWarehouseInfoByOrgIdTwo(orgId)
3884
-	//for _, it := range infoList {
3885
-	//	goodIds = append(goodIds, it.GoodId)
3886
-	//}
3887 3883
 
3888 3884
 	if len(keyword) > 0 {
3889 3885
 		manufacturers, _ := service.GetManufacturerListByKeyword(orgId, keyword)
@@ -4034,7 +4030,6 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
4034 4030
 			//期间减少
4035 4031
 			banceOutList, _ := service.GetInitOutBanceList(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4036 4032
 
4037
-			//banceOutList, _ := service.GetInitOutBanceTenty(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4038 4033
 			for _, it := range banceOutList {
4039 4034
 				item.WarehouseOutInfoTenty = append(item.WarehouseOutInfoTenty, it)
4040 4035
 			}

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

@@ -1000,6 +1000,7 @@ type XtAssessmentAfterDislysis struct {
1000 1000
 	SealingFluidDispose             string  `gorm:"column:sealing_fluid_dispose" json:"sealing_fluid_dispose" form:"sealing_fluid_dispose"`
1001 1001
 	Ktv                             string  `gorm:"column:ktv" json:"ktv" form:"ktv"`
1002 1002
 	Urr                             string  `gorm:"column:urr" json:"urr" form:"urr"`
1003
+	RecordTime                      int64   `gorm:"column:record_time" json:"record_time" form:"record_time"`
1003 1004
 }
1004 1005
 
1005 1006
 func (XtAssessmentAfterDislysis) TableName() string {

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

@@ -78,6 +78,7 @@ type DoctorAdviceTemplate struct {
78 78
 	Way                     int64                   `gorm:"column:way" json:"way" form:"way"`
79 79
 	DrugNameId              int64                   `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
80 80
 	SubDoctorAdviceTemplate []*DoctorAdviceTemplate `gorm:"ForeignKey:ParentId;AssociationForeignKey:ID" json:"child"`
81
+	Remark                  string                  `gorm:"column:remark" json:"remark" form:"remark"`
81 82
 }
82 83
 
83 84
 func (DoctorAdviceTemplate) TableName() string {

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

@@ -242,7 +242,6 @@ type VmStockFlowTwenty struct {
242 242
 	Price               float64            `gorm:"column:price" json:"price" form:"price"`
243 243
 	WarehousingDetailId int64              `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
244 244
 	BuyPrice            float64            `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
245
-	IsRead              int64              `gorm:"column:is_read" json:"is_read" form:"is_read"`
246 245
 	OverCount           int64              `gorm:"column:over_count" json:"over_count" form:"over_count"`
247 246
 	Ctime               int64              `gorm:"column:ctime" json:"ctime" form:"ctime"`
248 247
 	StorehouseId        int64              `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`

+ 135 - 0
models/patient_models.go 查看文件

@@ -2880,3 +2880,138 @@ func (XtDeathRecord) TableName() string {
2880 2880
 
2881 2881
 	return "xt_death_record"
2882 2882
 }
2883
+
2884
+type XtAutoDialysisPrescription struct {
2885
+	ID                         int64   `gorm:"column:id" json:"id" form:"id"`
2886
+	UserOrgId                  int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2887
+	PatientId                  int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2888
+	Dialyzer                   int64   `gorm:"column:dialyzer" json:"dialyzer" form:"dialyzer"`
2889
+	MachineType                string  `gorm:"column:machine_type" json:"machine_type" form:"machine_type"`
2890
+	DewaterAmount              float64 `gorm:"column:dewater_amount" json:"dewater_amount" form:"dewater_amount"`
2891
+	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
2892
+	PrescriptionDewatering     float64 `gorm:"column:prescription_dewatering" json:"prescription_dewatering" form:"prescription_dewatering"`
2893
+	Anticoagulant              int64   `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
2894
+	AnticoagulantShouji        float64 `gorm:"column:anticoagulant_shouji" json:"anticoagulant_shouji" form:"anticoagulant_shouji"`
2895
+	AnticoagulantWeichi        float64 `gorm:"column:anticoagulant_weichi" json:"anticoagulant_weichi" form:"anticoagulant_weichi"`
2896
+	AnticoagulantZongliang     float64 `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
2897
+	AnticoagulantGaimingcheng  string  `gorm:"column:anticoagulant_gaimingcheng" json:"anticoagulant_gaimingcheng" form:"anticoagulant_gaimingcheng"`
2898
+	AnticoagulantGaijiliang    string  `gorm:"column:anticoagulant_gaijiliang" json:"anticoagulant_gaijiliang" form:"anticoagulant_gaijiliang"`
2899
+	ModeId                     int64   `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
2900
+	DialysisDurationHour       int64   `gorm:"column:dialysis_duration_hour" json:"dialysis_duration_hour" form:"dialysis_duration_hour"`
2901
+	DialysisDurationMinute     int64   `gorm:"column:dialysis_duration_minute" json:"dialysis_duration_minute" form:"dialysis_duration_minute"`
2902
+	DialysisDuration           float64 `gorm:"column:dialysis_duration" json:"dialysis_duration" form:"dialysis_duration"`
2903
+	ReplacementTotal           float64 `gorm:"column:replacement_total" json:"replacement_total" form:"replacement_total"`
2904
+	ReplacementWay             int64   `gorm:"column:replacement_way" json:"replacement_way" form:"replacement_way"`
2905
+	HemodialysisMachine        int64   `gorm:"column:hemodialysis_machine" json:"hemodialysis_machine" form:"hemodialysis_machine"`
2906
+	BloodFilter                int64   `gorm:"column:blood_filter" json:"blood_filter" form:"blood_filter"`
2907
+	PerfusionApparatus         int64   `gorm:"column:perfusion_apparatus" json:"perfusion_apparatus" form:"perfusion_apparatus"`
2908
+	DryWeight                  float64 `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
2909
+	VascularAccessMode         int64   `gorm:"column:vascular_access_mode" json:"vascular_access_mode" form:"vascular_access_mode"`
2910
+	VascularAccess             int64   `gorm:"column:vascular_access" json:"vascular_access" form:"vascular_access"`
2911
+	BloodFlowVolume            float64 `gorm:"column:blood_flow_volume" json:"blood_flow_volume" form:"blood_flow_volume"`
2912
+	DialysateFlow              float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
2913
+	DisplaceLiqui              float64 `gorm:"column:displace_liqui" json:"displace_liqui" form:"displace_liqui"`
2914
+	Kalium                     float64 `gorm:"column:kalium" json:"kalium" form:"kalium"`
2915
+	Sodium                     float64 `gorm:"column:sodium" json:"sodium" form:"sodium"`
2916
+	Calcium                    float64 `gorm:"column:calcium" json:"calcium" form:"calcium"`
2917
+	Bicarbonate                float64 `gorm:"column:bicarbonate" json:"bicarbonate" form:"bicarbonate"`
2918
+	Glucose                    float64 `gorm:"column:glucose" json:"glucose" form:"glucose"`
2919
+	DialysateTemperature       float64 `gorm:"column:dialysate_temperature" json:"dialysate_temperature" form:"dialysate_temperature"`
2920
+	Conductivity               float64 `gorm:"column:conductivity" json:"conductivity" form:"conductivity"`
2921
+	PrescriptionDoctor         int64   `gorm:"column:prescription_doctor" json:"prescription_doctor" form:"prescription_doctor"`
2922
+	Creater                    int64   `gorm:"column:creater" json:"creater" form:"creater"`
2923
+	Modifier                   int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
2924
+	Remark                     string  `gorm:"column:remark" json:"remark" form:"remark"`
2925
+	Status                     int64   `gorm:"column:status" json:"status" form:"status"`
2926
+	CreatedTime                int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
2927
+	UpdatedTime                int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
2928
+	RecordDate                 int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
2929
+	RecordId                   int64   `gorm:"column:record_id" json:"record_id" form:"record_id"`
2930
+	TargetUltrafiltration      float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration" form:"target_ultrafiltration"`
2931
+	DialysateFormulation       int64   `gorm:"column:dialysate_formulation" json:"dialysate_formulation" form:"dialysate_formulation"`
2932
+	BodyFluid                  int64   `gorm:"column:body_fluid" json:"body_fluid" form:"body_fluid"`
2933
+	SpecialMedicine            int64   `gorm:"column:special_medicine" json:"special_medicine" form:"special_medicine"`
2934
+	SpecialMedicineOther       string  `gorm:"column:special_medicine_other" json:"special_medicine_other" form:"special_medicine_other"`
2935
+	DisplaceLiquiPart          int64   `gorm:"column:displace_liqui_part" json:"displace_liqui_part" form:"displace_liqui_part"`
2936
+	BloodAccess                int64   `gorm:"column:blood_access" json:"blood_access" form:"blood_access"`
2937
+	DisplaceLiquiValue         float64 `gorm:"column:displace_liqui_value" json:"displace_liqui_value" form:"displace_liqui_value"`
2938
+	Ultrafiltration            float64 `gorm:"column:ultrafiltration" json:"ultrafiltration" form:"ultrafiltration"`
2939
+	BodyFluidOther             string  `gorm:"column:body_fluid_other" json:"body_fluid_other" form:"body_fluid_other"`
2940
+	Niprocart                  int64   `gorm:"column:niprocart" json:"niprocart" form:"niprocart"`
2941
+	Jms                        int64   `gorm:"column:jms" json:"jms" form:"jms"`
2942
+	FistulaNeedleSet           int64   `gorm:"column:fistula_needle_set" json:"fistula_needle_set" form:"fistula_needle_set"`
2943
+	FistulaNeedleSet16         int64   `gorm:"column:fistula_needle_set_16" json:"fistula_needle_set_16" form:"fistula_needle_set_16"`
2944
+	Hemoperfusion              int64   `gorm:"column:hemoperfusion" json:"hemoperfusion" form:"hemoperfusion"`
2945
+	DialyserSterilised         int64   `gorm:"column:dialyser_sterilised" json:"dialyser_sterilised" form:"dialyser_sterilised"`
2946
+	Filtryzer                  int64   `gorm:"column:filtryzer" json:"filtryzer" form:"filtryzer"`
2947
+	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv" form:"target_ktv"`
2948
+	Dialyzers                  int64   `gorm:"column:dialyzers" json:"dialyzers" form:"dialyzers"`
2949
+	Injector                   int64   `gorm:"column:injector" json:"injector" form:"injector"`
2950
+	Bloodlines                 int64   `gorm:"column:bloodlines" json:"bloodlines" form:"bloodlines"`
2951
+	TubingHemodialysis         int64   `gorm:"column:tubing_hemodialysis" json:"tubing_hemodialysis" form:"tubing_hemodialysis"`
2952
+	Package                    int64   `gorm:"column:package" json:"package" form:"package"`
2953
+	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid" form:"a_liquid"`
2954
+	PreImpulse                 string  `gorm:"column:pre_impulse" json:"pre_impulse" form:"pre_impulse"`
2955
+	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
2956
+	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
2957
+	HeparinSodium              string  `gorm:"column:heparin_sodium" json:"heparin_sodium" form:"heparin_sodium"`
2958
+	Nucleoprotamine            string  `gorm:"column:nucleoprotamine" json:"nucleoprotamine" form:"nucleoprotamine"`
2959
+	PushTheProtamine           string  `gorm:"column:push_the_protamine" json:"push_the_protamine" form:"push_the_protamine"`
2960
+	NoHeparinRemarks           string  `gorm:"column:no_heparin_remarks" json:"no_heparin_remarks" form:"no_heparin_remarks"`
2961
+	Blood                      string  `gorm:"column:blood" json:"blood" form:"blood"`
2962
+	AntioxidantCommodityName   string  `gorm:"column:antioxidant_commodity_name" json:"antioxidant_commodity_name" form:"antioxidant_commodity_name"`
2963
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
2964
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
2965
+	DisplaceSpeed              string  `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
2966
+	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
2967
+	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
2968
+	SingleTime                 string  `gorm:"column:single_time" json:"single_time" form:"single_time"`
2969
+	SingleWater                string  `gorm:"column:single_water" json:"single_water" form:"single_water"`
2970
+	ReplacementFlow            string  `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
2971
+	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
2972
+	BilirubinAdsorptionColumn  string  `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
2973
+	OxygenUptake               int64   `gorm:"column:oxygen_uptake" json:"oxygen_uptake" form:"oxygen_uptake"`
2974
+	OxygenFlow                 string  `gorm:"column:oxygen_flow" json:"oxygen_flow" form:"oxygen_flow"`
2975
+	OxygenTime                 string  `gorm:"column:oxygen_time" json:"oxygen_time" form:"oxygen_time"`
2976
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
2977
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
2978
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
2979
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
2980
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
2981
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
2982
+	MaxUltrafiltrationRate     float64 `gorm:"column:max_ultrafiltration_rate" json:"max_ultrafiltration_rate" form:"max_ultrafiltration_rate"`
2983
+	AdminUserId                int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2984
+	DrhyWater                  string  `gorm:"column:drhy_water" json:"drhy_water" form:"drhy_water"`
2985
+	IsWater                    int64   `gorm:"column:is_water" json:"is_water" form:"is_water"`
2986
+	DryWaterHour               string  `gorm:"column:dry_water_hour" json:"dry_water_hour" form:"dry_water_hour"`
2987
+	WaterMachine               string  `gorm:"column:water_machine" json:"water_machine" form:"water_machine"`
2988
+	AddAmount                  float64 `gorm:"column:add_amount" json:"add_amount" form:"add_amount"`
2989
+	ReduceAmount               float64 `gorm:"column:reduce_amount" json:"reduce_amount" form:"reduce_amount"`
2990
+	DialysisRemark             string  `gorm:"column:dialysis_remark" json:"dialysis_remark" form:"dialysis_remark"`
2991
+	PrescribingNumber          float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
2992
+	TreatmentRemark            string  `gorm:"column:treatment_remark" json:"treatment_remark" form:"treatment_remark"`
2993
+	PrescriptionSodium         string  `gorm:"column:prescription_sodium" json:"prescription_sodium" form:"prescription_sodium"`
2994
+	StartSodium                string  `gorm:"column:start_sodium" json:"start_sodium" form:"start_sodium"`
2995
+	SodiumCurve                string  `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
2996
+	DialysisFluidFlow          string  `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
2997
+	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
2998
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
2999
+	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
3000
+	Chaptalization             string  `gorm:"column:chaptalization" json:"chaptalization" form:"chaptalization"`
3001
+	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
3002
+	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
3003
+	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
3004
+	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
3005
+	Dialyzate                  string  `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
3006
+	DialysisDialyszersId       int64   `gorm:"column:dialysis_dialyszers_id" json:"dialysis_dialyszers_id" form:"dialysis_dialyszers_id"`
3007
+	DialysisStrainerId         int64   `gorm:"column:dialysis_strainer_id" json:"dialysis_strainer_id" form:"dialysis_strainer_id"`
3008
+	DialysisIrrigationId       int64   `gorm:"column:dialysis_irrigation_id" json:"dialysis_irrigation_id" form:"dialysis_irrigation_id"`
3009
+	FirstSuper                 int64   `gorm:"column:first_super" json:"first_super" form:"first_super"`
3010
+	IsSequential               int64   `gorm:"column:is_sequential" json:"is_sequential" form:"is_sequential"`
3011
+	Conduct                    string  `gorm:"column:conduct" json:"conduct" form:"conduct"`
3012
+}
3013
+
3014
+func (XtAutoDialysisPrescription) TableName() string {
3015
+
3016
+	return "xt_dialysis_prescription"
3017
+}

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

@@ -115,13 +115,14 @@ func (StWarehousingInfo) TableName() string {
115 115
 }
116 116
 
117 117
 type StWarehousingInfoOne struct {
118
-	ID               int64  `gorm:"column:id" json:"id"`
119
-	GoodId           int64  `gorm:"column:good_id" json:"good_id"`
120
-	WarehousingCount int64  `gorm:"column:warehousing_count" json:"warehousing_count"`
121
-	WarehousingUnit  string `gorm:"column:warehousing_unit" json:"warehousing_unit"`
122
-	PackingUnit      string `json:"packing_unit"`
123
-	StorehouseId     int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
124
-	OrgId            int64  `gorm:"column:org_id" json:"org_id"`
118
+	ID               int64   `gorm:"column:id" json:"id"`
119
+	GoodId           int64   `gorm:"column:good_id" json:"good_id"`
120
+	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count"`
121
+	WarehousingUnit  string  `gorm:"column:warehousing_unit" json:"warehousing_unit"`
122
+	PackingUnit      string  `json:"packing_unit"`
123
+	StorehouseId     int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
124
+	OrgId            int64   `gorm:"column:org_id" json:"org_id"`
125
+	Price            float64 `gorm:"column:price" json:"price" form:"price"`
125 126
 }
126 127
 
127 128
 func (StWarehousingInfoOne) TableName() string {
@@ -1731,14 +1732,15 @@ func (WarehousingInfoNight) TableName() string {
1731 1732
 }
1732 1733
 
1733 1734
 type WarehouseOutInfoTenty struct {
1734
-	ID            int64 `gorm:"column:id" json:"id" form:"id"`
1735
-	GoodId        int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
1736
-	Count         int64 `gorm:"column:count" json:"count" form:"count"`
1737
-	Mtime         int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1738
-	Ctime         int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1739
-	Status        int64 `gorm:"column:status" json:"status" form:"status"`
1740
-	OrgId         int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
1741
-	SysRecordTime int64 `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
1735
+	ID            int64   `gorm:"column:id" json:"id" form:"id"`
1736
+	GoodId        int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
1737
+	Count         int64   `gorm:"column:count" json:"count" form:"count"`
1738
+	Mtime         int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
1739
+	Ctime         int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1740
+	Status        int64   `gorm:"column:status" json:"status" form:"status"`
1741
+	OrgId         int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
1742
+	SysRecordTime int64   `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
1743
+	Price         float64 `gorm:"column:price" json:"price" form:"price"`
1742 1744
 }
1743 1745
 
1744 1746
 func (WarehouseOutInfoTenty) TableName() string {

+ 4 - 3
service/doctor_advice_service.go 查看文件

@@ -237,11 +237,11 @@ func CreateSubTemplate(template []*models.DoctorAdviceTemplate) (err error) {
237 237
 		utx := writeDb.Begin()
238 238
 		if len(template) > 0 {
239 239
 			thisSQL := "INSERT INTO xt_doctor_advice_template (org_id, advice_name, advice_desc, single_dose, single_dose_unit,prescribing_number," +
240
-				"prescribing_number_unit,delivery_way,execution_frequency,advice_doctor,status,created_time,updated_time,template_id,drug_spec,drug_spec_unit,advice_type,day_count,week_days,frequency_type,drug_id,way) VALUES "
240
+				"prescribing_number_unit,delivery_way,execution_frequency,advice_doctor,status,created_time,updated_time,template_id,drug_spec,drug_spec_unit,advice_type,day_count,week_days,frequency_type,drug_id,way,remark) VALUES "
241 241
 			insertParams := make([]string, 0)
242 242
 			insertData := make([]interface{}, 0)
243 243
 			for _, info := range template {
244
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
244
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
245 245
 				insertData = append(insertData, info.OrgId)
246 246
 				insertData = append(insertData, info.AdviceName)
247 247
 				insertData = append(insertData, info.AdviceDesc)
@@ -264,6 +264,7 @@ func CreateSubTemplate(template []*models.DoctorAdviceTemplate) (err error) {
264 264
 				insertData = append(insertData, info.FrequencyType)
265 265
 				insertData = append(insertData, info.DrugId)
266 266
 				insertData = append(insertData, info.Way)
267
+				insertData = append(insertData, info.Remark)
267 268
 			}
268 269
 			thisSQL += strings.Join(insertParams, ", ")
269 270
 			err = utx.Exec(thisSQL, insertData...).Error
@@ -373,7 +374,7 @@ func ModifyHisTemplateName(id int64, template_name string) (err error) {
373 374
 
374 375
 func FindOtherAllAdviceTemplate(org_id int64) (temps []*models.DoctorAdviceParentTemplate, err error) {
375 376
 	err = readDb.Model(&models.DoctorAdviceParentTemplate{}).Preload("DoctorAdviceTemplate", func(db *gorm.DB) *gorm.DB {
376
-		return db.Select("id,advice_name,advice_desc,single_dose,single_dose_unit,prescribing_number,prescribing_number_unit,delivery_way,execution_frequency,status,created_time,updated_time,parent_id,template_id,drug_spec,drug_spec_unit,advice_type,day_count,week_days,frequency_type,drug_id,way, IF(parent_id>0, parent_id, id) as advice_order").Where("status = 1").Order("advice_order desc, id")
377
+		return db.Select("id,advice_name,advice_desc,single_dose,single_dose_unit,prescribing_number,prescribing_number_unit,delivery_way,execution_frequency,status,created_time,updated_time,parent_id,template_id,drug_spec,drug_spec_unit,advice_type,day_count,week_days,frequency_type,drug_id,way,remark, IF(parent_id>0, parent_id, id) as advice_order").Where("status = 1").Order("advice_order desc, id")
377 378
 	}).Where("org_id = ? AND status=1 ", org_id).Find(&temps).Error
378 379
 	return
379 380
 	//.Scan(&advices).Error

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

@@ -175,3 +175,10 @@ func GetPatientByIDThree(orgID int64, patientID int64) (*models.Patients, error)
175 175
 	}
176 176
 	return &patient, nil
177 177
 }
178
+
179
+func GetLongDoctorAdvice(org_id int64, patient_id int64, start_time int64, end_time int64) (advice []*models.DoctorAdvice, err error) {
180
+
181
+	err = XTReadDB().Where("user_org_id = ? and status=1 and patient_id = ? and created_time >=? and created_time<=? and advice_type=1", org_id, patient_id, 1514736000, end_time).Find(&advice).Error
182
+
183
+	return advice, err
184
+}

+ 164 - 0
service/patient_service.go 查看文件

@@ -4537,3 +4537,167 @@ func DeleteCouseTemplate(id int64) error {
4537 4537
 
4538 4538
 	return err
4539 4539
 }
4540
+
4541
+func GetAutoDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (prescription []*models.XtAutoDialysisPrescription, err error) {
4542
+
4543
+	db := XTReadDB().Model(&prescription).Where("status=1")
4544
+
4545
+	if patient_id > 0 {
4546
+		db = db.Where("patient_id = ?", patient_id)
4547
+	}
4548
+
4549
+	if start_time > 0 {
4550
+		db = db.Where("record_date>=?", start_time)
4551
+	}
4552
+
4553
+	if end_time > 0 {
4554
+		db = db.Where("record_date<=?", end_time)
4555
+	}
4556
+	if org_id > 0 {
4557
+		db = db.Where("user_org_id = ?", org_id)
4558
+	}
4559
+	err = db.Find(&prescription).Error
4560
+	return prescription, err
4561
+}
4562
+
4563
+func GetAutoMaxDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.DialysisPrescription, error) {
4564
+
4565
+	prescription := models.DialysisPrescription{}
4566
+	err := XTReadDB().Raw("select MAX(anticoagulant_zongliang) from xt_dialysis_prescripiton where patient_id = ? and record_date>=? and record_date<=? and org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
4567
+	return prescription, err
4568
+}
4569
+
4570
+func GetAutoMinDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.DialysisPrescription, error) {
4571
+	prescription := models.DialysisPrescription{}
4572
+	err := XTReadDB().Raw("select Min(anticoagulant_zongliang) from xt_dialysis_prescripiton where patient_id = ? and record_date>=? and record_date<=? and org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
4573
+	return prescription, err
4574
+}
4575
+
4576
+func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.XtAssessmentBeforeDislysis, err error) {
4577
+
4578
+	db := XTReadDB().Model(&berfor).Where("status=1")
4579
+
4580
+	if patient_id > 0 {
4581
+		db = db.Where("patient_id = ?", patient_id)
4582
+	}
4583
+
4584
+	if start_time > 0 {
4585
+		db = db.Where("assessment_date>=?", start_time)
4586
+	}
4587
+
4588
+	if end_time > 0 {
4589
+		db = db.Where("assessment_date<=?", end_time)
4590
+	}
4591
+	if org_id > 0 {
4592
+		db = db.Where("user_org_id = ?", org_id)
4593
+	}
4594
+	err = db.Find(&berfor).Error
4595
+	return berfor, err
4596
+}
4597
+
4598
+func GetAutoMonitorList(patient_id int64, start_time int64, end_time int64, org_id int64) (monitor []*models.XTMonitoringRecord, err error) {
4599
+
4600
+	db := XTReadDB().Model(&monitor).Where("status=1")
4601
+
4602
+	if patient_id > 0 {
4603
+		db = db.Where("patient_id = ?", patient_id)
4604
+	}
4605
+
4606
+	if start_time > 0 {
4607
+		db = db.Where("monitoring_date>=?", start_time)
4608
+	}
4609
+
4610
+	if end_time > 0 {
4611
+		db = db.Where("monitoring_date<=?", end_time)
4612
+	}
4613
+	if org_id > 0 {
4614
+		db = db.Where("user_org_id = ?", org_id)
4615
+	}
4616
+	err = db.Find(&monitor).Error
4617
+	return monitor, err
4618
+}
4619
+
4620
+func GetAutoPatientDryWeight(patient_id int64, start_time int64, end_time int64, org_id int64) (dryweight []*models.SgjPatientDryweight, err error) {
4621
+
4622
+	db := XTReadDB().Model(&dryweight).Where("status=1")
4623
+
4624
+	if patient_id > 0 {
4625
+		db = db.Where("patient_id = ?", patient_id)
4626
+	}
4627
+
4628
+	if org_id > 0 {
4629
+		db = db.Where("user_org_id = ?", org_id)
4630
+	}
4631
+	err = db.Order("id asc").Find(&dryweight).Error
4632
+	return dryweight, err
4633
+}
4634
+
4635
+func GetAutoInspectionList(patient_id int64, start_time int64, end_time int64, org_id int64) (inpection []*models.XtInspection, err error) {
4636
+
4637
+	db := XTReadDB().Model(&inpection).Where("status=1")
4638
+
4639
+	if patient_id > 0 {
4640
+		db = db.Where("patient_id = ?", patient_id)
4641
+	}
4642
+
4643
+	if start_time > 0 {
4644
+		db = db.Where("inspect_date>=?", start_time)
4645
+	}
4646
+
4647
+	if end_time > 0 {
4648
+		db = db.Where("inspect_date<=?", end_time)
4649
+	}
4650
+	if org_id > 0 {
4651
+		db = db.Where("org_id = ?", org_id)
4652
+	}
4653
+	err = db.Find(&inpection).Error
4654
+	return inpection, err
4655
+}
4656
+
4657
+func GetPatientDialysisOrder(org_id int64) (order []*models.XtDialysisOrder, err error) {
4658
+
4659
+	err = XTReadDB().Where("user_org_id = ? and status=1 and dialysis_date<1733155200", org_id).Find(&order).Error
4660
+
4661
+	return order, err
4662
+}
4663
+
4664
+func UpdateAssesmentAfeter(patient_id int64, dialysis_date int64, end_time int64) (models.XtAssessmentAfterDislysis, error) {
4665
+
4666
+	dialysisOrder := models.XtAssessmentAfterDislysis{}
4667
+
4668
+	err := XTWriteDB().Model(&dialysisOrder).Where("patient_id = ? and assessment_date =? and status=1", patient_id, dialysis_date).Updates(map[string]interface{}{"record_time": end_time}).Error
4669
+
4670
+	return dialysisOrder, err
4671
+}
4672
+
4673
+func GetPatientRescueRecord(id int64) (models.XtPatientRescueRecord, error) {
4674
+
4675
+	rescueRecords := models.XtPatientRescueRecord{}
4676
+
4677
+	err := XTReadDB().Where("id = ? and status=1", id).Find(&rescueRecords).Error
4678
+
4679
+	return rescueRecords, err
4680
+}
4681
+
4682
+func ModifyCoursePrint(id int64, content string) (models.XtPatientRescueRecord, error) {
4683
+
4684
+	rescueRecord := models.XtPatientRescueRecord{}
4685
+
4686
+	err := XTWriteDB().Model(&rescueRecord).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
4687
+
4688
+	return rescueRecord, err
4689
+}
4690
+
4691
+func GetPatientRescureRecordList(id int64) (rescueRecord []*models.XtPatientRescueRecord, err error) {
4692
+
4693
+	err = XTWriteDB().Model(&rescueRecord).Where("id = ? and status=1", id).Find(&rescueRecord).Error
4694
+
4695
+	return rescueRecord, err
4696
+}
4697
+
4698
+func GetAutoDialysisOrder(patient_id int64, start_time int64, end_time int64, user_org_id int64) (order []*models.XtDialysisOrder, err error) {
4699
+
4700
+	err = XTReadDB().Where("patient_id = ? and dialysis_date>=? and dialysis_date<=? and user_org_id = ? and status=1", patient_id, start_time, end_time, user_org_id).Find(&order).Error
4701
+
4702
+	return order, err
4703
+}

+ 21 - 10
service/pharmacy_service.go 查看文件

@@ -614,27 +614,25 @@ func GetManyDrugs(orgid int64, keyword string) (map[int64]models.PharmacyBaseDru
614 614
 // 查询(
615 615
 func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (finlly []*models.ListOfDrugs, err error) {
616 616
 	InitDrugidIsNil(orgid, stime, etime)
617
-
618
-	fmt.Println("startime==========================", stime)
619 617
 	var tmp []*models.TmpLLL
620 618
 	if is_medicine == 0 {
621 619
 		if keyword != "" {
622 620
 			keyword = "%" + keyword + "%"
623 621
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
624
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
622
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
625 623
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
626 624
 				"union "+
627 625
 				"select distinct drug_id from xt_doctor_advice where "+
628
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
626
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
629 627
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
630 628
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
631 629
 		} else {
632 630
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
633
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
631
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
634 632
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) "+
635 633
 				"union "+
636 634
 				"select distinct drug_id from xt_doctor_advice where "+
637
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
635
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
638 636
 				"drug_id in (select id from xt_base_drug where org_id = ? and is_pharmacy = 1) ",
639 637
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
640 638
 		}
@@ -645,20 +643,20 @@ func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (f
645 643
 		if keyword != "" {
646 644
 			keyword = "%" + keyword + "%"
647 645
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
648
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
646
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
649 647
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1) "+
650 648
 				"union "+
651 649
 				"select distinct drug_id from xt_doctor_advice where "+
652
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
650
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
653 651
 				"drug_id in (select id from xt_base_drug where org_id = ? and drug_name like ? and is_pharmacy = 1)",
654 652
 				stime, etime, orgid, is_medicine, orgid, keyword, stime, etime, orgid, is_medicine, orgid, keyword).Scan(&tmp).Error
655 653
 		} else {
656 654
 			err = XTReadDB().Raw("select distinct drug_id from his_doctor_advice_info where "+
657
-				"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
655
+				"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
658 656
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) "+
659 657
 				"union "+
660 658
 				"select distinct drug_id from xt_doctor_advice where "+
661
-				"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and is_medicine = ? and "+
659
+				"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and is_medicine = ? and "+
662 660
 				"drug_id in (select id from xt_base_drug where org_id = ? and status = 1) ",
663 661
 				stime, etime, orgid, is_medicine, orgid, stime, etime, orgid, is_medicine, orgid).Scan(&tmp).Error
664 662
 		}
@@ -1065,6 +1063,19 @@ func UpdateIsAdvice(id int64) (err error) {
1065 1063
 	return err
1066 1064
 }
1067 1065
 
1066
+func GetHisPrescriptionByStartTime(org_id int64, patient_id int64, start_time int64, end_time int64) (prescription []*models.HisPrescription, err error) {
1067
+
1068
+	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and record_date>=? and record_date<=? and status=1 and is_medicine =1", org_id, patient_id, start_time, end_time).Find(&prescription).Error
1069
+	return prescription, err
1070
+}
1071
+
1072
+func ModiftyPrescpiton(id int64) (models.HisPrescription, error) {
1073
+
1074
+	prescription := models.HisPrescription{}
1075
+	err := XTWriteDB().Model(&prescription).Where("id = ? and status=1", id).Updates(map[string]interface{}{"is_medicine": 0}).Error
1076
+	return prescription, err
1077
+}
1078
+
1068 1079
 // 患者退药按钮点击
1069 1080
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
1070 1081
 	//开事务

+ 15 - 0
service/stock_service.go 查看文件

@@ -1604,6 +1604,14 @@ func UpdateSingleWarehoseOut(id int64, storehouse_id int64) error {
1604 1604
 	return err
1605 1605
 }
1606 1606
 
1607
+func GetDrugWarehouseOutIsExit(org_id int64, is_sys int, record_time int64, warehousing_out_order string) (models.DrugWarehouseOut, error) {
1608
+
1609
+	drugWarehouseOut := models.DrugWarehouseOut{}
1610
+	err := XTReadDB().Where("is_sys = ? AND status = 1 AND org_id = ? AND warehouse_out_time = ? and warehouse_out_order_number = ?", is_sys, org_id, record_time, warehousing_out_order).Find(&drugWarehouseOut).Error
1611
+
1612
+	return drugWarehouseOut, err
1613
+}
1614
+
1607 1615
 func AddSigleDrugWarehouseOut(warehouseOut *models.DrugWarehouseOut) error {
1608 1616
 	err := writeDb.Create(&warehouseOut).Error
1609 1617
 	return err
@@ -3526,6 +3534,13 @@ func GetGoodsIsExsit(good_id int64, sys_record_time int64, org_id int64, warehou
3526 3534
 	return outInfo, err
3527 3535
 }
3528 3536
 
3537
+func GetDrugsIsExsit(drug_id int64, sys_record_time int64, org_id int64, warehouse_out_id int64) (models.XtDrugWarehouseOutInfo, error) {
3538
+
3539
+	outInfo := models.XtDrugWarehouseOutInfo{}
3540
+	err := XTReadDB().Where("drug_id = ? and sys_record_time = ? and org_id = ? and is_sys =0 and status = 1 and warehouse_out_id = ?", drug_id, sys_record_time, org_id, warehouse_out_id).Find(&outInfo).Error
3541
+	return outInfo, err
3542
+}
3543
+
3529 3544
 func AddSigleWarehouseOutInfo(info *models.WarehouseOutInfo) error {
3530 3545
 
3531 3546
 	err := writeDb.Create(&info).Error