|
@@ -536,3 +536,23 @@ func GetPatientGather(patient_id int64, org_id int64, start_time int64, end_time
|
536
|
536
|
}
|
537
|
537
|
return
|
538
|
538
|
}
|
|
539
|
+
|
|
540
|
+func GetAllChargeDetailsTwo(org_id int64, start_time int64, end_time int64) (patients []*models.HisChargeOrder, err error) {
|
|
541
|
+ err = readDb2.Model(&models.HisChargeOrder{}).Preload("Patients", "status = 1").Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
|
|
542
|
+ return db.Select("id,order_number,advice_id,det_item_fee_sumamt,cnt,pric,med_chrgitm_type,status,chld_medc_flag,chrgitm_lv,user_org_id,project_id,type").
|
|
543
|
+ Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
544
|
+ return db.Preload("Drug", "status = 1").Where("status = 1")
|
|
545
|
+ }).
|
|
546
|
+ Preload("HisChargePrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
547
|
+ return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").
|
|
548
|
+ Preload("HisChargeProject", func(db *gorm.DB) *gorm.DB {
|
|
549
|
+ return db.Select("id,project_name,unit").Where("status = 1 ")
|
|
550
|
+ }).
|
|
551
|
+ Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
|
|
552
|
+ return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
|
|
553
|
+ }).Where("status = 1 ")
|
|
554
|
+ }).Where("status = 1")
|
|
555
|
+ }).Where("status = 1 AND user_org_id = ? AND settle_accounts_date >= ? AND settle_accounts_date <= ? AND order_status = 2", org_id, start_time, end_time).Group("id").Find(&patients).Error
|
|
556
|
+
|
|
557
|
+ return
|
|
558
|
+}
|