3 Commits bb85bdda1a ... 2d136064c8

Author SHA1 Message Date
  陈少旭 2d136064c8 Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch 1 week ago
  陈少旭 675c0eb695 提交代码 1 week ago
  陈少旭 9423fbed8e 提交代码 2 weeks ago

+ 14 - 5
controllers/pharmacy_controller.go View File

189
 	fmt.Println(partition)
189
 	fmt.Println(partition)
190
 	w_his_advice_patient, _ := service.GetWaitPharmacyHISAdvicePatient(partition, shift, stime, orgid, keyword, is_medicine)
190
 	w_his_advice_patient, _ := service.GetWaitPharmacyHISAdvicePatient(partition, shift, stime, orgid, keyword, is_medicine)
191
 	w_xt_advice_patient, _ := service.GetWaitPharmacyXTPatient(partition, shift, stime, orgid, keyword, is_medicine)
191
 	w_xt_advice_patient, _ := service.GetWaitPharmacyXTPatient(partition, shift, stime, orgid, keyword, is_medicine)
192
-	w_his_goods_patient, _ := service.GetWaitPharmacyHISGoodsPatient(partition, shift, stime, orgid, keyword, is_medicine)
193
 	var patients []*models.PharmacyPatients
192
 	var patients []*models.PharmacyPatients
194
 	patients = append(patients, w_his_advice_patient...)
193
 	patients = append(patients, w_his_advice_patient...)
195
 	patients = append(patients, w_xt_advice_patient...)
194
 	patients = append(patients, w_xt_advice_patient...)
196
-	patients = append(patients, w_his_goods_patient...)
195
+
196
+	//good_info,_ := service.GetGoodCodeOpen(orgid)
197
+	good_info, _ := service.GetGoodCodeOpen(orgid)
198
+	if good_info.IsOpen == 1 {
199
+		w_his_goods_patient, _ := service.GetWaitPharmacyHISGoodsPatient(partition, shift, stime, orgid, keyword, is_medicine)
200
+		patients = append(patients, w_his_goods_patient...)
201
+	}
197
 	patients = RemoveRepeatedPurviewElement(patients)
202
 	patients = RemoveRepeatedPurviewElement(patients)
198
 
203
 
