Browse Source

2024/6/17

28169 2 weeks ago
parent
commit
88dfb56f09

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

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

+ 5 - 5
controllers/dialysis_api_controller.go View File

2331
 	patient, _ := c.GetInt64("patient", 0)
2331
 	patient, _ := c.GetInt64("patient", 0)
2332
 	recordDateStr := c.GetString("record_date")
2332
 	recordDateStr := c.GetString("record_date")
2333
 	record_time := c.GetString("record_time")
2333
 	record_time := c.GetString("record_time")
2334
-	fmt.Println(recordDateStr)
2334
+
2335
 	if patient <= 0 {
2335
 	if patient <= 0 {
2336
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2336
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2337
 		return
2337
 		return
2355
 
2355
 
2356
 	startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_time)
2356
 	startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_time)
2357
 
2357
 
2358
-	fmt.Println("startDate0000000000000000000000000000", startDate.Unix())
2359
-
2360
 	// data := make(map[string]interface{}, 0)
2358
 	// data := make(map[string]interface{}, 0)
2361
 	var data models.AssessmentAfterDislysis
2359
 	var data models.AssessmentAfterDislysis
2362
 	var err error
2360
 	var err error
5884
 			}
5882
 			}
5885
 
5883
 
5886
 			if adminInfo.CurrentOrgId == 10735 {
5884
 			if adminInfo.CurrentOrgId == 10735 {
5887
-				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5888
-				record.UltrafiltrationVolume = ultrafiltration_volume / 2
5885
+
5886
+				ultrafiltration_volume := math.Floor(float64(record.OperateTime+1800-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5887
+				record.UltrafiltrationVolume = ultrafiltration_volume
5888
+
5889
 			}
5889
 			}
5890
 
5890
 
5891
 		}
5891
 		}

+ 1 - 1
controllers/dialysis_record_api_controller.go View File

1842
 		service.CreateDialysisFinish(finishS)
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
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1847
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1848
 		if evaluation.SystolicBloodPressure == 0 {
1848
 		if evaluation.SystolicBloodPressure == 0 {

+ 13 - 3
controllers/drug_stock_api_contorller.go View File

1180
 	}
1180
 	}
1181
 
1181
 
