Bladeren bron

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

陈少旭 1 jaar geleden
bovenliggende
commit
fa2afc7185
36 gewijzigde bestanden met toevoegingen van 1401 en 100 verwijderingen
  1. 167 16
      controllers/dialysis_api_controller.go
  2. 6 7
      controllers/dialysis_record_api_controller.go
  3. 45 0
      controllers/doctors_api_controller.go
  4. 54 2
      controllers/his_api_controller.go
  5. 4 0
      controllers/his_project_api_controller.go
  6. 285 0
      controllers/manage_api_controller.go
  7. 3 0
      controllers/mobile_api_controllers/check_weight_api_controller.go
  8. 92 15
      controllers/mobile_api_controllers/dialysis_api_controller.go
  9. 3 3
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  10. 0 2
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  11. 12 9
      controllers/mobile_api_controllers/patient_api_controller.go
  12. 12 0
      controllers/new_mobile_api_controllers/staff_schedule_api_controller.go
  13. 31 10
      controllers/patient_api_controller.go
  14. 52 1
      controllers/patient_dataconfig_api_controller.go
  15. 10 5
      controllers/print_data_api_controller.go
  16. 0 1
      controllers/schedule_api_controller.go
  17. 27 0
      controllers/self_drug_api_congtroller.go
  18. 3 1
      controllers/stock_in_api_controller.go
  19. 1 1
      main.go
  20. 23 0
      models/device_models.go
  21. 1 0
      models/dialysis.go
  22. 2 0
      models/his_models.go
  23. 26 4
      models/patient_models.go
  24. 24 0
      models/schedule_models.go
  25. 28 0
      service/dialysis_solution_service.go
  26. 17 0
      service/doctor_schedule_service.go
  27. 1 1
      service/his_project_service.go
  28. 1 1
      service/his_service.go
  29. 4 4
      service/inspection_service.go
  30. 1 1
      service/manage_center_service.go
  31. 53 0
      service/manage_service.go
  32. 305 9
      service/mobile_dialysis_service.go
  33. 47 4
      service/patient_service.go
  34. 24 1
      service/self_drug_service.go
  35. 36 1
      service/stock_service.go
  36. 1 1
      service/user_service.go

+ 167 - 16
controllers/dialysis_api_controller.go Bestand weergeven

@@ -121,6 +121,8 @@ func DialysisApiRegistRouters() {
121 121
 	beego.Router("/api/patient/checkdialysisinformation", &DialysisApiController{}, "Get:CheckDialysisInformation")
122 122
 
123 123
 	beego.Router("/api/dialysis/patientsflow", &DialysisApiController{}, "Get:GetDialysisPatientsFlow")
124
+
125
+	beego.Router("/api/patient/getlongdialysisadvicetoday", &DialysisApiController{}, "Get:GetLongDialysisAdviceToday")
124 126
 }
125 127
 
