28169 vor 1 Jahr
Ursprung
Commit
dd642c58a5
33 geänderte Dateien mit 478 neuen und 99 gelöschten Zeilen
  1. 10 10
      controllers/base_api_controller.go
  2. 16 8
      controllers/dialysis_api_controller.go
  3. 1 0
      controllers/dialysis_record_api_controller.go
  4. 1 0
      controllers/doctors_api_controller.go
  5. 7 0
      controllers/drug_stock_api_contorller.go
  6. 2 0
      controllers/mobile_api_controllers/check_weight_api_controller.go
  7. 5 0
      controllers/mobile_api_controllers/dialysis_api_controller.go
  8. 26 4
      controllers/mobile_api_controllers/patient_api_controller.go
  9. 2 5
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  10. 8 0
      controllers/new_mobile_api_controllers/staff_schedule_api_controller.go
  11. 1 1
      controllers/patient_api_controller.go
  12. 70 50
      controllers/pharmacy_controller.go
  13. 18 9
      controllers/print_data_api_controller.go
  14. 8 0
      controllers/schedule_api_controller.go
  15. 24 4
      controllers/sign_api_controller.go
  16. 13 1
      controllers/stock_in_api_controller.go
  17. 13 0
      models/dialysis.go
  18. 5 0
      models/drug.go
  19. 1 0
      models/new_monitor.go
  20. 13 0
      models/patient_models.go
  21. 3 0
      models/user_models.go
  22. 6 0
      service/dialysis_solution_service.go
  23. 1 1
      service/gobal_config_service.go
  24. 5 0
      service/manage_service.go
  25. 4 2
      service/mobile_dialysis_service.go
  26. 20 0
      service/patient_service.go
  27. 1 1
      service/patientmanage_service.go
  28. 138 0
      service/pharmacy_service.go
  29. 2 2
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go
  30. 12 0
      service/schedule_service.go
  31. 39 1
      service/sign_service.go
  32. 1 0
      service/stock_service.go
  33. 2 0
      service/warhouse_service.go

+ 10 - 10
controllers/base_api_controller.go Datei anzeigen

71
 	this.BaseAPIController.Prepare()
71
 	this.BaseAPIController.Prepare()
72
 	if this.GetAdminUserInfo() == nil {
72
 	if this.GetAdminUserInfo() == nil {
73
 		var userAdmin models.AdminUser
73
 		var userAdmin models.AdminUser
74
-		userAdmin.Id = 796
74
+		userAdmin.Id = 16919
75
 		userAdmin.Mobile = "15717313968"
75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 796 //4,809
76
+		userAdmin.Id = 16919 //4,809
77
 		userAdmin.Mobile = "12222222222"
77
 		userAdmin.Mobile = "12222222222"
78
 		userAdmin.IsSuperAdmin = true
78
 		userAdmin.IsSuperAdmin = true
79
 		userAdmin.Status = 1
79
 		userAdmin.Status = 1
81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10344 //机构id 10344
84
+		subscibe.OrgId = 10579 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
95
-		adminUserInfo.CurrentAppId = 3244  //4
94
+		adminUserInfo.CurrentOrgId = 10579 //机构id小英9675或4
95
+		adminUserInfo.CurrentAppId = 16919 //4
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
98
 		this.SetSession("admin_user_info", &adminUserInfo)
98
 		this.SetSession("admin_user_info", &adminUserInfo)
316
 	this.BaseAPIController.Prepare()
316
 	this.BaseAPIController.Prepare()
317
 	if this.GetAdminUserInfo() == nil {
317
 	if this.GetAdminUserInfo() == nil {
318
 		var userAdmin models.AdminUser
318
 		var userAdmin models.AdminUser
319
-		userAdmin.Id = 796
319
+		userAdmin.Id = 16919
320
 		userAdmin.Mobile = "15717313968"
320
 		userAdmin.Mobile = "15717313968"
321
-		userAdmin.Id = 796 //4,809
321
+		userAdmin.Id = 16919 //4,809
322
 		userAdmin.Mobile = "12222222222"
322
 		userAdmin.Mobile = "12222222222"
323
 		userAdmin.IsSuperAdmin = false
323
 		userAdmin.IsSuperAdmin = false
324
 		userAdmin.Status = 1
324
 		userAdmin.Status = 1
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10344 //机构id小英10344或4
329
+		subscibe.OrgId = 10579 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
337
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10344 //机构id小英9675或4
340
-		adminUserInfo.CurrentAppId = 3244  //4
339
+		adminUserInfo.CurrentOrgId = 10579 //机构id小英9675或4
340
+		adminUserInfo.CurrentAppId = 16919 //4
341
 		adminUserInfo.AdminUser = &userAdmin
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
342
 		adminUserInfo.Subscibes = subscibes
343
 		this.SetSession("admin_user_info", &adminUserInfo)
343
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 16 - 8
controllers/dialysis_api_controller.go Datei anzeigen

369
 	washing_time := c.GetString("washing_time")
369
 	washing_time := c.GetString("washing_time")
370
 	warsh_count := c.GetString("warsh_count")
370
 	warsh_count := c.GetString("warsh_count")
371
 	blood_access_part_id := c.GetString("blood_access_part_id")
371
 	blood_access_part_id := c.GetString("blood_access_part_id")
372
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
372
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
373
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
373
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
374
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
374
 
375
 
490
 		WarshCount:                 warsh_count,
491
 		WarshCount:                 warsh_count,
491
 		WashingTime:                washing_time,
492
 		WashingTime:                washing_time,
492
 		BloodAccessPartId:          blood_access_part_id,
493
 		BloodAccessPartId:          blood_access_part_id,
494
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
493
 	}
495
 	}
494
 
496
 
495
 	//长沙南雅医院,自动生成抗凝剂的临时处方
497
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1018
 	warsh_count := c.GetString("warsh_count")
1020
 	warsh_count := c.GetString("warsh_count")
1019
 	washing_time := c.GetString("washing_time")
1021
 	washing_time := c.GetString("washing_time")
1020
 	blood_access_part_id := c.GetString("blood_access_part_id")
1022
 	blood_access_part_id := c.GetString("blood_access_part_id")
1023
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1021
 	var prescription_doctor int64
1024
 	var prescription_doctor int64
1022
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1025
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1023
 
1026
 
1189
 		WarshCount:                 warsh_count,
1192
 		WarshCount:                 warsh_count,
1190
 		WashingTime:                washing_time,
1193
 		WashingTime:                washing_time,
1191
 		BloodAccessPartId:          blood_access_part_id,
1194
 		BloodAccessPartId:          blood_access_part_id,
1195
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1192
 	}
1196
 	}
1193
 
1197
 
1194
 	if prescription.Anticoagulant == 0 {
1198
 	if prescription.Anticoagulant == 0 {
1398
 		WarshCount:                 warsh_count,
1402
 		WarshCount:                 warsh_count,
1399
 		WashingTime:                washing_time,
1403
 		WashingTime:                washing_time,
1400
 		BloodAccessPartId:          blood_access_part_id,
1404
 		BloodAccessPartId:          blood_access_part_id,
1405
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1401
 	}
1406
 	}
1402
 
1407
 
1403
 	if solution.Anticoagulant == 0 {
1408
 	if solution.Anticoagulant == 0 {
4401
 	}
4406
 	}
4402
 	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
