|
@@ -943,6 +943,12 @@ func FindPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int
|
943
|
943
|
|
944
|
944
|
}
|
945
|
945
|
|
|
946
|
+func FindPatientPrescriptionInfoTen(org_id int64, patient_id int64, start_time int64, end_time int64, p_type int64) (info []models.HisPrescriptionInfo, err error) {
|
|
947
|
+ err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? and record_date <= ? AND patient_id = ? AND p_type = ?", org_id, start_time, end_time, patient_id, p_type).First(&info).Error
|
|
948
|
+ return
|
|
949
|
+
|
|
950
|
+}
|
|
951
|
+
|
946
|
952
|
func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
|
947
|
953
|
err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).First(&info).Error
|
948
|
954
|
return
|
|
@@ -2905,3 +2911,25 @@ func GetLastHisOrderTwo(org_id int64) (his models.HisOrder, err error) {
|
2905
|
2911
|
//
|
2906
|
2912
|
// return
|
2907
|
2913
|
//}
|
|
2914
|
+
|
|
2915
|
+//func GetHisPrescriptionByHisPatientID(org_id int64, patient_id int64, record_date int64) (prescription []*models.HisPrescriptionTen, err error) {
|
|
2916
|
+// err = readDb.Model(&models.HisPrescriptionTen{}).
|
|
2917
|
+// Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = 2 and his_patient_id = 0", org_id, record_date, patient_id).
|
|
2918
|
+// Find(&prescription).Error
|
|
2919
|
+// return
|
|
2920
|
+//}
|
|
2921
|
+
|
|
2922
|
+func GetHisPrescriptionByHisPatientID(record_date int64, org_id int64, patient_id int64) (advice []*VMOtherHisPrescriptionInfo, err error) {
|
|
2923
|
+ err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date >= ? AND record_date <= ? AND p_type = ? and order_status = 1", patient_id, org_id, record_date, record_date, 1).
|
|
2924
|
+ Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
|
|
2925
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).
|
|
2926
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
2927
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
|
|
2928
|
+ }).
|
|
2929
|
+ Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
2930
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status = 1")
|
|
2931
|
+ })
|
|
2932
|
+ }).Order("record_date desc").Find(&advice).Error
|
|
2933
|
+
|
|
2934
|
+ return
|
|
2935
|
+}
|