|
@@ -596,11 +596,31 @@ func GetPrscriptionInfo(patientid int64, recorddata int64) (info []*models.HisPr
|
596
|
596
|
|
597
|
597
|
}
|
598
|
598
|
|
599
|
|
-func GetPrescriptionByPatientId(patient_id int64, startime int64, p_type int64) (prescritpion []*models.HisPrescription, err error) {
|
600
|
|
- err = XTReadDB().Model(&prescritpion).Where("patient_id = ? AND record_date =? AND p_type = ? AND status = 1", patient_id, startime, p_type).Find(&prescritpion).Error
|
601
|
|
- return prescritpion, err
|
|
599
|
+func GetPrescriptionByPatientId(patient_id int64, startime int64, p_type int64) (prescription []*models.HisPrescription, err error) {
|
|
600
|
+ err = readDb.Model(&models.HisPrescription{}).
|
|
601
|
+ Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
|
|
602
|
+ return db.Where("status = 1").Preload("XtHisAddtionConfig", "status=1")
|
|
603
|
+ }).
|
|
604
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
605
|
+ return db.Where("status = 1 ").Preload("Drug", "status=1")
|
|
606
|
+ }).
|
|
607
|
+ Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
608
|
+ return db.Where("status = 1 ").Preload("HisProject").Preload("GoodInfo", "status=1")
|
|
609
|
+ }).
|
|
610
|
+ Where("patient_id = ? AND record_date =? AND p_type = ? AND status = 1", patient_id, startime, p_type).
|
|
611
|
+ Find(&prescription).Error
|
|
612
|
+ return
|
602
|
613
|
}
|
603
|
614
|
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+// func GetPrescriptionByPatientId(patient_id int64, startime int64, p_type int64) (prescritpion []*models.HisPrescription, err error) {
|
|
618
|
+// // err = XTReadDB().Model(&prescritpion).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
619
|
+// // return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
|
|
620
|
+// // }).Where("patient_id = ? AND record_date =? AND p_type = ? AND status = 1", patient_id, startime, p_type).Find(&prescritpion).Error
|
|
621
|
+// // return prescritpion, err
|
|
622
|
+// }
|
|
623
|
+
|
604
|
624
|
func GetTodayHisPatient(recod_date int64, patientid int64, user_org_id int64) (*models.XtHisPatient, error) {
|
605
|
625
|
|
606
|
626
|
patient := models.XtHisPatient{}
|