4407
 	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 10345 {
4403
 
4408
 
4404
-		if xttime <= 1672416000 {
4409
+		if xttime <= 1703952000 {
4405
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4410
 			dialysis_count, _ := service.GetDialysisOrderCountOne(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4406
 			patientInfo.TotalDialysis = dialysis_count
4411
 			patientInfo.TotalDialysis = dialysis_count
4407
 		}
4412
 		}
4408
 
4413
 
4409
-		if xttime >= 1672502400 {
4414
+		if xttime >= 1704038400 {
4410
 			dialysis_count, _ := service.GetDialysisOrderCountTwo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4415
 			dialysis_count, _ := service.GetDialysisOrderCountTwo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4411
 			patientInfo.TotalDialysis = dialysis_count
4416
 			patientInfo.TotalDialysis = dialysis_count
4412
 		}
4417
 		}
5909
 	//获取长期医嘱
5914
 	//获取长期医嘱
5910
 	adviceList, _ := service.GetAllLongAdviceList(orgId)
5915
 	adviceList, _ := service.GetAllLongAdviceList(orgId)
5911
 
5916
 
5917
+	longHisAdviceList, _ := service.GetHisLongAdviceList(orgId)
5918
+
5912
 	_, config := service.FindXTHisRecordByOrgId(orgId)
5919
 	_, config := service.FindXTHisRecordByOrgId(orgId)
5913
 
5920
 
5914
 	drugList, _ := service.GetAllBaseDrugListTwenty(orgId)
5921
 	drugList, _ := service.GetAllBaseDrugListTwenty(orgId)
5915
 	if err == nil {
5922
 	if err == nil {
5916
 		this.ServeSuccessJSON(map[string]interface{}{
5923
 		this.ServeSuccessJSON(map[string]interface{}{
5917
-			"list":       list,
5918
-			"total":      total,
5919
-			"adviceList": adviceList,
5920
-			"config":     config,
5921
-			"drugList":   drugList,
5922
-			"tablelist":  tablelist,
5924
+			"list":              list,
5925
+			"total":             total,
5926
+			"adviceList":        adviceList,
5927
+			"config":            config,
5928
+			"drugList":          drugList,
5929
+			"tablelist":         tablelist,
5930
+			"longHisAdviceList": longHisAdviceList,
5923
 		})
5931
 		})
5924
 		return
5932
 		return
5925
 
5933
 

+ 1 - 0
controllers/dialysis_record_api_controller.go Datei anzeigen

77
 	redis := service.RedisClient()
77
 	redis := service.RedisClient()
78
 	defer redis.Close()
78
 	defer redis.Close()
79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
80
+
80
 	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81
 	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81
 	scheduals_json_str, _ := redis.Get(key).Result()
82
 	scheduals_json_str, _ := redis.Get(key).Result()
82
 
83
 

+ 1 - 0
controllers/doctors_api_controller.go Datei anzeigen

125
 			})
125
 			})
126
 		}
126
 		}
127
 	}
127
 	}
128
+
128
 	if config.IsOpen == 1 {
129
 	if config.IsOpen == 1 {
129
 		hisAdvices, err := service.GetHisDoctorAdvicesTwentyOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency)
130
 		hisAdvices, err := service.GetHisDoctorAdvicesTwentyOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency)
130
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
131
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)

+ 7 - 0
controllers/drug_stock_api_contorller.go Datei anzeigen

1270
 
1270
 
1271
 				stock_count, _ := items["stock_count"].(string)
1271
 				stock_count, _ := items["stock_count"].(string)
1272
 
1272
 
1273
+				patient_id := int64(items["patient_id"].(float64))
1274
+
1273
 				id := int64(items["id"].(float64))
1275
 				id := int64(items["id"].(float64))
1274
 
1276
 
1275
 				warehouseOutInfo := &models.DrugWarehouseOutInfo{
1277
 				warehouseOutInfo := &models.DrugWarehouseOutInfo{
1302
 					StockCount:              stock_count,
1304
 					StockCount:              stock_count,
1303
 					IsCheck:                 2,
1305
 					IsCheck:                 2,
1304
 					SysRecordTime:           warehousingOutDate.Unix(),
1306
 					SysRecordTime:           warehousingOutDate.Unix(),
1307
+					PatientId:               patient_id,
1305
 				}
1308
 				}
1306
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1309
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1307
 
1310
 
1521
 	houstList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1524
 	houstList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1522
 	appId := c.GetAdminUserInfo().CurrentAppId
1525
 	appId := c.GetAdminUserInfo().CurrentAppId
1523
 	doctorList, _ := service.GetAllDoctorListSix(adminInfo.CurrentOrgId, appId)
1526
 	doctorList, _ := service.GetAllDoctorListSix(adminInfo.CurrentOrgId, appId)
1527
+	patients, _ := service.GetAllpatientTwenty(adminInfo.CurrentOrgId)
1524
 	c.ServeSuccessJSON(map[string]interface{}{
1528
 	c.ServeSuccessJSON(map[string]interface{}{
1525
 		"list":       warehouseOutInfo,
1529
 		"list":       warehouseOutInfo,
1526
 		"info":       warehouseOut,
1530
 		"info":       warehouseOut,
1528
 		"dealerList": dealerList,
1532
 		"dealerList": dealerList,
1529
 		"houstList":  houstList,
1533
 		"houstList":  houstList,
1530
 		"doctorList": doctorList,
1534
 		"doctorList": doctorList,
1535
+		"patients":   patients,
1531
 	})
1536
 	})
1532
 
1537
 
1533
 }
1538
 }
3323
 	configlist, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
3328
 	configlist, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
3324
 	appId := c.GetAdminUserInfo().CurrentAppId
3329
 	appId := c.GetAdminUserInfo().CurrentAppId
3325
 	doctorList, _ := service.GetAllDoctorListSix(adminUserInfo.CurrentOrgId, appId)
3330
 	doctorList, _ := service.GetAllDoctorListSix(adminUserInfo.CurrentOrgId, appId)
3331
+	patients, _ := service.GetAllpatientTwenty(adminUserInfo.CurrentOrgId)
3326
 	c.ServeSuccessJSON(map[string]interface{}{
3332
 	c.ServeSuccessJSON(map[string]interface{}{
3327
 		"manufacturer": manufacturer,
3333
 		"manufacturer": manufacturer,
3328
 		"dealer":       dealer,
3334
 		"dealer":       dealer,
3331
 		"list":         list,
3337
 		"list":         list,
3332
 		"configlist":   configlist,
3338
 		"configlist":   configlist,
3333
 		"doctorList":   doctorList,
3339
 		"doctorList":   doctorList,
3340
+		"patients":     patients,
3334
 	})
3341
 	})
3335
 }
3342
 }
3336
 
3343
 

+ 2 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Datei anzeigen

386
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
386
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
387
 			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
387
 			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
388
 			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
388
 			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
389
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
389
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
390
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
390
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
391
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
391
 
392
 
512
 				newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
513
 				newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
513
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
514
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
514
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
515
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
516
+				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
515
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
517
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
516
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
518
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
517
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
519
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId

+ 5 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Datei anzeigen

1815
 	washing_time := c.GetString("washing_time")
1815
 	washing_time := c.GetString("washing_time")
1816
 	warsh_count := c.GetString("warsh_count")
1816
 	warsh_count := c.GetString("warsh_count")
1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1818
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1818
 
1819
 
1819
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820
 
1821
 
1979
 		WashingTime:                washing_time,
1980
 		WashingTime:                washing_time,
1980
 		WarshCount:                 warsh_count,
1981
 		WarshCount:                 warsh_count,
1981
 		BloodAccessPartId:          blood_access_part_id,
1982
 		BloodAccessPartId:          blood_access_part_id,
1983
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1982
 	}
1984
 	}
1983
 
1985
 
1984
 	//查询最近透析准备表里是否存在 透析器 灌流器
1986
 	//查询最近透析准备表里是否存在 透析器 灌流器
3710
 	washing_time := c.GetString("washing_time")
3712
 	washing_time := c.GetString("washing_time")
3711
 	warsh_count := c.GetString("warsh_count")
3713
 	warsh_count := c.GetString("warsh_count")
3712
 	blood_access_part_id := c.GetString("blood_access_part_id")
3714
 	blood_access_part_id := c.GetString("blood_access_part_id")
