28169 před 1 rokem
rodič
revize
dd642c58a5
33 změnil soubory, kde provedl 478 přidání a 99 odebrání
  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 Zobrazit soubor

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

+ 16 - 8
controllers/dialysis_api_controller.go Zobrazit soubor

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

+ 1 - 0
controllers/dialysis_record_api_controller.go Zobrazit soubor

@@ -77,6 +77,7 @@ func (this *DialysisRecordAPIController) GetSchedules() {
77 77
 	redis := service.RedisClient()
78 78
 	defer redis.Close()
79 79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
80
+
80 81
 	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81 82
 	scheduals_json_str, _ := redis.Get(key).Result()
82 83
 

+ 1 - 0
controllers/doctors_api_controller.go Zobrazit soubor

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

+ 7 - 0
controllers/drug_stock_api_contorller.go Zobrazit soubor

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

+ 2 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Zobrazit soubor

@@ -386,6 +386,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
386 386
 			newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
387 387
 			newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
388 388
 			newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
389
+			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
389 390
 			newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
390 391
 			newprescribe.TargetKtv = dialysisSolution.TargetKtv
391 392
 
@@ -512,6 +513,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
512 513
 				newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
513 514
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
514 515
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
516
+				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
515 517
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
516 518
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
517 519
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId

+ 5 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Zobrazit soubor

@@ -1815,6 +1815,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1815 1815
 	washing_time := c.GetString("washing_time")
1816 1816
 	warsh_count := c.GetString("warsh_count")
1817 1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1818
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1818 1819
 
1819 1820
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820 1821
 
@@ -1979,6 +1980,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1979 1980
 		WashingTime:                washing_time,
1980 1981
 		WarshCount:                 warsh_count,
1981 1982
 		BloodAccessPartId:          blood_access_part_id,
1983
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1982 1984
 	}
1983 1985
 
