陈少旭 1 mese fa
parent
commit
73bdb8fb2f
1 ha cambiato i file con 58 aggiunte e 14 eliminazioni
  1. 58 14
      controllers/his_api_controller.go

+ 58 - 14
controllers/his_api_controller.go Vedi File

1080
 	var operationSelfTotal float64 = 0         //床位部分项目自费
1080
 	var operationSelfTotal float64 = 0         //床位部分项目自费
1081
 	var operationInscpTotal float64 = 0        //床位部分项目自费
1081
 	var operationInscpTotal float64 = 0        //床位部分项目自费
1082
 
1082
 
1083
-	var otherCostTotal float64 = 0 //其他费用
1084
-	//var otherCostSelfTotal float64 = 0     //其他费用
1083
+	var otherCostTotal float64 = 0         //其他费用
1084
+	var otherCostSelfTotal float64 = 0     //其他费用
1085
 	var otherCostPartSelfTotal float64 = 0 //其他费用
1085
 	var otherCostPartSelfTotal float64 = 0 //其他费用
1086
 	//var otherSelfTotal float64 = 0         //床位部分项目自费
1086
 	//var otherSelfTotal float64 = 0         //床位部分项目自费
1087
 	//var otherInscpTotal float64 = 0        //床位部分项目自费
1087
 	//var otherInscpTotal float64 = 0        //床位部分项目自费
1122
 	var treatSelfTotal float64 = 0         //床位部分项目自费
1122
 	var treatSelfTotal float64 = 0         //床位部分项目自费
1123
 	var treatInscpTotal float64 = 0        //床位部分项目自费
1123
 	var treatInscpTotal float64 = 0        //床位部分项目自费
1124
 
1124
 
1125
+	var huliCostTotal float64 = 0         //治疗费用
1126
+	var huliCostSelfTotal float64 = 0     //治疗费用
1127
+	var huliCostPartSelfTotal float64 = 0 //治疗费用
1128
+	var huliSelfTotal float64 = 0         //床位部分项目自费
1129
+	var huliInscpTotal float64 = 0        //床位部分项目自费
1130
+
1131
+	var zcCostTotal float64 = 0         //治疗费用
1132
+	var zcCostSelfTotal float64 = 0     //治疗费用
1133
+	var zcCostPartSelfTotal float64 = 0 //治疗费用
1134
+	var zcSelfTotal float64 = 0         //床位部分项目自费
1135
+	var zcInscpTotal float64 = 0        //床位部分项目自费
1136
+
1125
 	var zhenChaCostTotal float64 = 0 //其他费用
1137
 	var zhenChaCostTotal float64 = 0 //其他费用
1126
 	//var zhenChaCostPartSelfTotal float64 = 0 //其他费用
1138
 	//var zhenChaCostPartSelfTotal float64 = 0 //其他费用
1127
 
1139
 
1347
 
1359
 
1348
 		if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
1360
 		if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
1349
 			otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
1361
 			otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