3715
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
3713
 	if mode_id > 0 {
3716
 	if mode_id > 0 {
3714
 
3717
 
3715
 		var str string
3718
 		var str string
3871
 		WashingTime:                washing_time,
3874
 		WashingTime:                washing_time,
3872
 		WarshCount:                 warsh_count,
3875
 		WarshCount:                 warsh_count,
3873
 		BloodAccessPartId:          blood_access_part_id,
3876
 		BloodAccessPartId:          blood_access_part_id,
3877
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3874
 	}
3878
 	}
3875
 
3879
 
3876
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3880
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3998
 		WashingTime:                washing_time,
4002
 		WashingTime:                washing_time,
3999
 		WarshCount:                 warsh_count,
4003
 		WarshCount:                 warsh_count,
4000
 		BloodAccessPartId:          blood_access_part_id,
4004
 		BloodAccessPartId:          blood_access_part_id,
4005
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4001
 	}
4006
 	}
4002
 
4007
 
4003
 	//针对河间咸的
4008
 	//针对河间咸的

+ 26 - 4
controllers/mobile_api_controllers/patient_api_controller.go Datei anzeigen

716
 			return
716
 			return
717
 		}
717
 		}
718
 
718
 
719
-		if advice.StartTime > theTime.Unix() {
720
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
721
-			return
719
+		//针对普宁
720
+		if adminUserInfo.Org.Id != 10599 {
721
+			if advice.StartTime > theTime.Unix() {
722
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
723
+				return
724
+			}
722
 		}
725
 		}
723
 
726
 
724
 		advices := models.DoctorAdvice{
727
 		advices := models.DoctorAdvice{
3819
 
3822
 
3820
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3823
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3821
 		is_infect, _ := dataBody["is_infect"].(string)
3824
 		is_infect, _ := dataBody["is_infect"].(string)
3822
-		fmt.Println("is_infect================", is_infect)
3823
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3825
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3824
 		evaluation.IsInfect = infect
3826
 		evaluation.IsInfect = infect
3825
 	}
3827
 	}
4046
 		puncture_needle_direction, _ := dataBody["puncture_needle_direction"].(string)
4048
 		puncture_needle_direction, _ := dataBody["puncture_needle_direction"].(string)
4047
 		evaluation.PunctureNeedleDirection = puncture_needle_direction
4049
 		evaluation.PunctureNeedleDirection = puncture_needle_direction
4048
 	}
4050
 	}
4051
+
4052
+	if dataBody["symptom_before_dialysis_other"] != nil && reflect.TypeOf(dataBody["symptom_before_dialysis_other"]).String() == "string" {
4053
+		symptom_before_dialysis_other, _ := dataBody["symptom_before_dialysis_other"].(string)
4054
+		evaluation.SymptomBeforeDialysisOther = symptom_before_dialysis_other
4055
+	}
4049
 	return
4056
 	return
4050
 }
4057
 }
4051
 
4058
 
4410
 			//获取所有的患者
4417
 			//获取所有的患者
4411
 			patients, _ := service.GetAllPatientListByListOne(orgID)
4418
 			patients, _ := service.GetAllPatientListByListOne(orgID)
4412
 
4419
 
4420
+			for _, it := range patients {
4421
+				if orgID == 10445 {
4422
+					if theStartTime <= 1703952000 {
4423
+						listOne, _ := service.GetDialysisOrderCountTwentyEight(orgID, it.ID, theStartTime)
4424
+						it.TotalDialysis = listOne.Count
4425
+
4426
+					}
4427
+
4428
+					if theStartTime >= 1704038400 {
4429
+						listOrder, _ := service.GetDialysisOrderCountTenEight(it.ID, theStartTime)
4430
+						it.TotalDialysis = listOrder.Count
4431
+					}
4432
+				}
4433
+			}
4434
+
4413
 			//获取所有透析模式
4435
 			//获取所有透析模式
4414
 			treatments, _ := service.GetAllTreatModeByList(orgID)
4436
 			treatments, _ := service.GetAllTreatModeByList(orgID)
4415
 
4437
 

+ 2 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Datei anzeigen

843
 	timeLayout := "2006-01-02"
843
 	timeLayout := "2006-01-02"
844
 	loc, _ := time.LoadLocation("Local")
844
 	loc, _ := time.LoadLocation("Local")
845
 	id, _ := this.GetInt64("id")
845
 	id, _ := this.GetInt64("id")
846
-	fmt.Print("id", id)
847
 	patient, _ := service.GetPatientDetailTwo(id)
846
 	patient, _ := service.GetPatientDetailTwo(id)
848
 	start := this.GetString("startime")
847
 	start := this.GetString("startime")
849
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
848
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
850
 	startime := startTimes.Unix()
849
 	startime := startTimes.Unix()
851
-	fmt.Print("startime", startime)
852
 	end := this.GetString("endtime")
850
 	end := this.GetString("endtime")
853
 	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
851
 	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
854
 	endtime := endTimes.Unix()
852
 	endtime := endTimes.Unix()
855
-	fmt.Print("endtime", endtime)
856
 	limit, _ := this.GetInt64("limit")
853
 	limit, _ := this.GetInt64("limit")
857
-	fmt.Print("limit", limit)
854
+
858
 	page, _ := this.GetInt64("page")
855
 	page, _ := this.GetInt64("page")
859
-	fmt.Print("page", page)
856
+
860
 	adminInfo := this.GetMobileAdminUserInfo()
857
 	adminInfo := this.GetMobileAdminUserInfo()
861
 	orgid := adminInfo.Org.Id
858
 	orgid := adminInfo.Org.Id
862
 	dialysisrecord, total, err := service.GetlongDialysisrecord(patient.BloodId, startime, endtime, limit, page, orgid)
859
 	dialysisrecord, total, err := service.GetlongDialysisrecord(patient.BloodId, startime, endtime, limit, page, orgid)

+ 8 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Datei anzeigen

508
 			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
508
 			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
509
 		}
509
 		}
510
 		service.CreateScheduleLog(xtScheduleLog)
510
 		service.CreateScheduleLog(xtScheduleLog)
511
+
512
+		//针对凤凰医院
513
+		if org_id == 10579 || org_id == 10344 {
514
+			advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, org_id)
515
+			if len(advice) > 0 {
516
+				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
517
+			}
518
+		}
511
 		redis := service.RedisClient()
519
 		redis := service.RedisClient()
512
 		//处方
520
 		//处方
513
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
521
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"

+ 1 - 1
controllers/patient_api_controller.go Datei anzeigen

3686
 		}
3686
 		}
3687
 	}
3687
 	}
3688
 
3688
 
