Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 1 year ago
parent
commit
fce6d3a258
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)
@@ -8529,6 +8527,9 @@ func (c *HisApiController) GetFaPiaoData() {
8529 8527
 
8530 8528
 	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, order.MdtrtId)
8531 8529
 
8530
+	prescriptions, _ := service.GetHisPrescriptionByBatchNumber(adminUser.CurrentOrgId, order.Number)
8531
+
8532
+	doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, prescriptions[0].Creator)
8532 8533
 	his_hospital_record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8533 8534
 
8534 8535
 	patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
@@ -8907,6 +8908,7 @@ func (c *HisApiController) GetFaPiaoData() {
8907 8908
 		"his_hospital_record":         his_hospital_record,
8908 8909
 		"pre_pay_money":               pre_pay_money,
8909 8910
 		"refund_sum":                  sum,
8911
+		"doctor_info":                 doctor_info,
8910 8912
 	})
8911 8913
 
8912 8914
 }

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