1350
-			//otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
1351
-			//otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
1362
+			otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
1363
+			otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
1364
+		}
1365
+
1366
+		if item.MedChrgitmType == "02" { //其他费
1367
+			zcCostTotal, _ = decimal.NewFromFloat(zcCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
1368
+			zcCostSelfTotal, _ = decimal.NewFromFloat(zcCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
1369
+			zcCostPartSelfTotal, _ = decimal.NewFromFloat(zcCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
1370
+			zcSelfTotal, _ = decimal.NewFromFloat(zcSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
1371
+			zcInscpTotal, _ = decimal.NewFromFloat(zcInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
1372
+
1373
+		}
1374
+
1375
+		if item.MedChrgitmType == "07" { //其他费
1376
+			huliCostTotal, _ = decimal.NewFromFloat(huliCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
1377
+			huliCostSelfTotal, _ = decimal.NewFromFloat(huliCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
1378
+			huliCostPartSelfTotal, _ = decimal.NewFromFloat(huliCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
1379
+			huliSelfTotal, _ = decimal.NewFromFloat(huliSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
1380
+			huliInscpTotal, _ = decimal.NewFromFloat(huliInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
1381
+
1352
 		}
1382
 		}
1353
 	}
1383
 	}
1354
 
1384
 
1391
 		"operationInscpTotal":        operationInscpTotal,
1421
 		"operationInscpTotal":        operationInscpTotal,
1392
 		"operationSelfTotal":         operationSelfTotal,
1422
 		"operationSelfTotal":         operationSelfTotal,
1393
 
1423
 
1394
-		"otherCostTotal": otherCostTotal,
1395
-		//"otherCostSelfTotal":        otherCostSelfTotal,
1424
+		"otherCostTotal":            otherCostTotal,
1425
+		"otherCostSelfTotal":        otherCostSelfTotal,
1396
 		"otherCostPartSelfTotal":    otherCostPartSelfTotal,
1426
 		"otherCostPartSelfTotal":    otherCostPartSelfTotal,
1397
 		"materialCostTotal":         materialCostTotal,
1427
 		"materialCostTotal":         materialCostTotal,
1398
 		"materialCostSelfTotal":     materialCostSelfTotal,
1428
 		"materialCostSelfTotal":     materialCostSelfTotal,
1446
 		"his":           his,
1476
 		"his":           his,
1447
 		"funds":         rf,
1477
 		"funds":         rf,
1448
 		"dia_config":    dia_config,
1478
 		"dia_config":    dia_config,
1479
+
1480
+		"huliCostTotal":         huliCostTotal,
1481
+		"huliCostSelfTotal":     huliCostSelfTotal,
1482
+		"huliCostPartSelfTotal": huliCostPartSelfTotal,
1483
+		"huliSelfTotal":         huliSelfTotal,
1484
+		"huliInscpTotal":        huliInscpTotal,
1485
+
1486
+		"zcCostTotal":         zcCostTotal,
1487
+		"zcCostSelfTotal":     zcCostSelfTotal,
1488
+		"zcCostPartSelfTotal": zcCostPartSelfTotal,
1489
+		"zcSelfTotal":         zcSelfTotal,
1490
+		"zcInscpTotal":        zcInscpTotal,
1449
 	})
1491
 	})
1450
 
1492
 
1451
 }
1493
 }
1657
 	sch, _ := service.GetPatientSch(patient_id, recordDateTime, admin.CurrentOrgId)
1699
 	sch, _ := service.GetPatientSch(patient_id, recordDateTime, admin.CurrentOrgId)
1658
 	if sch.ID > 0 {
1700
 	if sch.ID > 0 {
1659
 		var week string
1701
 		var week string
1660
-		t := time.Now()
1702
+		t := theTime
1661
 		switch t.Weekday().String() {
1703
 		switch t.Weekday().String() {
1662
 		case "Monday":
1704
 		case "Monday":
1663
 			week = "周一"
1705
 			week = "周一"
1713
 					}
1755
 					}
1714
 
1756
 
1715
 					if subItem.FrequencyType == 2 { //按照天数频率
1757
 					if subItem.FrequencyType == 2 { //按照天数频率
1716
-						p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
1758
+						p, _ := time.Parse("2006-01-02", theTime.Format("2006-01-02"))
1717
 						now := p.Unix()
1759
 						now := p.Unix()
1718
 						dayStr := strconv.FormatInt(subItem.DayCount, 10)
1760
 						dayStr := strconv.FormatInt(subItem.DayCount, 10)
1719
 						dayStr2 := "-" + dayStr
1761
 						dayStr2 := "-" + dayStr
1720
 						count, _ := strconv.ParseInt(dayStr2, 10, 64)
1762
 						count, _ := strconv.ParseInt(dayStr2, 10, 64)
1721
-						oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
1763
+						oldTime := theTime.AddDate(0, 0, int(count)).Unix()
1722
 						advices, _ := service.FindAllHisDoctorAdviceByTime(now, oldTime, patient_id, c.GetAdminUserInfo().CurrentOrgId, subItem.DrugId)
1764
 						advices, _ := service.FindAllHisDoctorAdviceByTime(now, oldTime, patient_id, c.GetAdminUserInfo().CurrentOrgId, subItem.DrugId)
1723
 						if len(advices) == 0 {
1765
 						if len(advices) == 0 {
1724
 							cus.HisPrescriptionAdviceTemplate = append(cus.HisPrescriptionAdviceTemplate, subItem)
1766
 							cus.HisPrescriptionAdviceTemplate = append(cus.HisPrescriptionAdviceTemplate, subItem)
1740
 						}
1782
 						}
1741
 
1783
 
1742
 						if subItem.FrequencyType == 2 {
1784
 						if subItem.FrequencyType == 2 {
1743
-							p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
1785
+							p, _ := time.Parse("2006-01-02", theTime.Format("2006-01-02"))
1744
 							now := p.Unix()
1786
 							now := p.Unix()
1745
 							dayStr := strconv.FormatInt(subItem.DayCount, 10)
1787
 							dayStr := strconv.FormatInt(subItem.DayCount, 10)
1746
 							dayStr2 := "-" + dayStr
1788
 							dayStr2 := "-" + dayStr
1747
 							count, _ := strconv.ParseInt(dayStr2, 10, 64)
1789
 							count, _ := strconv.ParseInt(dayStr2, 10, 64)
1748
-							oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
1790
+							oldTime := theTime.AddDate(0, 0, int(count)).Unix()
1749
 							projects, _ := service.FindAllHisProjectByTime(now, oldTime, patient_id, c.GetAdminUserInfo().CurrentOrgId, subItem.ProjectId)
1791
 							projects, _ := service.FindAllHisProjectByTime(now, oldTime, patient_id, c.GetAdminUserInfo().CurrentOrgId, subItem.ProjectId)
1750
 							if len(projects) == 0 {
1792
 							if len(projects) == 0 {
1751
 								cus.HisPrescriptionProjectTemplate = append(cus.HisPrescriptionProjectTemplate, subItem)
1793
 								cus.HisPrescriptionProjectTemplate = append(cus.HisPrescriptionProjectTemplate, subItem)
1765
 						}
1807
 						}
1766
 
1808
 
1767
 						if subItem.FrequencyType == 2 {
1809
 						if subItem.FrequencyType == 2 {
1768
-							p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
1810
+							p, _ := time.Parse("2006-01-02", theTime.Format("2006-01-02"))
1769
 							now := p.Unix()
1811
 							now := p.Unix()
1770
 							dayStr := strconv.FormatInt(subItem.DayCount, 10)
1812
 							dayStr := strconv.FormatInt(subItem.DayCount, 10)
1771
 							dayStr2 := "-" + dayStr
1813
 							dayStr2 := "-" + dayStr
1772
 							count, _ := strconv.ParseInt(dayStr2, 10, 64)
1814
 							count, _ := strconv.ParseInt(dayStr2, 10, 64)
1773
-							oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
1815
+							oldTime := theTime.AddDate(0, 0, int(count)).Unix()
1774
 							projects, _ := service.FindAllHisProjectByTime(now, oldTime, patient_id, c.GetAdminUserInfo().CurrentOrgId, subItem.ProjectId)
1816
 							projects, _ := service.FindAllHisProjectByTime(now, oldTime, patient_id, c.GetAdminUserInfo().CurrentOrgId, subItem.ProjectId)
1775
 							if len(projects) == 0 {
1817
 							if len(projects) == 0 {
1776
 								cus.HisPrescriptionProjectTemplate = append(cus.HisPrescriptionProjectTemplate, subItem)
1818
 								cus.HisPrescriptionProjectTemplate = append(cus.HisPrescriptionProjectTemplate, subItem)
3572
 					ctime := time.Now().Unix()
3614
 					ctime := time.Now().Unix()
3573
 
3615
 
3574
 					if tempPrescription.ID == 0 {
3616
 					if tempPrescription.ID == 0 {
3617
+
3575
 						prescription := &models.HisPrescription{
3618
 						prescription := &models.HisPrescription{
3576
 							ID:                 0,
3619
 							ID:                 0,
3577
 							PatientId:          patient_id,
3620
 							PatientId:          patient_id,
10214
 	sch_type, _ := c.GetInt64("sch_type", 0)
10257
 	sch_type, _ := c.GetInt64("sch_type", 0)
10215
 	zone_type, _ := c.GetInt64("zone_type", 0)
10258
 	zone_type, _ := c.GetInt64("zone_type", 0)
10216
 	med_type, _ := c.GetInt64("med_type", 0)
10259
 	med_type, _ := c.GetInt64("med_type", 0)
10260
+	fee_type, _ := c.GetInt64("fee_type", 0)
10217
 
10261
 
10218
 	timeLayout := "2006-01-02"
10262
 	timeLayout := "2006-01-02"
10219
 	loc, _ := time.LoadLocation("Local")
10263
 	loc, _ := time.LoadLocation("Local")
10240
 
10284
 
10241
 	adminUser := c.GetAdminUserInfo()
10285
 	adminUser := c.GetAdminUserInfo()
10242
 	org_id := adminUser.CurrentOrgId
10286
 	org_id := adminUser.CurrentOrgId
10243
-	order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type, sort_type, start_time, end_time, charge_type, sch_type, zone_type, med_type)
10287
+	order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type, sort_type, start_time, end_time, charge_type, sch_type, zone_type, med_type, fee_type)
10244
 
10288
 
10245
 	for _, item := range order {
10289
 	for _, item := range order {
10246
 		info, _ := service.GetHisPrescriptionByPatientID(item.PatientId, item.UserOrgId)
10290
 		info, _ := service.GetHisPrescriptionByPatientID(item.PatientId, item.UserOrgId)