28169 il y a 2 ans
Parent
révision
5466c72d88

+ 12 - 0
controllers/new_mobile_api_controllers/mobile_his_api_controller.go Voir le fichier

1269
 	})
1269
 	})
1270
 	return
1270
 	return
1271
 }
1271
 }
1272
+
1273
+func (c *MobileHisApiController) ToGetPatient() {
1274
+
1275
+	order, _ := service.GetDialysisOrderList(10340)
1276
+	for _, item := range order {
1277
+		service.UpdatePatientDialysisOrder(item.PatientId, item.Url)
1278
+	}
1279
+	c.ServeSuccessJSON(map[string]interface{}{
1280
+		"msg": "ok",
1281
+	})
1282
+	return
1283
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Voir le fichier

181
 	beego.Router("/m/api/prescription/create", &MobileHisApiController{}, "Post:CreateHisPrescription")
181
 	beego.Router("/m/api/prescription/create", &MobileHisApiController{}, "Post:CreateHisPrescription")
182
 
182
 
183
 	beego.Router("/m/api/patient/getpatientplan", &MobileHisApiController{}, "Get:GetPatientPlan")
183
 	beego.Router("/m/api/patient/getpatientplan", &MobileHisApiController{}, "Get:GetPatientPlan")
184
+	beego.Router("/m/api/patient/togetpatient", &MobileHisApiController{}, "Get:ToGetPatient")
184
 
185
 
185
 }
186
 }

+ 115 - 14
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Voir le fichier

49
 func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
49
 func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
50
 
50
 
51
 	orgId := this.GetMobileAdminUserInfo().Org.Id
51
 	orgId := this.GetMobileAdminUserInfo().Org.Id