199
 	this.ServeSuccessJSON(map[string]interface{}{
204
 	this.ServeSuccessJSON(map[string]interface{}{
273
 	is_medicine := 0
278
 	is_medicine := 0
274
 	w_his_advice_patient, _ := service.GetWaitPharmacyHISAdvicePatient(partition, shift, stime, orgid, keyword, is_medicine)
279
 	w_his_advice_patient, _ := service.GetWaitPharmacyHISAdvicePatient(partition, shift, stime, orgid, keyword, is_medicine)
275
 	w_xt_advice_patient, _ := service.GetWaitPharmacyXTPatient(partition, shift, stime, orgid, keyword, is_medicine)
280
 	w_xt_advice_patient, _ := service.GetWaitPharmacyXTPatient(partition, shift, stime, orgid, keyword, is_medicine)
276
-	w_his_goods_patient, _ := service.GetWaitPharmacyHISGoodsPatient(partition, shift, stime, orgid, keyword, is_medicine)
281
+
277
 	var patients []*models.PharmacyPatients
282
 	var patients []*models.PharmacyPatients
278
 	patients = append(patients, w_his_advice_patient...)
283
 	patients = append(patients, w_his_advice_patient...)
279
 	patients = append(patients, w_xt_advice_patient...)
284
 	patients = append(patients, w_xt_advice_patient...)
280
-	patients = append(patients, w_his_goods_patient...)
285
+
286
+	good_info, _ := service.GetGoodCodeOpen(orgid)
287
+	if good_info.IsOpen == 1 {
288
+		w_his_goods_patient, _ := service.GetWaitPharmacyHISGoodsPatient(partition, shift, stime, orgid, keyword, is_medicine)
289
+		patients = append(patients, w_his_goods_patient...)
290
+	}
281
 	patients = RemoveRepeatedPurviewElement(patients)
291
 	patients = RemoveRepeatedPurviewElement(patients)
282
 
292
 
283
 	this.ServeSuccessJSON(map[string]interface{}{
293
 	this.ServeSuccessJSON(map[string]interface{}{
1417
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1427
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1418
 	data_source, _ := this.GetInt64("data_source")
1428
 	data_source, _ := this.GetInt64("data_source")
1419
 	drug_code := this.GetString("drug_code")
1429
 	drug_code := this.GetString("drug_code")
1420
-	//item_type := this.GetString("type")
1421
 
1430
 
1422
 	str := strings.Replace(drug_code, " ", "", -1)
1431
 	str := strings.Replace(drug_code, " ", "", -1)
1423
 	// 去除换行符
1432
 	// 去除换行符

+ 13 - 0
models/stock_models.go View File

1867
 	return "xt_drug_code_open"
1867
 	return "xt_drug_code_open"
1868
 }
1868
 }
1869
 
1869
 
1870
+type XtGoodCodeOpen struct {
1871
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1872
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1873
+	IsOpen    int64 `gorm:"column:is_open" json:"is_open" form:"is_open"`
1874
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1875
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1876
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1877
+}
1878
+
1879
+func (XtGoodCodeOpen) TableName() string {
1880
+	return "xt_good_code_open"
1881
+}
1882
+
1870
 type PrintWarehousingInfo struct {
1883
 type PrintWarehousingInfo struct {
1871
 	ID                        int64   `gorm:"column:id" json:"id"`
1884
 	ID                        int64   `gorm:"column:id" json:"id"`
1872
 	WarehousingId             int64   `gorm:"column:warehousing_id" json:"warehousing_id"`
1885
 	WarehousingId             int64   `gorm:"column:warehousing_id" json:"warehousing_id"`

+ 31 - 23
service/export_data_service.go View File

303
 	XtCount                  float64 `gorm:"column:血透"`
303
 	XtCount                  float64 `gorm:"column:血透"`
304
 	XlCount                  float64 `gorm:"column:血滤"`
304
 	XlCount                  float64 `gorm:"column:血滤"`
305
 	GlCount                  float64 `gorm:"column:灌流"`
305
 	GlCount                  float64 `gorm:"column:灌流"`
306
-	WesternMedicineFee       float64 `gorm:"column:西药费"`    // 西药费
307
-	ChinesePatentMedicineFee float64 `gorm:"column:中成药费"`   // 中成药费
308
-	HealthMaterialsFee       float64 `gorm:"column:耗材费"`    // 卫生材料费
309
-	RegistrationFee          float64 `gorm:"column:挂号费"`    // 挂号费
310
-	TreatmentFee             float64 `gorm:"column:治疗费"`    // 治疗费
311
-	ExaminationFee           float64 `gorm:"column:检查费"`    // 检查费
312
-	LaboratoryFee            float64 `gorm:"column:化验费"`    // 化验费
313
-	NursingFee               float64 `gorm:"column:护理费"`    // 护理费
314
-	OtherFee                 float64 `gorm:"column:其他费"`    // 其他费
315
-	BedsFee                  float64 `gorm:"column:床位费"`    // 床位费
316
-	ConsultationFee          float64 `gorm:"column:诊察费"`    // 诊察费
317
-	ChineseMedicineFee       float64 `gorm:"column:中药饮片费"`  // 中药饮片费
318
-	GeneralTreatmentFee      float64 `gorm:"column:一般诊疗费"`  // 一般诊疗费
319
-	TotalMedicalFee          float64 `gorm:"column:合计"`     // 医疗费总额
320
-	SelfPay                  float64 `gorm:"column:自费金额"`   // 个人自付金额
321
-	AcctPay                  float64 `gorm:"column:个人账户支付"` // 基本账户支付
322
-	Return                   string  `gorm:"column:退费"`     // 共济账户支付
323
-	YouHui                   string  `gorm:"column:优惠"`     // 公务员补助
324
-	YingShou                 float64 `gorm:"column:应收"`     // 统筹支付金额
325
-	GuaZhang                 string  `gorm:"column:挂账"`     // 医疗救助
326
-	ChongZhang               string  `gorm:"column:冲账"`     // 大病支付
327
-	ShiShou                  float64 `gorm:"column:实收"`     // 企业补充支付
328
-	YiShou                   float64 `gorm:"column:已收"`     // 重大疾病补充 (Empty in SQL, will be left blank in Go)
306
+	WesternMedicineFee       float64 `gorm:"column:西药费"`      // 西药费
307
+	ChinesePatentMedicineFee float64 `gorm:"column:中成药费"`     // 中成药费
308
+	HealthMaterialsFee       float64 `gorm:"column:耗材费"`      // 卫生材料费
309
+	RegistrationFee          float64 `gorm:"column:挂号费"`      // 挂号费
310
+	TreatmentFee             float64 `gorm:"column:治疗费"`      // 治疗费
311
+	ExaminationFee           float64 `gorm:"column:检查费"`      // 检查费
312
+	LaboratoryFee            float64 `gorm:"column:化验费"`      // 化验费
313
+	NursingFee               float64 `gorm:"column:护理费"`      // 护理费
314
+	OtherFee                 float64 `gorm:"column:其他费"`      // 其他费
315
+	BedsFee                  float64 `gorm:"column:床位费"`      // 床位费
316
+	ConsultationFee          float64 `gorm:"column:诊察费"`      // 诊察费
317
+	ChineseMedicineFee       float64 `gorm:"column:中药饮片费"`    // 中药饮片费
318
+	GeneralTreatmentFee      float64 `gorm:"column:一般诊疗费"`    // 一般诊疗费
319
+	TotalMedicalFee          float64 `gorm:"column:合计"`       // 医疗费总额
320
+	TC                       float64 `gorm:"column:医保统筹基金支出"` // 医疗费总额
321
+	Func                     float64 `gorm:"column:医保基金支付金额"` // 医疗费总额
322
+	SelfPay                  float64 `gorm:"column:自费金额"`     // 个人自付金额
323
+	AcctPay                  float64 `gorm:"column:个人账户支付"`   // 基本账户支付
324
+	Return                   string  `gorm:"column:退费"`       // 共济账户支付
325
+	YouHui                   string  `gorm:"column:优惠"`       // 公务员补助
326
+	YingShou                 float64 `gorm:"column:应收"`       // 统筹支付金额
327
+	GuaZhang                 string  `gorm:"column:挂账"`       // 医疗救助
328
+	ChongZhang               string  `gorm:"column:冲账"`       // 大病支付
329
+	ShiShou                  float64 `gorm:"column:实收"`       // 企业补充支付
330
+	YiShou                   float64 `gorm:"column:已收"`       // 重大疾病补充 (Empty in SQL, will be left blank in Go)
329
 }
331
 }
330
 
332
 
331
 func GetHisOrderBy10697Summary(start_time string, end_time string, ins string) (results []MedicalCharges, err error) {
333
 func GetHisOrderBy10697Summary(start_time string, end_time string, ins string) (results []MedicalCharges, err error) {
495
 		PsnCashPay   float64
497
 		PsnCashPay   float64
496
 		AcctPay      float64
498
 		AcctPay      float64
497
 		FunPay       float64
499
 		FunPay       float64
500
+		TcPay        float64
498
 	}
501
 	}
499
 
502
 
500
 	// To store totals per patient
503
 	// To store totals per patient
507
 		err := readDb.Model(models.HisOrder{}).
510
 		err := readDb.Model(models.HisOrder{}).
508
 			Select("sum(medfee_sumamt) as medfee_sumamt, "+
511
 			Select("sum(medfee_sumamt) as medfee_sumamt, "+
509
 				"sum(psn_cash_pay) as psn_cash_pay, "+
512
 				"sum(psn_cash_pay) as psn_cash_pay, "+
513
+				"sum(hifp_pay) as tc_pay, "+
510
 				"sum(acct_pay) as acct_pay, "+
514
 				"sum(acct_pay) as acct_pay, "+
511
 				"sum(fund_pay_sumamt) as fun_pay").
515
 				"sum(fund_pay_sumamt) as fun_pay").
512
 			Where("patient_id = ? and user_org_id = ? "+
516
 			Where("patient_id = ? and user_org_id = ? "+
529
 		grandTotal.PsnCashPay += tempTotal.PsnCashPay
533
 		grandTotal.PsnCashPay += tempTotal.PsnCashPay
530
 		grandTotal.AcctPay += tempTotal.AcctPay
534
 		grandTotal.AcctPay += tempTotal.AcctPay
531
 		grandTotal.FunPay += tempTotal.FunPay
535
 		grandTotal.FunPay += tempTotal.FunPay
536
+		grandTotal.TcPay += tempTotal.TcPay
537
+
532
 	}
538
 	}
533
 
539
 
534
 	// Print totals per patient
540
 	// Print totals per patient
542
 				item.YingShou = total.MedfeeSumamt
548
 				item.YingShou = total.MedfeeSumamt
543
 				item.ShiShou = total.MedfeeSumamt
549
 				item.ShiShou = total.MedfeeSumamt
544
 				item.YiShou = total.PsnCashPay
550
 				item.YiShou = total.PsnCashPay
551
+				item.Func = total.FunPay
552
+				item.TC = total.TcPay
545
 				fmt.Println(item)
553
 				fmt.Println(item)
546
 			}
554
 			}
547
 
555
 

+ 7 - 0
service/stock_service.go View File

11007
 	return drugCodeOpen, err
11007
 	return drugCodeOpen, err
11008
 }
11008
 }
11009
 
11009
 
11010
+func GetGoodCodeOpen(user_org_id int64) (models.XtGoodCodeOpen, error) {
11011
+
11012
+	drugCodeOpen := models.XtGoodCodeOpen{}
11013
+	err := XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&drugCodeOpen).Error
11014
+	return drugCodeOpen, err
11015
+}
11016
+
11010
 func CreateDrugOpen(open models.XtDrugCodeOpen) error {
11017
 func CreateDrugOpen(open models.XtDrugCodeOpen) error {
11011
 
11018
 
11012
 	err := XTWriteDB().Create(&open).Error
11019
 	err := XTWriteDB().Create(&open).Error