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
00fa5d6cbf
2 changed files with 21 additions and 3 deletions
  1. 18 0
      controllers/his_api_controller.go
  2. 3 3
      service/patientmanage_service.go

+ 18 - 0
controllers/his_api_controller.go View File

@@ -8562,6 +8562,10 @@ func (c *HisApiController) GetFaPiaoData() {
8562 8562
 	var checkCostSelfTotal float64 = 0     //检查费
8563 8563
 	var checkCostPartSelfTotal float64 = 0 //检查费
8564 8564
 
8565
+	var hiliCostTotal float64 = 0         //护理费
8566
+	var hiliCostSelfTotal float64 = 0     //护理费
8567
+	var hiliCostPartSelfTotal float64 = 0 //护理费
8568
+
8565 8569
 	var laboratoryCostTotal float64 = 0         //化验费
8566 8570
 	var laboratoryCostSelfTotal float64 = 0     //化验费
8567 8571
 	var laboratoryCostPartSelfTotal float64 = 0 //化验费
@@ -8704,6 +8708,11 @@ func (c *HisApiController) GetFaPiaoData() {
8704 8708
 
8705 8709
 		for _, item := range orderInfos_two {
8706 8710
 			fmt.Println(item.MedChrgitmType)
8711
+			if item.MedChrgitmType == "07" { //床位费
8712
+				hiliCostTotal, _ = decimal.NewFromFloat(hiliCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
8713
+				hiliCostSelfTotal = hiliCostTotal
8714
+			}
8715
+
8707 8716
 			if item.MedChrgitmType == "01" { //床位费
8708 8717
 				bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
8709 8718
 				bedCostSelfTotal = bedCostTotal
@@ -8820,6 +8829,12 @@ func (c *HisApiController) GetFaPiaoData() {
8820 8829
 				materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
8821 8830
 			}
8822 8831
 
8832
+			if item.MedChrgitmType == "07" { //西药费
8833
+				hiliCostTotal, _ = decimal.NewFromFloat(hiliCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
8834
+				hiliCostSelfTotal, _ = decimal.NewFromFloat(hiliCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
8835
+				hiliCostPartSelfTotal, _ = decimal.NewFromFloat(hiliCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
8836
+			}
8837
+
8823 8838
 			if item.MedChrgitmType == "09" { //西药费
8824 8839
 				westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
8825 8840
 				westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
@@ -8909,6 +8924,9 @@ func (c *HisApiController) GetFaPiaoData() {
8909 8924
 		"pre_pay_money":               pre_pay_money,
8910 8925
 		"refund_sum":                  sum,
8911 8926
 		"doctor_info":                 doctor_info,
8927
+		"hiliCostTotal":               hiliCostTotal,
8928
+		"hiliCostSelfTotal":           hiliCostSelfTotal,
8929
+		"hiliCostPartSelfTotal":       hiliCostPartSelfTotal,
8912 8930
 	})
8913 8931
 
8914 8932
 }

+ 3 - 3
service/patientmanage_service.go View File

@@ -1967,7 +1967,7 @@ type InspectionCount struct {
1967 1967
 
1968 1968
 func GetNormalInspectionTotalByID(startime int64, endtime int64, orgid int64, projectid int64, item_id int64, max_value float64, min_value float64) (total int64, err error) {
1969 1969
 	var count []*InspectionCount
1970
-	err2 := XTReadDB().Table("xt_inspection as xti ").Select("count(*) as count").Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x Join xt_patients pp on pp.id = x.patient_id and pp.lapseto = 1  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` < ? and xti.inspect_value > ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&count).Error
1970
+	err2 := XTReadDB().Table("xt_inspection as xti ").Select("count(*) as count").Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x Join xt_patients pp on pp.id = x.patient_id and pp.lapseto = 1  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` <= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&count).Error
1971 1971
 	for _, items := range count {
1972 1972
 		total = total + items.Count
1973 1973
 	}
@@ -2082,7 +2082,7 @@ func GetNormalInspectionPatientList(startime int64, endtime int64, orgid int64,
2082 2082
 	} else {
2083 2083
 		db = db.Select("xti.patient_id as patient_id,FROM_UNIXTIME(xti.inspect_date,'%Y-%m-%d') as date,xti.inspect_value as inspect_value,pp.name as name, pp.dialysis_no as dialysis_no").Joins("join xt_patients pp On pp.id = xti.patient_id and pp.status = 1 and pp.lapseto = 1")
2084 2084
 	}
2085
-	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` < ? and xti.inspect_value > ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&xti).Error
2085
+	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` <= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&xti).Error
2086 2086
 	return xti, err2
2087 2087
 }
2088 2088
 func GetUnusualInspectionPatientList(startime int64, endtime int64, orgid int64, projectid int64, item_id int64, max_value float64, min_value float64, keyword string) (xti []*models.Inspection, err error) {
@@ -2136,7 +2136,7 @@ func GetNormalKTVORURRInspectionPatientList(startime int64, endtime int64, orgid
2136 2136
 	} else {
2137 2137
 		db = db.Select("xti.patient_id as patient_id,FROM_UNIXTIME(xti.inspect_date,'%Y-%m-%d') as date,xti.inspect_value as inspect_value,pp.name as name, pp.dialysis_no as dialysis_no").Joins("join xt_patients pp On pp.id = xti.patient_id and pp.status = 1 and pp.lapseto = 1")
2138 2138
 	}
2139
-	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.project_id = ? and x.item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.project_id = ? and xti.item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, min_value).Scan(&xti).Error
2139
+	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.project_id = ? and x.item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.project_id = ? and xti.item_id = ?  and xti.inspect_date >= ? and xti.inspect_date <= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, min_value).Scan(&xti).Error
2140 2140
 	return xti, err2
2141 2141
 }
2142 2142