XMLWAN il y a 3 ans
Parent
révision
763ba1873c
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      service/his_project_service.go

+ 5 - 1
service/his_project_service.go Voir le fichier

@@ -393,7 +393,11 @@ func GetHistPatient(orgid int64, keyword string) (hisPatient []*models.HisPatien
393 393
 
394 394
 func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64) (prescription []*models.HisPrescription, err error) {
395 395
 
396
-	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 ", his_patient_id, recorddate, schIDs).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", "status = 1 and user_org_id = ?", orgid).Preload("HisPrescriptionProject", "status = 1 and user_org_id = ?", orgid).Preload("VMHisPrescriptionInfo", "status =1 and user_org_id = ?", orgid).Preload("XtHisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
396
+	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 ", his_patient_id, recorddate, schIDs).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
397
+		return XTReadDB().Where("user_org_id=? and status=1", orgid).Preload("Drug", func(db *gorm.DB) *gorm.DB {
398
+			return XTReadDB().Where("status = 1")
399
+		})
400
+	}).Preload("HisPrescriptionProject", "status = 1 and user_org_id = ?", orgid).Preload("VMHisPrescriptionInfo", "status =1 and user_org_id = ?", orgid).Preload("XtHisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
397 401
 
398 402
 	return prescription, err
399 403
 }