1984 1986
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -3710,6 +3712,7 @@ func (c *DialysisAPIController) PostSolution() {
3710 3712
 	washing_time := c.GetString("washing_time")
3711 3713
 	warsh_count := c.GetString("warsh_count")
3712 3714
 	blood_access_part_id := c.GetString("blood_access_part_id")
3715
+	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
3713 3716
 	if mode_id > 0 {
3714 3717
 
3715 3718
 		var str string
@@ -3871,6 +3874,7 @@ func (c *DialysisAPIController) PostSolution() {
3871 3874
 		WashingTime:                washing_time,
3872 3875
 		WarshCount:                 warsh_count,
3873 3876
 		BloodAccessPartId:          blood_access_part_id,
3877
+		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3874 3878
 	}
3875 3879
 
3876 3880
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -3998,6 +4002,7 @@ func (c *DialysisAPIController) PostSolution() {
3998 4002
 		WashingTime:                washing_time,
3999 4003
 		WarshCount:                 warsh_count,
4000 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 Zobrazit soubor

@@ -716,9 +716,12 @@ func (c *PatientApiController) ExecDoctorAdvice() {
716 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 727
 		advices := models.DoctorAdvice{
@@ -3819,7 +3822,6 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
3819 3822
 
3820 3823
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3821 3824
 		is_infect, _ := dataBody["is_infect"].(string)
3822
-		fmt.Println("is_infect================", is_infect)
3823 3825
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3824 3826
 		evaluation.IsInfect = infect
3825 3827
 	}
@@ -4046,6 +4048,11 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
4046 4048
 		puncture_needle_direction, _ := dataBody["puncture_needle_direction"].(string)
4047 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 4056
 	return
4050 4057
 }
4051 4058
 
@@ -4410,6 +4417,21 @@ func (c *PatientApiController) GetPatientMonitor() {
4410 4417
 			//获取所有的患者
4411 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 4436
 			treatments, _ := service.GetAllTreatModeByList(orgID)
4415 4437
 

+ 2 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Zobrazit soubor

@@ -843,20 +843,17 @@ func (this *NewDialysisApiController) GetlongDialysisrecord() {
843 843
 	timeLayout := "2006-01-02"
844 844
 	loc, _ := time.LoadLocation("Local")
845 845
 	id, _ := this.GetInt64("id")
846
-	fmt.Print("id", id)
847 846
 	patient, _ := service.GetPatientDetailTwo(id)
848 847
 	start := this.GetString("startime")
849 848
 	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
850 849
 	startime := startTimes.Unix()
851
-	fmt.Print("startime", startime)
852 850
 	end := this.GetString("endtime")
853 851
 	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
854 852
 	endtime := endTimes.Unix()
855
-	fmt.Print("endtime", endtime)
856 853
 	limit, _ := this.GetInt64("limit")
857
-	fmt.Print("limit", limit)
854
+
858 855
 	page, _ := this.GetInt64("page")
859
-	fmt.Print("page", page)
856
+
860 857
 	adminInfo := this.GetMobileAdminUserInfo()
861 858
 	orgid := adminInfo.Org.Id
862 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 Zobrazit soubor

@@ -508,6 +508,14 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
508 508
 			AdminUserId: this.GetMobileAdminUserInfo().AdminUser.Id,
509 509
 		}
510 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 519
 		redis := service.RedisClient()
512 520
 		//处方
513 521
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"

+ 1 - 1
controllers/patient_api_controller.go Zobrazit soubor

@@ -3686,7 +3686,7 @@ func (c *PatientApiController) DeleteGroupAdvice() {
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 3691
 	byterequest, _ := json.Marshal(advice)
3692 3692
 	doctorAdviceLog := models.XtDoctorAdviceLog{

+ 70 - 50
controllers/pharmacy_controller.go Zobrazit soubor

@@ -348,6 +348,7 @@ func (this *PharmacyController) GetPharmacyContent() {
348 348
 
349 349
 // 发药按钮点击
350 350
 func (this *PharmacyController) DispensingMedicine() {
351
+
351 352
 	var err error
352 353
 	defer func() {
353 354
 		if rec := recover(); rec != nil {
@@ -379,37 +380,35 @@ func (this *PharmacyController) DispensingMedicine() {
379 380
 		for _, item := range advicelist {
380 381
 			//查询改药品信息
381 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,34 +417,55 @@ func (this *PharmacyController) DispensingMedicine() {
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 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 Zobrazit soubor

@@ -38,7 +38,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
38 38
 	adminUserInfo := this.GetAdminUserInfo()
39 39
 
40 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 42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
43 43
 		for _, item := range schedules {
44 44
 
@@ -99,14 +99,14 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
99 99
 
100 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 103
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
104 104
 
105 105
 					item.Patient.TotalDialysis = listOne.Count
106 106
 					item.Count = listOne.Count
107 107
 				}
108 108
 
109
-				if item.ScheduleDate >= 1672502400 {
109
+				if item.ScheduleDate >= 1704038400 {
110 110
 
111 111
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
112 112
 
@@ -145,13 +145,26 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
145 145
 	}
146 146
 
147 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 149
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
149 150
 		for _, item := range schedules {
151
+
150 152
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
151 153
 			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
152 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 169
 				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
157 170
 					item.Count = list.Count
@@ -162,10 +175,6 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
162 175
 
163 176
 			item.Schedule = &lastSchedule
164 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 179
 				if item.ScheduleDate <= 1640966400 {
171 180
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)

+ 8 - 0
controllers/schedule_api_controller.go Zobrazit soubor

@@ -1968,6 +1968,14 @@ func (c *ScheduleApiController) DeleteSchedule() {
1968 1968
 
1969 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 1979
 	redis := service.RedisClient()
1972 1980
 
1973 1981
 	//处方

+ 24 - 4
controllers/sign_api_controller.go Zobrazit soubor

@@ -665,7 +665,7 @@ func (this *SignApiController) GetEnterPriseDetail() {
665 665
 
666 666
 func (this *SignApiController) UploadPrintOrder() {
667 667
 
668
-	list, _ := service.GetAllPatientNew(10440)
668
+	list, _ := service.GetAllPatientNew(10587)
669 669
 	for _, item := range list {
670 670
 
671 671
 		hans := item.Name // 要转换的汉字字符串
@@ -1216,6 +1216,14 @@ func (this *SignApiController) ToAutoDrug() {
1216 1216
 func (this *SignApiController) ToAutoDiagnose() {
1217 1217
 
1218 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 1227
 	list, _ := service.GetNewAllpatient(orgId)
1220 1228
 
1221 1229
 	for _, item := range list {
@@ -1226,9 +1234,21 @@ func (this *SignApiController) ToAutoDiagnose() {
1226 1234
 	//for _, item := range list {
1227 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 Zobrazit soubor

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

+ 13 - 0
models/dialysis.go Zobrazit soubor

@@ -1624,3 +1624,16 @@ type NoHisPrescriptionProject struct {
1624 1624
 func (NoHisPrescriptionProject) TableName() string {
1625 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 Zobrazit soubor

@@ -115,6 +115,11 @@ type BaseDrugLibEleven struct {
115 115
 	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
116 116
 	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
117 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 125
 func (BaseDrugLibEleven) TableName() string {

+ 1 - 0
models/new_monitor.go Zobrazit soubor

@@ -34,6 +34,7 @@ type VMMonitorPatients struct {
34 34
 	Status             int64  `gorm:"column:status" json:"status" form:"status"`
35 35
 	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
36 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 40
 func (VMMonitorPatients) TableName() string {

+ 13 - 0
models/patient_models.go Zobrazit soubor

@@ -380,6 +380,7 @@ type DialysisPrescription struct {
380 380
 	WarshCount                 string        `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
381 381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
382 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 386
 func (DialysisPrescription) TableName() string {
@@ -618,6 +619,7 @@ type DialysisSolution struct {
618 619
 	WarshCount                 string  `gorm:"column:warsh_count" json:"warsh_count" form:"warsh_count"`
619 620
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
620 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 625
 func (DialysisSolution) TableName() string {
@@ -2361,3 +2363,14 @@ type XtDeviceValusalMapVrr struct {
2361 2363
 func (XtDeviceValusalMapVrr) TableName() string {
2362 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 Zobrazit soubor

@@ -351,6 +351,9 @@ type XtDialysisSolution struct {
351 351
 	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
352 352
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
353 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 359
 func (XtDialysisSolution) TableName() string {

+ 6 - 0
service/dialysis_solution_service.go Zobrazit soubor

@@ -120,6 +120,12 @@ func GetAllLongAdviceList(user_org_id int64) (advice []*models.DoctorAdvice, err
120 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 129
 func GetAllHisAdviceTemplateList(user_org_id int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
124 130
 
125 131
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&advice).Error

+ 1 - 1
service/gobal_config_service.go Zobrazit soubor

@@ -635,7 +635,7 @@ func GetAllBaseDrugListTwo(orgid int64) (drug []*models.BaseDrugLibEleven, err e
635 635
 	if orgid > 0 {
636 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 639
 	return drug, err
640 640
 }
641 641
 

+ 5 - 0
service/manage_service.go Zobrazit soubor

@@ -915,6 +915,11 @@ func GetAllpatient(orgid int64) (patients []*models.Patients, err error) {
915 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 923
 func GetAllpatientThirty(orgid int64) (patients []*models.PatientsThirty, err error) {
919 924
 	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
920 925
 	return patients, err

+ 4 - 2
service/mobile_dialysis_service.go Zobrazit soubor

@@ -2810,7 +2810,7 @@ func GetDialysisOrderCountOne(orgID int64, patient_id int64, recordDate int64) (
2810 2810
 }
2811 2811
 
2812 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 2814
 	return
2815 2815
 }
2816 2816
 
@@ -8113,7 +8113,7 @@ func GetDialysisTotalCountOne(org_id int64, patient_id int64) (models.BloodDialy
8113 8113
 	order := models.BloodDialysisOrderCount{}
8114 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 8118
 	return order, err
8119 8119
 }
@@ -8168,6 +8168,7 @@ func GetHisDoctorAdvicesTwentyOne(orgID int64, scheduleDate int64, deliverWay st
8168 8168
 			db = db.Where("partition_id = ?", partitionType)
8169 8169
 		}
8170 8170
 		if patient_id > 0 {
8171
+
8171 8172
 			if execution_state > 0 {
8172 8173
 				if cost_type > 0 {
8173 8174
 					if len(execution_frequency) > 0 {
@@ -8445,6 +8446,7 @@ func GetHisDoctorAdvicesTwentyOne(orgID int64, scheduleDate int64, deliverWay st
8445 8446
 		}
8446 8447
 		if patient_id > 0 {
8447 8448
 			if execution_state > 0 {
8449
+				fmt.Println("execution_state---------------------", execution_state)
8448 8450
 				if cost_type > 0 {
8449 8451
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8450 8452
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).

+ 20 - 0
service/patient_service.go Zobrazit soubor

@@ -1231,6 +1231,14 @@ func DeleteGroupAdvice(orgId int64, groupNo int64, admin_user_id int64) (err err
1231 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 1242
 func FindDoctorAdvice(orgID, id int64) (advice models.DoctorAdvice, err error) {
1235 1243
 	err = readDb.Model(&models.DoctorAdvice{}).Where("id = ? and user_org_id=? and status = 1", id, orgID).First(&advice).Error
1236 1244
 	return
@@ -3377,3 +3385,15 @@ func GetPatientScheudleListTwenty(org_id int64, scheduel_type int64, startime in
3377 3385
 	fmt.Println("err2330230320202023", err)
3378 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 Zobrazit soubor

@@ -640,7 +640,7 @@ func GetDryWeightDetail(id int64) (models.SgjPatientDryweights, error) {
640 640
 }
641 641
 
642 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 644
 	if patientid > 0 {
645 645
 		db = db.Where("x.patient_id = ?", patientid)
646 646
 	}

+ 138 - 0
service/pharmacy_service.go Zobrazit soubor

@@ -678,6 +678,7 @@ func DispensingMedicine(orgid, patient_id, stime, etime, creater int64) (err err
678 678
 
679 679
 	if orgid != 10480 {
680 680
 		for _, v := range advice_info {
681
+
681 682
 			tmp_bool := IsPharmacyConfig(orgid)
682 683
 			if tmp_bool {
683 684
 				if PettyCash(v.DrugId) {
@@ -779,6 +780,143 @@ func DispensingMedicine(orgid, patient_id, stime, etime, creater int64) (err err
779 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 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 Zobrazit soubor

@@ -229,13 +229,13 @@ func GetDialysisOrderCountTen(patient_id int64, recordDate int64) (models.VmDial
229 229
 
230 230
 func GetDialysisOrderCountEight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
231 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 233
 	return order, err
234 234
 }
235 235
 
236 236
 func GetDialysisOrderCountNight(orgID int64, patient_id int64, recordDate int64) (models.VmDialysisOrder, error) {
237 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 239
 	return order, err
240 240
 }
241 241
 

+ 12 - 0
service/schedule_service.go Zobrazit soubor

@@ -1763,6 +1763,18 @@ func CreateScheduleLog(log models.XtScheduleLog) error {
1763 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 1778
 func GetLastSchedule(patient_id int64, user_org_id int64) (models.XtSchedule, error) {
1767 1779
 
1768 1780
 	schedule := models.XtSchedule{}

+ 39 - 1
service/sign_service.go Zobrazit soubor

@@ -2099,7 +2099,7 @@ func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64,
2099 2099
 
2100 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 2104
 	return list, err
2105 2105
 }
@@ -2162,3 +2162,41 @@ func UpdateDialysisScheduleOne(id int64, mode_id int64, dialysis_machine_name st
2162 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 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 Zobrazit soubor

@@ -1770,6 +1770,7 @@ type DrugWarehouseOutInfo struct {
1770 1770
 	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1771 1771
 	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
1772 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 1776
 func (DrugWarehouseOutInfo) TableName() string {

+ 2 - 0
service/warhouse_service.go Zobrazit soubor

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