Browse Source

历史排班

28169 1 year ago
parent
commit
afb5203e32

+ 74 - 16
controllers/dialysis_api_controller.go View File

@@ -623,7 +623,7 @@ func (c *DialysisApiController) PostPrescription() {
623 623
 		// 查询信息规挡的设置天数
624 624
 
625 625
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
626
-		if infor.ID > 0 {
626
+		if infor.ID > 0 && infor.WeekDay > 0 {
627 627
 
628 628
 			var cha_time int64
629 629
 
@@ -738,7 +738,7 @@ func (c *DialysisApiController) PostPrescription() {
738 738
 		// 查询信息规挡的设置天数
739 739
 
740 740
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
741
-		if infor.ID > 0 {
741
+		if infor.ID > 0 && infor.WeekDay > 0 {
742 742
 
743 743
 			var cha_time int64
744 744
 
@@ -976,7 +976,7 @@ func (c *DialysisApiController) PostSoulution() {
976 976
 	// 查询信息规挡的设置天数
977 977
 
978 978
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
979
-	if infor.ID > 0 {
979
+	if infor.ID > 0 && infor.WeekDay > 0 {
980 980
 		var cha_time int64
981 981
 
982 982
 		timeNowStr := time.Now().Format("2006-01-02")
@@ -1571,7 +1571,7 @@ func (c *DialysisApiController) PostDouleCheck() {
1571 1571
 	// 查询信息规挡的设置天数
1572 1572
 
1573 1573
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1574
-	if infor.ID > 0 {
1574
+	if infor.ID > 0 && infor.WeekDay > 0 {
1575 1575
 
1576 1576
 		var cha_time int64
1577 1577
 
@@ -1777,7 +1777,7 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1777 1777
 	// 查询信息规挡的设置天数
1778 1778
 
1779 1779
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1780
-	if infor.ID > 0 {
1780
+	if infor.ID > 0 && infor.WeekDay > 0 {
1781 1781
 
1782 1782
 		var cha_time int64
1783 1783
 
@@ -1846,6 +1846,29 @@ func (c *DialysisApiController) PostReceiveTreatmentAsses() {
1846 1846
 		//	}
1847 1847
 		//}
1848 1848
 
1849
+		// 查询信息规挡的设置天数
1850
+
1851
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1852
+		if infor.ID > 0 && infor.WeekDay > 0 {
1853
+			var cha_time int64
1854
+			timeNowStr := time.Now().Format("2006-01-02")
1855
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1856
+
1857
+			//今日的日期减去设置的日期
1858
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1859
+
1860
+			if cha_time >= recordDate.Unix() {
1861
+				//查询审核是否允许
1862
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
1863
+				//申请状态不允许的情况 拒绝修改
1864
+				if infor.ApplicationStatus != 1 {
1865
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1866
+					return
1867
+				}
1868
+
1869
+			}
1870
+		}
1871
+
1849 1872
 		receiveTreatmentAsses.Creater = receiveTreatment.Creater
1850 1873
 		receiveTreatmentAsses.CreatedTime = receiveTreatment.CreatedTime
1851 1874
 		receiveTreatmentAsses.UpdateTime = time.Now().Unix()
@@ -2298,7 +2321,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2298 2321
 		// 查询信息规挡的设置天数
2299 2322
 
2300 2323
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2301
-		if infor.ID > 0 {
2324
+		if infor.ID > 0 && infor.WeekDay > 0 {
2302 2325
 
2303 2326
 			var cha_time int64
2304 2327
 
@@ -2895,7 +2918,7 @@ func (c *DialysisApiController) PostTreatmentSummary() {
2895 2918
 		// 查询信息规挡的设置天数
2896 2919
 
2897 2920
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2898
-		if infor.ID > 0 {
2921
+		if infor.ID > 0 && infor.WeekDay > 0 {
2899 2922
 
2900 2923
 			var cha_time int64
2901 2924
 
@@ -2964,6 +2987,28 @@ func (c *DialysisApiController) PostTreatmentSummary() {
2964 2987
 		//	}
2965 2988
 		//}
2966 2989
 
2990
+		// 查询信息规挡的设置天数
2991
+
2992
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2993
+		if infor.ID > 0 && infor.WeekDay > 0 {
2994
+			var cha_time int64
2995
+			timeNowStr := time.Now().Format("2006-01-02")
2996
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
2997
+
2998
+			//今日的日期减去设置的日期
2999
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
3000
+
3001
+			if cha_time >= recordDate.Unix() {
3002
+				//查询审核是否允许
3003
+				infor, _ := service.GetDialysisInformationByRecordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
3004
+				//申请状态不允许的情况 拒绝修改
3005
+				if infor.ApplicationStatus != 1 {
3006
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
3007
+					return
3008
+				}
3009
+			}
3010
+		}
3011
+
2967 3012
 		treatmentSummary.Creater = tempTreatmentSummary.Creater
2968 3013
 		treatmentSummary.CreatedTime = tempTreatmentSummary.CreatedTime
2969 3014
 		treatmentSummary.UpdatedTime = time.Now().Unix()
@@ -3465,7 +3510,7 @@ func (this *DialysisApiController) DelMonitor() {
3465 3510
 	// 查询信息规挡的设置天数
3466 3511
 
3467 3512
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.CurrentOrgId)
3468
-	if infor.ID > 0 {
3513
+	if infor.ID > 0 && infor.WeekDay > 0 {
3469 3514
 
3470 3515
 		var cha_time int64
3471 3516
 
@@ -3612,7 +3657,7 @@ func (c *DialysisApiController) CreateMonitor() {
3612 3657
 	// 查询信息规挡的设置天数
3613 3658
 
3614 3659
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3615
-	if infor.ID > 0 {
3660
+	if infor.ID > 0 && infor.WeekDay > 0 {
3616 3661
 
3617 3662
 		var cha_time int64
3618 3663
 
@@ -6731,11 +6776,24 @@ func (this *DialysisApiController) SaveInformation() {
6731 6776
 
6732 6777
 	patient_id, _ := this.GetInt64("patient_id")
6733 6778
 	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()
6779
+	startTime := this.GetString("selected_date")
6780
+
6781
+	timeLayout := "2006-01-02 15:04"
6782
+	loc, _ := time.LoadLocation("Local")
6783
+
6784
+	if len(startTime) == 0 {
6785
+		utils.ErrorLog("len(start_time) == 0")
6786
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
6787
+		return
6788
+	}
6789
+	theTime, err := time.ParseInLocation(timeLayout, startTime, loc)
6790
+	if err != nil {
6791
+		utils.ErrorLog(err.Error())
6792
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
6793
+		return
6794
+	}
6795
+	StartTime := theTime.Unix()
6796
+	fmt.Println("startime-------------", StartTime)
6739 6797
 
6740 6798
 	module, _ := this.GetInt64("module")
6741 6799
 
@@ -6748,7 +6806,7 @@ func (this *DialysisApiController) SaveInformation() {
6748 6806
 		Module:            module,
6749 6807
 		PatientId:         patient_id,
6750 6808
 		RecordDate:        record_date,
6751
-		ApplicationDate:   AdviceDate,
6809
+		ApplicationDate:   StartTime,
6752 6810
 		Creater:           creater,
6753 6811
 		ApplicationStatus: 2,
6754 6812
 		Checker:           0,
@@ -6771,7 +6829,7 @@ func (this *DialysisApiController) SaveInformation() {
6771 6829
 		}
6772 6830
 	}
6773 6831
 	if infor.ID > 0 {
6774
-		err := service.UpdateDialysisInformationById(patient_id, record_date, orgId, module, AdviceDate, remark)
6832
+		err := service.UpdateDialysisInformationById(patient_id, record_date, orgId, module, StartTime, remark)
6775 6833
 		if err == nil {
6776 6834
 			this.ServeSuccessJSON(map[string]interface{}{
6777 6835
 				"information": information,

+ 6 - 7
controllers/dialysis_record_api_controller.go View File

@@ -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
 

+ 40 - 22
controllers/his_api_controller.go View File

@@ -2846,6 +2846,14 @@ func (c *HisApiController) CreateHisPrescription() {
2846 2846
 							if s.PrescribingNumberUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
2847 2847
 								total_count += prescribingNumberSeven
2848 2848
 							}
2849
+							if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 3877 {
2850
+								storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
2851
+								lastWarehouse, _ := service.FindLastDrugWarehousingInfoByID(s.DrugId, storeConfig.DrugStorehouseOut)
2852
+								if s.Price != lastWarehouse.RetailPrice {
2853
+									s.Price = lastWarehouse.RetailPrice
2854
+								}
2855
+							}
2856
+
2849 2857
 							service.CreateHisDoctorAdvice(&s)
2850 2858
 
2851 2859
 							//存储切片中
@@ -2907,6 +2915,17 @@ func (c *HisApiController) CreateHisPrescription() {
2907 2915
 								projectDetail, _ := service.GetHisPrescriptonProjectById(p.ID)
2908 2916
 								p.IsOut = projectDetail.IsOut
2909 2917
 							}
2918
+							if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 3877 {
2919
+								storeConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
2920
+								if p.Type == 3 {
2921
+									lastWarehouse, _ := service.FindFirstWarehousingInfoByStockThree(p.ProjectId, storeConfig.DrugStorehouseOut)
2922
+									if p.Price != lastWarehouse.PackingPrice {
2923
+										p.Price = lastWarehouse.PackingPrice
2924
+									}
2925
+								}
2926
+
2927
+							}
2928
+
2910 2929
 							service.CreateHisProjectTwo(&p)
2911 2930
 							projectList = append(projectList, p)
2912 2931
 							var randNum int
@@ -3012,7 +3031,6 @@ func (c *HisApiController) CreateHisPrescription() {
3012 3031
 		//查询今日该患者开的药品处方
3013 3032
 		hisdoctorlist, _ := service.GetHisAdviceListByDrugIdTwo(patient_id, recordDateTime, adminInfo.CurrentOrgId)
3014 3033
 
3015
-		fmt.Println("今日出库2333333333333333333333333333333333333333")
3016 3034
 		drugOutConfig, _ := service.GetDrugOpenConfigOne(adminInfo.CurrentOrgId)
3017 3035
 		//药品出库
3018 3036
 		if drugOutConfig.IsOpen == 1 {
@@ -3021,7 +3039,7 @@ func (c *HisApiController) CreateHisPrescription() {
3021 3039
 
3022 3040
 				// 查询该药品最后一次出库记录
3023 3041
 				druginfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(item.DrugId, patient_id, recordDateTime, item.ID)
3024
-				fmt.Println("今日最后出库2333333333333333333333333333333333333333", druginfo)
3042
+
3025 3043
 				if len(druginfo) > 0 {
3026 3044
 					//回退库存
3027 3045
 					for _, it := range druginfo {
@@ -9774,30 +9792,30 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
9774 9792
 		}
9775 9793
 	}
9776 9794
 
9777
-	new_order_info := RemoveRepeatedTeam(orderInfos_four)
9795
+	//new_order_info := RemoveRepeatedTeam(orderInfos_four)
9778 9796
 	var cus_slice []CustomOrderInfo
9779
-	for _, item := range new_order_info {
9780
-		var cus CustomOrderInfo
9781
-		cus.Name = item.HisPrescriptionProject.XtHisProjectTeam.ProjectTeam
9782
-		cus.Unit = ""
9783
-		cus.Spec = ""
9784
-		var total float64
9785
-		for _, subItem := range orderInfos_four {
9786
-			if item.HisPrescriptionProject.TeamId == subItem.HisPrescriptionProject.TeamId {
9787
-				total = total + subItem.DetItemFeeSumamt
9788
-				fmt.Println(subItem.DetItemFeeSumamt)
9789
-			}
9790
-		}
9791
-		cus.Count = 1
9792
-		cus.Total = total
9793
-		cus_slice = append(cus_slice, cus)
9794
-	}
9797
+	//for _, item := range new_order_info {
9798
+	//	var cus CustomOrderInfo
9799
+	//	cus.Name = item.HisPrescriptionProject.XtHisProjectTeam.ProjectTeam
9800
+	//	cus.Unit = ""
9801
+	//	cus.Spec = ""
9802
+	//	var total float64
9803
+	//	for _, subItem := range orderInfos_four {
9804
+	//		if item.HisPrescriptionProject.TeamId == subItem.HisPrescriptionProject.TeamId {
9805
+	//			total = total + subItem.DetItemFeeSumamt
9806
+	//			fmt.Println(subItem.DetItemFeeSumamt)
9807
+	//		}
9808
+	//	}
9809
+	//	cus.Count = 1
9810
+	//	cus.Total = total
9811
+	//	cus_slice = append(cus_slice, cus)
9812
+	//}
9795 9813
 
9796 9814
 	orderInfos = append(orderInfos, orderInfos_two...)
9797
-	if c.GetAdminUserInfo().CurrentOrgId != 10138 || c.GetAdminUserInfo().CurrentOrgId != 10278 {
9798
-		orderInfos = append(orderInfos, orderInfos_three...)
9815
+	//if c.GetAdminUserInfo().CurrentOrgId != 10138 || c.GetAdminUserInfo().CurrentOrgId != 10278 {
9816
+	orderInfos = append(orderInfos, orderInfos_three...)
9799 9817
 
9800
-	}
9818
+	//}/**/
9801 9819
 
9802 9820
 	patient, _ := service.GetPatientByID(org_id, order.PatientId)
9803 9821
 	c.ServeSuccessJSON(map[string]interface{}{

+ 4 - 0
controllers/his_project_api_controller.go View File

@@ -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 View File

@@ -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
+}

+ 59 - 13
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -690,7 +690,7 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
690 690
 	// 查询信息规挡的设置天数
691 691
 
692 692
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
693
-	if infor.ID > 0 {
693
+	if infor.ID > 0 && infor.WeekDay > 0 {
694 694
 
695 695
 		var cha_time int64
696 696
 
@@ -901,7 +901,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
901 901
 		// 查询信息规挡的设置天数
902 902
 
903 903
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
904
-		if infor.ID > 0 {
904
+		if infor.ID > 0 && infor.WeekDay > 0 {
905 905
 
906 906
 			var cha_time int64
907 907
 
@@ -1117,7 +1117,7 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
1117 1117
 	// 查询信息规挡的设置天数
1118 1118
 
1119 1119
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1120
-	if infor.ID > 0 {
1120
+	if infor.ID > 0 && infor.WeekDay > 0 {
1121 1121
 
1122 1122
 		var cha_time int64
1123 1123
 
@@ -1216,6 +1216,30 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
1216 1216
 		//		return
1217 1217
 		//	}
1218 1218
 		//}
1219
+		// 查询信息规挡的设置天数
1220
+
1221
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1222
+		if infor.ID > 0 && infor.WeekDay > 0 {
1223
+
1224
+			var cha_time int64
1225
+
1226
+			timeNowStr := time.Now().Format("2006-01-02")
1227
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1228
+
1229
+			//今日的日期减去设置的日期
1230
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1231
+
1232
+			if cha_time >= recordDate.Unix() {
1233
+				//查询审核是否允许
1234
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1235
+				//申请状态不允许的情况 拒绝修改
1236
+				if infor.ApplicationStatus != 1 {
1237
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1238
+					return
1239
+				}
1240
+
1241
+			}
1242
+		}
1219 1243
 
1220 1244
 		receiveTreatmentAsses.Creater = receiveTreatment.Creater
1221 1245
 		receiveTreatmentAsses.CreatedTime = receiveTreatment.CreatedTime
@@ -1435,7 +1459,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1435 1459
 	// 查询信息规挡的设置天数
1436 1460
 
1437 1461
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1438
-	if infor.ID > 0 {
1462
+	if infor.ID > 0 && infor.WeekDay > 0 {
1439 1463
 
1440 1464
 		var cha_time int64
1441 1465
 
@@ -1502,6 +1526,28 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1502 1526
 		}
1503 1527
 	} else { //修改
1504 1528
 
1529
+		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1530
+		if infor.ID > 0 && infor.WeekDay > 0 {
1531
+
1532
+			var cha_time int64
1533
+
1534
+			timeNowStr := time.Now().Format("2006-01-02")
1535
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
1536
+
1537
+			//今日的日期减去设置的日期
1538
+			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1539
+			fmt.Println("recordDate.Unix()", recordDate.Unix())
1540
+			if cha_time >= recordDate.Unix() {
1541
+				//查询审核是否允许
1542
+				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1543
+				//申请状态不允许的情况 拒绝修改
1544
+				if infor.ApplicationStatus != 1 {
1545
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1546
+					return
1547
+				}
1548
+
1549
+			}
1550
+		}
1505 1551
 		if appRole.UserType == 2 || appRole.UserType == 1 {
1506 1552
 			assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
1507 1553
 			assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
@@ -1704,7 +1750,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1704 1750
 	// 查询信息规挡的设置天数
1705 1751
 
1706 1752
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1707
-	if infor.ID > 0 {
1753
+	if infor.ID > 0 && infor.WeekDay > 0 {
1708 1754
 
1709 1755
 		var cha_time int64
1710 1756
 
@@ -2287,7 +2333,7 @@ func (c *DialysisAPIController) Finish() {
2287 2333
 	// 查询信息规挡的设置天数
2288 2334
 
2289 2335
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
2290
-	if infor.ID > 0 {
2336
+	if infor.ID > 0 && infor.WeekDay > 0 {
2291 2337
 
2292 2338
 		var cha_time int64
2293 2339
 
@@ -3001,7 +3047,7 @@ func (this *DialysisAPIController) StartDialysis() {
3001 3047
 	// 查询信息规挡的设置天数
3002 3048
 
3003 3049
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
3004
-	if infor.ID > 0 {
3050
+	if infor.ID > 0 && infor.WeekDay > 0 {
3005 3051
 
3006 3052
 		var cha_time int64
3007 3053
 
@@ -3196,7 +3242,7 @@ func (this *DialysisAPIController) StartDialysis() {
3196 3242
 	}
3197 3243
 
3198 3244
 	//只针对广慈医院
3199
-	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 {
3245
+	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 {
3200 3246
 		// 查询病人是否有透前评估数据
3201 3247
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
3202 3248
 
@@ -3473,7 +3519,7 @@ func (c *DialysisAPIController) PostSolution() {
3473 3519
 	// 查询信息规挡的设置天数
3474 3520
 
3475 3521
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
3476
-	if infor.ID > 0 {
3522
+	if infor.ID > 0 && infor.WeekDay > 0 {
3477 3523
 
3478 3524
 		var cha_time int64
3479 3525
 
@@ -4391,7 +4437,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
4391 4437
 	// 查询信息规挡的设置天数
4392 4438
 
4393 4439
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4394
-	if infor.ID > 0 {
4440
+	if infor.ID > 0 && infor.WeekDay > 0 {
4395 4441
 
4396 4442
 		var cha_time int64
4397 4443
 
@@ -5771,7 +5817,7 @@ func (c *DialysisAPIController) CreateStockOutInfo() {
5771 5817
 	// 查询信息规挡的设置天数
5772 5818
 
5773 5819
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
5774
-	if infor.ID > 0 {
5820
+	if infor.ID > 0 && infor.WeekDay > 0 {
5775 5821
 
5776 5822
 		var cha_time int64
5777 5823
 
@@ -6214,7 +6260,7 @@ func (c *DialysisAPIController) EditConsumables() {
6214 6260
 	// 查询信息规挡的设置天数
6215 6261
 
6216 6262
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
6217
-	if infor.ID > 0 {
6263
+	if infor.ID > 0 && infor.WeekDay > 0 {
6218 6264
 
6219 6265
 		var cha_time int64
6220 6266
 
@@ -7093,7 +7139,7 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
7093 7139
 	// 查询信息规挡的设置天数
7094 7140
 
7095 7141
 	infor, _ := service.GetDialysisInformationSetting(adminInfo.Org.Id)
7096
-	if infor.ID > 0 {
7142
+	if infor.ID > 0 && infor.WeekDay > 0 {
7097 7143
 
7098 7144
 		var cha_time int64
7099 7145
 

+ 3 - 3
controllers/mobile_api_controllers/dialysis_api_controller_extend.go View File

@@ -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
 

+ 7 - 8
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -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
 
@@ -2653,7 +2652,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2653 2652
 	// 查询信息规挡的设置天数
2654 2653
 
2655 2654
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
2656
-	if infor.ID > 0 {
2655
+	if infor.ID > 0 && infor.WeekDay > 0 {
2657 2656
 
2658 2657
 		var cha_time int64
2659 2658
 
@@ -4358,7 +4357,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
4358 4357
 		// 查询信息规挡的设置天数
4359 4358
 
4360 4359
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4361
-		if infor.ID > 0 {
4360
+		if infor.ID > 0 && infor.WeekDay > 0 {
4362 4361
 
4363 4362
 			var cha_time int64
4364 4363
 
@@ -4647,7 +4646,7 @@ func (c *PatientApiController) DelDoctorAdvice() {
4647 4646
 		// 查询信息规挡的设置天数
4648 4647
 
4649 4648
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
4650
-		if infor.ID > 0 {
4649
+		if infor.ID > 0 && infor.WeekDay > 0 {
4651 4650
 
4652 4651
 			var cha_time int64
4653 4652
 

+ 7 - 7
controllers/patient_api_controller.go View File

@@ -1343,7 +1343,7 @@ func (c *PatientApiController) CreateGroupAdvice() {
1343 1343
 		// 查询信息规挡的设置天数
1344 1344
 
1345 1345
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1346
-		if infor.ID > 0 {
1346
+		if infor.ID > 0 && infor.WeekDay > 0 {
1347 1347
 
1348 1348
 			var cha_time int64
1349 1349
 
@@ -1717,7 +1717,7 @@ func (c *PatientApiController) CreateDoctorAdvice() {
1717 1717
 	// 查询信息规挡的设置天数
1718 1718
 
1719 1719
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
1720
-	if infor.ID > 0 {
1720
+	if infor.ID > 0 && infor.WeekDay > 0 {
1721 1721
 
1722 1722
 		var cha_time int64
1723 1723
 
@@ -2053,7 +2053,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2053 2053
 		// 查询信息规挡的设置天数
2054 2054
 
2055 2055
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2056
-		if infor.ID > 0 {
2056
+		if infor.ID > 0 && infor.WeekDay > 0 {
2057 2057
 
2058 2058
 			var cha_time int64
2059 2059
 
@@ -2843,7 +2843,7 @@ func (c *PatientApiController) CheckDoctorAdvice() {
2843 2843
 		// 查询信息规挡的设置天数
2844 2844
 
2845 2845
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2846
-		if infor.ID > 0 {
2846
+		if infor.ID > 0 && infor.WeekDay > 0 {
2847 2847
 
2848 2848
 			var cha_time int64
2849 2849
 
@@ -3058,7 +3058,7 @@ func (c *PatientApiController) UpdateDoctorAdvice() {
3058 3058
 	// 查询信息规挡的设置天数
3059 3059
 
3060 3060
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3061
-	if infor.ID > 0 {
3061
+	if infor.ID > 0 && infor.WeekDay > 0 {
3062 3062
 
3063 3063
 		var cha_time int64
3064 3064
 
@@ -3295,7 +3295,7 @@ func (c *PatientApiController) DeleteDoctorAdvice() {
3295 3295
 	// 查询信息规挡的设置天数
3296 3296
 
3297 3297
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3298
-	if infor.ID > 0 {
3298
+	if infor.ID > 0 && infor.WeekDay > 0 {
3299 3299
 
3300 3300
 		var cha_time int64
3301 3301
 
@@ -3366,7 +3366,7 @@ func (c *PatientApiController) DeleteGroupAdvice() {
3366 3366
 	// 查询信息规挡的设置天数
3367 3367
 
3368 3368
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
3369
-	if infor.ID > 0 {
3369
+	if infor.ID > 0 && infor.WeekDay > 0 {
3370 3370
 
3371 3371
 		var cha_time int64
3372 3372
 

+ 10 - 5
controllers/print_data_api_controller.go View File

@@ -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)

+ 1 - 1
main.go View File

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

+ 23 - 0
models/device_models.go View File

@@ -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 View File

@@ -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 View File

@@ -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 {

+ 1 - 1
service/his_project_service.go View File

@@ -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 View File

@@ -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 View File

@@ -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
 	}

+ 53 - 0
service/manage_service.go View File

@@ -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
+}

+ 2 - 9
service/mobile_dialysis_service.go View File

@@ -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) {

+ 11 - 0
service/stock_service.go View File

@@ -8602,3 +8602,14 @@ func UpdateWarehouseInfoMap(list []*models.WarehousingInfo, warehousing_info_id
8602 8602
 	return err
8603 8603
 
8604 8604
 }
8605
+
8606
+func FindFirstWarehousingInfoByStockThree(good_id int64, storehouse_id int64) (info models.WarehousingInfo, err error) {
8607
+	if storehouse_id == 0 {
8608
+		err = readDb.Model(&models.WarehousingInfo{}).Where("good_id = ? AND status = 1 and stock_count > 0", good_id).Order("ctime").First(&info).Error
8609
+	}
8610
+	if storehouse_id > 0 {
8611
+		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
8612
+	}
8613
+
8614
+	return info, err
8615
+}

+ 1 - 1
service/user_service.go View File

@@ -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
 	}