csx před 2 roky
rodič
revize
6350a586e7

+ 12 - 8
controllers/his_api_controller.go Zobrazit soubor

@@ -4949,13 +4949,16 @@ func (c *HisApiController) GetAllOrderDetailCollect() {
4949 4949
 	patient, _ := service.GetPatientByID(org_id, order.PatientId)
4950 4950
 
4951 4951
 	his, _ := service.GetHisPatientInfoThree(order.UserOrgId, order.MdtrtId)
4952
+	//his, _ := service.Get(order.UserOrgId, order.MdtrtId)
4953
+	record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
4952 4954
 
4953 4955
 	if his.BalanceAccountsType != 2 {
4954 4956
 		c.ServeSuccessJSON(map[string]interface{}{
4955
-			"order":      order,
4956
-			"order_info": order_info,
4957
-			"patient":    patient,
4958
-			"admin_info": adminInfo,
4957
+			"order":        order,
4958
+			"order_info":   order_info,
4959
+			"patient":      patient,
4960
+			"admin_info":   adminInfo,
4961
+			"his_hospital": record,
4959 4962
 		})
4960 4963
 	} else {
4961 4964
 
@@ -5009,10 +5012,11 @@ func (c *HisApiController) GetAllOrderDetailCollect() {
5009 5012
 			}
5010 5013
 		}
5011 5014
 		c.ServeSuccessJSON(map[string]interface{}{
5012
-			"order":      order,
5013
-			"order_info": order_info,
5014
-			"patient":    patient,
5015
-			"admin_info": adminInfo,
5015
+			"order":        order,
5016
+			"order_info":   order_info,
5017
+			"patient":      patient,
5018
+			"admin_info":   adminInfo,
5019
+			"his_hospital": record,
5016 5020
 		})
5017 5021
 
5018 5022
 	}

+ 6 - 2
controllers/his_hospital_api_controller.go Zobrazit soubor

@@ -198,14 +198,18 @@ func (c *HisHospitalApiController) GetHisHospitalChargePatientInfo() {
198 198
 	}
199 199
 
200 200
 	var monthPrescriptions []*models.HisPrescription
201
+	var settle_prescriptions []*models.HisPrescription
201 202
 	if order_status == 1 || order_status == 0 {
202 203
 		monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
203 204
 	} else if order_status == 2 {
204 205
 		monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFour(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
205 206
 	}
206 207
 
207
-	settle_prescriptions, _ := service.GetSettleHisHospitalPrescription(admin.CurrentOrgId, patient_id, his_patient_id, his_patient_info.RecordDate)
208
-
208
+	if order_status == 1 || order_status == 0 {
209
+		settle_prescriptions, _ = service.GetSettleHisHospitalPrescription(admin.CurrentOrgId, patient_id, his_patient_id, his_patient_info.RecordDate)
210
+	} else if order_status == 2 {
211
+		settle_prescriptions, _ = service.GetSettleHisHospitalPrescriptionTwo(admin.CurrentOrgId, patient_id, his_patient_info.Number)
212
+	}
209 213
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
210 214
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
211 215
 	order, _ := service.GetNewHisOrder(admin.CurrentOrgId, his_patient_info.Number, patient_id)

+ 10 - 0
controllers/his_print_api_controller.go Zobrazit soubor

@@ -39,6 +39,16 @@ func (c *HisPrintApiController) GetBatchHisPrescriptionData() {
39 39
 		break
40 40
 	case 2:
41 41
 		patients, _ := service.GetBatchProjectHisPrescription(ids, recordDateTime, adminInfo.CurrentOrgId)
42
+		for _, item := range patients {
43
+			for _, subItem := range item.HisPrintPrescription {
44
+				for _, subItemTwo := range subItem.HisPrescriptionProject {
45
+					if subItemTwo.HisProject.CostClassify == 3 {
46
+
47
+					}
48
+				}
49
+			}
50
+		}
51
+
42 52
 		c.ServeSuccessJSON(map[string]interface{}{
43 53
 			"patients": patients,
44 54
 		})

+ 16 - 0
service/his_hospital_service.go Zobrazit soubor

@@ -413,3 +413,19 @@ func GetAllMonthHisHospitalPrescription(org_id int64, patient_id int64, start_ti
413 413
 		Find(&prescription).Error
414 414
 	return
415 415
 }
416
+
417
+func GetSettleHisHospitalPrescriptionTwo(org_id int64, patient_id int64, number string) (prescription []*models.HisPrescription, err error) {
418
+	err = readDb.Model(&models.HisPrescription{}).
419
+		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
420
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
421
+		}).
422
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
423
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
424
+		}).
425
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
426
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
427
+		}).
428
+		Where("user_org_id = ? AND status = 1 AND patient_id = ? AND order_status = 2 AND batch_number = ? ", org_id, patient_id, number).
429
+		Find(&prescription).Error
430
+	return
431
+}

+ 58 - 29
service/his_service.go Zobrazit soubor

@@ -875,7 +875,7 @@ func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time int6
875 875
 		db = db.Where("his_order.settle_accounts_date<=?", end_time)
876 876
 	}
877 877
 