52
-	start_time, _ := this.GetInt64("start_time")
53
-	fmt.Println("staft_time", start_time)
54
-	end_time, _ := this.GetInt64("end_time")
55
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
52
+	//start_time, _ := this.GetInt64("start_time")
53
+	//fmt.Println("staft_time", start_time)
54
+	//end_time, _ := this.GetInt64("end_time")
55
+	//fmt.Println("start_time",start_time)
56
+	//fmt.Println("end_time",end_time)
57
+	start_time_one := this.GetString("start_time_one")
58
+	end_time_one := this.GetString("end_time_one")
59
+	fmt.Println("start_time_one--------", len(start_time_one))
60
+	fmt.Println("end_time_one-------", end_time_one)
61
+	timeLayout := "2006-01-02"
62
+	loc, _ := time.LoadLocation("Local")
63
+	var startTime int64
64
+	if len(start_time_one) > 0 {
65
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
66
+		fmt.Println("err-----------", err)
67
+		if err != nil {
68
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
69
+			return
70
+		}
71
+		startTime = theTime.Unix()
72
+	}
73
+	var endTime int64
74
+	if len(end_time_one) > 0 {
75
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
76
+		if err != nil {
77
+			utils.ErrorLog(err.Error())
78
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
79
+			return
80
+		}
81
+		endTime = theTime.Unix()
82
+	}
83
+	fmt.Println("starti_time233232323232", startTime)
84
+	fmt.Println("end_time2323223232323", endTime)
85
+	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
56
 	if err != nil {
86
 	if err != nil {
57
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
87
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
58
 		return
88
 		return
66
 func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
96
 func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
67
 
97
 
68
 	orgId := this.GetMobileAdminUserInfo().Org.Id
98
 	orgId := this.GetMobileAdminUserInfo().Org.Id
69
-	start_time, _ := this.GetInt64("start_time")
70
-	end_time, _ := this.GetInt64("end_time")
99
+	//start_time, _ := this.GetInt64("start_time")
100
+	//end_time, _ := this.GetInt64("end_time")
101
+	start_time_one := this.GetString("start_time_one")
102
+	end_time_one := this.GetString("end_time_one")
103
+	timeLayout := "2006-01-02"
104
+	loc, _ := time.LoadLocation("Local")
105
+	var startTime int64
106
+	if len(start_time_one) > 0 {
107
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
108
+		if err != nil {
109
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
110
+			return
111
+		}
112
+		startTime = theTime.Unix()
113
+	}
114
+	var endTime int64
115
+	if len(end_time_one) > 0 {
116
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
117
+		if err != nil {
118
+			utils.ErrorLog(err.Error())
119
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
120
+			return
121
+		}
122
+		endTime = theTime.Unix()
123
+	}
71
 
124
 
72
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
125
+	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
73
 	if err != nil {
126
 	if err != nil {
74
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
127
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
75
 		return
128
 		return
82
 
135
 
83
 func (this *StaffScheduleApiController) GetScheduleByUserType() {
136
 func (this *StaffScheduleApiController) GetScheduleByUserType() {
84
 	doctor_id, _ := this.GetInt64("doctor_id")
137
 	doctor_id, _ := this.GetInt64("doctor_id")
85
-	start_time, _ := this.GetInt64("start_time")
86
-	end_time, _ := this.GetInt64("end_time")
138
+	//start_time, _ := this.GetInt64("start_time")
139
+	//end_time, _ := this.GetInt64("end_time")
140
+	start_time_one := this.GetString("start_time_one")
141
+	end_time_one := this.GetString("end_time_one")
142
+	timeLayout := "2006-01-02"
143
+	loc, _ := time.LoadLocation("Local")
144
+	var startTime int64
145
+	if len(start_time_one) > 0 {
146
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
147
+		if err != nil {
148
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
149
+			return
150
+		}
151
+		startTime = theTime.Unix()
152
+	}
153
+	var endTime int64
154
+	if len(end_time_one) > 0 {
155
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
156
+		if err != nil {
157
+			utils.ErrorLog(err.Error())
158
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
159
+			return
160
+		}
161
+		endTime = theTime.Unix()
162
+	}
87
 	orgId := this.GetMobileAdminUserInfo().Org.Id
163
 	orgId := this.GetMobileAdminUserInfo().Org.Id
88
-	staffList, err := service.GetScheduleByDoctorId(doctor_id, start_time, end_time, orgId)
164
+	staffList, err := service.GetScheduleByDoctorId(doctor_id, startTime, endTime, orgId)
89
 	if err != nil {
165
 	if err != nil {
90
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
166
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
91
 		return
167
 		return
100
 
176
 
101
 	orgId := this.GetMobileAdminUserInfo().Org.Id
177
 	orgId := this.GetMobileAdminUserInfo().Org.Id
102
 	user_name := this.GetString("user_name")
178
 	user_name := this.GetString("user_name")
103
-	start_time, _ := this.GetInt64("start_time")
104
-	end_time, _ := this.GetInt64("end_time")
105
-	staffList, err := service.ToSearchSeacheduleList(user_name, start_time, end_time, orgId)
179
+	//start_time, _ := this.GetInt64("start_time")
180
+	//end_time, _ := this.GetInt64("end_time")
181
+
182
+	start_time_one := this.GetString("start_time_one")
183
+	end_time_one := this.GetString("end_time_one")
184
+	timeLayout := "2006-01-02"
185
+	loc, _ := time.LoadLocation("Local")
186
+	var startTime int64
187
+	if len(start_time_one) > 0 {
188
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
189
+		if err != nil {
190
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
191
+			return
192
+		}
193
+		startTime = theTime.Unix()
194
+	}
195
+	var endTime int64
196
+	if len(end_time_one) > 0 {
197
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 23:59:59", loc)
198
+		if err != nil {
199
+			utils.ErrorLog(err.Error())
200
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
201
+			return
202
+		}
203
+		endTime = theTime.Unix()
204
+	}
205
+	//
206
+	staffList, err := service.ToSearchSeacheduleList(user_name, startTime, endTime, orgId)
106
 	if err != nil {
207
 	if err != nil {
107
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
208
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
108
 		return
209
 		return
812
 	patient_id, _ := c.GetInt64("patient_id")
913
 	patient_id, _ := c.GetInt64("patient_id")
813
 	org_id := c.GetMobileAdminUserInfo().Org.Id
914
 	org_id := c.GetMobileAdminUserInfo().Org.Id
814
 	err := service.ChangeScheduleById(id, mode_id)
915
 	err := service.ChangeScheduleById(id, mode_id)
815
-	fmt.Println("9999999999999999", err)
916
+	fmt.Println("err", err)
816
 	err = service.ChangeDialysisSolution(patient_id, schedule_date, org_id, mode_id)
917
 	err = service.ChangeDialysisSolution(patient_id, schedule_date, org_id, mode_id)
817
 	c.ServeSuccessJSON(map[string]interface{}{
918
 	c.ServeSuccessJSON(map[string]interface{}{
818
 		"msg": "ok",
919
 		"msg": "ok",

+ 29 - 13
controllers/pharmacy_controller.go Voir le fichier

35
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
35
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
36
 }
36
 }
37
 
37
 
38
-//测试
38
+// 测试
39
 func (this *PharmacyController) Tlili() {
39
 func (this *PharmacyController) Tlili() {
40
 	var err error
40
 	var err error
41
 	defer func() {
41
 	defer func() {
65
 	return
65
 	return
66
 }
66
 }
67
 
67
 
68
-//查询今天的待发药,已发药人数
68
+// 查询今天的待发药,已发药人数
69
 func (this *PharmacyController) TodayNumber() {
69
 func (this *PharmacyController) TodayNumber() {
70
 	var err error
70
 	var err error
71
 	defer func() {
71
 	defer func() {
166
 	}
166
 	}
167
 
167
 
168
 	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 {
168
 	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 {
169
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1)
169
+
170
+		//获取排班班次
171
+		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
172
+		var ids []int64
173
+		for _, item := range schedule {
174
+			ids = append(ids, item.PatientId)
175
+		}
176
+
177
+		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
170
 		fmt.Println("list23323232323232", list)
178
 		fmt.Println("list23323232323232", list)
171
 		var flist []models.TmpPatientOne
179
 		var flist []models.TmpPatientOne
172
 		if len(list) > 0 {
180
 		if len(list) > 0 {
247
 			return
255
 			return
248
 		}
256
 		}
249
 		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
257
 		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
258
+
250
 		if err != nil {
259
 		if err != nil {
251
 			utils.ErrorLog(err.Error())
260
 			utils.ErrorLog(err.Error())
252
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
261
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
261
 	//当天已发药的人数
270
 	//当天已发药的人数
262
 	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 {
271
 	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 {
263
 
272
 
264
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0)
273
+		//获取排班班次
274
+		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
275
+		fmt.Println("schedule--------", schedule)
276
+		var ids []int64
277
+		for _, item := range schedule {
278
+			ids = append(ids, item.PatientId)
279
+		}
280
+
281
+		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
265
 
282
 
266
 		var flist []models.TmpPatientOne
283
 		var flist []models.TmpPatientOne
267
 		if len(list) > 0 {
284
 		if len(list) > 0 {
278
 
295
 
279
 }
296
 }
280
 
297
 
281
-//
282
 func (this *PharmacyController) GetPharmacyContent() {
298
 func (this *PharmacyController) GetPharmacyContent() {
283
 	var err error
299
 	var err error
284
 	defer func() {
300
 	defer func() {
320
 
336
 
321
 }
337
 }
322
 
338
 
323
-//发药按钮点击
339
+// 发药按钮点击
324
 func (this *PharmacyController) DispensingMedicine() {
340
 func (this *PharmacyController) DispensingMedicine() {
325
 	var err error
341
 	var err error
326
 	defer func() {
342
 	defer func() {
399
 	return
415
 	return
400
 }
416
 }
401
 
417
 
402
-//退药按钮点击
418
+// 退药按钮点击
403
 func (this *PharmacyController) DrugWithdrawal() {
419
 func (this *PharmacyController) DrugWithdrawal() {
404
 	var err error
420
 	var err error
405
 	defer func() {
421
 	defer func() {
437
 
453
 
438
 }
454
 }
439
 
455
 
440
-//发药明细列表
456
+// 发药明细列表
441
 func (this *PharmacyController) DispensingDetails() {
457
 func (this *PharmacyController) DispensingDetails() {
442
 	var err error
458
 	var err error
443
 	defer func() {
459
 	defer func() {
485
 	return
501
 	return
486
 }
502
 }
487
 
503
 
488
-//处方详情
504
+// 处方详情
489
 func (this *PharmacyController) PrescriptionDetails() {
505
 func (this *PharmacyController) PrescriptionDetails() {
490
 	var err error
506
 	var err error
491
 	defer func() {
507
 	defer func() {
518
 	return
534
 	return
519
 }
535
 }
520
 
536
 
521
-//已发药品的信息
537
+// 已发药品的信息
522
 func (this *PharmacyController) DispenseMedicine() {
538
 func (this *PharmacyController) DispenseMedicine() {
523
 	var err error
539
 	var err error
524
 	defer func() {
540
 	defer func() {
563
 	return
579
 	return
564
 }
580
 }
565
 
581
 
566
-//待发药的药品信息
582
+// 待发药的药品信息
567
 func (this *PharmacyController) WaitingMedicine() {
583
 func (this *PharmacyController) WaitingMedicine() {
568
 	var err error
584
 	var err error
569
 	defer func() {
585
 	defer func() {
608
 	return
624
 	return
609
 }
625
 }
610
 
626
 
611
-//获取药品的所有患者信息
627
+// 获取药品的所有患者信息
612
 func (this *PharmacyController) GetPatientsWithDrugs() {
628
 func (this *PharmacyController) GetPatientsWithDrugs() {
613
 	var err error
629
 	var err error
614
 	defer func() {
630
 	defer func() {
675
 	return
691
 	return
676
 }
692
 }
677
 
693
 
678
-//药品管理发药按钮点击
694
+// 药品管理发药按钮点击
679
 func (this *PharmacyController) MedicineDeparture() {
695
 func (this *PharmacyController) MedicineDeparture() {
680
 	var err error
696
 	var err error
681
 	defer func() {
697
 	defer func() {

+ 1 - 0
models/dialysis.go Voir le fichier

888
 	Number         int64  `gorm:"column:number" json:"number" form:"number"`
888
 	Number         int64  `gorm:"column:number" json:"number" form:"number"`
889
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
889
 	UserName       int64  `gorm:"column:user_name" json:"user_name" form:"user_name"`
890
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
890
 	WashpipeNurse  int64  `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
891
+	Url            string `gorm:"column:url" json:"url" form:"url"`
891
 }
892
 }
892
 
893
 
893
 func (XtDialysisOrder) TableName() string {
894
 func (XtDialysisOrder) TableName() string {

+ 1 - 0
models/patient_models.go Voir le fichier

1177
 	SchRemark                    string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
1177
 	SchRemark                    string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
1178
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1178
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1179
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1179
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1180
+	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1180
 }
1181
 }
1181
 
1182
 
1182
 func (XtPatients) TableName() string {
1183
 func (XtPatients) TableName() string {

+ 16 - 4
service/his_service.go Voir le fichier

618
 	return
618
 	return
619
 }
619
 }
620
 
620
 
621
-//未收费
621
+// 未收费
622
 func GetUnChargeMonthHisPrescriptionThree(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
622
 func GetUnChargeMonthHisPrescriptionThree(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
623
 	err = readDb.Model(&models.HisPrescription{}).
623
 	err = readDb.Model(&models.HisPrescription{}).
624
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
624
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
637
 	return
637
 	return
638
 }
638
 }
639
 
639
 
640
-//已收费
640
+// 已收费
641
 func GetChargeMonthHisPrescriptionFour(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
641
 func GetChargeMonthHisPrescriptionFour(org_id int64, patient_id int64, start_date int64, end_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
642
 	err = readDb.Model(&models.HisPrescription{}).
642
 	err = readDb.Model(&models.HisPrescription{}).
643
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
643
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2235
 	return
2235
 	return
2236
 }
2236
 }
2237
 
2237
 
2238
-//组
2238
+// 
2239
 func GetHisPrescriptionTemplateL(template_id int64, org_id int64) (prescription []*models.HisPrescriptionInfoTemplateL, err error) {
2239
 func GetHisPrescriptionTemplateL(template_id int64, org_id int64) (prescription []*models.HisPrescriptionInfoTemplateL, err error) {
2240
 	err = readDb.Model(&models.HisPrescriptionInfoTemplateL{}).
2240
 	err = readDb.Model(&models.HisPrescriptionInfoTemplateL{}).
2241
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
2241
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
2343
 	return
2343
 	return
2344
 }
2344
 }
2345
 
2345
 
2346
-//已收费
2346
+// 已收费
2347
 func GetChargeMonthHisPrescriptionFive(org_id int64, patient_id int64, order_number string, p_type int64) (prescription []*models.HisPrescription, err error) {
2347
 func GetChargeMonthHisPrescriptionFive(org_id int64, patient_id int64, order_number string, p_type int64) (prescription []*models.HisPrescription, err error) {
2348
 	err = readDb.Model(&models.HisPrescription{}).
2348
 	err = readDb.Model(&models.HisPrescription{}).
2349
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2349
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2714
 	err := XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status = 1", id).Update(map[string]interface{}{"treatment_plan": trement_plan}).Error
2714
 	err := XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status = 1", id).Update(map[string]interface{}{"treatment_plan": trement_plan}).Error
2715
 	return err
2715
 	return err
2716
 }
2716
 }
2717
+
2718
+func GetDialysisOrderList(orgid int64) (order []*models.XtDialysisOrder, err error) {
2719
+
2720
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and url<>''", orgid).Group("patient_id").Find(&order).Error
2721
+	return order, err
2722
+}
2723
+
2724
+func UpdatePatientDialysisOrder(patient_id int64, url string) error {
2725
+
2726
+	err := XTWriteDB().Model(&models.XtPatients{}).Where("id =? and status=1", patient_id).Updates(map[string]interface{}{"url": url}).Error
2727
+	return err
2728
+}

+ 32 - 2
service/pharmacy_service.go Voir le fichier

96
 	return len(tmp), err
96
 	return len(tmp), err
97
 }
97
 }
98
 
98
 
99
-func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine int64) (advice []*models.HisDoctorAdviceInfo, err error) {
99
+func GetSchedulePatientId(start_time int64, end_time int64, org_id int64, class_type int64, partion_type int64) (schedule []*models.XtSchedules, err error) {
100
+
101
+	db := XTReadDB().Model(&schedule).Where("status = 1")
102
+
103
+	if start_time > 0 {
104
+		db = db.Where("schedule_date >=?", start_time)
105
+	}
106
+
107
+	if end_time > 0 {
108
+		db = db.Where("schedule_date <=?", end_time)
109
+	}
110
+
111
+	if org_id > 0 {
112
+		db = db.Where("user_org_id = ?", org_id)
113
+	}
114
+	if class_type > 0 {
115
+		db = db.Where("schedule_type =?", class_type)
116
+	}
117
+	if partion_type > 0 {
118
+		db = db.Where("partition_id = ?", partion_type)
119
+	}
120
+	err = db.Find(&schedule).Error
121
+
122
+	return schedule, err
123
+}
124
+
125
+func GetTodayAdviceCountOne(stime int64, etime int64, orgid int64, is_medicine int64, ids []int64) (advice []*models.HisDoctorAdviceInfo, err error) {
100
 
126
 
101
 	db := XTReadDB().Model(&advice).Where("status=1 and is_medicine = ?", is_medicine)
127
 	db := XTReadDB().Model(&advice).Where("status=1 and is_medicine = ?", is_medicine)
102
 	if stime > 0 {
128
 	if stime > 0 {
108
 	if orgid > 0 {
134
 	if orgid > 0 {
109
 		db = db.Where("user_org_id = ?", orgid)
135
 		db = db.Where("user_org_id = ?", orgid)
110
 	}
136
 	}
137
+	if len(ids) > 0 {
138
+		db = db.Where("patient_id in(?)", ids)
139
+	}
111
 
140
 
112
 	err = db.Group("patient_id").Find(&advice).Error
141
 	err = db.Group("patient_id").Find(&advice).Error
113
 	return advice, err
142
 	return advice, err
1828
 	if shift == 0 && partition == 0 {
1857
 	if shift == 0 && partition == 0 {
1829
 		return flist, nil
1858
 		return flist, nil
1830
 	}
1859
 	}
1831
-	err = XTWriteDB().Model(&models.XtScheduleTwo{}).Where(s, orgid, stime, etime).Find(&sch).Error
1860
+	err = XTReadDB().Model(&models.XtScheduleTwo{}).Where(s, orgid, stime, etime).Find(&sch).Error
1861
+
1832
 	if err != nil {
1862
 	if err != nil {
1833
 		return
1863
 		return
1834
 	}
1864
 	}