3689
-	err := service.DeleteGroupAdvice(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
3689
+	err := service.DeleteGroupAdviceOne(adminUserInfo.CurrentOrgId, groupNo, adminUserInfo.AdminUser.Id)
3690
 
3690
 
3691
 	byterequest, _ := json.Marshal(advice)
3691
 	byterequest, _ := json.Marshal(advice)
3692
 	doctorAdviceLog := models.XtDoctorAdviceLog{
3692
 	doctorAdviceLog := models.XtDoctorAdviceLog{

+ 70 - 50
controllers/pharmacy_controller.go Datei anzeigen

348
 
348
 
349
 // 发药按钮点击
349
 // 发药按钮点击
350
 func (this *PharmacyController) DispensingMedicine() {
350
 func (this *PharmacyController) DispensingMedicine() {
351
+
351
 	var err error
352
 	var err error
352
 	defer func() {
353
 	defer func() {
353
 		if rec := recover(); rec != nil {
354
 		if rec := recover(); rec != nil {
379
 		for _, item := range advicelist {
380
 		for _, item := range advicelist {
380
 			//查询改药品信息
381
 			//查询改药品信息
381
 			medical, _ := service.GetBaseDrugMedical(item.DrugId)
382
 			medical, _ := service.GetBaseDrugMedical(item.DrugId)
382
-			//针对阜阳经沃
383
-			if orgid != 10480 {
384
-				if medical.IsPharmacy == 1 {
385
-					houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
386
-					//查询该药品是否有库存
387
-					list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
388
-
389
-					//判断单位是否相等
390
-					if medical.MaxUnit == item.PrescribingNumberUnit {
391
-						prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
392
-						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
393
-						//转化为最小单位
394
-						total = list.Count*medical.MinNumber + list.StockMinNumber
395
-						prescribing_number_total = count * medical.MinNumber
396
-					}
397
-					if medical.MinUnit == item.PrescribingNumberUnit {
398
-						prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
399
-						count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
400
-						total = list.Count*medical.MinNumber + list.StockMinNumber
401
-						prescribing_number_total = count
402
-					}
383
+			//如果是药房发药的方式
384
+			if medical.IsPharmacy == 1 {
385
+				houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
386
+				//查询该药品是否有库存
387
+				list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
388
+
389
+				//判断单位是否相等
390
+				if medical.MaxUnit == item.PrescribingNumberUnit {
391
+					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
392
+					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
393
+					//转化为最小单位
394
+					total = list.Count*medical.MinNumber + list.StockMinNumber
395
+					prescribing_number_total = count * medical.MinNumber
396
+				}
397
+				if medical.MinUnit == item.PrescribingNumberUnit {
398
+					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
399
+					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
400
+					total = list.Count*medical.MinNumber + list.StockMinNumber
401
+					prescribing_number_total = count
402
+				}
403
 
403
 
404
-					if medical.IsUse != 1 {
405
-						//如果出库数量大于库存数量
406
-						if prescribing_number_total > total {
407
-							err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
408
-							if err != nil {
409
-								utils.ErrorLog(err.Error())
410
-								this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
411
-								return
412
-							}
404
+				if medical.IsUse != 1 {
405
+					//如果出库数量大于库存数量
406
+					if prescribing_number_total > total {
407
+						err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
408
+						if err != nil {
409
+							utils.ErrorLog(err.Error())
410
+							this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
411
+							return
413
 						}
412
 						}
414
 					}
413
 					}
415
 				}
414
 				}
418
 		}
417
 		}
419
 	}
418
 	}
420
 
419
 
421
-	err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
420
+	if orgid != 10480 {
421
+		//发药
422
+		err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
423
+		if err != nil {
424
+			utils.ErrorLog(err.Error())
425
+			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
426
+			return
427
+		}
422
 
428
 
423
-	if orgid == 10387 || orgid == 3877 {
424
-		advicelist, _ := service.FindeHisAdviceDocAdvice(orgid, patient_id, stime, etime)
425
-		if len(advicelist) > 0 {
426
-			for _, item := range advicelist {
427
-				//查询改药品信息
428
-				medical, _ := service.GetBaseDrugMedical(item.DrugId)
429
-				if medical.IsPharmacy == 1 {
430
-					flow, _ := service.GetFlow(item.DrugId, item.AdviceDate, orgid, item.PatientId)
431
-					if len(flow) > 0 {
432
-						service.UpdateAdviceFlow(item.ID)
429
+		this.ServeSuccessJSON(map[string]interface{}{
430
+			"list": "操作成功",
431
+		})
432
+		return
433
+	}
434
+
435
+	if orgid == 10480 {
436
+		//发药逻辑
437
+
438
+		service.DispensingMedicineOne(orgid, patient_id, stime, etime, creater)
439
+
440
+		//针对桑植盛康
441
+		if orgid == 10387 || orgid == 3877 {
442
+			advicelist, _ := service.FindeHisAdviceDocAdvice(orgid, patient_id, stime, etime)
443
+			if len(advicelist) > 0 {
444
+				for _, item := range advicelist {
445
+					//查询改药品信息
446
+					medical, _ := service.GetBaseDrugMedical(item.DrugId)
447
+					if medical.IsPharmacy == 1 {
448
+						flow, _ := service.GetFlow(item.DrugId, item.AdviceDate, orgid, item.PatientId)
449
+						if len(flow) > 0 {
450
+							service.UpdateAdviceFlow(item.ID)
451
+						}
433
 					}
452
 					}
434
 				}
453
 				}
435
-			}
436
 
454
 
455
+			}
437
 		}
456
 		}
438
-	}
439
-	if err != nil {
440
-		utils.ErrorLog(err.Error())
441
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
457
+		if err != nil {
458
+			utils.ErrorLog(err.Error())
459
+			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
460
+			return
461
+		}
462
+
463
+		this.ServeSuccessJSON(map[string]interface{}{
464
+			"list": "操作成功",
465
+		})
442
 		return
466
 		return
443
 	}
467
 	}
444
 
468
 
445
-	this.ServeSuccessJSON(map[string]interface{}{
446
-		"list": "操作成功",
447
-	})
448
-	return
449
 }
469
 }
450
 
470
 
451
 // 退药按钮点击
471
 // 退药按钮点击

+ 18 - 9
controllers/print_data_api_controller.go Datei anzeigen

38
 	adminUserInfo := this.GetAdminUserInfo()
38
 	adminUserInfo := this.GetAdminUserInfo()
39
 
39
 
40
 	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 || this.GetAdminUserInfo().CurrentOrgId == 10441 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
40
 	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 || this.GetAdminUserInfo().CurrentOrgId == 10441 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
41
-
41
+		fmt.Println("JINALADOOWOWOWOWOWOO")
42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
43
 		for _, item := range schedules {
43
 		for _, item := range schedules {
44
 
44
 
99
 
99
 
100
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
100
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
101
 
101
 
102
-				if item.ScheduleDate <= 1672416000 {
102
+				if item.ScheduleDate <= 1703952000 {
103
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
103
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
104
 
104
 
105
 					item.Patient.TotalDialysis = listOne.Count
105
 					item.Patient.TotalDialysis = listOne.Count
106
 					item.Count = listOne.Count
106
 					item.Count = listOne.Count
107
 				}
107
 				}
108
 
108
 
109
-				if item.ScheduleDate >= 1672502400 {
109
+				if item.ScheduleDate >= 1704038400 {
110
 
110
 
111
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
111
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
112
 
112
 
145
 	}
145
 	}
146
 
146
 
147
 	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 && this.GetAdminUserInfo().CurrentOrgId != 10441 && this.GetAdminUserInfo().CurrentOrgId != 9970 && this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 10495 && this.GetAdminUserInfo().CurrentOrgId != 10013 && this.GetAdminUserInfo().CurrentOrgId != 10014 {
147
 	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 && this.GetAdminUserInfo().CurrentOrgId != 10441 && this.GetAdminUserInfo().CurrentOrgId != 9970 && this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 10495 && this.GetAdminUserInfo().CurrentOrgId != 10013 && this.GetAdminUserInfo().CurrentOrgId != 10014 {
148
+
148
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
149
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
149
 		for _, item := range schedules {
150
 		for _, item := range schedules {
151
+
150
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
152
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
151
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
153
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
152
 				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
154
 				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
153
-					listOrder, _ := service.GetDialysisOrderCountTen(item.PatientID, item.ScheduleDate)
154
-					item.Count = listOrder.DialysisTotal
155
+					if item.ScheduleDate <= 1703952000 {
156
+						listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
157
+
158
+						item.Patient.TotalDialysis = listOne.Count
159
+						item.Count = listOne.Count
160
+					}
161
+
162
+					if item.ScheduleDate >= 1704038400 {
163
+
164
+						listOrder, _ := service.GetDialysisOrderCountTen(item.PatientID, item.ScheduleDate)
165
+						item.Count = listOrder.DialysisTotal
166
+					}
167
+
155
 				}
168
 				}
156
 				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
169
 				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
157
 					item.Count = list.Count
170
 					item.Count = list.Count
162
 
175
 
163
 			item.Schedule = &lastSchedule
176
 			item.Schedule = &lastSchedule
164
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
177
 			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
165
-				//listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
166
-
167
-				//item.Patient.TotalDialysis = listOne.Count
168
-				//item.Count = listOne.Count
169
 
178
 
170
 				if item.ScheduleDate <= 1640966400 {
179
 				if item.ScheduleDate <= 1640966400 {
171
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
180
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)

+ 8 - 0
controllers/schedule_api_controller.go Datei anzeigen

1968
 
1968
 
1969
 	service.CreateScheduleLog(scheduleLog)
1969
 	service.CreateScheduleLog(scheduleLog)
1970
 
1970
 
1971
+	//针对凤凰医院
1972
+	if adminINfo.CurrentOrgId == 10579 || adminINfo.CurrentOrgId == 10344 {
1973
+		advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1974
+		if len(advice) > 0 {
1975
+			service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1976
+		}
1977
+	}
1978
+
1971
 	redis := service.RedisClient()
1979
 	redis := service.RedisClient()
1972
 
1980
 
1973
 	//处方
1981
 	//处方

+ 24 - 4
controllers/sign_api_controller.go Datei anzeigen

665
 
665
 
666
 func (this *SignApiController) UploadPrintOrder() {
666
 func (this *SignApiController) UploadPrintOrder() {
667
 
667
 
668
-	list, _ := service.GetAllPatientNew(10440)
668
+	list, _ := service.GetAllPatientNew(10587)
669
 	for _, item := range list {
669
 	for _, item := range list {
670
 
670
 
671
 		hans := item.Name // 要转换的汉字字符串
671
 		hans := item.Name // 要转换的汉字字符串
1216
 func (this *SignApiController) ToAutoDiagnose() {
1216
 func (this *SignApiController) ToAutoDiagnose() {
1217
 
1217
 
1218
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1218
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1219
+
1220
+	//order, _ := service.GetDialysisOrderTotalCount()
1221
+	//
1222
+	//for _, item := range order {
1223
+	//
1224
+	//	service.ModifyPatient(item.PatientId, item.Count)
1225
+	//}
1226
+
1219
 	list, _ := service.GetNewAllpatient(orgId)
1227
 	list, _ := service.GetNewAllpatient(orgId)
1220
 
1228
 
1221
 	for _, item := range list {
1229
 	for _, item := range list {
1226
 	//for _, item := range list {
1234
 	//for _, item := range list {
1227
 	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
1235
 	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
1228
 	//}
1236
 	//}
1229
-	//this.ServeSuccessJSON(map[string]interface{}{
1230
-	//	"msg": "ok",
1231
-	//})
1237
+
1238
+	//drugList, _ := service.GetAllBaseDrugList(10571)
1239
+	//for _, item := range drugList {
1240
+	//	//service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)
1241
+	//
1242
+	//	service.UpdateHisDoctorAdviceOne(item.ID, item.MinPrice, item.OrgId)
1243
+	//}
1244
+
1245
+	//goodList, _ := service.GetAllGoodList(10571)
1246
+	//for _, item := range goodList {
1247
+	//	service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
1248
+	//}
1249
+	this.ServeSuccessJSON(map[string]interface{}{
1250
+		"msg": "ok",
1251
+	})
1232
 
1252
 
1233
 }
1253
 }
1234
 
1254
 

+ 13 - 1
controllers/stock_in_api_controller.go Datei anzeigen

1329
 				}
1329
 				}
1330
 				license_number := items["license_number"].(string)
1330
 				license_number := items["license_number"].(string)
1331
 
1331
 
1332
+				patient_id := int64(items["patient_id"].(float64))
1333
+
1332
 				warehouseOutInfo := &models.WarehouseOutInfo{
1334
 				warehouseOutInfo := &models.WarehouseOutInfo{
1333
 					ID:                      id,
1335
 					ID:                      id,
1334
 					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1336
 					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1357
 					IsCheck:                 2,
1359
 					IsCheck:                 2,
1358
 					RegisterNumber:          register_number,
1360
 					RegisterNumber:          register_number,
1359
 					SysRecordTime:           warehouseOut.WarehouseOutTime,
1361
 					SysRecordTime:           warehouseOut.WarehouseOutTime,
1362
+					PatientId:               patient_id,
1360
 				}
1363
 				}
1361
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1364
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1362
 
1365
 
1363
 			}
1366
 			}
1364
 		}
1367
 		}
1365
 	}
1368
 	}
1366
-	fmt.Println("warehouseOut_id", warehouseOut_id)
1367
 	if warehouseOut_id == 0 {
1369
 	if warehouseOut_id == 0 {
1368
 		//查询是否生成出库单
1370
 		//查询是否生成出库单
1369
 		_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
1371
 		_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
1407
 			Count:                   it.Count,
1409
 			Count:                   it.Count,
1408
 			IsCheck:                 2,
1410
 			IsCheck:                 2,
1409
 			RegisterNumber:          it.RegisterNumber,
1411
 			RegisterNumber:          it.RegisterNumber,
1412
+			PatientId:               it.PatientId,
1410
 		}
1413
 		}
1411
 		if it.ID == 0 {
1414
 		if it.ID == 0 {
1412
 			service.AddSigleWarehouseOutInfo(warehouseOutInfo)
1415
 			service.AddSigleWarehouseOutInfo(warehouseOutInfo)
1712
 
1715
 
1713
 				register_number := items["register_number"].(string)
1716
 				register_number := items["register_number"].(string)
1714
 
1717
 
1718
+				patient_id := int64(items["patient_id"].(float64))
1719
+
1715
 				var productDate int64
1720
 				var productDate int64
1716
 				if len(product_date) > 0 {
1721
 				if len(product_date) > 0 {
1717
 					theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", product_date+" 00:00:00", loc)
1722
 					theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", product_date+" 00:00:00", loc)
1751
 						AdminUserId:             admin_user_id,
1756
 						AdminUserId:             admin_user_id,
1752
 						StockCount:              stock_count,
1757
 						StockCount:              stock_count,
1753
 						RegisterNumber:          register_number,
1758
 						RegisterNumber:          register_number,
1759
+						PatientId:               patient_id,
1754
 					}
1760
 					}
1755
 					warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1761
 					warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1756
 
1762
 
1798
 						AdminUserId:             admin_user_id,
1804
 						AdminUserId:             admin_user_id,
1799
 						StockCount:              stock_count,
1805
 						StockCount:              stock_count,
1800
 						RegisterNumber:          register_number,
1806
 						RegisterNumber:          register_number,
1807
+						PatientId:               patient_id,
1801
 					}
1808
 					}
1802
 					upDateWarehouseOutInfos = append(upDateWarehouseOutInfos, warehouseOutInfo)
1809
 					upDateWarehouseOutInfos = append(upDateWarehouseOutInfos, warehouseOutInfo)
1803
 				}
1810
 				}
3094
 	configList, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
3101
 	configList, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
3095
 	appId := c.GetAdminUserInfo().CurrentAppId
3102
 	appId := c.GetAdminUserInfo().CurrentAppId
3096
 	doctorList, _ := service.GetAllDoctorListSix(adminUserInfo.CurrentOrgId, appId)
3103
 	doctorList, _ := service.GetAllDoctorListSix(adminUserInfo.CurrentOrgId, appId)
3104
+
3105
+	patients, _ := service.GetAllpatientTwenty(adminUserInfo.CurrentOrgId)
3097
 	c.ServeSuccessJSON(map[string]interface{}{
3106
 	c.ServeSuccessJSON(map[string]interface{}{
3098
 		"manufacturer": manufacturer,
3107
 		"manufacturer": manufacturer,
3099
 		"dealer":       dealer,
3108
 		"dealer":       dealer,
3102
 		"list":         list,
3111
 		"list":         list,
3103
 		"configlist":   configList,
3112
 		"configlist":   configList,
3104
 		"doctorList":   doctorList,
3113
 		"doctorList":   doctorList,
3114
+		"patients":     patients,
3105
 	})
3115
 	})
3106
 }
3116
 }
3107
 func (this *StockManagerApiController) GetAllSalesReturnConfig() {
3117
 func (this *StockManagerApiController) GetAllSalesReturnConfig() {
4989
 	goodType, _ := service.GetAllGoodType(orgId)
4999
 	goodType, _ := service.GetAllGoodType(orgId)
4990
 	appId := this.GetAdminUserInfo().CurrentAppId
5000
 	appId := this.GetAdminUserInfo().CurrentAppId
4991
 	doctorlist, _ := service.GetAllDoctorListSix(orgId, appId)
5001
 	doctorlist, _ := service.GetAllDoctorListSix(orgId, appId)
5002
+	patients, _ := service.GetAllpatientTwenty(orgId)
4992
 	this.ServeSuccessJSON(map[string]interface{}{
5003
 	this.ServeSuccessJSON(map[string]interface{}{
4993
 		"list":             warehouseOutInfo,
5004
 		"list":             warehouseOutInfo,
4994
 		"dealerList":       dealerList,
5005
 		"dealerList":       dealerList,
4997
 		"out":              out,
5008
 		"out":              out,
4998
 		"storelist":        storelist,
5009
 		"storelist":        storelist,
4999
 		"doctorlist":       doctorlist,
5010
 		"doctorlist":       doctorlist,
5011
+		"patients":         patients,
5000
 	})
5012
 	})
5001
 }
5013
 }
5002
 
5014
 

+ 13 - 0
models/dialysis.go Datei anzeigen

1624
 func (NoHisPrescriptionProject) TableName() string {
1624
 func (NoHisPrescriptionProject) TableName() string {
1625
 	return "his_prescription_project"
1625
 	return "his_prescription_project"
1626
 }
1626
 }
1627
+
1628
+type XtDialysisOrderLost struct {
1629
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1630
+	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date" form:"dialysis_date"`
1631
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1632
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1633
+	Count        int64
1634
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1635
+}
1636
+
1637
+func (XtDialysisOrderLost) TableName() string {
1638
+	return "xt_dialysis_order"
1639
+}

+ 5 - 0
models/drug.go Datei anzeigen

115
 	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
115
 	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
116
 	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
116
 	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
117
 	ManufacturerName string `gorm:"column:manufacturer_name" json:"manufacturer_name"`
117
 	ManufacturerName string `gorm:"column:manufacturer_name" json:"manufacturer_name"`
118
+	MaxUnit          string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
119
+	MinNumber        int64  `gorm:"column:min_number" json:"min_number" form:"min_number"`
120
+	MinUnit          string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
121
+	Dose             string `gorm:"column:dose" json:"dose" form:"dose"`
122
+	DoseUnit         string `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
118
 }
123
 }
119
 
124
 
120
 func (BaseDrugLibEleven) TableName() string {
125
 func (BaseDrugLibEleven) TableName() string {

+ 1 - 0
models/new_monitor.go Datei anzeigen

34
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
34
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
35
 	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
35
 	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
36
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
36
 	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
37
+	TotalDialysis      int64  `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
37
 }
38
 }
38
 
39
 
39
 func (VMMonitorPatients) TableName() string {
40
 func (VMMonitorPatients) TableName() string {

+ 13 - 0
models/patient_models.go Datei anzeigen

380
 	WarshCount                 string        `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
380
 	WarshCount                 string        `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
383
+	AnticoagulantWeichiHour    string        `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
383
 }
384
 }
384
 
385
 
385
 func (DialysisPrescription) TableName() string {
386
 func (DialysisPrescription) TableName() string {
618
 	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
619
 	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
619
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
620
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
620
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
621
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
622
+	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
621
 }
623
 }
622
 
624
 
623
 func (DialysisSolution) TableName() string {
625
 func (DialysisSolution) TableName() string {
2361
 func (XtDeviceValusalMapVrr) TableName() string {
2363
 func (XtDeviceValusalMapVrr) TableName() string {
2362
 	return "xt_device_valusal_map_vrr"
2364
 	return "xt_device_valusal_map_vrr"
2363
 }
2365
 }
2366
+
2367
+type PatientsTwenty struct {
2368
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2369
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2370
+	Name      string `gorm:"column:name" json:"name" form:"name"`
2371
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2372
+}
2373
+
2374
+func (PatientsTwenty) TableName() string {
2375
+	return "xt_patients"
2376
+}

+ 3 - 0
models/user_models.go Datei anzeigen

351
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
351
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
352
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
352
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
353
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
353
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
354
+	SolutionStatus             int64   `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
355
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
356
+	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
354
 }
357
 }
355
 
358
 
356
 func (XtDialysisSolution) TableName() string {
359
 func (XtDialysisSolution) TableName() string {

+ 6 - 0
service/dialysis_solution_service.go Datei anzeigen

120
 	return advice, err
120
 	return advice, err
121
 }
121
 }
122
 
122
 
123
+func GetHisLongAdviceList(user_org_id int64) (advice []*models.HisDoctorAdviceTemplate, err error) {
124
+
125
+	err = XTReadDB().Where("org_id = ? and status=1", user_org_id).Find(&advice).Error
126
+	return advice, err
127
+}
128
+
123
 func GetAllHisAdviceTemplateList(user_org_id int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
129
 func GetAllHisAdviceTemplateList(user_org_id int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
124
 
130
 
125
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&advice).Error
131
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&advice).Error

+ 1 - 1
service/gobal_config_service.go Datei anzeigen

635
 	if orgid > 0 {
635
 	if orgid > 0 {
636
 		db = db.Where("x.org_id =?", orgid)
636
 		db = db.Where("x.org_id =?", orgid)
637
 	}
637
 	}
638
-	err = db.Select("x.id,x.drug_name,p.manufacturer_name").Joins("left join xt_manufacturer as p on p.id =x.manufacturer").Scan(&drug).Error
638
+	err = db.Select("x.id,x.drug_name,p.manufacturer_name,x.dose,x.dose_unit,x.min_number,x.max_unit,x.min_unit").Joins("left join xt_manufacturer as p on p.id =x.manufacturer").Scan(&drug).Error
639
 	return drug, err
639
 	return drug, err
640
 }
640
 }
641
 
641
 

+ 5 - 0
service/manage_service.go Datei anzeigen

915
 	return patients, err
915
 	return patients, err
916
 }
916
 }
