csx 3 лет назад
Родитель
Сommit
a1c6ef4b27

controllers/new_mobile_api_controllers/common_api_controller.go → controllers/common_api_controller.go Просмотреть файл

@@ -1,7 +1,6 @@
1
-package new_mobile_api_controllers
1
+package controllers
2 2
 
3 3
 import (
4
-	"XT_New/controllers"
5 4
 	"XT_New/enums"
6 5
 	"XT_New/models"
7 6
 	"XT_New/service"
@@ -14,7 +13,7 @@ import (
14 13
 )
15 14
 
16 15
 type CommonApiController struct {
17
-	controllers.BaseAuthAPIController
16
+	BaseAuthAPIController
18 17
 }
19 18
 
20 19
 func (this *CommonApiController) GetInspectionMajor() {
@@ -527,9 +526,15 @@ func (this *CommonApiController) GetDialysisModeType() {
527 526
 	orgid := adminUser.CurrentOrgId
528 527
 	//统计透析总量
529 528
 	total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid, lapsetotype, sourcetype)
530
-	fmt.Println("total3333333333333", total)
529
+	//var mode models.PatientPrescriptionCountStruct
530
+	//mode.Count = total
531 531
 	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid, lapsetotype, sourcetype)
532
-	fmt.Println("modetype555555555555555", modeType)
532
+
533
+	//var total models.PatientPrescriptionCountStruct
534
+	//for _, item := range modeType {
535
+	//	total.Count = total.Count + item.Count
536
+	//}
537
+
533 538
 	if err != nil {
534 539
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
535 540
 		return
@@ -645,8 +650,8 @@ func (this *CommonApiController) GetTotalAgeCount() {
645 650
 	sourcetype, _ := this.GetInt64("sourcetype")
646 651
 	//统计透析总人数
647 652
 	total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
653
+
648 654
 	agecount, err := service.GetTotalAgeCount(orgid, lapsetotype, sourcetype)
649
-	fmt.Println("ageCount22222222222", agecount)
650 655
 	//two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
651 656
 	if err != nil {
652 657
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -717,7 +722,6 @@ func (this *CommonApiController) GetDialysislist() {
717 722
 	statime := startDate.Unix()
718 723
 
719 724
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
720
-
721 725
 	entime := endDate.Unix()
722 726
 
723 727
 	page, _ := this.GetInt64("page")

controllers/new_mobile_api_controllers/common_api_router.go → controllers/common_api_router.go Просмотреть файл

@@ -1,4 +1,4 @@
1
-package new_mobile_api_controllers
1
+package controllers
2 2
 
3 3
 import (
4 4
 	"github.com/astaxie/beego"

+ 61 - 43
controllers/doctors_api_controller.go Просмотреть файл

@@ -90,53 +90,11 @@ func (c *DoctorsApiController) ScheduleAdvices() {
90 90
 	hisAdvices, _ := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id)
91 91
 
92 92
 	project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id)
93
-
93
+	//project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id)
94 94
 	for _, item := range project {
95 95
 		index := 0
96 96
 		for _, subItem := range item.HisPrescriptionTeamProject {
97 97
 
98
-			//获取所有的患者
99
-			patients, _ := service.GetAllPatientListByListTwo(orgID)
100
-
101
-			//获取所有床位
102
-			numberList, _ := service.GetAllDeviceNumberByListOne(orgID)
103
-
104
-			//获取透析处方
105
-			prescriptions, _ := service.GetAllPrescriptionByListOne(orgID, date.Unix())
106
-
107
-			//获取上机
108
-			dialysisOrders, _ := service.GetAllDialysisOrdersByListTwo(orgID, date.Unix())
109
-			for key, item := range project {
110
-				for _, patient := range patients {
111
-					if item.PatientId == patient.ID {
112
-						project[key].SchedualPatient = patient
113
-						break
114
-					}
115
-				}
116
-				// 获取床位信息
117
-				for _, it := range numberList {
118
-					if item.BedId == it.ID {
119
-						project[key].DeviceNumber = it
120
-						break
121
-					}
122
-				}
123
-
124
-				// 获取处方
125
-				for _, it := range prescriptions {
126
-					if item.PatientId == it.PatientId {
127
-						project[key].Prescription = it
128
-						break
129
-					}
130
-				}
131
-
132
-				//获取上机
133
-				for _, it := range dialysisOrders {
134
-					if item.PatientId == it.PatientId {
135
-						project[key].DialysisOrder = it
136
-						break
137
-					}
138
-				}
139
-			}
140 98
 			if subItem.HisProject.CostClassify != 3 {
141 99
 				subItem.IsCheckTeam = 2
142 100
 				item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
@@ -151,6 +109,66 @@ func (c *DoctorsApiController) ScheduleAdvices() {
151 109
 			}
152 110
 		}
153 111
 	}
112
+	//for _, item := range project {
113
+	//	index := 0
114
+	//	for _, subItem := range item.HisPrescriptionTeamProject {
115
+	//
116
+	//		//获取所有的患者
117
+	//		patients, _ := service.GetAllPatientListByListTwo(orgID)
118
+	//
119
+	//		//获取所有床位
120
+	//		numberList, _ := service.GetAllDeviceNumberByListOne(orgID)
121
+	//
122
+	//		//获取透析处方
123
+	//		prescriptions, _ := service.GetAllPrescriptionByListOne(orgID, date.Unix())
124
+	//
125
+	//		//获取上机
126
+	//		dialysisOrders, _ := service.GetAllDialysisOrdersByListTwo(orgID, date.Unix())
127
+	//		for key, item := range project {
128
+	//			for _, patient := range patients {
129
+	//				if item.PatientId == patient.ID {
130
+	//					project[key].SchedualPatient = patient
131
+	//					break
132
+	//				}
133
+	//			}
134
+	//			// 获取床位信息
135
+	//			for _, it := range numberList {
136
+	//				if item.BedId == it.ID {
137
+	//					project[key].DeviceNumber = it
138
+	//					break
139
+	//				}
140
+	//			}
141
+	//
142
+	//			// 获取处方
143
+	//			for _, it := range prescriptions {
144
+	//				if item.PatientId == it.PatientId {
145
+	//					project[key].Prescription = it
146
+	//					break
147
+	//				}
148
+	//			}
149
+	//
150
+	//			//获取上机
151
+	//			for _, it := range dialysisOrders {
152
+	//				if item.PatientId == it.PatientId {
153
+	//					project[key].DialysisOrder = it
154
+	//					break
155
+	//				}
156
+	//			}
157
+	//		}
158
+	//		if subItem.HisProject.CostClassify != 3 {
159
+	//			subItem.IsCheckTeam = 2
160
+	//			item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
161
+	//		}
162
+	//
163
+	//		if subItem.HisProject.CostClassify == 3 {
164
+	//			subItem.IsCheckTeam = 1
165
+	//			index = index + 1
166
+	//			if index == 1 {
167
+	//				item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
168
+	//			}
169
+	//		}
170
+	//	}
171
+	//}
154 172
 	config, _ := service.GetHisDoctorConfig(orgID)
155 173
 	project_config, _ := service.GetHisProjectConfig(orgID)
156 174
 

+ 32 - 30
controllers/his_api_controller.go Просмотреть файл

@@ -1063,50 +1063,52 @@ func (c *HisApiController) CreateHisPrescription() {
1063 1063
 							timeFormat := tempTime.Format("20060102150405")
1064 1064
 							p.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "2" + "-" + strconv.FormatInt(p.ID, 10)
1065 1065
 
1066
-							//新增或者编辑项目,修改对应的标签数据
1067
-							labelOrigin, _ := service.GetProjectById(p.UserOrgId, p.ID, patient_id, recordDateTime)
1068
-							if labelOrigin.ID == 0 { //当天某个人的处方中的项目不存在
1069
-								var label models.HisLabelPrintInfo
1070
-								project, _ := service.GetProjectDetail(p.ProjectId)
1071
-								if project.CostClassify == 3 { //类别为检验检查
1072
-									if p.TeamId > 0 { //检验检查组套
1073
-										tempLabel, _ := service.GetProjectByTeamId(p.UserOrgId, p.TeamId, patient_id, recordDateTime)
1074
-										if tempLabel.ID == 0 {
1075
-											team, _ := service.GetProjectTeamDetail(p.TeamId)
1066
+							if p.Type == 2 { //因为项目和耗材的基础库存在id相同的情况,所以需要根据该字段来判断,type为2的话为从项目开出来的
1067
+								//新增或者编辑项目,修改对应的标签数据
1068
+								labelOrigin, _ := service.GetProjectById(p.UserOrgId, p.ID, patient_id, recordDateTime)
1069
+								if labelOrigin.ID == 0 { //当天某个人的处方中的项目不存在
1070
+									var label models.HisLabelPrintInfo
1071
+									project, _ := service.GetProjectDetail(p.ProjectId)
1072
+									if project.CostClassify == 3 { //类别为检验检查
1073
+										if p.TeamId > 0 { //检验检查组套
1074
+											tempLabel, _ := service.GetProjectByTeamId(p.UserOrgId, p.TeamId, patient_id, recordDateTime)
1075
+											if tempLabel.ID == 0 {
1076
+												team, _ := service.GetProjectTeamDetail(p.TeamId)
1077
+												label.Number = tempPrescription.PrescriptionNumber
1078
+												label.ProjectId = project.ID
1079
+												label.Status = 1
1080
+												label.IsPrint = 2
1081
+												label.DoctorId = info.DoctorId
1082
+												label.UserOrgId = p.UserOrgId
1083
+												label.PatientId = patient_id
1084
+												label.RecordDate = recordDateTime
1085
+												label.Ctime = time.Now().Unix()
1086
+												label.Mtime = time.Now().Unix()
1087
+												label.ItemId = p.TeamId
1088
+												label.FeedetlSn = p.FeedetlSn
1089
+												label.PProjectId = p.ID
1090
+												label.ProjectName = team.ProjectTeam
1091
+												label.PatientName = patient.Name
1092
+												service.CreateHisLabelRecord(&label)
1093
+											}
1094
+										} else { //单条检验检查项目
1076 1095
 											label.Number = tempPrescription.PrescriptionNumber
1077 1096
 											label.ProjectId = project.ID
1078 1097
 											label.Status = 1
1079
-											label.IsPrint = 2
1080 1098
 											label.DoctorId = info.DoctorId
1081 1099
 											label.UserOrgId = p.UserOrgId
1082 1100
 											label.PatientId = patient_id
1083 1101
 											label.RecordDate = recordDateTime
1102
+											label.IsPrint = 2
1084 1103
 											label.Ctime = time.Now().Unix()
1085 1104
 											label.Mtime = time.Now().Unix()
1086
-											label.ItemId = p.TeamId
1087 1105
 											label.FeedetlSn = p.FeedetlSn
1088 1106
 											label.PProjectId = p.ID
1089
-											label.ProjectName = team.ProjectTeam
1107
+											label.ItemId = p.TeamId
1108
+											label.ProjectName = project.ProjectName
1090 1109
 											label.PatientName = patient.Name
1091 1110
 											service.CreateHisLabelRecord(&label)
1092 1111
 										}
1093
-									} else { //单条检验检查项目
1094
-										label.Number = tempPrescription.PrescriptionNumber
1095
-										label.ProjectId = project.ID
1096
-										label.Status = 1
1097
-										label.DoctorId = info.DoctorId
1098
-										label.UserOrgId = p.UserOrgId
1099
-										label.PatientId = patient_id
1100
-										label.RecordDate = recordDateTime
1101
-										label.IsPrint = 2
1102
-										label.Ctime = time.Now().Unix()
1103
-										label.Mtime = time.Now().Unix()
1104
-										label.FeedetlSn = p.FeedetlSn
1105
-										label.PProjectId = p.ID
1106
-										label.ItemId = p.TeamId
1107
-										label.ProjectName = project.ProjectName
1108
-										label.PatientName = patient.Name
1109
-										service.CreateHisLabelRecord(&label)
1110 1112
 									}
1111 1113
 								}
1112 1114
 							}

+ 6 - 2
controllers/new_mobile_api_controllers/new_common_api_controller.go Просмотреть файл

@@ -36,9 +36,13 @@ func (this *NewCommonApiController) GetTotalDialysis() {
36 36
 
37 37
 	//统计透析总量
38 38
 	total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid, lapsetotype, sourcetype)
39
-
39
+	//var mode models.PatientPrescriptionCountStruct
40
+	//mode.Count = total
40 41
 	modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid, lapsetotype, sourcetype)
41
-
42
+	//var total models.PatientPrescriptionCountStruct
43
+	//for _, item := range modeType {
44
+	//	total.Count = total.Count + item.Count
45
+	//}
42 46
 	if err != nil {
43 47
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
44 48
 		return

+ 11 - 24
service/common_service.go Просмотреть файл

@@ -213,38 +213,28 @@ func DeleteCheck(id int64) error {
213 213
 func GetDialysiTotal(startime int64, endtime int64, orgid int64, lapsetotype int64, sourcetype int64) (models.PatientPrescriptionCountStruct, error) {
214 214
 	counts := models.PatientPrescriptionCountStruct{}
215 215
 
216
-	db := XTReadDB().Table("xt_dialysis_order as x").Where("x.status = 1")
217
-	table := XTReadDB().Table("xt_paitents as s").Where("s.status = 1")
218
-	fmt.Println(table)
216
+	db := XTReadDB().Table("xt_dialysis_order as x").Select("count(x.id) as count").Joins("Join xt_dialysis_prescription as prescription On x.dialysis_date = prescription.record_date AND x.patient_id = prescription.patient_id  AND prescription.status = 1 AND prescription.mode_id > 0").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? AND x.status = 1", startime, endtime, orgid)
219 217
 
220 218
 	if lapsetotype > 0 {
221
-		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? and s.lapseto = ?", startime, endtime, orgid, lapsetotype).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
219
+		err = db.Where("x.user_org_id = ? and s.lapseto = ?", startime, endtime, orgid, lapsetotype).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
222 220
 	}
223 221
 	if lapsetotype == 0 {
224
-		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? ", startime, endtime, orgid).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
222
+		err = db.Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
225 223
 	}
226 224
 
227 225
 	if sourcetype > 0 {
228
-		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? and s.source = ?", startime, endtime, orgid, sourcetype).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
226
+		err = db.Where("x.user_org_id = ? and s.source = ?", startime, endtime, orgid, sourcetype).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
229 227
 	}
230 228
 
231 229
 	if sourcetype == 0 {
232
-		err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ?", startime, endtime, orgid).Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
230
+		err = db.Joins("left join xt_patients as s on s.id= x.patient_id").Scan(&counts).Error
233 231
 	}
234 232
 
235 233
 	return counts, err
236 234
 }
237 235
 
238 236
 func GetDialysisCountMode(starttime int64, endtime int64, orgid int64, lapsetotype int64, sourcetype int64) (counts []*models.PatientPrescriptionCountStruct, err error) {
239
-
240
-	//err = readDb.Table("xt_dialysis_order as o left join xt_schedule as s on s.patient_id = o.patient_id").Where("s.schedule_date = o.dialysis_date and o.dialysis_date>=? and o.dialysis_date<=? and o.user_org_id = ? and o.status = 1 and s.status = 1", starttime, endtime, orgid).Select("s.mode_id,count(s.mode_id) as count").Group("s.mode_id").Scan(&counts).Error
241
-	//return counts, err
242
-
243 237
 	db := readDb.Table("xt_dialysis_order as o").Where("o.status = 1")
244
-	table := readDb.Table("xt_schedule as s").Where("s.status = 1")
245
-	fmt.Println(table)
246
-	p := readDb.Table("xt_patients as p").Where("p.status = 1")
247
-	fmt.Println(p)
248 238
 	if starttime > 0 {
249 239
 		db = db.Where("o.dialysis_date >=?", starttime)
250 240
 	}
@@ -260,7 +250,7 @@ func GetDialysisCountMode(starttime int64, endtime int64, orgid int64, lapsetoty
260 250
 	if sourcetype > 0 {
261 251
 		db = db.Where("p.source = ?", sourcetype)
262 252
 	}
263
-	err = db.Select("s.mode_id,count(s.mode_id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id and s.schedule_date = o.dialysis_date and s.status= 1").Joins("left join xt_patients as  p on o.patient_id = p.id").Group("s.mode_id").Scan(&counts).Error
253
+	err = db.Select("s.mode_id,count(s.mode_id) as count").Joins("join xt_dialysis_prescription as s on s.patient_id = o.patient_id and s.record_date = o.dialysis_date and s.status= 1 AND s.record_date >= ? AND s.record_date <= ? AND AND s.mode_id > 0 ", starttime, endtime).Joins("left join xt_patients as  p on o.patient_id = p.id").Group("s.mode_id").Scan(&counts).Error
264 254
 	return counts, err
265 255
 }
266 256
 
@@ -287,13 +277,14 @@ func GetTotalRollOutPatients(orgid int64, startime int64, endtime int64, lapseto
287 277
 }
288 278
 
289 279
 func GetTotalRollOutPatientsTwo(orgid int64, startime int64, endtime int64, lapsetotype int64, sourcetype int64) (patients []*models.XtPatients, err error) {
290
-
291 280
 	db := XTReadDB().Table("xt_patients as x")
292 281
 	if sourcetype == 0 {
282
+
293 283
 		err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1", startime, endtime, orgid).Scan(&patients).Error
294 284
 
295 285
 	}
296 286
 	if sourcetype > 0 {
287
+
297 288
 		err = db.Raw("select x.id,x.`name`,s.lapseto_type,s.lapseto_time from xt_patients as x left join xt_patient_lapseto AS s ON s.patient_id = x.id where s.lapseto_time >=? and s.lapseto_time <=? and x.user_org_id = ? and s.lapseto_type = 2 and x.status = 1 and x.source = ?", startime, endtime, orgid, sourcetype).Scan(&patients).Error
298 289
 	}
299 290
 	return patients, err
@@ -629,10 +620,6 @@ func GetPrescritionByName(orgid int64, patient_id int64, startime int64, endtime
629 620
 func GetTreateInfo(orgID int64, startime int64, endtime int64, lapseto int64, limit int64, page int64) (blood []*models.TreatDialysisOrder, total int64, err error) {
630 621
 
631 622
 	db := XTReadDB().Table("xt_dialysis_order as o").Where("o.status =  1")
632
-	table := XTReadDB().Table("xt_schedule as s")
633
-	fmt.Println(table)
634
-	p := XTReadDB().Table("xt_patients as p")
635
-	fmt.Println(p)
636 623
 	sql := "from_unixtime(o.dialysis_date, '%Y%m%d') AS date"
637 624
 
638 625
 	if orgID > 0 {
@@ -651,7 +638,7 @@ func GetTreateInfo(orgID int64, startime int64, endtime int64, lapseto int64, li
651 638
 		db = db.Where("p.lapseto = ?", lapseto)
652 639
 	}
653 640
 	offset := (page - 1) * limit
654
-	err = db.Group("o.dialysis_date").Select(sql).Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1").Count(&total).Offset(offset).Limit(limit).Scan(&blood).Error
641
+	err = db.Group("o.dialysis_date").Select(sql).Joins("join xt_dialysis_prescription as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.record_date = o.dialysis_date and s.status =1").Count(&total).Offset(offset).Limit(limit).Scan(&blood).Error
655 642
 	return blood, total, err
656 643
 
657 644
 }
@@ -676,7 +663,7 @@ func GetTreatList(orgid int64, startime int64, endtime int64, lapseto int64) (tt
676 663
 	if lapseto > 0 {
677 664
 		db = db.Where("p.lapseto = ?", lapseto)
678 665
 	}
679
-	err = db.Select("s.mode_id, count(s.mode_id) as number").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status = 1").Group("s.mode_id").Order("s.mode_id asc").Find(&ttd).Error
666
+	err = db.Select("s.mode_id, count(s.mode_id) as number").Joins("join xt_dialysis_prescription as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.record_date = o.dialysis_date and s.status = 1").Group("s.mode_id").Order("s.mode_id asc").Find(&ttd).Error
680 667
 	return ttd, err
681 668
 }
682 669
 
@@ -685,7 +672,7 @@ func GetStatistics(orgID int64, startime int64, endtime int64, modeID int64) (dt
685 672
 	sql := "s.mode_id,from_unixtime(o.dialysis_date, '%Y%m%d') as date, count(o.dialysis_date) as number"
686 673
 	datesql := " o.dialysis_date as date"
687 674
 	group := "from_unixtime(o.dialysis_date, '%Y%m%d')"
688
-	db = db.Table(" xt_dialysis_order AS o").Joins("left join xt_schedule as s on o.patient_id = s.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1")
675
+	db = db.Table(" xt_dialysis_order AS o").Joins("join xt_dialysis_prescription as s on o.patient_id = s.patient_id").Where("s.record_date = o.dialysis_date and s.status =1")
689 676
 	if orgID > 0 {
690 677
 		db = db.Where("o.user_org_id = ?", orgID)
691 678
 	}

+ 0 - 49
service/mobile_dialysis_service.go Просмотреть файл

@@ -3466,55 +3466,6 @@ func GetPCHisPrescriptionProject(orgID int64, scheduleDate int64, deliverWay str
3466 3466
 		}
3467 3467
 		err = db.Find(&vms).Error
3468 3468
 	}
3469
-	//if patientType == 0 {
3470
-	//	db := readDb.
3471
-	//		Table("xt_schedule").
3472
-	//		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
3473
-	//		Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
3474
-	//			return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
3475
-	//		}).
3476
-	//		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
3477
-	//		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
3478
-	//		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
3479
-	//		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
3480
-	//			return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).Preload("HisProject").Preload("GoodInfo", "status=1")
3481
-	//		}).Where("status = 1 AND user_org_id = ?", orgID)
3482
-	//	if scheduleDate != 0 {
3483
-	//		db = db.Where("schedule_date = ?", scheduleDate)
3484
-	//	}
3485
-	//	err = db.Find(&vms).Error
3486
-	//}
3487
-	//
3488
-	//if patientType > 0 {
3489
-	//	db := readDb.
3490
-	//		Table("xt_schedule").
3491
-	//		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
3492
-	//		Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
3493
-	//			return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
3494
-	//		}).
3495
-	//		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
3496
-	//		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
3497
-	//		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
3498
-	//		Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and  (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
3499
-	//		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
3500
-	//			return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).Preload("HisProject").Preload("GoodInfo", "status=1")
3501
-	//		}).
3502
-	//		Where("status = 1 AND user_org_id = ?", orgID)
3503
-	//	if scheduleDate != 0 {
3504
-	//		db = db.Where("schedule_date = ?", scheduleDate)
3505
-	//	}
3506
-	//	err = db.Find(&vms).Error
3507
-	//}
3508
-
3509
-	db := readDb.Table("xt_schedule").Where("status = 1")
3510
-	if scheduleDate > 0 {
3511
-		db = db.Where("schedule_date = ?", scheduleDate)
3512
-	}
3513
-	if orgID > 0 {
3514
-		db = db.Where("user_org_id = ?", orgID)
3515
-	}
3516
-
3517
-	err = db.Find(&vms).Error
3518 3469
 
3519 3470
 	return vms, err
3520 3471
 }