1182
 	if warehouse_out_id == 0 {
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
 	if warehouse_out_id > 0 {
1190
 	if warehouse_out_id > 0 {
1186
 		service.UpdateSingleDrugWarehouseOut(warehouse_out_id, storehouse_id)
1191
 		service.UpdateSingleDrugWarehouseOut(warehouse_out_id, storehouse_id)
1329
 	//调用出库逻辑
1334
 	//调用出库逻辑
1330
 	for _, item := range warehousingOutInfo {
1335
 	for _, item := range warehousingOutInfo {
1331
 		if item.ID == 0 {
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
 		if item.ID > 0 {
1345
 		if item.ID > 0 {
1336
 			service.UpdatedDrugWarehouseInfo(item, item.ID)
1346
 			service.UpdatedDrugWarehouseInfo(item, item.ID)

+ 1 - 1
controllers/his_api_controller.go View File

3390
 	var adviceList []models.HisDoctorAdviceInfo
3390
 	var adviceList []models.HisDoctorAdviceInfo
3391
 	var projectList []models.HisPrescriptionProject
3391
 	var projectList []models.HisPrescriptionProject
3392
 
3392
 
3393
-	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 {
3393
+	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 {
3394
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3394
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3395
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3395
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3396
 
3396
 

+ 1 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go View File

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
 			dewater_amount = (evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight) * 1000
990
 			dewater_amount = (evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight) * 1000
991
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
991
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)

+ 31 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go View File

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
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3051
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3052
 
3052
 
3053
 		if adminUserInfo.Org.Id != 10702 {
3053
 		if adminUserInfo.Org.Id != 10702 {
3189
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
3189
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
3190
 		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
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
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10598 {
3199
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10598 {
3194
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3200
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
4188
 			record.BloodFlowVolume = prescription.BloodFlowVolume
4194
 			record.BloodFlowVolume = prescription.BloodFlowVolume
4189
 		}
4195
 		}
4190
 
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
+
4191
 		if adminUserInfo.Org.Id != 10683 {
4207
 		if adminUserInfo.Org.Id != 10683 {
4192
 			err = service.CreateMonitor(&record)
4208
 			err = service.CreateMonitor(&record)
4193
 		}
4209
 		}
5269
 
5285
 
5270
 			if adminInfo.Org.Id == 10206 {
5286
 			if adminInfo.Org.Id == 10206 {
5271
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
5287
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
5272
-				fmt.Println("ultrafiltration_rate------------------", ultrafiltration_rate)
5288
+
5273
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5289
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5274
 			}
5290
 			}
5275
 			//if template.TemplateId == 47 {
5291
 			//if template.TemplateId == 47 {
5298
 			}
5314
 			}
5299
 			//胶州少海医院
5315
 			//胶州少海医院
5300
 			if adminInfo.Org.Id == 10735 {
5316
 			if adminInfo.Org.Id == 10735 {
5301
-				ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5302
-				record.UltrafiltrationVolume = ultrafiltration_volume / 2
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
+
5303
 			}
5330
 			}
5304
 
5331
 
5305
 		}
5332
 		}

+ 11 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

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
 	err = service.UpadatePredialysisEvaluation(&evaluation)
4315
 	err = service.UpadatePredialysisEvaluation(&evaluation)
4305
 
4316
 
4306
 	//记录日志
4317
 	//记录日志

+ 15 - 9
controllers/patient_api_controller.go View File

4530
 		}
4530
 		}
4531
 	}
4531
 	}
4532
 
4532
 
4533
-	err := service.DeleteGroupAdviceOne(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
4533
+	err := service.DeleteGroupAdvice(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
4534
 
4534
 
4535
 	byterequest, _ := json.Marshal(advice)
4535
 	byterequest, _ := json.Marshal(advice)
4536
 	doctorAdviceLog := models.XtDoctorAdviceLog{
4536
 	doctorAdviceLog := models.XtDoctorAdviceLog{
8568
 	//获取透析处方
8568
 	//获取透析处方
8569
 	prescription, _ := service.GetAutoDialysisPrescription(patient_id, startTime, endTime, orgId)
8569
 	prescription, _ := service.GetAutoDialysisPrescription(patient_id, startTime, endTime, orgId)
8570
 
8570
 
8571
+	maxPrescription, _ := service.GetAutoMaxDialysisPrescription(patient_id, startTime, endTime, orgId)
8572
+
8573
+	minPrescription, _ := service.GetAutoMinDialysisPrescription(patient_id, startTime, endTime, orgId)
8574
+
8571
 	berfor, _ := service.GetAutoAssessmentBefor(patient_id, startTime, endTime, orgId)
8575
 	berfor, _ := service.GetAutoAssessmentBefor(patient_id, startTime, endTime, orgId)
8572
 
8576
 
8573
 	monitorList, _ := service.GetAutoMonitorList(patient_id, startTime, endTime, orgId)
8577
 	monitorList, _ := service.GetAutoMonitorList(patient_id, startTime, endTime, orgId)
8583
 	longAdvice, _ := service.GetLongDoctorAdvice(orgId, patient_id, startTime, endTime)
8587
 	longAdvice, _ := service.GetLongDoctorAdvice(orgId, patient_id, startTime, endTime)
8584
 
8588
 
8585
 	this.ServeSuccessJSON(map[string]interface{}{
8589
 	this.ServeSuccessJSON(map[string]interface{}{
8586
-		"prescription":  prescription,
8587
-		"berfor":        berfor,
8588
-		"monitorList":   monitorList,
8589
-		"dryweightList": dryweightList,
8590
-		"inpectionList": inpectionList,
8591
-		"dialysisOrder": dialysisOrder,
8592
-		"patient":       patient,
8593
-		"longAdvice":    longAdvice,
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,
8594
 	})
8600
 	})
8595
 
8601
 
8596
 }
8602
 }

+ 0 - 5
controllers/self_drug_api_congtroller.go View File

3880
 	}
3880
 	}
3881
 	var ids []int64
3881
 	var ids []int64
3882
 	var goodIds []int64
3882
 	var goodIds []int64
3883
-	//infoList, _ := service.GetGoodWarehouseInfoByOrgIdTwo(orgId)
3884
-	//for _, it := range infoList {
3885
-	//	goodIds = append(goodIds, it.GoodId)
3886
-	//}
3887
 
3883
 
3888
 	if len(keyword) > 0 {
3884
 	if len(keyword) > 0 {
3889
 		manufacturers, _ := service.GetManufacturerListByKeyword(orgId, keyword)
3885
 		manufacturers, _ := service.GetManufacturerListByKeyword(orgId, keyword)
4034
 			//期间减少
4030
 			//期间减少
4035
 			banceOutList, _ := service.GetInitOutBanceList(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
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
 			for _, it := range banceOutList {
4033
 			for _, it := range banceOutList {
4039
 				item.WarehouseOutInfoTenty = append(item.WarehouseOutInfoTenty, it)
4034
 				item.WarehouseOutInfoTenty = append(item.WarehouseOutInfoTenty, it)
4040
 			}
4035
 			}

+ 0 - 1
models/new_stock_models.go View File

242
 	Price               float64            `gorm:"column:price" json:"price" form:"price"`
242
 	Price               float64            `gorm:"column:price" json:"price" form:"price"`
243
 	WarehousingDetailId int64              `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
243
 	WarehousingDetailId int64              `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
244
 	BuyPrice            float64            `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
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
 	OverCount           int64              `gorm:"column:over_count" json:"over_count" form:"over_count"`
245
 	OverCount           int64              `gorm:"column:over_count" json:"over_count" form:"over_count"`
247
 	Ctime               int64              `gorm:"column:ctime" json:"ctime" form:"ctime"`
246
 	Ctime               int64              `gorm:"column:ctime" json:"ctime" form:"ctime"`
248
 	StorehouseId        int64              `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
247
 	StorehouseId        int64              `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`

+ 17 - 15
models/stock_models.go View File

115
 }
115
 }
116
 
116
 
117
 type StWarehousingInfoOne struct {
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
 func (StWarehousingInfoOne) TableName() string {
128
 func (StWarehousingInfoOne) TableName() string {
1731
 }
1732
 }
1732
 
1733
 
1733
 type WarehouseOutInfoTenty struct {
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
 func (WarehouseOutInfoTenty) TableName() string {
1746
 func (WarehouseOutInfoTenty) TableName() string {

+ 13 - 0
service/patient_service.go View File

4560
 	return prescription, err
4560
 	return prescription, err
4561
 }
4561
 }
4562
 
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
+
4563
 func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.XtAssessmentBeforeDislysis, err error) {
4576
 func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.XtAssessmentBeforeDislysis, err error) {
4564
 
4577
 
4565
 	db := XTReadDB().Model(&berfor).Where("status=1")
4578
 	db := XTReadDB().Model(&berfor).Where("status=1")

+ 15 - 0
service/stock_service.go View File

1604
 	return err
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
 func AddSigleDrugWarehouseOut(warehouseOut *models.DrugWarehouseOut) error {
1615
 func AddSigleDrugWarehouseOut(warehouseOut *models.DrugWarehouseOut) error {
1608
 	err := writeDb.Create(&warehouseOut).Error
1616
 	err := writeDb.Create(&warehouseOut).Error
1609
 	return err
1617
 	return err
3526
 	return outInfo, err
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
 func AddSigleWarehouseOutInfo(info *models.WarehouseOutInfo) error {
3544
 func AddSigleWarehouseOutInfo(info *models.WarehouseOutInfo) error {
3530
 
3545
 
3531
 	err := writeDb.Create(&info).Error
3546
 	err := writeDb.Create(&info).Error