878
-	db = db.Where("his_order.status = 1 AND his_order.user_org_id = ? AND his_order.p_type = ?", user_org_id, p_type)
878
+	db = db.Where("his_order.status = 1 AND his_order.user_org_id = ? AND his_order.p_type = ? AND his_order.order_status = 2", user_org_id, p_type)
879 879
 
880 880
 	db = db.Preload("HisOrderInfo", "status = 1 AND user_org_id = ?", user_org_id).
881 881
 		Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id).
@@ -933,26 +933,61 @@ func UpDateHospitalHisPrescriptionInfoNumber(user_org_id int64, number string, s
933 933
 }
934 934
 
935 935
 type HisOrder struct {
936
-	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
937
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
938
-	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
939
-	SettleAccountsDate    int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
940
-	Ctime                 int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
941
-	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
942
-	Status                int64   `gorm:"column:status" json:"status" form:"status"`
943
-	Number                string  `gorm:"column:number" json:"number" form:"number"`
944
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
945
-	MedfeeSumamt          float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
946
-	OrderStatus           float64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
947
-	PayWay                int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
948
-	PayPrice              float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
949
-	PayCardNo             string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
950
-	DiscountPrice         float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
951
-	PreferentialPrice     float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
952
-	RealityPrice          float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
953
-	FoundPrice            float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
954
-	MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
955
-	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
936
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
937
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
938
+	HisPatientId int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
939
+	Number       string `gorm:"column:number" json:"number" form:"number"`
940
+
941
+	SettleAccountsDate  int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
942
+	Status              int64   `gorm:"column:status" json:"status" form:"status"`
943
+	PatientId           int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
944
+	Infcode             int64   `gorm:"column:infcode" json:"infcode" form:"infcode"`
945
+	WarnMsg             string  `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
946
+	Cainfo              string  `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
947
+	ErrMsg              string  `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
948
+	RespondTime         string  `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
949
+	InfRefmsgid         string  `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
950
+	OrderStatus         int64   `gorm:"column:order_status" json:"order_status" form:"order_status"`
951
+	MdtrtId             string  `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
952
+	SetlId              string  `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
953
+	Insutype            string  `gorm:"column:insutype" json:"insutype" form:"insutype"`
954
+	PsnType             string  `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
955
+	CvlservFlag         string  `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
956
+	SetlTime            string  `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
957
+	MdtrtCertType       string  `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
958
+	MedType             string  `gorm:"column:med_type" json:"med_type" form:"med_type"`
959
+	MedfeeSumamt        float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
960
+	FulamtOwnpayAmt     float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
961
+	OverlmtSelfPay      float64 `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
962
+	PreselfpayAmt       float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
963
+	InscpScpAmt         float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
964
+	ActPayDedc          float64 `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
965
+	HifpPay             float64 `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
966
+	CvlservPay          float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
967
+	PoolPropSelfpay     float64 `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
968
+	HifesPay            float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
969
+	HifmiPay            float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
970
+	HifobPay            float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
971
+	MafPay              float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
972
+	OthPay              float64 `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
973
+	FundPaySumamt       float64 `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
974
+	PsnPartAmt          float64 `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
975
+	AcctPay             float64 `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
976
+	PsnCashPay          float64 `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
977
+	HospPartAmt         float64 `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
978
+	Balc                float64 `gorm:"column:balc" json:"balc" form:"balc"`
979
+	AcctMulaidPay       float64 `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
980
+	MedinsSetlId        string  `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
981
+	ClrOptins           string  `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
982
+	ClrWay              string  `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
983
+	ClrType             string  `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
984
+	SetlDetail          string  `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
985
+	IsMedicineInsurance int64   `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
986
+	PType               int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
987
+	SettleType          int64   `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
988
+	SettleStartTime     int64   `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
989
+	SettleEndTime       int64   `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
990
+	IsPre               int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
956 991
 
957 992
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
958 993
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -962,7 +997,6 @@ type HisOrder struct {
962 997
 
963 998
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
964 999
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
965
-	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
966 1000
 	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
967 1001
 }
968 1002
 
@@ -1807,13 +1841,8 @@ func GetNewHisPatientInfo(his_patient_id int64) (info models.HisPatient, err err
1807 1841
 	return
1808 1842
 }
1809 1843
 
1810
-func GetNewHisOrder(user_org_id int64, mdtrt_id string, patient_id int64) (order HisOrder, err error) {
1811
-	err = readDb.Model(&HisOrder{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND mdtrt_id=? ", user_org_id, patient_id, mdtrt_id).
1812
-		Preload("HisOrderInfo", "status = 1 AND user_org_id = ?", user_org_id).
1813
-		Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id).
1814
-		Preload("HisPatient", "status = 1 AND user_org_id = ?", user_org_id).
1815
-		Preload("HisPrescriptionInfo", "status = 1 AND user_org_id = ?", user_org_id).
1816
-		Order("ctime desc").
1844
+func GetNewHisOrder(user_org_id int64, mdtrt_id string, patient_id int64) (order models.HisOrder, err error) {
1845
+	err = readDb.Model(&models.HisOrder{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND mdtrt_id=? ", user_org_id, patient_id, mdtrt_id).
1817 1846
 		Last(&order).Error
1818 1847
 	return
1819 1848
 }