Bladeren bron

体积小

XMLWAN 3 jaren geleden
bovenliggende
commit
6a3c05f163

+ 3 - 1
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Bestand weergeven

@@ -510,7 +510,9 @@ func (this *XcxApiController) GetMobileSchedule() {
510 510
 
511 511
 	fmt.Println("timeNowUnix", timeNowUnix.Unix())
512 512
 	//获取该患者最后一次排班
513
-	list, _ := service.GetLastScheduleList(patientID)
513
+	list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
514
+	fmt.Println("hh2332323232323223", list)
515
+	fmt.Println("list233232232332", list.ScheduleDate)
514 516
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
515 517
 	if getPatientErr != nil {
516 518
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)

+ 1 - 1
models/xcx_user_models.go Bestand weergeven

@@ -558,5 +558,5 @@ type XcxSchedule struct {
558 558
 }
559 559
 
560 560
 func (XcxSchedule) TableName() string {
561
-	return "his_doctor_advice_info"
561
+	return "xt_schedule"
562 562
 }

+ 2 - 2
service/xcx_mobile_api_service.go Bestand weergeven

@@ -573,9 +573,9 @@ func GetDataConfig(orgid int64) (list []*models.XcxDataConfig, err error) {
573 573
 	return list, err
574 574
 }
575 575
 
576
-func GetLastScheduleList(patient_id int64) (models.XcxSchedule, error) {
576
+func GetLastScheduleListOne(patient_id int64, schedule_date int64) (models.XcxSchedule, error) {
577 577
 
578 578
 	schedule := models.XcxSchedule{}
579
-	err := XTReadDB().Where("patient_id = ? and status = 1", patient_id).Last(&schedule).Error
579
+	err := XTReadDB().Model(&schedule).Where("patient_id = ? and status = 1 and schedule_date <=?", patient_id, schedule_date).Last(&schedule).Error
580 580
 	return schedule, err
581 581
 }