917
 
917
 
918
+func GetAllpatientTwenty(orgid int64) (patients []*models.PatientsTwenty, err error) {
919
+	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
920
+	return patients, err
921
+}
922
+
918
 func GetAllpatientThirty(orgid int64) (patients []*models.PatientsThirty, err error) {
923
 func GetAllpatientThirty(orgid int64) (patients []*models.PatientsThirty, err error) {
919
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
924
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
920
 	return patients, err
925
 	return patients, err

+ 4 - 2
service/mobile_dialysis_service.go Datei anzeigen

2810
 }
2810
 }
2811
 
2811
 
2812
 func GetDialysisOrderCountTwo(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
2812
 func GetDialysisOrderCountTwo(orgID int64, patient_id int64, recordDate int64) (count int64, err error) {
2813
-	err = readDb.Model(&models.DialysisOrder{}).Where("dialysis_date>=1672502400 and  dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
2813
+	err = readDb.Model(&models.DialysisOrder{}).Where("dialysis_date>=1704038400 and  dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
2814
 	return
2814
 	return
2815
 }
2815
 }
2816
 
2816
 
8113
 	order := models.BloodDialysisOrderCount{}
8113
 	order := models.BloodDialysisOrderCount{}
8114
 	db := XTReadDB().Table("xt_dialysis_order as o")
8114
 	db := XTReadDB().Table("xt_dialysis_order as o")
8115
 
8115
 
8116
-	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and o.patient_id = ? and o.dialysis_date>=1672502400 and  x.schedule_date = o.dialysis_date and x.status = 1 ", org_id, patient_id).Scan(&order).Error
8116
+	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and o.patient_id = ? and o.dialysis_date>=1704038400 and  x.schedule_date = o.dialysis_date and x.status = 1 ", org_id, patient_id).Scan(&order).Error
8117
 
8117
 
8118
 	return order, err
8118
 	return order, err
8119
 }
8119
 }
