Browse Source

体积小

XMLWAN 3 years ago
parent
commit
6a3c05f163

+ 3 - 1
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

510
 
510
 
511
 	fmt.Println("timeNowUnix", timeNowUnix.Unix())
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
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
516
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
515
 	if getPatientErr != nil {
517
 	if getPatientErr != nil {
516
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
518
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)

+ 1 - 1
models/xcx_user_models.go View File

558
 }
558
 }
559
 
559
 
560
 func (XcxSchedule) TableName() string {
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 View File

573
 	return list, err
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
 	schedule := models.XcxSchedule{}
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
 	return schedule, err
580
 	return schedule, err
581
 }
581
 }