|
@@ -2824,3 +2824,19 @@ func GetGoodByIdIsStop(good_id int64, org_id int64) (models.GoodInfoSeven, error
|
2824
|
2824
|
err = XTReadDB().Where("org_id = ? and status = 1 and find_in_set('停用',good_status) = 0 and id =?", org_id, good_id).Find(&goodInfoSeven).Error
|
2825
|
2825
|
return goodInfoSeven, err
|
2826
|
2826
|
}
|
|
2827
|
+
|
|
2828
|
+func GetHisPrescriptionByBatchNumber(org_id int64, number string) (prescription []*models.HisPrescription, err error) {
|
|
2829
|
+ err = readDb.Model(&models.HisPrescription{}).
|
|
2830
|
+ Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
|
|
2831
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
|
|
2832
|
+ }).
|
|
2833
|
+ Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
2834
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
|
|
2835
|
+ }).
|
|
2836
|
+ Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
2837
|
+ return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
|
|
2838
|
+ }).
|
|
2839
|
+ Where("user_org_id = ? AND status = 1 AND batch_number = ?", org_id, number).
|
|
2840
|
+ Find(&prescription).Error
|
|
2841
|
+ return
|
|
2842
|
+}
|