126 128
 func (c *DialysisApiController) GetQueueCall() {
@@ -623,7 +625,7 @@ func (c *DialysisApiController) PostPrescription() {
623 625
 		// 查询信息规挡的设置天数
624 626
 
625 627
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
626
-		if infor.ID > 0 {
628
+		if infor.ID > 0 && infor.WeekDay > 0 {
627 629
 
628 630
 			var cha_time int64
629 631
 
@@ -738,7 +740,7 @@ func (c *DialysisApiController) PostPrescription() {
738 740
 		// 查询信息规挡的设置天数
739 741
 
740 742
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
741
-		if infor.ID > 0 {
743
+		if infor.ID > 0 && infor.WeekDay > 0 {
742 744
 
743 745
 			var cha_time int64
744 746
 
@@ -762,6 +764,23 @@ func (c *DialysisApiController) PostPrescription() {
762 764
 
763 765
 		updateErr := service.UpDateDialysisPrescription(&prescription)
764 766
 
767
+		//创建步骤表
768
+		finish := models.XtDialysisFinish{
769
+			IsFinish:   1,
770
+			UserOrgId:  adminUserInfo.CurrentOrgId,
771
+			Status:     1,
772
+			Ctime:      time.Now().Unix(),
773
+			Mtime:      0,
774
+			Module:     1,
775
+			RecordDate: recordDate.Unix(),
776
+			Sourse:     1,
777
+			PatientId:  patient,
778
+		}
779
+
780
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 1, patient)
781
+		if dialysisFinish.ID == 0 {
782
+			service.CreateDialysisFinish(finish)
783
+		}
765 784
 		//修改处方
766 785
 		if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
767 786
 			// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
@@ -976,7 +995,7 @@ func (c *DialysisApiController) PostSoulution() {
976 995
 	// 查询信息规挡的设置天数
977 996
 
978 997
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
979
-	if infor.ID > 0 {
998
+	if infor.ID > 0 && infor.WeekDay > 0 {
980 999
 		var cha_time int64
981 1000
 
982 1001
 		timeNowStr := time.Now().Format("2006-01-02")
@@ -1327,6 +1346,23 @@ func (c *DialysisApiController) PostSoulution() {
1327 1346
 
1328 1347
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1329 1348
 
1349
+	//创建步骤表
1350
+	finishOne := models.XtDialysisFinish{
1351
+		IsFinish:   1,
1352
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1353
+		Status:     1,
1354
+		Ctime:      time.Now().Unix(),
1355
+		Mtime:      0,
1356
+		Module:     1,
1357
+		RecordDate: recordDate.Unix(),
1358
+		Sourse:     1,
1359
+		PatientId:  patient,
1360
+	}
1361
+
1362
+	dialysisFinishOne, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 1, patient)
1363
+	if dialysisFinishOne.ID == 0 {
1364
+		service.CreateDialysisFinish(finishOne)
1365
+	}
1330 1366
 	//获取最新1条
1331 1367
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(patient, adminUserInfo.CurrentOrgId)
1332 1368
 
@@ -1571,7 +1607,7 @@ func (c *DialysisApiController) PostDouleCheck() {
1571 1607
 	// 查询信息规挡的设置天数
1572 1608
 
1573 1609
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1574
-	if infor.ID > 0 {
1610
+	if infor.ID > 0 && infor.WeekDay > 0 {
1575 1611
 
1576 1612
 		var cha_time int64
1577 1613
 
@@ -1777,7 +1813,7 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1777 1813
 	// 查询信息规挡的设置天数
1778 1814
 
1779 1815
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1780
-	if infor.ID > 0 {
1816
+	if infor.ID > 0 && infor.WeekDay > 0 {
1781 1817
 
1782 1818
 		var cha_time int64
1783 1819
 
@@ -1846,6 +1882,29 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1846 1882
 		//	}
1847 1883
 		//}
1848 1884
 
1885
+		// 查询信息规挡的设置天数
1886
+
1887
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1888
+		if infor.ID > 0 && infor.WeekDay > 0 {
1889
+			var cha_time int64
1890
+			timeNowStr := time.Now().Format("2006-01-02")
1891
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1892
+
1893
+			//今日的日期减去设置的日期
1894
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1895
+
1896
+			if cha_time >= recordDate.Unix() {
1897
+				//查询审核是否允许
1898
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1899
+				//申请状态不允许的情况 拒绝修改
1900
+				if infor.ApplicationStatus != 1 {
1901
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1902
+					return
1903
+				}
1904
+
1905
+			}
1906
+		}
1907
+
1849 1908
 		receiveTreatmentAsses.Creater = receiveTreatment.Creater
1850 1909
 		receiveTreatmentAsses.CreatedTime = receiveTreatment.CreatedTime
1851 1910
 		receiveTreatmentAsses.UpdateTime = time.Now().Unix()
@@ -2298,7 +2357,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2298 2357
 		// 查询信息规挡的设置天数
2299 2358
 
2300 2359
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2301
-		if infor.ID > 0 {
2360
+		if infor.ID > 0 && infor.WeekDay > 0 {
2302 2361
 
2303 2362
 			var cha_time int64
2304 2363
 
@@ -2432,6 +2491,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2432 2491
 				newprescribe.RecordDate = recordDate.Unix()
2433 2492
 				newprescribe.DewaterAmount = dewater_amount
2434 2493
 				newprescribe.TargetUltrafiltration = dewater_amount
2494
+				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2435 2495
 				newprescribe.Status = 1
2436 2496
 
2437 2497
 				err := service.AddSigleRecord(&newprescribe)
@@ -2490,6 +2550,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2490 2550
 					newprescribe.Status = 1
2491 2551
 					newprescribe.Creater = adminUserInfo.AdminUser.Id
2492 2552
 					newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2553
+					newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2493 2554
 
2494 2555
 					err := service.AddSigleRecord(&newprescribe)
2495 2556
 					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -2687,6 +2748,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2687 2748
 			newprescribe.RecordDate = recordDate.Unix()
2688 2749
 			newprescribe.DewaterAmount = dewater_amount
2689 2750
 			newprescribe.TargetUltrafiltration = dewater_amount
2751
+			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2690 2752
 			newprescribe.Status = 1
2691 2753
 
2692 2754
 			err := service.AddSigleRecord(&newprescribe)
@@ -2742,6 +2804,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2742 2804
 				newprescribe.RecordDate = recordDate.Unix()
2743 2805
 				newprescribe.DewaterAmount = dewater_amount
2744 2806
 				newprescribe.TargetUltrafiltration = dewater_amount
2807
+				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2745 2808
 				newprescribe.Status = 1
2746 2809
 
2747 2810
 				err := service.AddSigleRecord(&newprescribe)
@@ -2814,6 +2877,24 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2814 2877
 		}
2815 2878
 
2816 2879
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
2880
+
2881
+		//创建步骤表
2882
+		finish := models.XtDialysisFinish{
2883
+			IsFinish:   1,
2884
+			UserOrgId:  adminUserInfo.CurrentOrgId,
2885
+			Status:     1,
2886
+			Ctime:      time.Now().Unix(),
2887
+			Mtime:      0,
2888
+			Module:     3,
2889
+			RecordDate: recordDate.Unix(),
2890
+			Sourse:     1,
2891
+			PatientId:  patient,
2892
+		}
2893
+
2894
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 3, patient)
2895
+		if dialysisFinish.ID == 0 {
2896
+			service.CreateDialysisFinish(finish)
2897
+		}
2817 2898
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
2818 2899
 		redis := service.RedisClient()
2819 2900
 		//清空key 值
@@ -2895,7 +2976,7 @@ func (c *DialysisApiController) PostTreatmentSummary() {
2895 2976
 		// 查询信息规挡的设置天数
2896 2977
 
2897 2978
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2898
-		if infor.ID > 0 {
2979
+		if infor.ID > 0 && infor.WeekDay > 0 {
2899 2980
 
2900 2981
 			var cha_time int64
2901 2982
 
@@ -2964,6 +3045,28 @@ func (c *DialysisApiController) PostTreatmentSummary() {
2964 3045
 		//	}
2965 3046
 		//}
2966 3047
 
3048
+		// 查询信息规挡的设置天数
3049
+
3050
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3051
+		if infor.ID > 0 && infor.WeekDay > 0 {
3052
+			var cha_time int64
3053
+			timeNowStr := time.Now().Format("2006-01-02")
3054
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
3055
+
3056
+			//今日的日期减去设置的日期
3057
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3058
+
3059
+			if cha_time >= recordDate.Unix() {
3060
+				//查询审核是否允许
3061
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
3062
+				//申请状态不允许的情况 拒绝修改
3063
+				if infor.ApplicationStatus != 1 {
3064
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3065
+					return
3066
+				}
3067
+			}
3068
+		}
3069
+
2967 3070
 		treatmentSummary.Creater = tempTreatmentSummary.Creater
2968 3071
 		treatmentSummary.CreatedTime = tempTreatmentSummary.CreatedTime
2969 3072
 		treatmentSummary.UpdatedTime = time.Now().Unix()
@@ -3465,7 +3568,7 @@ func (this *DialysisApiController) DelMonitor() {
3465 3568
 	// 查询信息规挡的设置天数
3466 3569
 
3467 3570
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.CurrentOrgId)
3468
-	if infor.ID > 0 {
3571
+	if infor.ID > 0 && infor.WeekDay > 0 {
3469 3572
 
3470 3573
 		var cha_time int64
3471 3574
 
@@ -3612,7 +3715,7 @@ func (c *DialysisApiController) CreateMonitor() {
3612 3715
 	// 查询信息规挡的设置天数
3613 3716
 
3614 3717
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3615
-	if infor.ID > 0 {
3718
+	if infor.ID > 0 && infor.WeekDay > 0 {
3616 3719
 
3617 3720
 		var cha_time int64
3618 3721
 
@@ -6731,11 +6834,24 @@ func (this *DialysisApiController) SaveInformation() {
6731 6834
 
6732 6835
 	patient_id, _ := this.GetInt64("patient_id")
6733 6836
 	record_date, _ := this.GetInt64("record_date")
6734
-	adviceDate := this.GetString("selected_date")
6735
-	timeLayout2 := "2006-01-02"
6736
-	loc2, _ := time.LoadLocation("Local")
6737
-	theTime, _ := time.ParseInLocation(timeLayout2, adviceDate, loc2)
6738
-	AdviceDate := theTime.Unix()
6837
+	startTime := this.GetString("selected_date")
6838
+
6839
+	timeLayout := "2006-01-02 15:04"
6840
+	loc, _ := time.LoadLocation("Local")
6841
+
6842
+	if len(startTime) == 0 {
6843
+		utils.ErrorLog("len(start_time) == 0")
6844
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
6845
+		return
6846
+	}
6847
+	theTime, err := time.ParseInLocation(timeLayout, startTime, loc)
6848
+	if err != nil {
6849
+		utils.ErrorLog(err.Error())
6850
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
6851
+		return
6852
+	}
6853
+	StartTime := theTime.Unix()
6854
+	fmt.Println("startime-------------", StartTime)
6739 6855
 
6740 6856
 	module, _ := this.GetInt64("module")
6741 6857
 
@@ -6748,7 +6864,7 @@ func (this *DialysisApiController) SaveInformation() {
6748 6864
 		Module:            module,
6749 6865
 		PatientId:         patient_id,
6750 6866
 		RecordDate:        record_date,
6751
-		ApplicationDate:   AdviceDate,
6867
+		ApplicationDate:   StartTime,
6752 6868
 		Creater:           creater,
6753 6869
 		ApplicationStatus: 2,
6754 6870
 		Checker:           0,
@@ -6771,7 +6887,7 @@ func (this *DialysisApiController) SaveInformation() {
6771 6887
 		}
6772 6888
 	}
6773 6889
 	if infor.ID > 0 {
6774
-		err := service.UpdateDialysisInformationById(patient_id, record_date, orgId, module, AdviceDate, remark)
6890
+		err := service.UpdateDialysisInformationById(patient_id, record_date, orgId, module, StartTime, remark)
6775 6891
 		if err == nil {
6776 6892
 			this.ServeSuccessJSON(map[string]interface{}{
6777 6893
 				"information": information,
@@ -6781,3 +6897,38 @@ func (this *DialysisApiController) SaveInformation() {
6781 6897
 	}
6782 6898
 
6783 6899
 }
6900
+
6901
+func (this *DialysisApiController) GetLongDialysisAdviceToday() {
6902
+
6903
+	orgId := this.GetAdminUserInfo().CurrentOrgId
6904
+
6905
+	schedule_type, _ := this.GetInt64("schedule_type")
6906
+
6907
+	partion_type := this.GetString("partion_type")
6908
+	var ids []string
6909
+	ids = strings.Split(partion_type, ",")
6910
+	start_time := this.GetString("selected_date")
6911
+	timeLayout := "2006-01-02"
6912
+	loc, _ := time.LoadLocation("Local")
6913
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
6914
+
6915
+	list, err := service.GetLongDialysisAdviceToday(orgId, schedule_type, ids, startTime.Unix())
6916
+
6917
+	drug, _ := service.GetAllBaseDrugListTwenty(orgId)
6918
+	_, config := service.FindXTHisRecordByOrgId(orgId)
6919
+	appId := this.GetAdminUserInfo().CurrentAppId
6920
+	doctorList, _ := service.GetAllAdminUsers(orgId, appId)
6921
+	if err == nil {
6922
+		this.ServeSuccessJSON(map[string]interface{}{
6923
+			"list":       list,
6924
+			"drug":       drug,
6925
+			"config":     config,
6926
+			"doctorList": doctorList,
6927
+		})
6928
+		return
6929
+
6930
+	} else {
6931
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
6932
+		return
6933
+	}
6934
+}

+ 6 - 7
controllers/dialysis_record_api_controller.go Bestand weergeven

@@ -638,7 +638,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
638 638
 	// 查询信息规挡的设置天数
639 639
 
640 640
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
641
-	if infor.ID > 0 {
641
+	if infor.ID > 0 && infor.WeekDay > 0 {
642 642
 
643 643
 		var cha_time int64
644 644
 
@@ -647,8 +647,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
647 647
 
648 648
 		//今日的日期减去设置的日期
649 649
 		cha_time = timeNewDate.Unix() - infor.WeekDay*86400
650
-
651
-		if cha_time >= scheduleDate {
650
+		if cha_time >= scheduleDate && infor.WeekDay != 0 {
652 651
 			//查询审核是否允许
653 652
 			infor, _ := service.GetDialysisInformationByRecordDate(patientID, scheduleDate, adminUserInfo.CurrentOrgId)
654 653
 			//申请状态不允许的情况 拒绝修改
@@ -1055,7 +1054,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1055 1054
 	// 查询信息规挡的设置天数
1056 1055
 
1057 1056
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1058
-	if infor.ID > 0 {
1057
+	if infor.ID > 0 && infor.WeekDay > 0 {
1059 1058
 
1060 1059
 		var cha_time int64
1061 1060
 
@@ -1691,7 +1690,7 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1691 1690
 	// 查询信息规挡的设置天数
1692 1691
 
1693 1692
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1694
-	if infor.ID > 0 {
1693
+	if infor.ID > 0 && infor.WeekDay > 0 {
1695 1694
 
1696 1695
 		var cha_time int64
1697 1696
 
@@ -1952,7 +1951,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1952 1951
 	}
1953 1952
 
1954 1953
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1955
-	if infor.ID > 0 {
1954
+	if infor.ID > 0 && infor.WeekDay > 0 {
1956 1955
 
1957 1956
 		var cha_time int64
1958 1957
 
@@ -2110,7 +2109,7 @@ func (c *DialysisRecordAPIController) ModifyFinishDialysis() {
2110 2109
 	// 查询信息规挡的设置天数
2111 2110
 
2112 2111
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2113
-	if infor.ID > 0 {
2112
+	if infor.ID > 0 && infor.WeekDay > 0 {
2114 2113
 
2115 2114
 		var cha_time int64
2116 2115
 

+ 45 - 0
controllers/doctors_api_controller.go Bestand weergeven

@@ -65,6 +65,8 @@ func DoctorApiRegistRouters() {
65 65
 	beego.Router("/api/patient/getfirstdetailbyid", &DoctorsApiController{}, "Get:GetFirstDetailById")
66 66
 	beego.Router("/api/patient/updatefirstdisease", &DoctorsApiController{}, "Post:UpdateFirstDisease")
67 67
 	beego.Router("/api/patient/deletefirstdisease", &DoctorsApiController{}, "Get:DeleteFirstDisease")
68
+
69
+	beego.Router("/api/schedule/new/long/advices", &DoctorsApiController{}, "Get:GetLongScheduleAdvicesList")
68 70
 }
69 71
 
70 72
 func (c *DoctorsApiController) ScheduleAdvices() {
@@ -1626,3 +1628,46 @@ func (c *DoctorsApiController) DeleteFirstDisease() {
1626 1628
 	c.ServeSuccessJSON(returnData)
1627 1629
 	return
1628 1630
 }
1631
+
1632
+func (c *DoctorsApiController) GetLongScheduleAdvicesList() {
1633
+
1634
+	schedualDate := c.GetString("date")
1635
+	adviceType, _ := c.GetInt("advice_type")
1636
+	patientType, _ := c.GetInt("patient_type")
1637
+	delivery_way := c.GetString("delivery_way")
1638
+	schedule_type, _ := c.GetInt64("schedule_type")
1639
+	partition_type, _ := c.GetInt64("partition_type")
1640
+	patient_id, _ := c.GetInt64("patient_id")
1641
+	excution_way, _ := c.GetInt64("excution_way")
1642
+	cost_type, _ := c.GetInt64("cost_type")
1643
+	execution_frequency := c.GetString("execution_frequency")
1644
+
1645
+	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
1646
+	if parseDateErr != nil {
1647
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1648
+		return
1649
+	}
1650
+
1651
+	adminUserInfo := c.GetAdminUserInfo()
1652
+	orgID := adminUserInfo.CurrentOrgId
1653
+
1654
+	scheduals, err := service.MobileGetLongScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type, execution_frequency)
1655
+
1656
+	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1657
+	if err != nil {
1658
+		c.ErrorLog("获取排班信息失败:%v", err)
1659
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1660
+	} else {
1661
+		filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
1662
+		for _, schedual := range scheduals {
1663
+			if len(schedual.DoctorAdvices) > 0 {
1664
+				filtedScheduals = append(filtedScheduals, schedual)
1665
+			}
1666
+		}
1667
+		c.ServeSuccessJSON(map[string]interface{}{
1668
+			"scheduals": filtedScheduals,
1669
+			"adminUser": adminUser,
1670
+		})
1671
+	}
1672
+
1673
+}

+ 54 - 2
controllers/his_api_controller.go Bestand weergeven

@@ -2636,6 +2636,23 @@ func (c *HisApiController) CreateHisPrescription() {
2636 2636
 			PatientDiagnosis:   patient_diagnose,
2637 2637
 		}
2638 2638
 		service.SavePatientPrescriptionInfo(hpInfo)
2639
+		//创建步骤表
2640
+		finish := models.XtDialysisFinish{
2641
+			IsFinish:   1,
2642
+			UserOrgId:  adminInfo.CurrentOrgId,
2643
+			Status:     1,
2644
+			Ctime:      time.Now().Unix(),
2645
+			Mtime:      0,
2646
+			Module:     4,
2647
+			RecordDate: theTime.Unix(),
2648
+			Sourse:     1,
2649
+			PatientId:  patient_id,
2650
+		}
2651
+
2652
+		dialysisFinish, _ := service.GetDialysisFinish(adminInfo.CurrentOrgId, theTime.Unix(), 4, patient_id)
2653
+		if dialysisFinish.ID == 0 {
2654
+			service.CreateDialysisFinish(finish)
2655
+		}
2639 2656
 		redis := service.RedisClient()
2640 2657
 		key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
2641 2658
 		redis.Set(key, "", time.Second)
@@ -2669,6 +2686,23 @@ func (c *HisApiController) CreateHisPrescription() {
2669 2686
 			PatientDiagnosis:   patient_diagnose,
2670 2687
 		}
2671 2688
 		service.SavePatientPrescriptionInfo(hpInfo)
2689
+		//创建步骤表
2690
+		finish := models.XtDialysisFinish{
2691
+			IsFinish:   1,
2692
+			UserOrgId:  adminInfo.CurrentOrgId,
2693
+			Status:     1,
2694
+			Ctime:      time.Now().Unix(),
2695
+			Mtime:      0,
2696
+			Module:     4,
2697
+			RecordDate: info.RecordDate,
2698
+			Sourse:     1,
2699
+			PatientId:  info.PatientId,
2700
+		}
2701
+
2702
+		dialysisFinish, _ := service.GetDialysisFinish(adminInfo.CurrentOrgId, info.RecordDate, 4, info.PatientId)
2703
+		if dialysisFinish.ID == 0 {
2704
+			service.CreateDialysisFinish(finish)
2705
+		}
2672 2706
 		redis := service.RedisClient()
2673 2707
 		key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
2674 2708
 		redis.Set(key, "", time.Second)
@@ -2846,6 +2880,14 @@ func (c *HisApiController) CreateHisPrescription() {
2846 2880
 							if s.PrescribingNumberUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
2847 2881
 								total_count += prescribingNumberSeven
2848 2882
 							}
2883
+							if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 3877 {
2884
+								storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
2885
+								lastWarehouse, _ := service.FindLastDrugWarehousingInfoByID(s.DrugId, storeConfig.DrugStorehouseOut)
2886
+								if s.Price != lastWarehouse.RetailPrice {
2887
+									s.Price = lastWarehouse.RetailPrice
2888
+								}
2889
+							}
2890
+
2849 2891
 							service.CreateHisDoctorAdvice(&s)
2850 2892
 
2851 2893
 							//存储切片中
@@ -2907,6 +2949,17 @@ func (c *HisApiController) CreateHisPrescription() {
2907 2949
 								projectDetail, _ := service.GetHisPrescriptonProjectById(p.ID)
2908 2950
 								p.IsOut = projectDetail.IsOut
2909 2951
 							}
2952
+							if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 3877 {
2953
+								storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
2954
+								if p.Type == 3 {
2955
+									lastWarehouse, _ := service.FindFirstWarehousingInfoByStockThree(p.ProjectId, storeConfig.DrugStorehouseOut)
2956
+									if p.Price != lastWarehouse.PackingPrice {
2957
+										p.Price = lastWarehouse.PackingPrice
2958
+									}
2959
+								}
2960
+
2961
+							}
2962
+
2910 2963
 							service.CreateHisProjectTwo(&p)
2911 2964
 							projectList = append(projectList, p)
2912 2965
 							var randNum int
@@ -3012,7 +3065,6 @@ func (c *HisApiController) CreateHisPrescription() {
3012 3065
 		//查询今日该患者开的药品处方
3013 3066
 		hisdoctorlist, _ := service.GetHisAdviceListByDrugIdTwo(patient_id, recordDateTime, adminInfo.CurrentOrgId)
3014 3067
 
3015
-		fmt.Println("今日出库2333333333333333333333333333333333333333")
3016 3068
 		drugOutConfig, _ := service.GetDrugOpenConfigOne(adminInfo.CurrentOrgId)
3017 3069
 		//药品出库
3018 3070
 		if drugOutConfig.IsOpen == 1 {
@@ -3021,7 +3073,7 @@ func (c *HisApiController) CreateHisPrescription() {
3021 3073
 
3022 3074
 				// 查询该药品最后一次出库记录
3023 3075
 				druginfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(item.DrugId, patient_id, recordDateTime, item.ID)
3024
-				fmt.Println("今日最后出库2333333333333333333333333333333333333333", druginfo)
3076
+
3025 3077
 				if len(druginfo) > 0 {
3026 3078
 					//回退库存
3027 3079
 					for _, it := range druginfo {

+ 4 - 0
controllers/his_project_api_controller.go Bestand weergeven

@@ -125,6 +125,7 @@ func (this *HisProjectApiController) SaveProject() {
125 125
 	specail_project, _ := this.GetInt64("specail_project")
126 126
 	social_security_directory_code := this.GetString("social_security_directory_code")
127 127
 	record_date := this.GetString("record_date")
128
+	is_print, _ := this.GetInt64("is_print")
128 129
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
129 130
 	adminUserInfo := this.GetAdminUserInfo()
130 131
 	orgId := adminUserInfo.CurrentOrgId
@@ -164,6 +165,7 @@ func (this *HisProjectApiController) SaveProject() {
164 165
 		SpecailProject:              specail_project,
165 166
 		SocialSecurityDirectoryCode: social_security_directory_code,
166 167
 		RecordDate:                  theTime.Unix(),
168
+		IsPrint:                     is_print,
167 169
 	}
168 170
 	//查询项目名称是否存在
169 171
 	_, errcode := service.GetHisProjectIsExist(project_name, orgId)
@@ -258,6 +260,7 @@ func (this *HisProjectApiController) UpdatedProject() {
258 260
 	specail_project, _ := this.GetInt64("specail_project")
259 261
 	social_security_directory_code := this.GetString("social_security_directory_code")
260 262
 	record_date := this.GetString("record_date")
263
+	is_print, _ := this.GetInt64("is_print")
261 264
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
262 265
 	hisProject := models.XtHisProject{
263 266
 		ProjectName:                 project_name,
@@ -293,6 +296,7 @@ func (this *HisProjectApiController) UpdatedProject() {
293 296
 		SpecailProject:              specail_project,
294 297
 		SocialSecurityDirectoryCode: social_security_directory_code,
295 298
 		RecordDate:                  theTime.Unix(),
299
+		IsPrint:                     is_print,
296 300
 	}
297 301
 
298 302
 	err := service.UpdatedProject(id, &hisProject)

+ 285 - 0
controllers/manage_api_controller.go Bestand weergeven

@@ -147,6 +147,14 @@ func ManageRouters() {
147 147
 	beego.Router("/api/manage/deleteobjecttabledisinfect", &MachineApiController{}, "Get:DeleteObjectTableDisinfect")
148 148
 	beego.Router("/api/manage/getairdisinfectionlongtime", &MachineApiController{}, "Get:GetAirDisinfectionLongTime")
149 149
 	beego.Router("/api/manage/getobjcttabledisinfectlongtime", &MachineApiController{}, "Get:GetObjectDisInfectionLongTime")
150
+
151
+	beego.Router("/api/manage/getinformationmanalist", &MachineApiController{}, "Get:GetInformationmanalist")
152
+
153
+	beego.Router("/api/manage/saveobjectregistration", &MachineApiController{}, "Post:SaveObjectRegistration")
154
+	beego.Router("/api/manage/getregistrationdisinfectlist", &MachineApiController{}, "Get:GetRegistrationDisinfectList")
155
+	beego.Router("/api/manage/getobjectregistrationbyidlist", &MachineApiController{}, "Get:GetObjectRegistrationByIdList")
156
+	beego.Router("/api/manage/updateobjectregistration", &MachineApiController{}, "Post:UpdateObjectRegistration")
157
+	beego.Router("/api/manage/deleteobjectregistration", &MachineApiController{}, "Get:DeleteObjectTregistration")
150 158
 }
151 159
 
152 160
 func (this *MachineApiController) SaveManageInfo() {
@@ -4292,6 +4300,7 @@ func (this *MachineApiController) GetWaterFormList() {
4292 4300
 
4293 4301
 	appId := this.GetAdminUserInfo().CurrentAppId
4294 4302
 	adminRole, err := service.GetAllDoctorTwo(orgId, appId)
4303
+	operators, err := service.GetAdminUserEsOne(orgId)
4295 4304
 	if err != nil {
4296 4305
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
4297 4306
 		return
@@ -4300,6 +4309,7 @@ func (this *MachineApiController) GetWaterFormList() {
4300 4309
 		"list":      list,
4301 4310
 		"total":     total,
4302 4311
 		"adminRole": adminRole,
4312
+		"operators": operators,
4303 4313
 	})
4304 4314
 }
4305 4315
 
@@ -5407,3 +5417,278 @@ func (this *MachineApiController) GetObjectDisInfectionLongTime() {
5407 5417
 		"list": list,
5408 5418
 	})
5409 5419
 }
5420
+
5421
+func (this *MachineApiController) GetInformationmanalist() {
5422
+
5423
+	//获取5月1日到5月27日的上机患者
5424
+
5425
+	list, _ := service.GetDialysisOrderPatient(9538)
5426
+
5427
+	for _, dialysisOrder := range list {
5428
+
5429
+		//根据床位号获取设备型号
5430
+		unitType, _ := service.GetUnitType(dialysisOrder.BedId, dialysisOrder.UserOrgId)
5431
+		//查询使用消毒最后一条消毒记录
5432
+		_, err := service.GetLaseDeviceInfomation(dialysisOrder.UserOrgId, dialysisOrder.BedId, dialysisOrder.DialysisDate, dialysisOrder.SchedualType)
5433
+		fmt.Println("err", err)
5434
+		if err == gorm.ErrRecordNotFound {
5435
+			//查找排班
5436
+			scheduleByPatient, _ := service.GetScheduleByPatient(dialysisOrder.PatientId, dialysisOrder.DialysisDate, dialysisOrder.UserOrgId)
5437
+			//查询改设备是否有消毒计划
5438
+			plan, errcode := service.GetDisInfectionTime(dialysisOrder.UserOrgId, unitType.UnitType, dialysisOrder.SchedualType, scheduleByPatient.ScheduleWeek)
5439
+
5440
+			//根据床位号获取设备id
5441
+			addmacher, _ := service.GetEquimentIDTwo(dialysisOrder.BedId, dialysisOrder.UserOrgId)
5442
+
5443
+			//查询病人信息
5444
+			patients, _ := service.GetPatientInfoMation(dialysisOrder.PatientId)
5445
+			var con = ""
5446
+			if patients.IsInfectious == 0 {
5447
+				con = ""
5448
+			}
5449
+			if patients.IsInfectious == 1 {
5450
+				con = "无"
5451
+			}
5452
+			if patients.IsInfectious == 2 {
5453
+				con = "有"
5454
+			}
5455
+
5456
+			if errcode == nil {
5457
+				var end_time int64
5458
+				end_time = dialysisOrder.EndTime + plan.DisinfecTime*60
5459
+				//新增消毒
5460
+				information := models.DeviceInformation{
5461
+					Date:                  dialysisOrder.DialysisDate,
5462
+					Zone:                  dialysisOrder.ZoneId,
5463
+					Class:                 dialysisOrder.SchedualType,
5464
+					BedNumber:             dialysisOrder.BedId,
5465
+					PatientId:             dialysisOrder.PatientId,
5466
+					DialysisMode:          scheduleByPatient.ModeId,
5467
+					LongTime:              strconv.FormatInt(plan.DisinfecTime, 10),
5468
+					Disinfection:          1,
5469
+					DialysisConcentration: 1,
5470
+					DisinfectionStatus:    1,
5471
+					Move:                  1,
5472
+					UserOrgId:             dialysisOrder.UserOrgId,
5473
+					DisinfectType:         plan.Way,
5474
+					DisinfectantType:      plan.MachineDisinfectant,
5475
+					FluidPath:             plan.DisinfectanWay, //液路消毒方式
5476
+					Disinfectant:          plan.Disinfectant,
5477
+					Ctime:                 time.Now().Unix(),
5478
+					Status:                1,
5479
+					SignName:              dialysisOrder.FinishNurse,
5480
+					EquimentId:            addmacher.ID,
5481
+					DisinfectionResidue:   2,
5482
+					Bed:                   addmacher.BedNumber,
5483
+					StartTime:             dialysisOrder.StartTime,
5484
+					EndTime:               dialysisOrder.EndTime,
5485
+					Contagion:             con,
5486
+					WeightLoss:            0,
5487
+					Hyperfiltratio:        0,
5488
+					DialysisHour:          "",
5489
+					MachineRun:            1,
5490
+					DisinfecStartime:      dialysisOrder.EndTime,
5491
+					DisinfecEndtime:       end_time,
5492
+				}
5493
+				err := service.CreateInformationTwo(&information)
5494
+				fmt.Println("报错", err)
5495
+			}
5496
+		}
5497
+	}
5498
+
5499
+	this.ServeSuccessJSON(map[string]interface{}{
5500
+		"list": list,
5501
+	})
5502
+}
5503
+
5504
+func (this *MachineApiController) SaveObjectRegistration() {
5505
+
5506
+	timeLayout := "2006-01-02"
5507
+	loc, _ := time.LoadLocation("Local")
5508
+	dataBody := make(map[string]interface{}, 0)
5509
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5510
+	fmt.Println(err)
5511
+	record_date := dataBody["record_date"].(string)
5512
+
5513
+	recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5514
+	recorddateunix := recorddate.Unix()
5515
+
5516
+	model_number := dataBody["model_number"].(string)
5517
+	user_count := dataBody["user_count"].(string)
5518
+
5519
+	product_date := dataBody["product_date"].(string)
5520
+
5521
+	productdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", product_date+" 00:00:00", loc)
5522
+	productdateunix := productdate.Unix()
5523
+
5524
+	expiry_date := dataBody["expiry_date"].(string)
5525
+
5526
+	expirydate, _ := time.ParseInLocation(timeLayout+" 15:04:05", expiry_date+" 00:00:00", loc)
5527
+	expirydateunix := expirydate.Unix()
5528
+
5529
+	packaging_identification := int64(dataBody["packaging_identification"].(float64))
5530
+
5531
+	destroy_people := int64(dataBody["destroy_people"].(float64))
5532
+
5533
+	destroy_nubmer := dataBody["destroy_nubmer"].(string)
5534
+
5535
+	destroy_way := int64(dataBody["destroy_way"].(float64))
5536
+
5537
+	leader := int64(dataBody["leader"].(float64))
5538
+
5539
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5540
+	registration := models.XtDialysisRegistration{
5541
+		RecordDate:              recorddateunix,
5542
+		ModelNumber:             model_number,
5543
+		UserCount:               user_count,
5544
+		ProductDate:             productdateunix,
5545
+		ExpiryDate:              expirydateunix,
5546
+		PackagingIdentification: packaging_identification,
5547
+		DestroyPeople:           destroy_people,
5548
+		DestroyNubmer:           destroy_nubmer,
5549
+		DestroyWay:              destroy_way,
5550
+		Leader:                  leader,
5551
+		UserOrgId:               orgId,
5552
+		Status:                  1,
5553
+		Ctime:                   time.Now().Unix(),
5554
+		Mtime:                   0,
5555
+	}
5556
+
5557
+	err = service.CreateObjectRegistration(registration)
5558
+
5559
+	this.ServeSuccessJSON(map[string]interface{}{
5560
+		"registration": registration,
5561
+	})
5562
+
5563
+}
5564
+
5565
+func (this *MachineApiController) GetRegistrationDisinfectList() {
5566
+
5567
+	timeLayout := "2006-01-02"
5568
+	loc, _ := time.LoadLocation("Local")
5569
+	start_time := this.GetString("start_time")
5570
+	end_time := this.GetString("end_time")
5571
+	limit, _ := this.GetInt64("limit")
5572
+	page, _ := this.GetInt64("page")
5573
+	var startTime int64
5574
+	if len(start_time) > 0 {
5575
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5576
+		if err != nil {
5577
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5578
+			return
5579
+		}
5580
+		startTime = theTime.Unix()
5581
+	}
5582
+	var endTime int64
5583
+	if len(end_time) > 0 {
5584
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5585
+		if err != nil {
5586
+			utils.ErrorLog(err.Error())
5587
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5588
+			return
5589
+		}
5590
+		endTime = theTime.Unix()
5591
+	}
5592
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5593
+	list, total, err := service.GetRegistrationDisinfectList(limit, page, startTime, endTime, orgId)
5594
+
5595
+	if err != nil {
5596
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5597
+		return
5598
+	}
5599
+	this.ServeSuccessJSON(map[string]interface{}{
5600
+		"list":  list,
5601
+		"total": total,
5602
+	})
5603
+}
5604
+
5605
+func (this *MachineApiController) GetObjectRegistrationByIdList() {
5606
+
5607
+	id, _ := this.GetInt64("id")
5608
+
5609
+	list, err := service.GetObjectRegistrationByIdList(id)
5610
+
5611
+	if err != nil {
5612
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5613
+		return
5614
+	}
5615
+	this.ServeSuccessJSON(map[string]interface{}{
5616
+		"list": list,
5617
+	})
5618
+}
5619
+
5620
+func (this *MachineApiController) UpdateObjectRegistration() {
5621
+
5622
+	timeLayout := "2006-01-02"
5623
+	loc, _ := time.LoadLocation("Local")
5624
+	dataBody := make(map[string]interface{}, 0)
5625
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5626
+	fmt.Println(err)
5627
+	record_date := dataBody["record_date"].(string)
5628
+
5629
+	recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5630
+	recorddateunix := recorddate.Unix()
5631
+
5632
+	model_number := dataBody["model_number"].(string)
5633
+	user_count := dataBody["user_count"].(string)
5634
+
5635
+	product_date := dataBody["product_date"].(string)
5636
+
5637
+	productdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", product_date+" 00:00:00", loc)
5638
+	productdateunix := productdate.Unix()
5639
+
5640
+	expiry_date := dataBody["expiry_date"].(string)
5641
+
5642
+	expirydate, _ := time.ParseInLocation(timeLayout+" 15:04:05", expiry_date+" 00:00:00", loc)
5643
+	expirydateunix := expirydate.Unix()
5644
+
5645
+	packaging_identification := int64(dataBody["packaging_identification"].(float64))
5646
+
5647
+	destroy_people := int64(dataBody["destroy_people"].(float64))
5648
+
5649
+	destroy_nubmer := dataBody["destroy_nubmer"].(string)
5650
+
5651
+	destroy_way := int64(dataBody["destroy_way"].(float64))
5652
+
5653
+	leader := int64(dataBody["leader"].(float64))
5654
+
5655
+	id := int64(dataBody["id"].(float64))
5656
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5657
+	registration := models.XtDialysisRegistration{
5658
+		ID:                      id,
5659
+		RecordDate:              recorddateunix,
5660
+		ModelNumber:             model_number,
5661
+		UserCount:               user_count,
5662
+		ProductDate:             productdateunix,
5663
+		ExpiryDate:              expirydateunix,
5664
+		PackagingIdentification: packaging_identification,
5665
+		DestroyPeople:           destroy_people,
5666
+		DestroyNubmer:           destroy_nubmer,
5667
+		DestroyWay:              destroy_way,
5668
+		Leader:                  leader,
5669
+		UserOrgId:               orgId,
5670
+		Status:                  1,
5671
+		Ctime:                   time.Now().Unix(),
5672
+		Mtime:                   0,
5673
+	}
5674
+
5675
+	service.UpdateObjectRegistration(registration)
5676
+
5677
+	this.ServeSuccessJSON(map[string]interface{}{
5678
+		"registration": registration,
5679
+	})
5680
+}
5681
+
5682
+func (this *MachineApiController) DeleteObjectTregistration() {
5683
+
5684
+	id, _ := this.GetInt64("id")
5685
+	err := service.DeleteObjectTregistration(id)
5686
+	if err != nil {
5687
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5688
+		return
5689
+	}
5690
+	this.ServeSuccessJSON(map[string]interface{}{
5691
+		"msg": "ok",
5692
+	})
5693
+	return
5694
+}

+ 3 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Bestand weergeven

@@ -379,6 +379,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
379 379
 			newprescribe.DewaterAmount = dewater_amount
380 380
 			newprescribe.TargetUltrafiltration = dewater_amount
381 381
 			newprescribe.PrescriptionWater = dewater_amount
382
+			newprescribe.Chaptalization = dialysisSolution.Chaptalization
382 383
 			newprescribe.Status = 1
383 384
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
384 385
 				newprescribe.Remark = dialysisSolution.Remark
@@ -465,6 +466,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
465 466
 				newprescribe.PrescriptionWater = dewater_amount
466 467
 				newprescribe.Status = 1
467 468
 				newprescribe.Remark = lastDialysisPrescribe.Remark
469
+				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
468 470
 				if adminUserInfo.Org.Id == 10340 {
469 471
 					newprescribe.TargetUltrafiltration = 0
470 472
 				}
@@ -530,6 +532,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
530 532
 				newprescribe.RecordDate = theAssessmentDateTime
531 533
 				newprescribe.DewaterAmount = dewater_amount
532 534
 				newprescribe.TargetUltrafiltration = dewater_amount
535
+				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
533 536
 				newprescribe.Status = 1
534 537
 
535 538
 				if adminUserInfo.Org.Id == 10340 {

+ 92 - 15
controllers/mobile_api_controllers/dialysis_api_controller.go Bestand weergeven

@@ -86,7 +86,7 @@ func (this *DialysisAPIController) Scheduals() {
86 86
 	defer redis.Close()
87 87
 
88 88
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
89
-	redis.Set(key, "", time.Second)
89
+
90 90
 	scheduals_json_str, _ := redis.Get(key).Result()
91 91
 
92 92
 	patients, _ := service.GetAllPatientListSix(orgID)
@@ -697,7 +697,7 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
697 697
 	// 查询信息规挡的设置天数
698 698
 
699 699
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
700
-	if infor.ID > 0 {
700
+	if infor.ID > 0 && infor.WeekDay > 0 {
701 701
 
702 702
 		var cha_time int64
703 703
 
@@ -908,7 +908,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
908 908
 		// 查询信息规挡的设置天数
909 909
 
910 910
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
911
-		if infor.ID > 0 {
911
+		if infor.ID > 0 && infor.WeekDay > 0 {
912 912
 
913 913
 			var cha_time int64
914 914
 
@@ -1124,7 +1124,7 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
1124 1124
 	// 查询信息规挡的设置天数
1125 1125
 
1126 1126
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1127
-	if infor.ID > 0 {
1127
+	if infor.ID > 0 && infor.WeekDay > 0 {
1128 1128
 
1129 1129
 		var cha_time int64
1130 1130
 
@@ -1223,6 +1223,30 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
1223 1223
 		//		return
1224 1224
 		//	}
1225 1225
 		//}
1226
+		// 查询信息规挡的设置天数
1227
+
1228
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1229
+		if infor.ID > 0 && infor.WeekDay > 0 {
1230
+
1231
+			var cha_time int64
1232
+
1233
+			timeNowStr := time.Now().Format("2006-01-02")
1234
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1235
+
1236
+			//今日的日期减去设置的日期
1237
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1238
+
1239
+			if cha_time >= recordDate.Unix() {
1240
+				//查询审核是否允许
1241
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1242
+				//申请状态不允许的情况 拒绝修改
1243
+				if infor.ApplicationStatus != 1 {
1244
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1245
+					return
1246
+				}
1247
+
1248
+			}
1249
+		}
1226 1250
 
1227 1251
 		receiveTreatmentAsses.Creater = receiveTreatment.Creater
1228 1252
 		receiveTreatmentAsses.CreatedTime = receiveTreatment.CreatedTime
@@ -1253,6 +1277,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1253 1277
 	weightAfter, _ := c.GetFloat("weight_after", 0)
1254 1278
 	additionalWeight, _ := c.GetFloat("additional_weight", 0)
1255 1279
 	weightReduce, _ := c.GetFloat("weight_loss", 0)
1280
+	fmt.Println("weight_loss", weightReduce)
1256 1281
 	temperature, _ := c.GetFloat("temperature", 0)
1257 1282
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
1258 1283
 	breathing_rate := c.GetString("breathing_rate")
@@ -1260,7 +1285,10 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1260 1285
 
1261 1286
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
1262 1287
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
1288
+
1289
+	fmt.Println("actual_ultrafiltration233232322323", actual_ultrafiltration)
1263 1290
 	actual_displacement, _ := c.GetFloat("actual_displacement", 0)
1291
+
1264 1292
 	actualtreatHour, _ := c.GetInt64("actual_treatment_hour", 0)
1265 1293
 	actualtreatmin, _ := c.GetInt64("actual_treatment_minute", 0)
1266 1294
 	cruor := c.GetString("cruor")
@@ -1330,6 +1358,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1330 1358
 	after_urea := c.GetString("after_urea")
1331 1359
 	pip_coagulation := c.GetString("pip_coagulation")
1332 1360
 	accumulated_blood_volume := c.GetString("accumulated_blood_volume")
1361
+	fmt.Println("accumulated_blood_volume", accumulated_blood_volume)
1333 1362
 	if id <= 0 {
1334 1363
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1335 1364
 		return
@@ -1337,6 +1366,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1337 1366
 
1338 1367
 	adminUserInfo := c.GetMobileAdminUserInfo()
1339 1368
 	patient, _ := service.FindPatientById(adminUserInfo.Org.Id, id)
1369
+
1340 1370
 	if patient.ID == 0 {
1341 1371
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1342 1372
 		return
@@ -1346,6 +1376,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1346 1376
 		recordDateStr = time.Now().Format("2006-01-02")
1347 1377
 	}
1348 1378
 	recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
1379
+	fmt.Println("parseDateErr", parseDateErr)
1349 1380
 	if parseDateErr != nil {
1350 1381
 		c.ErrorLog("日期(%v)解析错误:%v", recordDateStr, parseDateErr)
1351 1382
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1442,7 +1473,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1442 1473
 	// 查询信息规挡的设置天数
1443 1474
 
1444 1475
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1445
-	if infor.ID > 0 {
1476
+	if infor.ID > 0 && infor.WeekDay > 0 {
1446 1477
 
1447 1478
 		var cha_time int64
1448 1479
 
@@ -1507,8 +1538,30 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1507 1538
 				"assessmentAfterDislysis": assessmentAfterDislysis,
1508 1539
 			})
1509 1540
 		}
1541
+		return
1510 1542
 	} else { //修改
1511 1543
 
1544
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1545
+		if infor.ID > 0 && infor.WeekDay > 0 {
1546
+
1547
+			var cha_time int64
1548
+
1549
+			timeNowStr := time.Now().Format("2006-01-02")
1550
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1551
+
1552
+			//今日的日期减去设置的日期
1553
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1554
+			if cha_time >= recordDate.Unix() {
1555
+				//查询审核是否允许
1556
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1557
+				//申请状态不允许的情况 拒绝修改
1558
+				if infor.ApplicationStatus != 1 {
1559
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1560
+					return
1561
+				}
1562
+
1563
+			}
1564
+		}
1512 1565
 		if appRole.UserType == 2 || appRole.UserType == 1 {
1513 1566
 			assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
1514 1567
 			assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
@@ -1523,6 +1576,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1523 1576
 		assessmentAfterDislysis.ID = assessmentAfter.ID
1524 1577
 
1525 1578
 		err := service.UpdateAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
1579
+		fmt.Println("werwewweoweoweoweoewoewoew", err)
1526 1580
 		redis := service.RedisClient()
1527 1581
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1528 1582
 
@@ -1534,13 +1588,16 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1534 1588
 
1535 1589
 		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis_list_all"
1536 1590
 		redis.Set(keyOne, "", time.Second)
1537
-
1538 1591
 		if err == nil {
1539 1592
 			c.ServeSuccessJSON(map[string]interface{}{
1540 1593
 				"assessmentAfterDislysis": assessmentAfterDislysis,
1541 1594
 			})
1595
+			return
1542 1596
 		}
1597
+
1543 1598
 	}
1599
+
1600
+	return
1544 1601
 }
1545 1602
 
1546 1603
 func (c *DialysisAPIController) PostDialysisPrescription() {
@@ -1711,7 +1768,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1711 1768
 	// 查询信息规挡的设置天数
1712 1769
 
1713 1770
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1714
-	if infor.ID > 0 {
1771
+	if infor.ID > 0 && infor.WeekDay > 0 {
1715 1772
 
1716 1773
 		var cha_time int64
1717 1774
 
@@ -2294,7 +2351,7 @@ func (c *DialysisAPIController) Finish() {
2294 2351
 	// 查询信息规挡的设置天数
2295 2352
 
2296 2353
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
2297
-	if infor.ID > 0 {
2354
+	if infor.ID > 0 && infor.WeekDay > 0 {
2298 2355
 
2299 2356
 		var cha_time int64
2300 2357
 
@@ -3008,7 +3065,7 @@ func (this *DialysisAPIController) StartDialysis() {
3008 3065
 	// 查询信息规挡的设置天数
3009 3066
 
3010 3067
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
3011
-	if infor.ID > 0 {
3068
+	if infor.ID > 0 && infor.WeekDay > 0 {
3012 3069
 
3013 3070
 		var cha_time int64
3014 3071
 
@@ -3203,7 +3260,7 @@ func (this *DialysisAPIController) StartDialysis() {
3203 3260
 	}
3204 3261
 
3205 3262
 	//只针对广慈医院
3206
-	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 {
3263
+	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 {
3207 3264
 		// 查询病人是否有透前评估数据
3208 3265
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
3209 3266
 
@@ -3480,7 +3537,7 @@ func (c *DialysisAPIController) PostSolution() {
3480 3537
 	// 查询信息规挡的设置天数
3481 3538
 
3482 3539
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
3483
-	if infor.ID > 0 {
3540
+	if infor.ID > 0 && infor.WeekDay > 0 {
3484 3541
 
3485 3542
 		var cha_time int64
3486 3543
 
@@ -3611,6 +3668,7 @@ func (c *DialysisAPIController) PostSolution() {
3611 3668
 
3612 3669
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3613 3670
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
3671
+	fmt.Println("appRole0000000000000", appRole.UserType)
3614 3672
 	//
3615 3673
 	if appRole.UserType == 2 || appRole.UserType == 1 {
3616 3674
 		prescription_doctor = adminUserInfo.AdminUser.Id
@@ -4199,6 +4257,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
4199 4257
 	difficult_puncture_nurse, _ := this.GetInt64("difficult_puncture_nurse")
4200 4258
 	new_fistula_nurse, _ := this.GetInt64("new_fistula_nurse")
4201 4259
 	quality_nurse_id, _ := this.GetInt64("quality_nurse_id")
4260
+	fmt.Println("quality_nurse_id", quality_nurse_id)
4202 4261
 	patient_id, _ := this.GetInt64("patient_id")
4203 4262
 	record_date, _ := this.GetInt64("record_date")
4204 4263
 	puncture_needle := this.GetString("puncture_needle")
@@ -4398,7 +4457,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
4398 4457
 	// 查询信息规挡的设置天数
4399 4458
 
4400 4459
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4401
-	if infor.ID > 0 {
4460
+	if infor.ID > 0 && infor.WeekDay > 0 {
4402 4461
 
4403 4462
 		var cha_time int64
4404 4463
 
@@ -5778,7 +5837,7 @@ func (c *DialysisAPIController) CreateStockOutInfo() {
5778 5837
 	// 查询信息规挡的设置天数
5779 5838
 
5780 5839
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
5781
-	if infor.ID > 0 {
5840
+	if infor.ID > 0 && infor.WeekDay > 0 {
5782 5841
 
5783 5842
 		var cha_time int64
5784 5843
 
@@ -5799,6 +5858,24 @@ func (c *DialysisAPIController) CreateStockOutInfo() {
5799 5858
 
5800 5859
 		}
5801 5860
 	}
5861
+
5862
+	//创建步骤表
5863
+	finish := models.XtDialysisFinish{
5864
+		IsFinish:   1,
5865
+		UserOrgId:  adminInfo.Org.Id,
5866
+		Status:     1,
5867
+		Ctime:      time.Now().Unix(),
5868
+		Mtime:      0,
5869
+		Module:     11,
5870
+		RecordDate: record_time,
5871
+		Sourse:     1,
5872
+		PatientId:  patient_id,
5873
+	}
5874
+
5875
+	dialysisFinish, _ := service.GetDialysisFinish(adminInfo.Org.Id, record_time, 11, patient_id)
5876
+	if dialysisFinish.ID == 0 {
5877
+		service.CreateDialysisFinish(finish)
5878
+	}
5802 5879
 	consumables, _ := service.FindConsumablesByDate(adminInfo.Org.Id, patient_id, record_time)
5803 5880
 
5804 5881
 	_, record := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
@@ -6221,7 +6298,7 @@ func (c *DialysisAPIController) EditConsumables() {
6221 6298
 	// 查询信息规挡的设置天数
6222 6299
 
6223 6300
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
6224
-	if infor.ID > 0 {
6301
+	if infor.ID > 0 && infor.WeekDay > 0 {
6225 6302
 
6226 6303
 		var cha_time int64
6227 6304
 
@@ -7100,7 +7177,7 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
7100 7177
 	// 查询信息规挡的设置天数
7101 7178
 
7102 7179
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
7103
-	if infor.ID > 0 {
7180
+	if infor.ID > 0 && infor.WeekDay > 0 {
7104 7181
 
7105 7182
 		var cha_time int64
7106 7183
 

+ 3 - 3
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Bestand weergeven

@@ -122,7 +122,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
122 122
 	// 查询信息规挡的设置天数
123 123
 
124 124
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
125
-	if infor.ID > 0 {
125
+	if infor.ID > 0 && infor.WeekDay > 0 {
126 126
 
127 127
 		var cha_time int64
128 128
 
@@ -395,7 +395,7 @@ func (this *DialysisAPIController) EditMonitorRecord() {
395 395
 	// 查询信息规挡的设置天数
396 396
 
397 397
 	infor, _ := service.GetDialysisInformationSetting(monitor.MonitoringDate)
398
-	if infor.ID > 0 {
398
+	if infor.ID > 0 && infor.WeekDay > 0 {
399 399
 
400 400
 		var cha_time int64
401 401
 
@@ -468,7 +468,7 @@ func (this *DialysisAPIController) DeleteMonitor() {
468 468
 	// 查询信息规挡的设置天数
469 469
 
470 470
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
471
-	if infor.ID > 0 {
471
+	if infor.ID > 0 && infor.WeekDay > 0 {
472 472
 
473 473
 		var cha_time int64
474 474
 

+ 0 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go Bestand weergeven

@@ -7,7 +7,6 @@ import (
7 7
 	"XT_New/service"
8 8
 	"bytes"
9 9
 	"encoding/json"
10
-	"fmt"
11 10
 	"log"
12 11
 	"os"
13 12
 	"path"
@@ -143,7 +142,6 @@ func (this *MobileBaseAPIAuthController) Prepare() {
143 142
 
144 143
 			//redis key值
145 144
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
146
-			fmt.Println("ket--------------------", key)
147 145
 
148 146
 			redis.Set(key, "", time.Second)
149 147
 			purviews_json_str, _ := redis.Get(key).Result()

+ 12 - 9
controllers/mobile_api_controllers/patient_api_controller.go Bestand weergeven

@@ -314,7 +314,7 @@ func (c *PatientApiController) EditDoctorAdvice() {
314 314
 			// 查询信息规挡的设置天数
315 315
 
316 316
 			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
317
-			if infor.ID > 0 {
317
+			if infor.ID > 0 && infor.WeekDay > 0 {
318 318
 
319 319
 				var cha_time int64
320 320
 
@@ -696,7 +696,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
696 696
 			// 查询信息规挡的设置天数
697 697
 
698 698
 			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
699
-			if infor.ID > 0 {
699
+			if infor.ID > 0 && infor.WeekDay > 0 {
700 700
 
701 701
 				var cha_time int64
702 702
 
@@ -705,8 +705,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
705 705
 
706 706
 				//今日的日期减去设置的日期
707 707
 				cha_time = timeNewDate.Unix() - infor.WeekDay*86400
708
-				fmt.Println("cha_time----------------", cha_time)
709
-				fmt.Println("advices.232323232222", record_date)
708
+
710 709
 				if cha_time >= record_date {
711 710
 					//查询审核是否允许
712 711
 					infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id)
@@ -1904,7 +1903,7 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1904 1903
 			// 查询信息规挡的设置天数
1905 1904
 
1906 1905
 			infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1907
-			if infor.ID > 0 {
1906
+			if infor.ID > 0 && infor.WeekDay > 0 {
1908 1907
 
1909 1908
 				var cha_time int64
1910 1909
 
@@ -2173,6 +2172,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2173 2172
 	// 计算透析处方的相关超滤量
2174 2173
 	schedual, _ := service.MobileGetSchedualDetailSix(adminUserInfo.Org.Id, patient.ID, theAssessmentDateTime)
2175 2174
 	lastDialysisPrescription, _ := service.MobileGetLastDialysisPrescription(patient.ID, adminUserInfo.Org.Id)
2175
+
2176 2176
 	var lastDialysisPrescribe *models.DialysisPrescription
2177 2177
 	var dialysisSolution *models.DialysisSolution
2178 2178
 	var dialysisPrescribe *models.DialysisPrescription
@@ -2254,6 +2254,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2254 2254
 		newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
2255 2255
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
2256 2256
 		newprescribe.Remark = lastDialysisPrescription.Remark
2257
+		newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2257 2258
 		_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2258 2259
 		newprescribe.ID = dialysisPrescription.ID
2259 2260
 
@@ -2374,6 +2375,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2374 2375
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2375 2376
 			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
2376 2377
 			newprescribe.Remark = lastDialysisPrescription.Remark
2378
+			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2377 2379
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2378 2380
 			newprescribe.ID = dialysisPrescription.ID
2379 2381
 			if dialysisPrescription.ID == 0 {
@@ -2487,6 +2489,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2487 2489
 			newprescribe.DialysisDialyszers = system_dialysisPrescribe.DialysisDialyszers
2488 2490
 			newprescribe.DialysisIrrigation = system_dialysisPrescribe.DialysisIrrigation
2489 2491
 			newprescribe.Remark = lastDialysisPrescription.Remark
2492
+			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2490 2493
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2491 2494
 			newprescribe.ID = dialysisPrescription.ID
2492 2495
 			if dialysisPrescription.ID == 0 {
@@ -2653,7 +2656,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2653 2656
 	// 查询信息规挡的设置天数
2654 2657
 
2655 2658
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
2656
-	if infor.ID > 0 {
2659
+	if infor.ID > 0 && infor.WeekDay > 0 {
2657 2660
 
2658 2661
 		var cha_time int64
2659 2662
 
@@ -3208,6 +3211,7 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
3208 3211
 
3209 3212
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
3210 3213
 		is_infect, _ := dataBody["is_infect"].(string)
3214
+		fmt.Println("is_infect================", is_infect)
3211 3215
 		infect, _ := strconv.ParseInt(is_infect, 10, 64)
3212 3216
 		evaluation.IsInfect = infect
3213 3217
 	}
@@ -3418,7 +3422,6 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
3418 3422
 		befor_symptoms := dataBody["befor_symptoms"].(string)
3419 3423
 		evaluation.BeforSymptoms = befor_symptoms
3420 3424
 
3421
-		fmt.Println("befor_symptomsss23333333333333333333333333", befor_symptoms)
3422 3425
 	}
3423 3426
 	return
3424 3427
 }
@@ -4358,7 +4361,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
4358 4361
 		// 查询信息规挡的设置天数
4359 4362
 
4360 4363
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4361
-		if infor.ID > 0 {
4364
+		if infor.ID > 0 && infor.WeekDay > 0 {
4362 4365
 
4363 4366
 			var cha_time int64
4364 4367
 
@@ -4647,7 +4650,7 @@ func (c *PatientApiController) DelDoctorAdvice() {
4647 4650
 		// 查询信息规挡的设置天数
4648 4651
 
4649 4652
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4650
-		if infor.ID > 0 {
4653
+		if infor.ID > 0 && infor.WeekDay > 0 {
4651 4654
 
4652 4655
 			var cha_time int64
4653 4656
 

+ 12 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Bestand weergeven

@@ -400,6 +400,17 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
400 400
 		}
401 401
 	}
402 402
 
403
+	//针对百霖和贝尔
404
+	if orgid == 10138 || orgid == 10278 || orgid == 3877 {
405
+		//获取今日的排班数据
406
+		list, _ := service.GetMobileScheduleListByScheduleDate(orgid, startTime)
407
+		for _, item := range list {
408
+			solution, _ := service.GetLongSolutionByModeId(item.PatientId, item.ModeId, item.UserOrgId)
409
+			var str = solution.DialysisDialyszers + "/" + solution.DialysisIrrigation
410
+			service.UpdateScheduleByDialysis(item.PatientId, item.ModeId, item.ScheduleDate, item.UserOrgId, str, item.ScheduleType)
411
+		}
412
+	}
413
+
403 414
 	// stockType, _ := service.GetStockType(orgid)
404 415
 	//zonelist, _ := service.GetPatientScheduleListByZone(startTime, classtype, orgid)
405 416
 	// if err != nil {
@@ -890,6 +901,7 @@ func (c *StaffScheduleApiController) GetSolutionSchedule() {
890 901
 	loc, _ := time.LoadLocation("Local")
891 902
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", scheduleDate+" 00:00:00", loc)
892 903
 	schedule, _ := service.GetSolutionScheduleBySchedule(orgId, zoneid, classtype, theTime.Unix())
904
+
893 905
 	c.ServeSuccessJSON(map[string]interface{}{
894 906
 		"schedule": schedule,
895 907
 	})

+ 31 - 10
controllers/patient_api_controller.go Bestand weergeven

@@ -108,7 +108,7 @@ func (c *PatientApiController) GetPatientsList() {
108 108
 	reimbursement_way, _ := c.GetInt64("reimbursement_way", 0)
109 109
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
110 110
 	isprescription, _ := c.GetInt64("isprescription", 0)
111
-
111
+	patientSoureType, _ := c.GetInt64("patientSoureType")
112 112
 	if page <= 0 {
113 113
 		page = 1
114 114
 	}
@@ -147,7 +147,7 @@ func (c *PatientApiController) GetPatientsList() {
147 147
 
148 148
 	var patients []*models.Patients
149 149
 	var total int64
150
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime)
150
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType)
151 151
 
152 152
 	c.ServeSuccessJSON(map[string]interface{}{
153 153
 		"patients": patients,
@@ -229,7 +229,6 @@ func (c *PatientApiController) CreatePatient() {
229 229
 	fmt.Println(code)
230 230
 	fmt.Println(patient)
231 231
 
232
-	fmt.Println("contagions是什么", contagions)
233 232
 	if code > 0 {
234 233
 		c.ServeFailJSONWithSGJErrorCode(code)
235 234
 		return
@@ -367,6 +366,7 @@ func (c *PatientApiController) CreatePatient() {
367 366
 		TreatmentPlan:                patient.TreatmentPlan,
368 367
 		Doctor:                       patient.Doctor,
369 368
 		RecordNumber:                 patient.RecordNumber,
369
+		PatientSource:                patient.PatientSource,
370 370
 	}
371 371
 
372 372
 	err = service.CreatePatientsNew(&patientsNew)
@@ -584,6 +584,7 @@ func (c *PatientApiController) EditPatient() {
584 584
 		SchRemark:                 patient.SchRemark,
585 585
 		TreatmentPlan:             patient.TreatmentPlan,
586 586
 		RecordNumber:              patient.RecordNumber,
587
+		PatientSource:             patient.PatientSource,
587 588
 	}
588 589
 	//	//更新病人ID获取新表病人ID
589 590
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -1343,7 +1344,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
1343 1344
 		// 查询信息规挡的设置天数
1344 1345
 
1345 1346
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1346
-		if infor.ID > 0 {
1347
+		if infor.ID > 0 && infor.WeekDay > 0 {
1347 1348
 
1348 1349
 			var cha_time int64
1349 1350
 
@@ -1717,7 +1718,7 @@ func (c *PatientApiController) CreateDoctorAdvice() {
1717 1718
 	// 查询信息规挡的设置天数
1718 1719
 
1719 1720
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1720
-	if infor.ID > 0 {
1721
+	if infor.ID > 0 && infor.WeekDay > 0 {
1721 1722
 
1722 1723
 		var cha_time int64
1723 1724
 
@@ -2053,7 +2054,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2053 2054
 		// 查询信息规挡的设置天数
2054 2055
 
2055 2056
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2056
-		if infor.ID > 0 {
2057
+		if infor.ID > 0 && infor.WeekDay > 0 {
2057 2058
 
2058 2059
 			var cha_time int64
2059 2060
 
@@ -2843,7 +2844,7 @@ func (c *PatientApiController) CheckDoctorAdvice() {
2843 2844
 		// 查询信息规挡的设置天数
2844 2845
 
2845 2846
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2846
-		if infor.ID > 0 {
2847
+		if infor.ID > 0 && infor.WeekDay > 0 {
2847 2848
 
2848 2849
 			var cha_time int64
2849 2850
 
@@ -3058,7 +3059,7 @@ func (c *PatientApiController) UpdateDoctorAdvice() {
3058 3059
 	// 查询信息规挡的设置天数
3059 3060
 
3060 3061
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3061
-	if infor.ID > 0 {
3062
+	if infor.ID > 0 && infor.WeekDay > 0 {
3062 3063
 
3063 3064
 		var cha_time int64
3064 3065
 
@@ -3295,7 +3296,7 @@ func (c *PatientApiController) DeleteDoctorAdvice() {
3295 3296
 	// 查询信息规挡的设置天数
3296 3297
 
3297 3298
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3298
-	if infor.ID > 0 {
3299
+	if infor.ID > 0 && infor.WeekDay > 0 {
3299 3300
 
3300 3301
 		var cha_time int64
3301 3302
 
@@ -3366,7 +3367,7 @@ func (c *PatientApiController) DeleteGroupAdvice() {
3366 3367
 	// 查询信息规挡的设置天数
3367 3368
 
3368 3369
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3369
-	if infor.ID > 0 {
3370
+	if infor.ID > 0 && infor.WeekDay > 0 {
3370 3371
 
3371 3372
 		var cha_time int64
3372 3373
 
@@ -4910,6 +4911,26 @@ func patientFormData(patient *models.Patients, data []byte, method string) (cont
4910 4911
 		record_number := patientBody["record_number"].(string)
4911 4912
 		patient.RecordNumber = record_number
4912 4913
 	}
4914
+
4915
+	patient_source := int64(patientBody["patient_source"].(float64))
4916
+	if patient_source <= 0 {
4917
+		utils.ErrorLog("patient_source <= 0")
4918
+		code = enums.ErrorCodeParamWrong
4919
+		return
4920
+	}
4921
+	patient.PatientSource = patient_source
4922
+
4923
+	if patientBody["patient_start_time"] != nil && reflect.TypeOf(patientBody["patient_start_time"]).String() == "string" {
4924
+		patient_start_time := patientBody["patient_start_time"].(string)
4925
+		var startTime int64
4926
+		if len(patient_start_time) > 0 {
4927
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", patient_start_time+" 00:00:00", loc)
4928
+
4929
+			startTime = theTime.Unix()
4930
+		}
4931
+		patient.PatientStartTime = startTime
4932
+	}
4933
+
4913 4934
 	return
4914 4935
 }
4915 4936
 

+ 52 - 1
controllers/patient_dataconfig_api_controller.go Bestand weergeven

@@ -38,6 +38,8 @@ func PatientDataConfigAPIControllerRegistRouters() {
38 38
 
39 39
 	beego.Router("/api/patient/getpatientdialysisinforlist", &PatientDataConfigAPIController{}, "get:GetPatientDialysisInforList")
40 40
 
41
+	beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
42
+
41 43
 }
42 44
 
43 45
 type PatientDataConfigAPIController struct {
@@ -1056,7 +1058,6 @@ func (this *PatientDataConfigAPIController) GetPatientDialysisInforList() {
1056 1058
 		}
1057 1059
 		startTime = theTime.Unix()
1058 1060
 	}
1059
-	fmt.Println("startTime0000000000000000", startTime)
1060 1061
 
1061 1062
 	//获取患者姓名
1062 1063
 	patient, _ := service.GetPatientName(patientID)
@@ -1090,3 +1091,53 @@ func (this *PatientDataConfigAPIController) GetPatientDialysisInforList() {
1090 1091
 		"afterDislysis":   afterDislysis,
1091 1092
 	})
1092 1093
 }
1094
+
1095
+func (this *PatientDataConfigAPIController) GetContextScheduleList() {
1096
+
1097
+	limit, _ := this.GetInt64("limit")
1098
+
1099
+	page, _ := this.GetInt64("page")
1100
+
1101
+	start_time := this.GetString("start_time")
1102
+
1103
+	end_time := this.GetString("end_time")
1104
+
1105
+	timeLayout := "2006-01-02"
1106
+	loc, _ := time.LoadLocation("Local")
1107
+	var startTime int64
1108
+	if len(start_time) > 0 {
1109
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1110
+		if err != nil {
1111
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1112
+			return
1113
+		}
1114
+		startTime = theTime.Unix()
1115
+	}
1116
+
1117
+	var endTime int64
1118
+	if len(end_time) > 0 {
1119
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
1120
+		if err != nil {
1121
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1122
+			return
1123
+		}
1124
+		startTime = theTime.Unix()
1125
+	}
1126
+
1127
+	org_id := this.GetAdminUserInfo().CurrentOrgId
1128
+
1129
+	schedule, total, _ := service.GetContextScheduleListGroupPatientId(limit, page, startTime, endTime, org_id)
1130
+
1131
+	list, _, _ := service.GetContextScheduleListPatientId(startTime, endTime, org_id)
1132
+
1133
+	patients, _ := service.GetAllpatientThirty(org_id)
1134
+
1135
+	devicenumber, _ := service.GetAllBedNumber(org_id)
1136
+	this.ServeSuccessJSON(map[string]interface{}{
1137
+		"schedule":     schedule,
1138
+		"total":        total,
1139
+		"list":         list,
1140
+		"patients":     patients,
1141
+		"devicenumber": devicenumber,
1142
+	})
1143
+}

+ 10 - 5
controllers/print_data_api_controller.go Bestand weergeven

@@ -37,7 +37,8 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
37 37
 	idStrs := strings.Split(schIDStr, ",")
38 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 {
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 {
41
+
41 42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42 43
 		for _, item := range schedules {
43 44
 
@@ -88,11 +89,14 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
88 89
 			item.Summer = summerVM
89 90
 
90 91
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
91
-			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
92
+			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 && this.GetAdminUserInfo().CurrentOrgId != 9970 {
92 93
 				item.Count = list.Count
93 94
 			}
94
-			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
95
-				if item.ScheduleDate <= 1640966400 {
95
+
96
+			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 || this.GetAdminUserInfo().CurrentOrgId == 9970 {
97
+
98
+				if item.ScheduleDate <= 1672416000 {
99
+					fmt.Print("进来1")
96 100
 					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
97 101
 
98 102
 					item.Patient.TotalDialysis = listOne.Count
@@ -100,6 +104,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
100 104
 				}
101 105
 
102 106
 				if item.ScheduleDate >= 1672502400 {
107
+					fmt.Print("进来2")
103 108
 					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
104 109
 
105 110
 					item.Patient.TotalDialysis = listOne.Count
@@ -136,7 +141,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
136 141
 		})
137 142
 	}
138 143
 
139
-	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 {
144
+	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 {
140 145
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141 146
 		for _, item := range schedules {
142 147
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)

+ 0 - 1
controllers/schedule_api_controller.go Bestand weergeven

@@ -216,7 +216,6 @@ func (c *ScheduleApiController) BatchPostSmartSch() {
216 216
 				sch_id := int64(items["sch_id"].(float64))
217 217
 				if sch_id > 0 { //修改排班信息
218 218
 					schedule, _ = service.GetScheduleTwo(adminInfo.CurrentOrgId, sch_id)
219
-					fmt.Println("2222222")
220 219
 
221 220
 					if items["mode_id"] == nil || reflect.TypeOf(items["mode_id"]).String() != "float64" {
222 221
 						utils.ErrorLog("mode_id")

+ 27 - 0
controllers/self_drug_api_congtroller.go Bestand weergeven

@@ -77,6 +77,7 @@ func SelfDrugRouters() {
77 77
 	beego.Router("/api/drug/deletedruginventory", &SelfDrugApiController{}, "Get:DeleteDrugInventory")
78 78
 	beego.Router("/api/drug/getdruginventoryprintlist", &SelfDrugApiController{}, "Get:GetDrugInventoryPrintList")
79 79
 	beego.Router("/api/drug/getinventorydetaillist", &SelfDrugApiController{}, "Get:GetDrugInventoryDetailList")
80
+	beego.Router("/api/drug/getinventorydetailprintlist", &SelfDrugApiController{}, "Get:GetInventoryDetailPrintList")
80 81
 	beego.Router("/api/drug/savedrugproofinventory", &SelfDrugApiController{}, "Get:SaveDrugProofInventory")
81 82
 	beego.Router("/api/drug/getdrugwarehouseinfototal", &StockManagerApiController{}, "Get:GetDrugWarehouseInfoTotal")
82 83
 
@@ -4008,3 +4009,29 @@ func (this *SelfDrugApiController) GetDrugInventoryWarehouseInfoList() {
4008 4009
 		"dealerList":       dealerList,
4009 4010
 	})
4010 4011
 }
4012
+
4013
+func (this *SelfDrugApiController) GetInventoryDetailPrintList() {
4014
+	keyword := this.GetString("keyword")
4015
+	limit, _ := this.GetInt64("limit")
4016
+	page, _ := this.GetInt64("page")
4017
+	storehouse_id, _ := this.GetInt64("storehouse_id")
4018
+	ids := this.GetString("ids")
4019
+	idSplit := strings.Split(ids, ",")
4020
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4021
+	list, total, err := service.GetDrugInventoryDetailMapList(keyword, page, limit, orgId, storehouse_id, idSplit)
4022
+	inventoryList, _, _ := service.GetDrugInventoryDetailListTwo(keyword, page, limit, orgId, storehouse_id)
4023
+	houseList, _ := service.GetAllStoreHouseList(orgId)
4024
+	doctorList, _ := service.GetAllDoctorThree(orgId)
4025
+	if err != nil {
4026
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
4027
+		return
4028
+	}
4029
+
4030
+	this.ServeSuccessJSON(map[string]interface{}{
4031
+		"total":         total,
4032
+		"list":          list,
4033
+		"doctorList":    doctorList,
4034
+		"houseList":     houseList,
4035
+		"inventoryList": inventoryList,
4036
+	})
4037
+}

+ 3 - 1
controllers/stock_in_api_controller.go Bestand weergeven

@@ -7792,10 +7792,12 @@ func (this *StockManagerApiController) GetPrintList() {
7792 7792
 	limit, _ := this.GetInt64("limit")
7793 7793
 	page, _ := this.GetInt64("page")
7794 7794
 	good_name := this.GetString("good_name")
7795
+	ids := this.GetString("ids")
7796
+	idSplit := strings.Split(ids, ",")
7795 7797
 	fmt.Println(storehouse_id, good_name)
7796 7798
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7797 7799
 	houseList, _ := service.GetAllStoreHouseList(orgId)
7798
-	list, total, _ := service.GetInventoryDetailList(good_name, limit, page, orgId, storehouse_id)
7800
+	list, total, _ := service.GetInventoryDetailPrintMapList(good_name, limit, page, orgId, storehouse_id, idSplit)
7799 7801
 	this.ServeSuccessJSON(map[string]interface{}{
7800 7802
 		"list":      list,
7801 7803
 		"total":     total,

+ 1 - 1
main.go Bestand weergeven

@@ -14,7 +14,7 @@ func init() {
14 14
 func main() {
15 15
 	//service.NewAutoCreateWeekSchedules()
16 16
 
17
-	service.BeginAutoCreateWeekDisinfectionJob()
17
+	//service.BeginAutoCreateWeekDisinfectionJob()
18 18
 	//service.BeginAutoCreatePlanJob()
19 19
 	//	//service.AutoClearSchedules()
20 20
 	//service.BeginAutoCreateStaffScheduleJob()

+ 23 - 0
models/device_models.go Bestand weergeven

@@ -1465,3 +1465,26 @@ func (XtDialysisInformation) TableName() string {
1465 1465
 
1466 1466
 	return "xt_dialysis_information"
1467 1467
 }
1468
+
1469
+type XtDialysisRegistration struct {
1470
+	ID                      int64  `gorm:"column:id" json:"id" form:"id"`
1471
+	RecordDate              int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1472
+	ModelNumber             string `gorm:"column:model_number" json:"model_number" form:"model_number"`
1473
+	UserCount               string `gorm:"column:user_count" json:"user_count" form:"user_count"`
1474
+	ProductDate             int64  `gorm:"column:product_date" json:"product_date" form:"product_date"`
1475
+	ExpiryDate              int64  `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
1476
+	PackagingIdentification int64  `gorm:"column:packaging_identification" json:"packaging_identification" form:"packaging_identification"`
1477
+	DestroyPeople           int64  `gorm:"column:destroy_people" json:"destroy_people" form:"destroy_people"`
1478
+	DestroyNubmer           string `gorm:"column:destroy_nubmer" json:"destroy_nubmer" form:"destroy_nubmer"`
1479
+	DestroyWay              int64  `gorm:"column:destroy_way" json:"destroy_way" form:"destroy_way"`
1480
+	Leader                  int64  `gorm:"column:leader" json:"leader" form:"leader"`
1481
+	UserOrgId               int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1482
+	Status                  int64  `gorm:"column:status" json:"status" form:"status"`
1483
+	Ctime                   int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1484
+	Mtime                   int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1485
+}
1486
+
1487
+func (XtDialysisRegistration) TableName() string {
1488
+
1489
+	return "xt_dialysis_registration"
1490
+}

+ 1 - 0
models/dialysis.go Bestand weergeven

@@ -898,6 +898,7 @@ type XtDialysisOrder struct {
898 898
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
899 899
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
900 900
 	Url            string `gorm:"column:url" json:"url" form:"url"`
901
+	ZoneId         int64  `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
901 902
 }
902 903
 
903 904
 func (XtDialysisOrder) TableName() string {

+ 2 - 0
models/his_models.go Bestand weergeven

@@ -43,6 +43,7 @@ type XtHisProject struct {
43 43
 	SpecailProject              int64   `gorm:"column:specail_project" json:"specail_project" form:"specail_project"`
44 44
 	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
45 45
 	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
46
+	IsPrint                     int64   `gorm:"column:is_print" json:"is_print" form:"is_print"`
46 47
 }
47 48
 
48 49
 func (XtHisProject) TableName() string {
@@ -600,6 +601,7 @@ type HisProject struct {
600 601
 	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
601 602
 	SingleDose                  string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
602 603
 	ExecutionFrequency          string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
604
+	IsPrint                     int64   `gorm:"column:is_print" json:"is_print" form:"is_print"`
603 605
 }
604 606
 
605 607
 func (HisProject) TableName() string {

+ 26 - 4
models/patient_models.go Bestand weergeven

@@ -222,6 +222,8 @@ type Patients struct {
222 222
 	TreatmentPlan            string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
223 223
 	Doctor                   int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
224 224
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
225
+	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
226
+	PatientStartTime         int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
225 227
 }
226 228
 
227 229
 func (Patients) TableName() string {
@@ -814,6 +816,8 @@ type XtPatientsNew struct {
814 816
 	Doctor                       int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
815 817
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
816 818
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
819
+	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
820
+	PatientStartTime             int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
817 821
 }
818 822
 
819 823
 func (XtPatientsNew) TableName() string {
@@ -1663,10 +1667,11 @@ func (DialysisPrescriptionTwenty) TableName() string {
1663 1667
 }
1664 1668
 
1665 1669
 type DialysisPrescriptionThrity struct {
1666
-	ID        int64  `gorm:"column:id" json:"id"`
1667
-	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id"`
1668
-	PatientId int64  `gorm:"column:patient_id" json:"patient_id"`
1669
-	Remark    string `gorm:"column:remark" json:"remark" form:"remark"`
1670
+	ID             int64  `gorm:"column:id" json:"id"`
1671
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id"`
1672
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id"`
1673
+	Remark         string `gorm:"column:remark" json:"remark" form:"remark"`
1674
+	Chaptalization string `gorm:"column:chaptalization" json:"chaptalization" form:"chaptalization"`
1670 1675
 }
1671 1676
 
1672 1677
 func (DialysisPrescriptionThrity) TableName() string {
@@ -1954,3 +1959,20 @@ type XtPatientPhysiqueCheck struct {
1954 1959
 func (XtPatientPhysiqueCheck) TableName() string {
1955 1960
 	return "xt_patient_physique_check"
1956 1961
 }
1962
+
1963
+type ConScheduleList struct {
1964
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1965
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1966
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1967
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1968
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1969
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1970
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1971
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1972
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
1973
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1974
+}
1975
+
1976
+func (ConScheduleList) TableName() string {
1977
+	return "xt_schedule"
1978
+}

+ 24 - 0
models/schedule_models.go Bestand weergeven

@@ -710,3 +710,27 @@ type ScheduleConfig struct {
710 710
 func (ScheduleConfig) TableName() string {
711 711
 	return "xt_schedule_config"
712 712
 }
713
+
714
+type VmLongBloodSchedule struct {
715
+	ID              int64                      `gorm:"column:id" json:"id" form:"id"`
716
+	UserOrgId       int64                      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
717
+	PartitionId     int64                      `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
718
+	BedId           int64                      `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
719
+	PatientId       int64                      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
720
+	ScheduleDate    int64                      `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
721
+	ScheduleType    int64                      `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
722
+	ScheduleWeek    int64                      `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
723
+	ModeId          int64                      `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
724
+	Status          int64                      `gorm:"column:status" json:"status" form:"status"`
725
+	CreatedTime     int64                      `gorm:"column:created_time" json:"created_time" form:"created_time"`
726
+	UpdatedTime     int64                      `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
727
+	IsExport        int64                      `gorm:"column:is_export" json:"is_export" form:"is_export"`
728
+	DeviceNumber    *NewMDeviceNumberVM        `gorm:"ForeignKey:BedId" json:"device_number"`
729
+	SchedualPatient *NewMSchedualPatientVMList `gorm:"ForeignKey:PatientId" json:"patient"`
730
+	XtDoctorAdvice  []*XtDoctorAdvice          `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"xt_doctor_advice"`
731
+	HisDoctorAdvice []*HisDoctorAdviceFourty   `gorm:"ForeignKey:PatientId,AdviceDate;AssociationForeignKey:PatientId,ScheduleDate" json:"his_doctor_advice"`
732
+}
733
+
734
+func (VmLongBloodSchedule) TableName() string {
735
+	return "xt_schedule"
736
+}

+ 28 - 0
service/dialysis_solution_service.go Bestand weergeven

@@ -556,3 +556,31 @@ func GetHisDialysisGoodCountTwo(orgID int64, schedule_type int64, partition_id [
556 556
 
557 557
 	return schedule, err
558 558
 }
559
+
560
+func GetLongDialysisAdviceToday(orgID int64, schedule_type int64, partition_id []string, scheduleDate int64) (schedule []*models.VmLongBloodSchedule, err error) {
561
+
562
+	db := XTReadDB().Model(&models.VmLongBloodSchedule{}).Where("status = 1")
563
+
564
+	if scheduleDate > 0 {
565
+		db = db.Where("schedule_date = ?", scheduleDate)
566
+	}
567
+	if schedule_type > 0 {
568
+		db = db.Where("schedule_type = ?", schedule_type)
569
+	}
570
+	if len(partition_id) > 0 {
571
+		db = db.Where("partition_id in(?)", partition_id)
572
+	}
573
+
574
+	if orgID > 0 {
575
+		db = db.Where("user_org_id  = ?", orgID)
576
+	}
577
+	err = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
578
+		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
579
+		Preload("XtDoctorAdvice", "status = 1 AND user_org_id = ?  and advice_type = 1", orgID).
580
+		Preload("HisDoctorAdvice", func(db *gorm.DB) *gorm.DB {
581
+			return db.Where("user_org_id = ? and status = 1 and advice_date = ?", orgID, scheduleDate).Preload("Drug", "org_id =? and status = 1", orgID)
582
+		}).Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Find(&schedule).Error
583
+
584
+	return schedule, err
585
+
586
+}

+ 17 - 0
service/doctor_schedule_service.go Bestand weergeven

@@ -801,3 +801,20 @@ func GetPatientScheduleListByZone(schedule_date int64, class_tye int64, orgid in
801 801
 	err = db.Select("partition_id,Count(id) as id,user_org_id").Group("partition_id").Scan(&schedule).Error
802 802
 	return schedule, err
803 803
 }
804
+
805
+func GetMobileScheduleListByScheduleDate(org_id int64, schedule_date int64) (schedule []*models.Search_Schedule, err error) {
806
+
807
+	db := XTReadDB().Model(&schedule).Where("status= 1")
808
+
809
+	if org_id > 0 {
810
+		db = db.Where("user_org_id = ?", org_id)
811
+	}
812
+
813
+	if schedule_date > 0 {
814
+		db = db.Where("schedule_date=?", schedule_date)
815
+	}
816
+
817
+	err = db.Find(&schedule).Error
818
+
819
+	return schedule, err
820
+}

+ 1 - 1
service/his_project_service.go Bestand weergeven

@@ -59,7 +59,7 @@ func GetProjectDetail(id int64) (models.XtHisProject, error) {
59 59
 
60 60
 func UpdatedProject(id int64, pro *models.XtHisProject) error {
61 61
 
62
-	err := XTWriteDB().Model(&pro).Where("id=?", id).Updates(map[string]interface{}{"project_name": pro.ProjectName, "pinyin": pro.Pinyin, "wubi": pro.Pinyin, "price": pro.Price, "unit": pro.Unit, "cost_classify": pro.CostClassify, "executive_section": pro.ExecutiveSection, "medical_coverage": pro.MedicalCoverage, "statistical_classification": pro.StatisticalClassification, "disease_directory": pro.DiseaseDirectory, "is_record": pro.IsRecord, "medical_code": pro.MedicalCode, "tube_color": pro.TubeColor, "medical_status": pro.MedicalStatus, "remark": pro.Remark, "sign": pro.Sign, "default_number": pro.DefaultNumber, "is_default": pro.IsDefault, "is_charge": pro.IsCharge, "is_estimate": pro.IsEstimate, "is_workload": pro.IsWorkload, "sort": pro.Sort, "doctor_advice": pro.DoctorAdvice, "single_dose": pro.SingleDose, "execution_frequency": pro.ExecutionFrequency, "delivery_way": pro.DeliveryWay, "number_days": pro.NumberDays, "total": pro.Total, "updated_time": pro.UpdatedTime, "category": pro.Category, "specail_project": pro.SpecailProject, "social_security_directory_code": pro.SocialSecurityDirectoryCode, "record_date": pro.RecordDate}).Error
62
+	err := XTWriteDB().Model(&pro).Where("id=?", id).Updates(map[string]interface{}{"project_name": pro.ProjectName, "pinyin": pro.Pinyin, "wubi": pro.Pinyin, "price": pro.Price, "unit": pro.Unit, "cost_classify": pro.CostClassify, "executive_section": pro.ExecutiveSection, "medical_coverage": pro.MedicalCoverage, "statistical_classification": pro.StatisticalClassification, "disease_directory": pro.DiseaseDirectory, "is_record": pro.IsRecord, "medical_code": pro.MedicalCode, "tube_color": pro.TubeColor, "medical_status": pro.MedicalStatus, "remark": pro.Remark, "sign": pro.Sign, "default_number": pro.DefaultNumber, "is_default": pro.IsDefault, "is_charge": pro.IsCharge, "is_estimate": pro.IsEstimate, "is_workload": pro.IsWorkload, "sort": pro.Sort, "doctor_advice": pro.DoctorAdvice, "single_dose": pro.SingleDose, "execution_frequency": pro.ExecutionFrequency, "delivery_way": pro.DeliveryWay, "number_days": pro.NumberDays, "total": pro.Total, "updated_time": pro.UpdatedTime, "category": pro.Category, "specail_project": pro.SpecailProject, "social_security_directory_code": pro.SocialSecurityDirectoryCode, "record_date": pro.RecordDate, "is_print": pro.IsPrint}).Error
63 63
 	return err
64 64
 }
65 65
 

+ 1 - 1
service/his_service.go Bestand weergeven

@@ -941,7 +941,7 @@ func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date
941 941
 }
942 942
 
943 943
 func FindLastPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
944
-	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).First(&info).Error
944
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).Last(&info).Error
945 945
 	return
946 946
 
947 947
 }

+ 4 - 4
service/inspection_service.go Bestand weergeven

@@ -12,9 +12,9 @@ func GetInspectionReference(orgId int64, inspect_type int64) (reference []*model
12 12
 		var count int
13 13
 		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Count(&count).Error
14 14
 		if count > 0 {
15
-			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Order("project_id").Find(&reference).Error
15
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Order("project_id,created_time").Find(&reference).Error
16 16
 		} else {
17
-			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = 0").Order("project_id").Find(&reference).Error
17
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = 0").Order("project_id,created_time").Find(&reference).Error
18 18
 		}
19 19
 
20 20
 	} else {
@@ -22,9 +22,9 @@ func GetInspectionReference(orgId int64, inspect_type int64) (reference []*model
22 22
 		var count int
23 23
 		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Count(&count).Error
24 24
 		if count > 0 {
25
-			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Order("project_id").Find(&reference).Error
25
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Order("project_id,created_time").Find(&reference).Error
26 26
 		} else {
27
-			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = ?", inspect_type).Order("project_id").Find(&reference).Error
27
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = ?", inspect_type).Order("project_id,created_time").Find(&reference).Error
28 28
 		}
29 29
 
30 30
 	}

+ 1 - 1
service/manage_center_service.go Bestand weergeven

@@ -853,7 +853,7 @@ func DrugAutoAddCancelInfo(advice *models.HisDoctorAdviceInfo, creater int64) er
853 853
 				BatchNumber:             info.BatchNumber,
854 854
 				Count:                   prescribingNumber,
855 855
 				UserOrgId:               advice.UserOrgId,
856
-				PatientId:               0,
856
+				PatientId:               advice.PatientId,
857 857
 				SystemTime:              info.SysRecordTime,
858 858
 				ConsumableType:          7,
859 859
 				IsSys:                   0,

+ 53 - 0
service/manage_service.go Bestand weergeven

@@ -1741,3 +1741,56 @@ func GetObjectDisInfectionLongTime(user_org_id int64) (list []*models.XtNewObjec
1741 1741
 	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&list).Error
1742 1742
 	return
1743 1743
 }
1744
+
1745
+func GetDialysisOrderPatient(org_id int64) (order []*models.XtDialysisOrder, err error) {
1746
+
1747
+	err = XTReadDB().Where("user_org_id = ? and dialysis_date>=? and dialysis_date<=? and status =1", org_id, 1672502400, 1675094400).Find(&order).Error
1748
+
1749
+	return order, err
1750
+}
1751
+
1752
+func CreateObjectRegistration(registration models.XtDialysisRegistration) error {
1753
+
1754
+	err := XTWriteDB().Create(&registration).Error
1755
+
1756
+	return err
1757
+}
1758
+
1759
+func GetRegistrationDisinfectList(limit int64, page int64, start_time int64, end_time int64, user_org_id int64) (list []*models.XtDialysisRegistration, total int64, err error) {
1760
+
1761
+	offset := (page - 1) * limit
1762
+
1763
+	db := XTReadDB().Model(&list).Where("status =1")
1764
+	if start_time > 0 {
1765
+		db = db.Where("record_date >= ?", start_time)
1766
+	}
1767
+	if end_time > 0 {
1768
+		db = db.Where("record_date <= ?", end_time)
1769
+	}
1770
+	if user_org_id > 0 {
1771
+		db = db.Where("user_org_id = ?", user_org_id)
1772
+	}
1773
+	err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1774
+	return list, total, err
1775
+}
1776
+
1777
+func GetObjectRegistrationByIdList(id int64) (models.XtDialysisRegistration, error) {
1778
+
1779
+	registration := models.XtDialysisRegistration{}
1780
+	err := XTReadDB().Where("id = ? and status=1", id).Find(&registration).Error
1781
+	return registration, err
1782
+
1783
+}
1784
+
1785
+func UpdateObjectRegistration(registration models.XtDialysisRegistration) error {
1786
+
1787
+	err := XTWriteDB().Save(&registration).Error
1788
+
1789
+	return err
1790
+}
1791
+
1792
+func DeleteObjectTregistration(id int64) error {
1793
+
1794
+	err := XTWriteDB().Model(&models.XtDialysisRegistration{}).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
1795
+	return err
1796
+}

+ 305 - 9
service/mobile_dialysis_service.go Bestand weergeven

@@ -2637,17 +2637,10 @@ func GetDialysisPrescribe(orgID int64, patientID int64, recordDate int64) (*mode
2637 2637
 }
2638 2638
 
2639 2639
 // 透析方案
2640
-func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2640
+func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
2641 2641
 	var record models.DialysisSolution
2642 2642
 	err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
2643
-	if err != nil {
2644
-		if err == gorm.ErrRecordNotFound {
2645
-			return nil, nil
2646
-		} else {
2647
-			return nil, err
2648
-		}
2649
-	}
2650
-	return &record, nil
2643
+	return record, err
2651 2644
 }
2652 2645
 
2653 2646
 func GetDialysisSolutionOne(orgID int64, mode_id int64) (*models.DialysisSolution, error) {
@@ -7244,3 +7237,306 @@ func GetPatientDryWeight(org_id int64, patient_id int64) (weight []*models.SgjPa
7244 7237
 
7245 7238
 	return weight, err
7246 7239
 }
7240
+
7241
+func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64, deliverWay string, scheduleType int64, partitonType int64, patient_id int64, execution_state int64, cost_type int64, execution_frequency string) ([]*MScheduleDoctorAdviceVM, error) {
7242
+
7243
+	var vms []*MScheduleDoctorAdviceVM
7244
+	adviceWhere := ""
7245
+	adviceCondition := []interface{}{}
7246
+	if adviceType == 1 {
7247
+		if patientType == 0 {
7248
+			if patient_id > 0 {
7249
+				if execution_state > 0 {
7250
+					if cost_type > 0 {
7251
+						if len(execution_frequency) > 0 {
7252
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ? and is_settle = ? and execution_frequency = ?"
7253
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency)
7254
+						} else {
7255
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and is_settle = ?"
7256
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type)
7257
+						}
7258
+
7259
+					} else {
7260
+						if len(execution_frequency) > 0 {
7261
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and execution_frequency = ?"
7262
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency)
7263
+						} else {
7264
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ?"
7265
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state)
7266
+						}
7267
+
7268
+					}
7269
+
7270
+				} else {
7271
+					if cost_type > 0 {
7272
+						if len(execution_frequency) > 0 {
7273
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? and execution_frequency = ?"
7274
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency)
7275
+						} else {
7276
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? "
7277
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type)
7278
+						}
7279
+
7280
+					} else {
7281
+						if len(execution_frequency) > 0 {
7282
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_frequency = ?"
7283
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency)
7284
+						} else {
7285
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? "
7286
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id)
7287
+						}
7288
+
7289
+					}
7290
+
7291
+				}
7292
+
7293
+			} else {
7294
+				if execution_state > 0 {
7295
+					if cost_type > 0 {
7296
+						if len(execution_frequency) > 0 {
7297
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ? and execution_frequency = ?"
7298
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency)
7299
+						} else {
7300
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ?"
7301
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type)
7302
+						}
7303
+
7304
+					} else {
7305
+						if len(execution_frequency) > 0 {
7306
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and execution_frequency = ?"
7307
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency)
7308
+						} else {
7309
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ?"
7310
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state)
7311
+						}
7312
+
7313
+					}
7314
+
7315
+				} else {
7316
+					if cost_type > 0 {
7317
+						adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and is_settle = ? "
7318
+						adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type)
7319
+					} else {
7320
+						adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1   "
7321
+						adviceCondition = append(adviceCondition, adviceWhere, orgID)
7322
+					}
7323
+
7324
+				}
7325
+
7326
+			}
7327
+
7328
+		} else if patientType == 1 {
7329
+			if patient_id > 0 {
7330
+				if execution_state > 0 {
7331
+					if cost_type > 0 {
7332
+						if len(execution_frequency) > 0 {
7333
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ? and execution_frequency = ?"
7334
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type, execution_frequency)
7335
+						} else {
7336
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ?"
7337
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type)
7338
+						}
7339
+
7340
+					} else {
7341
+						if len(execution_frequency) > 0 {
7342
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and execution_state = ? and execution_frequency = ?"
7343
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, execution_frequency)
7344
+						} else {
7345
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ?"
7346
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state)
7347
+						}
7348
+
7349
+					}
7350
+
7351
+				} else {
7352
+					if cost_type > 0 {
7353
+						if len(execution_frequency) > 0 {
7354
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and is_settle = ?and execution_frequency = ?"
7355
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type, execution_frequency)
7356
+						} else {
7357
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and is_settle = ?"
7358
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type)
7359
+						}
7360
+
7361
+					} else {
7362
+						if len(execution_frequency) > 0 {
7363
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_frequency = ?"
7364
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_frequency)
7365
+						} else {
7366
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ?"
7367
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id)
7368
+						}
7369
+
7370
+					}
7371
+
7372
+				}
7373
+
7374
+			} else {
7375
+				if execution_state > 0 {
7376
+					if cost_type > 0 {
7377
+						if len(execution_frequency) > 0 {
7378
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and execution_state=? and is_settle = ?and execution_frequency = ?"
7379
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type, execution_frequency)
7380
+						} else {
7381
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=? and is_settle = ?"
7382
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type)
7383
+						}
7384
+
7385
+					} else {
7386
+						if len(execution_frequency) > 0 {
7387
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?and execution_frequency = ?"
7388
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, execution_frequency)
7389
+						} else {
7390
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?"
7391
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state)
7392
+						}
7393
+
7394
+					}
7395
+
7396
+				} else {
7397
+					if cost_type > 0 {
7398
+						if len(execution_frequency) > 0 {
7399
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? and execution_frequency = ?"
7400
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type, execution_frequency)
7401
+						} else {
7402
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? "
7403
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type)
7404
+						}
7405
+
7406
+					} else {
7407
+						if len(execution_frequency) > 0 {
7408
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_frequency = ?"
7409
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_frequency)
7410
+						} else {
7411
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? "
7412
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId)
7413
+						}
7414
+
7415
+					}
7416
+
7417
+				}
7418
+
7419
+			}
7420
+
7421
+		} else if patientType == 2 {
7422
+			if patient_id > 0 {
7423
+				if execution_state > 0 {
7424
+					if cost_type > 0 {
7425
+						if len(execution_frequency) > 0 {
7426
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?and execution_frequency = ?"
7427
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency)
7428
+						} else {
7429
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?"
7430
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type)
7431
+						}
7432
+
7433
+					} else {
7434
+						if len(execution_frequency) > 0 {
7435
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and execution_frequency = ?"
7436
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency)
7437
+						} else {
7438
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ?"
7439
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state)
7440
+						}
7441
+
7442
+					}
7443
+
7444
+				} else {
7445
+					if cost_type > 0 {
7446
+						if len(execution_frequency) > 0 {
7447
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ? and execution_frequency = ?"
7448
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency)
7449
+						} else {
7450
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ?"
7451
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type)
7452
+						}
7453
+
7454
+					} else {
7455
+						if len(execution_frequency) > 0 {
7456
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ?  and execution_frequency = ?"
7457
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency)
7458
+						} else {
7459
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and patient_id = ?"
7460
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id)
7461
+						}
7462
+
7463
+					}
7464
+
7465
+				}
7466
+			} else {
7467
+				if execution_state > 0 {
7468
+
7469
+					if cost_type > 0 {
7470
+						if len(execution_frequency) > 0 {
7471
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ? and execution_frequency = ?"
7472
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency)
7473
+						} else {
7474
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ?"
7475
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type)
7476
+						}
7477
+
7478
+					} else {
7479
+						if len(execution_frequency) > 0 {
7480
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_state = ? and execution_frequency = ?"
7481
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency)
7482
+						} else {
7483
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and execution_state = ?"
7484
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state)
7485
+						}
7486
+
7487
+					}
7488
+
7489
+				} else {
7490
+
7491
+					if cost_type > 0 {
7492
+						if len(execution_frequency) > 0 {
7493
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and is_settle = ? and execution_frequency = ?"
7494
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type, execution_frequency)
7495
+						} else {
7496
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and is_settle = ?"
7497
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type)
7498
+						}
7499
+
7500
+					} else {
7501
+						if len(execution_frequency) > 0 {
7502
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_frequency = ?"
7503
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_frequency)
7504
+						} else {
7505
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0"
7506
+							adviceCondition = append(adviceCondition, adviceWhere, orgID)
7507
+						}
7508
+
7509
+					}
7510
+
7511
+				}
7512
+
7513
+			}
7514
+
7515
+		}
7516
+
7517
+	}
7518
+
7519
+	db := readDb.Table("xt_schedule")
7520
+	if scheduleType > 0 {
7521
+		db = db.Where("schedule_type = ?", scheduleType)
7522
+	}
7523
+	if partitonType > 0 {
7524
+		db = db.Where("partition_id = ?", partitonType)
7525
+	}
7526
+	db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
7527
+		Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
7528
+			return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
7529
+		}).
7530
+		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
7531
+		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
7532
+		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
7533
+		Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
7534
+		Preload("DoctorAdvices", adviceCondition...).
7535
+		Where("status = 1 AND user_org_id = ?", orgID)
7536
+	if scheduleDate != 0 {
7537
+		db = db.Where("schedule_date = ?", scheduleDate)
7538
+	}
7539
+
7540
+	err := db.Find(&vms).Error
7541
+	return vms, err
7542
+}

+ 47 - 4
service/patient_service.go Bestand weergeven

@@ -12,7 +12,7 @@ import (
12 12
 )
13 13
 
14 14
 // GetPatientList 返回患者的列表
15
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool) (patients []*models.Patients, total int64, err error) {
15
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64) (patients []*models.Patients, total int64, err error) {
16 16
 
17 17
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
18 18
 	if orgID > 0 {
@@ -65,6 +65,10 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
65 65
 		db = db.Where("p.created_time<=?", endTime)
66 66
 	}
67 67
 
68
+	if patientSoureType > 0 {
69
+		db = db.Where("p.patient_source =?", patientSoureType)
70
+	}
71
+
68 72
 	offset := (page - 1) * limit
69 73
 	if lapseto == 2 || lapseto == 3 {
70 74
 		err = db.Order("p.death_time desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
@@ -512,7 +516,6 @@ func GetPatientCount(orgID int64) (total int64) {
512 516
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1 and lapseto = 1", orgID).Count(&total)
513 517
 	return
514 518
 }
515
-
516 519
 func GetLapsetoPatientCount(orgID int64, lapseto int64) (total int64) {
517 520
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and lapseto=? and status=1", orgID, lapseto).Count(&total)
518 521
 	return
@@ -871,7 +874,7 @@ func UpdatePatientLapseto(patientid int64, lapseto models.PatientLapseto) error
871 874
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
872 875
 
873 876
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
874
-		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber}).Error
877
+		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime}).Error
875 878
 	return err
876 879
 }
877 880
 
@@ -2667,7 +2670,7 @@ func GetAllPatientListByListOne(orgID int64) (patients []*models.VMMonitorPatien
2667 2670
 	defer redis.Close()
2668 2671
 	key := strconv.FormatInt(orgID, 10) + ":" + ":patient_list_all"
2669 2672
 	patient_info_str, _ := redis.Get(key).Result()
2670
-
2673
+	redis.Set(key, "", time.Second)
2671 2674
 	if len(patient_info_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2672 2675
 		err = readDb.Model(&models.VMMonitorPatients{}).Where("user_org_id=? and status=1", orgID).Find(&patients).Error
2673 2676
 		if err != nil {
@@ -2895,3 +2898,43 @@ func UpdateScheduleByExport(org_id int64, shcheduledate int64) error {
2895 2898
 	err := XTWriteDB().Model(models.XtSchedule{}).Where("user_org_id = ? and schedule_date > ?", org_id, shcheduledate).Updates(map[string]interface{}{"status": 0}).Error
2896 2899
 	return err
2897 2900
 }
2901
+
2902
+func GetContextScheduleListGroupPatientId(limit int64, page int64, startTime int64, endTime int64, org_id int64) (schedule []*models.ConScheduleList, total int64, err error) {
2903
+
2904
+	db := XTReadDB().Model(&schedule).Where("status=1")
2905
+
2906
+	offset := (page - 1) * limit
2907
+
2908
+	if startTime > 0 {
2909
+		db = db.Where("schedule_date >=?", startTime)
2910
+	}
2911
+	if endTime > 0 {
2912
+		db = db.Where("schedule_date<=?", endTime)
2913
+	}
2914
+
2915
+	if org_id > 0 {
2916
+		db = db.Where("user_org_id = ?", org_id)
2917
+	}
2918
+	err = db.Count(&total).Offset(offset).Limit(limit).Group("patient_id").Find(&schedule).Error
2919
+
2920
+	return schedule, total, err
2921
+}
2922
+
2923
+func GetContextScheduleListPatientId(startTime int64, endTime int64, org_id int64) (schedule []*models.ConScheduleList, total int64, err error) {
2924
+
2925
+	db := XTReadDB().Model(&schedule).Where("status=1")
2926
+
2927
+	if startTime > 0 {
2928
+		db = db.Where("schedule_date >=?", startTime)
2929
+	}
2930
+	if endTime > 0 {
2931
+		db = db.Where("schedule_date<=?", endTime)
2932
+	}
2933
+
2934
+	if org_id > 0 {
2935
+		db = db.Where("user_org_id = ?", org_id)
2936
+	}
2937
+	err = db.Find(&schedule).Error
2938
+
2939
+	return schedule, total, err
2940
+}

+ 24 - 1
service/self_drug_service.go Bestand weergeven

@@ -1119,6 +1119,29 @@ func GetDrugInventoryDetailList(keyword string, page int64, limit int64, orgid i
1119 1119
 	return list, total, err
1120 1120
 }
1121 1121
 
1122
+func GetDrugInventoryDetailMapList(keyword string, page int64, limit int64, orgid int64, storehouse_id int64, ids []string) (list []*models.VmDrugInventory, total int64, err error) {
1123
+	likeKey := "%" + keyword + "%"
1124
+	offset := (page - 1) * limit
1125
+	db := XTReadDB().Table("xt_drug_inventory as x").Where("x.status = 1")
1126
+	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
1127
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
1128
+	fmt.Println(table, tab)
1129
+	if len(keyword) > 0 {
1130
+		db = db.Where("x.warehousing_order = ? or r.user_name like ? or t.drug_name like ?", keyword, likeKey, likeKey)
1131
+	}
1132
+	if orgid > 0 {
1133
+		db = db.Where("x.user_org_id = ?", orgid)
1134
+	}
1135
+	if storehouse_id > 0 {
1136
+		db = db.Where("x.storehouse_id = ?", storehouse_id)
1137
+	}
1138
+	if len(ids) > 0 {
1139
+		db = db.Where("x.id in(?)", ids)
1140
+	}
1141
+	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,x.storehouse_id,x.warehouse_info_id,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type,t.min_number,t.retail_price").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
1142
+	return list, total, err
1143
+}
1144
+
1122 1145
 func GetDrugInventoryDetailListTwo(keyword string, page int64, limit int64, orgid int64, storehouse_id int64) (list []*models.XtDrugInventory, total int64, err error) {
1123 1146
 
1124 1147
 	db := XTReadDB().Model(&list).Where("status = 1")
@@ -2715,6 +2738,6 @@ func ModifyDrugFlowById(id int64, over_count int64) error {
2715 2738
 
2716 2739
 func GetDrugInventoryWarehouseInfoList(org_id int64, storehouse_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
2717 2740
 
2718
-	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id = ? and is_check = 1 and org_id = ?", storehouse_id, org_id).Preload("XtBaseDrug", "status= 1").Find(&info).Error
2741
+	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id = ? and is_check = 1 and org_id = ? and (stock_max_number >0 or stock_min_number >0)", storehouse_id, org_id).Preload("XtBaseDrug", "status= 1").Order("drug_id").Find(&info).Error
2719 2742
 	return info, err
2720 2743
 }

+ 36 - 1
service/stock_service.go Bestand weergeven

@@ -6113,6 +6113,30 @@ func GetInventoryDetailList(keyword string, limit int64, page int64, orgid int64
6113 6113
 	return list, total, err
6114 6114
 }
6115 6115
 
6116
+func GetInventoryDetailPrintMapList(keyword string, limit int64, page int64, orgid int64, storehouse_id int64, ids []string) (list []*models.VmStockInventory, total int64, err error) {
6117
+
6118
+	likeKey := "%" + keyword + "%"
6119
+	offset := (page - 1) * limit
6120
+	db := XTReadDB().Table("xt_stock_inventory as x").Where("x.status = 1 and x.type = 10")
6121
+	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
6122
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
6123
+	fmt.Println(table, tab)
6124
+	if len(keyword) > 0 {
6125
+		db = db.Where("x.good_name like ?", likeKey)
6126
+	}
6127
+	if orgid > 0 {
6128
+		db = db.Where("x.user_org_id = ?", orgid)
6129
+	}
6130
+	if storehouse_id > 0 {
6131
+		db = db.Where("x.storehouse_id = ?", storehouse_id)
6132
+	}
6133
+	if len(ids) > 0 {
6134
+		db = db.Where("x.id in(?)", ids)
6135
+	}
6136
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.storehouse_id").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
6137
+	return list, total, err
6138
+}
6139
+
6116 6140
 func GetInventoryPrintList(ids []string) (list []*models.XtStockInventory, err error) {
6117 6141
 
6118 6142
 	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&list).Error
@@ -8212,7 +8236,7 @@ func ReduceGoodSumOutCount(storehouse_id int64, good_id int64, user_org_id int64
8212 8236
 
8213 8237
 func GetInvetoryWarehouseInfoList(orgid int64, storehouse_id int64) (info []*models.WarehousingInfo, err error) {
8214 8238
 
8215
-	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ?", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Find(&info).Error
8239
+	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ? and stock_count >0", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Order("good_id").Find(&info).Error
8216 8240
 	return info, err
8217 8241
 }
8218 8242
 
@@ -8602,3 +8626,14 @@ func UpdateWarehouseInfoMap(list []*models.WarehousingInfo, warehousing_info_id
8602 8626
 	return err
8603 8627
 
8604 8628
 }
8629
+
8630
+func FindFirstWarehousingInfoByStockThree(good_id int64, storehouse_id int64) (info models.WarehousingInfo, err error) {
8631
+	if storehouse_id == 0 {
8632
+		err = readDb.Model(&models.WarehousingInfo{}).Where("good_id = ? AND status = 1 and stock_count > 0", good_id).Order("ctime").First(&info).Error
8633
+	}
8634
+	if storehouse_id > 0 {
8635
+		err = readDb.Model(&models.WarehousingInfo{}).Where("good_id = ?  AND status = 1 and stock_count > 0 and storehouse_id =? ", good_id, storehouse_id).Order("ctime").First(&info).Error
8636
+	}
8637
+
8638
+	return info, err
8639
+}

+ 1 - 1
service/user_service.go Bestand weergeven

@@ -189,7 +189,7 @@ func GetAllData(orgid int64, id int64, page int64, limit int64) (dry []*models.X
189 189
 	offset := (page - 1) * limit
190 190
 	table := XTReadDB().Table("sgj_users.sgj_user_admin_role AS a")
191 191
 	fmt.Println("table", table)
192
-	err = XTReadDB().Table("xt_patient_dryweight as x").Select("x.id,x.dry_weight,x.creator,x.remakes,x.patient_id,x.ctime,x.status,x.user_org_id,x.adjusted_value,a.user_name").Where("x.user_org_id = ? AND x.patient_id = ? AND x.status = ? ", orgid, id, 1).Count(&total).Joins("LEFT  JOIN sgj_users.sgj_user_admin_role AS a ON a.admin_user_id = x.creator").Order("x.ctime desc").Offset(offset).Limit(limit).Group("id").Scan(&dry).Error
192
+	err = XTReadDB().Table("xt_patient_dryweight as x").Select("x.id,x.dry_weight,x.creator,x.remakes,x.patient_id,x.ctime,x.status,x.user_org_id,x.adjusted_value,a.user_name").Where("x.user_org_id = ? AND x.patient_id = ? AND x.status = ?", orgid, id, 1).Count(&total).Joins("LEFT  JOIN sgj_users.sgj_user_admin_role AS a ON a.admin_user_id = x.creator").Order("x.ctime desc").Offset(offset).Limit(limit).Group("id").Scan(&dry).Error
193 193
 	if err != nil {
194 194
 		return
195 195
 	}