8168
 			db = db.Where("partition_id = ?", partitionType)
8168
 			db = db.Where("partition_id = ?", partitionType)
8169
 		}
8169
 		}
8170
 		if patient_id > 0 {
8170
 		if patient_id > 0 {
8171
+
8171
 			if execution_state > 0 {
8172
 			if execution_state > 0 {
8172
 				if cost_type > 0 {
8173
 				if cost_type > 0 {
8173
 					if len(execution_frequency) > 0 {
8174
 					if len(execution_frequency) > 0 {
8445
 		}
8446
 		}
8446
 		if patient_id > 0 {
8447
 		if patient_id > 0 {
8447
 			if execution_state > 0 {
8448
 			if execution_state > 0 {
8449
+				fmt.Println("execution_state---------------------", execution_state)
8448
 				if cost_type > 0 {
8450
 				if cost_type > 0 {
8449
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8451
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8450
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
8452
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).

+ 20 - 0
service/patient_service.go Datei anzeigen

1231
 	return
1231
 	return
1232
 }
1232
 }
1233
 
1233
 
1234
+func DeleteGroupAdviceOne(orgId int64, groupNo int64, admin_user_id int64) (err error) {
1235
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? and groupno = ? and status =1 and advice_type=1", orgId, groupNo).Update(map[string]interface{}{"UpdatedTime": time.Now().Unix(), "Status": 0, "Modifier": admin_user_id}).Error
1236
+	if err != nil {
1237
+		return
1238
+	}
1239
+	return
1240
+}
1241
+
1234
 func FindDoctorAdvice(orgID, id int64) (advice models.DoctorAdvice, err error) {
1242
 func FindDoctorAdvice(orgID, id int64) (advice models.DoctorAdvice, err error) {
1235
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? and user_org_id=? and status = 1", id, orgID).First(&advice).Error
1243
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? and user_org_id=? and status = 1", id, orgID).First(&advice).Error
1236
 	return
1244
 	return
3377
 	fmt.Println("err2330230320202023", err)
3385
 	fmt.Println("err2330230320202023", err)
3378
 	return schedule, err
3386
 	return schedule, err
3379
 }
3387
 }
3388
+
3389
+func GetDialysisOrderCountTwentyEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
3390
+	order := models.VmDialysisOrder{}
3391
+	err := XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
3392
+	return order, err
3393
+}
3394
+
3395
+func GetDialysisOrderCountTenEight(patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
3396
+	order := models.VmDialysisOrder{}
3397
+	err := XTReadDB().Where("patient_id = ? and dialysis_date = ? and status = 1", patient_id, recordDate).Last(&order).Error
3398
+	return order, err
3399
+}

+ 1 - 1
service/patientmanage_service.go Datei anzeigen

640
 }
640
 }
641
 
641
 
642
 func GetlongDialysisrecord(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (prescription []*models.XtDialysisSolution, total int64, err error) {
642
 func GetlongDialysisrecord(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (prescription []*models.XtDialysisSolution, total int64, err error) {
643
-	db := XTReadDB().Table("xt_dialysis_solution as x").Where("x.status = 1")
643
+	db := XTReadDB().Table("xt_dialysis_solution as x").Where("x.status = 1 and x.solution_status=1")
644
 	if patientid > 0 {
644
 	if patientid > 0 {
645
 		db = db.Where("x.patient_id = ?", patientid)
645
 		db = db.Where("x.patient_id = ?", patientid)
646
 	}
646
 	}

+ 138 - 0
service/pharmacy_service.go Datei anzeigen

678
 
678
 
679
 	if orgid != 10480 {
679
 	if orgid != 10480 {
680
 		for _, v := range advice_info {
680
 		for _, v := range advice_info {
681
+
681
 			tmp_bool := IsPharmacyConfig(orgid)
682
 			tmp_bool := IsPharmacyConfig(orgid)
682
 			if tmp_bool {
683
 			if tmp_bool {
683
 				if PettyCash(v.DrugId) {
684
 				if PettyCash(v.DrugId) {
779
 	return
780
 	return
780
 }
781
 }
781
 
782
 
783
+func DispensingMedicineOne(orgid, patient_id, stime, etime, creater int64) (err error) {
784
+
785
+	//开事务
786
+	tx := XTWriteDB().Begin()
787
+	defer func() {
788
+		if err != nil {
789
+			utils.ErrorLog("事务失败,原因为: %v", err)
790
+			tx.Rollback()
791
+		} else {
792
+			tx.Commit()
793
+		}
794
+	}()
795
+
796
+	//查询当前患者未发药的列表
797
+	adviceList, err := GetHisPatientNoMedical(orgid, patient_id, stime, etime)
798
+	//发药
799
+	if len(adviceList) > 0 {
800
+		for _, item := range adviceList {
801
+			//扣减库存
802
+			err = HisDrugsDelivery(orgid, creater, item)
803
+			if err != nil {
804
+				err = fmt.Errorf("!:%v", err)
805
+				return
806
+			}
807
+			//修改发药状态
808
+			err = UpdateIsMedicalHisAdvice(item.ID)
809
+			if err != nil {
810
+				err = fmt.Errorf("!:%v", err)
811
+				return
812
+			}
813
+			err = UpdateHisPrescription(item.PrescriptionId)
814
+			if err != nil {
815
+				err = fmt.Errorf("!:%v", err)
816
+				return
817
+			}
818
+
819
+			//查询默认仓库
820
+			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
821
+			//查询默认仓库剩余多少库存
822
+			var sum_count int64
823
+			stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, item.DrugId)
824
+			for _, its := range stockInfo {
825
+				baseDrug, _ := GetBaseDrugMedical(its.DrugId)
826
+				if its.MaxUnit == baseDrug.MaxUnit {
827
+					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
828
+				}
829
+				sum_count += its.StockMaxNumber + its.StockMinNumber
830
+			}
831
+			UpdateBaseDrugSumTwo(item.DrugId, sum_count, orgid)
832
+			//扣减库存
833
+			UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
834
+
835
+			over, _ := FindOverCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut)
836
+			UpdateActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount)
837
+		}
838
+	}
839
+
840
+	advice, err := GetDocAdviceList(orgid, patient_id, stime, etime)
841
+
842
+	if len(advice) > 0 {
843
+		for _, item := range advice {
844
+			err = DrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
845
+			//查询默认仓库
846
+			storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
847
+			//查询默认仓库剩余多少库存
848
+			var sum_count int64
849
+			stockInfo, _ := GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, orgid, item.DrugId)
850
+			for _, its := range stockInfo {
851
+				baseDrug, _ := GetBaseDrugMedical(its.DrugId)
852
+				if its.MaxUnit == baseDrug.MaxUnit {
853
+					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
854
+				}
855
+				sum_count += its.StockMaxNumber + its.StockMinNumber
856
+			}
857
+			UpdateBaseDrugSumTwo(item.DrugId, sum_count, orgid)
858
+			//扣减库存
859
+			UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
860
+
861
+			over, _ := FindOverCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut)
862
+			UpdateActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount)
863
+			if err != nil {
864
+				err = fmt.Errorf("!:%v", err)
865
+				return
866
+			}
867
+			err = UpdateIsAdvice(item.ID)
868
+			if err != nil {
869
+				err = fmt.Errorf("!:%v", err)
870
+				return
871
+			}
872
+		}
873
+	}
874
+
875
+	//生成明细记录
876
+	tmp_ph := models.Pharmary{
877
+		UserOrgId:  orgid,
878
+		PatientId:  patient_id,
879
+		Ctime:      time.Now().Unix(),
880
+		Mtime:      time.Now().Unix(),
881
+		Status:     1,
882
+		RecordDate: time.Now().Unix(),
883
+	}
884
+	err = tx.Create(&tmp_ph).Error
885
+
886
+	return
887
+}
888
+
889
+func GetHisPatientNoMedical(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.HisDoctorAdviceInfo, err error) {
890
+
891
+	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0", user_org_id, patient_id, startime, end_time).Find(&advice).Error
892
+	return advice, err
893
+}
894
+
895
+func UpdateIsMedicalHisAdvice(id int64) (err error) {
896
+	adviceInfo := models.HisDoctorAdviceInfo{}
897
+	err = XTWriteDB().Model(&adviceInfo).Where("id =? and status =1", id).Update(map[string]interface{}{"is_medicine": 1, "dispensing_time": time.Now().Unix()}).Error
898
+	return err
899
+}
900
+func UpdateHisPrescription(id int64) (err error) {
901
+
902
+	prescriptionInfo := models.HisPrescription{}
903
+	err = XTWriteDB().Model(&prescriptionInfo).Where("id = ? and status=1", id).Update(map[string]interface{}{"is_medicine": 1, "mtime": time.Now().Unix()}).Error
904
+	return err
905
+}
906
+
907
+func GetDocAdviceList(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.DoctorAdvice, err error) {
908
+
909
+	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0", user_org_id, patient_id, startime, end_time).Find(&advice).Error
910
+	return advice, err
911
+
912
+}
913
+
914
+func UpdateIsAdvice(id int64) (err error) {
915
+
916
+	err = XTWriteDB().Model(&models.DoctorAdvice{}).Where("id = ? and status =1", id).Update(map[string]interface{}{"is_medicine": 1, "dispensing_time": time.Now().Unix()}).Error
917
+	return err
918
+}
919
+
782
 // 患者退药按钮点击
920
 // 患者退药按钮点击
783
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
921
 func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error) {
784
 	//开事务
922
 	//开事务

+ 2 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Datei anzeigen

229
 
229
 
230
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
230
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
231
 	order := models.VmDialysisOrder{}
231
 	order := models.VmDialysisOrder{}
232
-	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1640966400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
232
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
233
 	return order, err
233
 	return order, err
234
 }
234
 }
235
 
235
 
236
 func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
236
 func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
237
 	order := models.VmDialysisOrder{}
237
 	order := models.VmDialysisOrder{}
238
-	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1672502400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
238
+	err := p_service.XTReadDB().Raw("SELECT Count(id) as count,Max(dialysis_date) as dialysis_date  from xt_dialysis_order where dialysis_date>=1704038400 and dialysis_date <= ? AND status = 1 AND stage = 2 AND patient_id = ? and user_org_id = ?", recordDate, patient_id, orgID).Scan(&order).Error
239
 	return order, err
239
 	return order, err
240
 }
240
 }
241
 
241
 

+ 12 - 0
service/schedule_service.go Datei anzeigen

1763
 	return err
1763
 	return err
1764
 }
1764
 }
1765
 
1765
 
1766
+func GetDoctorAdviceListTwenty(patient_id int64, schedule_date int64, user_org_id int64) (advice []*models.XtDoctorAdvice, err error) {
1767
+
1768
+	err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&advice).Error
1769
+	return advice, err
1770
+}
1771
+
1772
+func UpdateAdviceObj(patient_id int64, schedule_date int64, user_org_id int64) (err error) {
1773
+
1774
+	err = XTWriteDB().Model(&models.XtDoctorAdvice{}).Where("patient_id = ? and advice_date =? and status=1 and user_org_id = ?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"status": 9}).Error
1775
+	return err
1776
+}
1777
+
1766
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1778
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1767
 
1779
 
1768
 	schedule := models.XtSchedule{}
1780
 	schedule := models.XtSchedule{}

+ 39 - 1
service/sign_service.go Datei anzeigen

2099
 
2099
 
2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2101
 
2101
 
2102
-	err = XTReadDB().Where("status =1 and user_org_id =10551").Find(&list).Error
2102
+	err = XTReadDB().Where("status =1 and user_org_id =10567").Find(&list).Error
2103
 
2103
 
2104
 	return list, err
2104
 	return list, err
2105
 }
2105
 }
2162
 	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name, "mode_id": mode_id}).Error
