XMLWAN 4 år sedan
förälder
incheckning
6790a9f783
2 ändrade filer med 4 tillägg och 3 borttagningar
  1. 1 1
      controllers/patient_api_controller.go
  2. 3 2
      service/patient_service.go

+ 1 - 1
controllers/patient_api_controller.go Visa fil

@@ -2023,7 +2023,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
2023 2023
 		theEndtTIme = theTime.Unix()
2024 2024
 	}
2025 2025
 
2026
-	advices, total, _ := service.GetDoctorAdviceList(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords)
2026
+	advices, total, _ := service.GetDoctorAdviceListOne(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2027 2027
 	advicestwo, _, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2028 2028
 
2029 2029
 	if len(advices) > 0 {

+ 3 - 2
service/patient_service.go Visa fil

@@ -719,7 +719,7 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
719 719
 	return
720 720
 }
721 721
 
722
-func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
722
+func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string, page int64, limit int64) (advices []*models.DoctorAdvices, total int64, err error) {
723 723
 
724 724
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
725 725
 	table := UserReadDB().Table("sgj_user_admin_role as r")
@@ -752,7 +752,8 @@ func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int6
752 752
 		likeKey := "%" + keywords + "%"
753 753
 		db = db.Where("x.advice_name LIKE ?", likeKey)
754 754
 	}
755
-	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
755
+	offset := (page - 1) * limit
756
+	err = db.Group("x.id").Count(&total).Count(&total).Offset(offset).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
756 757
 	fmt.Print("err", err)
757 758
 	return
758 759
 }