Browse Source

提交代码

陈少旭 1 year ago
parent
commit
0641c665b2
2 changed files with 20 additions and 2 deletions
  1. 4 2
      controllers/his_api_controller.go
  2. 16 0
      service/his_service.go

+ 4 - 2
controllers/his_api_controller.go View File

@@ -1868,9 +1868,7 @@ func (c *HisApiController) CreateHisPrescription() {
1868 1868
 														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1869 1869
 														return
1870 1870
 													}
1871
-
1872 1871
 												}
1873
-
1874 1872
 											} else {
1875 1873
 												if prescribingNumberUnit == drug.MaxUnit {
1876 1874
 													num := prescribing_number * float64(drug.MinNumber)
@@ -8517,6 +8515,9 @@ func (c *HisApiController) GetFaPiaoData() {
8517 8515
 
8518 8516
 	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, order.MdtrtId)
8519 8517
 
8518
+	prescriptions, _ := service.GetHisPrescriptionByBatchNumber(adminUser.CurrentOrgId, order.Number)
8519
+
8520
+	doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, prescriptions[0].Creator)
8520 8521
 	his_hospital_record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8521 8522
 
8522 8523
 	patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
@@ -8895,6 +8896,7 @@ func (c *HisApiController) GetFaPiaoData() {
8895 8896
 		"his_hospital_record":         his_hospital_record,
8896 8897
 		"pre_pay_money":               pre_pay_money,
8897 8898
 		"refund_sum":                  sum,
8899
+		"doctor_info":                 doctor_info,
8898 8900
 	})
8899 8901
 
8900 8902
 }

+ 16 - 0
service/his_service.go View File

@@ -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
+}