2162
 	err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name, "mode_id": mode_id}).Error
2163
 	return err
2163
 	return err
2164
 }
2164
 }
2165
+
2166
+func GetDialysisOrderTotalCount() (order []*models.XtDialysisOrderLost, err error) {
2167
+
2168
+	err = XTReadDB().Select("patient_id,Count(id) as count").Where("user_org_id = ? and status =1", 10265).Group("patient_id").Find(&order).Error
2169
+
2170
+	return order, err
2171
+}
2172
+
2173
+func ModifyPatient(patient_id int64, count int64) (models.XtPatients, error) {
2174
+
2175
+	patients := models.XtPatients{}
2176
+	err := XTReadDB().Model(&models.XtPatients{}).Where("id = ? and status =1", patient_id).Updates(map[string]interface{}{"total_dialysis": count}).Error
2177
+	return patients, err
2178
+}
2179
+
2180
+func UpdateDrugWarehouseInfoByDrug(drug_id int64, reatial_price float64, user_org_id int64) (models.DrugWarehouseInfo, error) {
2181
+
2182
+	drugWarehouseInfo := models.DrugWarehouseInfo{}
2183
+
2184
+	err := XTWriteDB().Model(&drugWarehouseInfo).Where("drug_id = ? and org_id =?", drug_id, user_org_id).Updates(map[string]interface{}{"retail_price": reatial_price}).Error
2185
+
2186
+	return drugWarehouseInfo, err
2187
+}
2188
+
2189
+func UpdasteGoodWarehouseInfoByGood(good_id int64, packing_price float64, org_id int64) (models.WarehousingInfo, error) {
2190
+
2191
+	info := models.WarehousingInfo{}
2192
+	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("good_id=? and org_id = ? and status =1", good_id, org_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
2193
+	return info, err
2194
+}
2195
+
2196
+func UpdateHisDoctorAdviceOne(drug_id int64, retail_price float64, user_org_id int64) (models.HisDoctorAdvice, error) {
2197
+
2198
+	advice := models.HisDoctorAdvice{}
2199
+
2200
+	err := XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("drug_id = ? and user_org_id = ?  and status=1", drug_id, user_org_id).Updates(map[string]interface{}{"price": retail_price}).Error
2201
+	return advice, err
2202
+}

+ 1 - 0
service/stock_service.go Datei anzeigen

1770
 	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1770
 	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1771
 	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1771
 	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1772
 	StockCount              string  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1772
 	StockCount              string  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1773
+	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1773
 }
1774
 }
1774
 
1775
 
1775
 func (DrugWarehouseOutInfo) TableName() string {
1776
 func (DrugWarehouseOutInfo) TableName() string {

+ 2 - 0
service/warhouse_service.go Datei anzeigen

6011
 			RetailPrice:             drug_price, //手动出库出库价格
6011
 			RetailPrice:             drug_price, //手动出库出库价格
6012
 			WarehousingId:           warehouse.ID,
6012
 			WarehousingId:           warehouse.ID,
6013
 			SystemTime:              advice.SysRecordTime,
6013
 			SystemTime:              advice.SysRecordTime,
6014
+			PatientId:               advice.PatientId,
6014
 		}
6015
 		}
6015
 		if warehouse.RetailPrice == 0 {
6016
 		if warehouse.RetailPrice == 0 {
6016
 			drugflow.Price = advice.Price
6017
 			drugflow.Price = advice.Price
6080
 			WarehousingId:           warehouse.ID,
6081
 			WarehousingId:           warehouse.ID,
6081
 			WarehousingDetailId:     warehouse.ID,
6082
 			WarehousingDetailId:     warehouse.ID,
6082
 			SystemTime:              advice.SysRecordTime,
6083
 			SystemTime:              advice.SysRecordTime,
6084
+			PatientId:               advice.PatientId,
6083
 		}
6085
 		}
6084
 
6086
 
6085
 		CreateDrugFlowOne(drugflow)
6087
 		CreateDrugFlowOne(drugflow)