Browse Source

医保对接

csx 3 years ago
parent
commit
c45d1679c8

+ 10 - 10
controllers/his_api_controller.go View File

@@ -977,7 +977,7 @@ func (c *HisApiController) CreateHisPrescription() {
977 977
 							if p.Type == 3 { //处理透前准备耗材数量数据
978 978
 								consumables, _ := service.FindHisConsumablesByID(adminInfo.CurrentOrgId, patient_id, recordDateTime, p.ProjectId)
979 979
 								if consumables.ID > 0 {
980
-									consumables.Count = p.Count
980
+									consumables.Count = int64(p.Count)
981 981
 									service.UpdateConsumables(&consumables)
982 982
 								}
983 983
 							}
@@ -1293,7 +1293,7 @@ func (c *HisApiController) DeletePrescription() {
1293 1293
 				if stockConfig.IsOpen == 1 {
1294 1294
 					if item.Type == 3 {
1295 1295
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
1296
-						f_count, _ := strconv.ParseFloat(strconv.FormatInt(item.Count, 10), 64)
1296
+						f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(item.Count), 10), 64)
1297 1297
 						good.Total = good.Total + f_count
1298 1298
 						service.UpdateGoodInfo(&good)
1299 1299
 					}
@@ -1381,7 +1381,7 @@ func (c *HisApiController) DeleteProject() {
1381 1381
 		if stockConfig.IsOpen == 1 {
1382 1382
 			if project.Type == 3 {
1383 1383
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1384
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(project.Count, 10), 64)
1384
+				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
1385 1385
 				good.Total = good.Total + f_count
1386 1386
 				service.UpdateGoodInfo(&good)
1387 1387
 			}
@@ -1879,7 +1879,7 @@ func (c *HisApiController) setProjectWithJSONTwo(project *models.HisPrescription
1879 1879
 
1880 1880
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1881 1881
 		total, _ := json["total"].(string)
1882
-		totals, _ := strconv.ParseInt(total, 10, 64)
1882
+		totals, _ := strconv.ParseFloat(total, 64)
1883 1883
 		project.Count = totals
1884 1884
 	}
1885 1885
 
@@ -2253,7 +2253,7 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
2253 2253
 
2254 2254
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
2255 2255
 		total, _ := json["total"].(string)
2256
-		totals, _ := strconv.ParseInt(total, 10, 64)
2256
+		totals, _ := strconv.ParseFloat(total, 64)
2257 2257
 		project.Count = totals
2258 2258
 	}
2259 2259
 
@@ -2310,7 +2310,7 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
2310 2310
 		if stockConfig.IsOpen == 1 {
2311 2311
 			if project.Type == 3 {
2312 2312
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2313
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(project.Count, 10), 64)
2313
+				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
2314 2314
 				good.Total = good.Total - f_count
2315 2315
 				service.UpdateGoodInfo(&good)
2316 2316
 			}
@@ -2324,12 +2324,12 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
2324 2324
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2325 2325
 				if project.Count < temp_project.Count {
2326 2326
 					other_count := temp_project.Count - project.Count
2327
-					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(other_count, 10), 64)
2327
+					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
2328 2328
 					good.Total = good.Total + other_count_two
2329 2329
 					service.UpdateGoodInfo(&good)
2330 2330
 				} else if project.Count > temp_project.Count {
2331 2331
 					other_count := project.Count - temp_project.Count
2332
-					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(other_count, 10), 64)
2332
+					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
2333 2333
 					good.Total = good.Total - other_count_two
2334 2334
 					service.UpdateGoodInfo(&good)
2335 2335
 				}
@@ -4094,7 +4094,7 @@ func (c *HisApiController) GetFaPiaoData() {
4094 4094
 				chineseTraditionalMedicineCostSelfTotal = chineseTraditionalMedicineCostTotal
4095 4095
 			}
4096 4096
 
4097
-			if item.MedChrgitmType == "14" { //其他费
4097
+			if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
4098 4098
 				otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
4099 4099
 				otherCostSelfTotal = otherCostTotal
4100 4100
 			}
@@ -4151,7 +4151,7 @@ func (c *HisApiController) GetFaPiaoData() {
4151 4151
 				chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
4152 4152
 			}
4153 4153
 
4154
-			if item.MedChrgitmType == "14" { //其他费
4154
+			if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
4155 4155
 				otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
4156 4156
 				otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
4157 4157
 				otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()

+ 1 - 38
controllers/his_charge_api_controller.go View File

@@ -13,7 +13,6 @@ type HisChargeApiController struct {
13 13
 
14 14
 func HisChargeApiRegistRouters() {
15 15
 	beego.Router("/api/his/chargestatistics/detail", &HisChargeApiController{}, "get:GetChargeStatisticsDetail")
16
-	beego.Router("/api/his/chargestatistics/summary", &HisChargeApiController{}, "get:GetChargeStatisticsSummary")
17 16
 	beego.Router("/api/his/chargestatistics/settle", &HisChargeApiController{}, "get:GetChargeStatisticsSettle")
18 17
 
19 18
 }
@@ -52,40 +51,6 @@ func (c *HisChargeApiController) GetChargeStatisticsDetail() {
52 51
 
53 52
 }
54 53
 
55
-func (c *HisChargeApiController) GetChargeStatisticsSummary() {
56
-	start_time := c.GetString("start_time")
57
-	end_time := c.GetString("end_time")
58
-	adminUser := c.GetAdminUserInfo()
59
-
60
-	timeLayout := "2006-01-02"
61
-	loc, _ := time.LoadLocation("Local")
62
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
63
-	if err != nil {
64
-
65
-	}
66
-	startRecordDateTime := startTime.Unix()
67
-
68
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
69
-	if err != nil {
70
-
71
-	}
72
-	endRecordDateTime := endTime.Unix()
73
-
74
-	chargePatient, err := service.GetAllPatientChargeDetails(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
75
-
76
-	if err == nil {
77
-		c.ServeSuccessJSON(map[string]interface{}{
78
-			"patients": chargePatient,
79
-		})
80
-		return
81
-	} else {
82
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
83
-		return
84
-
85
-	}
86
-
87
-}
88
-
89 54
 func (c *HisChargeApiController) GetChargeStatisticsSettle() {
90 55
 	start_time := c.GetString("start_time")
91 56
 	end_time := c.GetString("end_time")
@@ -104,9 +69,7 @@ func (c *HisChargeApiController) GetChargeStatisticsSettle() {
104 69
 
105 70
 	}
106 71
 	endRecordDateTime := endTime.Unix()
107
-
108
-	chargePatient, err := service.GetAllPatientChargeDetails(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
109
-
72
+	chargePatient, err := service.GetAllPatientChargeSettle(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
110 73
 	if err == nil {
111 74
 		c.ServeSuccessJSON(map[string]interface{}{
112 75
 			"patients": chargePatient,

+ 2 - 1
controllers/his_hospital_api_controller.go View File

@@ -33,6 +33,7 @@ func HisHospitalManagerApiRegistRouters() {
33 33
 func (c *HisHospitalApiController) GetHisHospitalPatientList() {
34 34
 	record_date := c.GetString("record_date")
35 35
 	types, _ := c.GetInt64("type", 0)
36
+	sch_type, _ := c.GetInt64("sch_type", 0)
36 37
 
37 38
 	timeLayout := "2006-01-02"
38 39
 	loc, _ := time.LoadLocation("Local")
@@ -45,7 +46,7 @@ func (c *HisHospitalApiController) GetHisHospitalPatientList() {
45 46
 	adminInfo := c.GetAdminUserInfo()
46 47
 	//var patients []*service.HospitalPatient
47 48
 	tempPatients, _ := service.GetHisHospitalPatientList(adminInfo.CurrentOrgId, recordDateTime)
48
-	tempPatients_two, _ := service.GetHisHospitalSchPatientList(adminInfo.CurrentOrgId, recordDateTime)
49
+	tempPatients_two, _ := service.GetHisHospitalSchPatientList(adminInfo.CurrentOrgId, recordDateTime, sch_type)
49 50
 
50 51
 	//当天有登记住院的和排班同时存在的话,删除掉排班的记录
51 52
 	for _, item := range tempPatients {

+ 7 - 7
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

@@ -287,7 +287,7 @@ func (c *MobileHisApiController) DeletePrescription() {
287 287
 				if stockConfig.IsOpen == 1 {
288 288
 					if item.Type == 3 {
289 289
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
290
-						f_count, _ := strconv.ParseFloat(strconv.FormatInt(item.Count, 10), 64)
290
+						f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(item.Count), 10), 64)
291 291
 						good.Total = good.Total + f_count
292 292
 						service.UpdateGoodInfo(&good)
293 293
 					}
@@ -364,7 +364,7 @@ func (c *MobileHisApiController) DeleteProject() {
364 364
 		if stockConfig.IsOpen == 1 {
365 365
 			if project.Type == 3 {
366 366
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
367
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(project.Count, 10), 64)
367
+				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
368 368
 				good.Total = good.Total + f_count
369 369
 				service.UpdateGoodInfo(&good)
370 370
 			}
@@ -762,7 +762,7 @@ func (c *MobileHisApiController) CreateHisPrescription() {
762 762
 							if p.Type == 3 { //处理透前准备耗材数量数据
763 763
 								consumables, _ := service.FindHisConsumablesByID(adminInfo.Org.Id, patient_id, recordDateTime, p.ProjectId)
764 764
 								if consumables.ID > 0 {
765
-									consumables.Count = p.Count
765
+									consumables.Count = int64(p.Count)
766 766
 									service.UpdateConsumables(&consumables)
767 767
 								}
768 768
 							}
@@ -1086,7 +1086,7 @@ func (c *MobileHisApiController) setProjectWithJSON(project *models.HisPrescript
1086 1086
 
1087 1087
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1088 1088
 		total, _ := json["total"].(string)
1089
-		totals, _ := strconv.ParseInt(total, 10, 64)
1089
+		totals, _ := strconv.ParseFloat(total, 64)
1090 1090
 		project.Count = totals
1091 1091
 	}
1092 1092
 
@@ -1127,7 +1127,7 @@ func (c *MobileHisApiController) setProjectWithJSON(project *models.HisPrescript
1127 1127
 		if stockConfig.IsOpen == 1 {
1128 1128
 			if project.Type == 3 {
1129 1129
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1130
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(project.Count, 10), 64)
1130
+				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
1131 1131
 				good.Total = good.Total - f_count
1132 1132
 				service.UpdateGoodInfo(&good)
1133 1133
 			}
@@ -1141,12 +1141,12 @@ func (c *MobileHisApiController) setProjectWithJSON(project *models.HisPrescript
1141 1141
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1142 1142
 				if project.Count < temp_project.Count {
1143 1143
 					other_count := temp_project.Count - project.Count
1144
-					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(other_count, 10), 64)
1144
+					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
1145 1145
 					good.Total = good.Total + other_count_two
1146 1146
 					service.UpdateGoodInfo(&good)
1147 1147
 				} else if project.Count > temp_project.Count {
1148 1148
 					other_count := project.Count - temp_project.Count
1149
-					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(other_count, 10), 64)
1149
+					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
1150 1150
 					good.Total = good.Total - other_count_two
1151 1151
 					service.UpdateGoodInfo(&good)
1152 1152
 				}

+ 228 - 202
controllers/public_api_controller.go View File

@@ -1780,73 +1780,58 @@ func (c *PublicApiController) Handle10215() {
1780 1780
 	his, _ := service.GetAllPT(10215)
1781 1781
 	for _, item := range his {
1782 1782
 
1783
-		info := &models.HisPrescriptionInfoTemplate{
1784
-			UserOrgId:   item.UserOrgId,
1785
-			RecordDate:  0,
1786
-			PatientId:   item.PatientId,
1787
-			Status:      1,
1788
-			Ctime:       time.Now().Unix(),
1789
-			Mtime:       time.Now().Unix(),
1790
-			Type:        2,
1791
-			Creator:     0,
1792
-			Modifier:    0,
1793
-			PType:       0,
1794
-			PTemplateId: item.ID,
1795
-			MedType:     "14",
1796
-		}
1797
-		service.CreateHisPrescriptionInfoTemplate(info)
1798
-
1799
-		pro := &models.HisPrescriptionProjectTemplate{
1800
-			ProjectId:          1750,
1801
-			Price:              6.00,
1802
-			UserOrgId:          10215,
1803
-			Status:             1,
1804
-			Ctime:              time.Now().Unix(),
1805
-			Mtime:              time.Now().Unix(),
1806
-			PatientId:          item.PatientId,
1807
-			RecordDate:         0,
1808
-			Count:              1,
1809
-			FeedetlSn:          "",
1810
-			MedListCodg:        "",
1811
-			SingleDose:         "1",
1812
-			DeliveryWay:        "",
1813
-			ExecutionFrequency: "",
1814
-			Day:                "1",
1815
-			Remark:             "",
1816
-			Unit:               "",
1817
-			Type:               2,
1818
-			PrescriptionId:     info.ID,
1819
-			FrequencyType:      1,
1820
-			DayCount:           0,
1821
-			WeekDay:            "",
1822
-		}
1823
-		service.CreateHisPrescriptionProjectTemplate(pro)
1824
-
1825
-		pro2 := &models.HisPrescriptionProjectTemplate{
1826
-			ProjectId:          2462,
1827
-			Price:              4.94,
1828
-			UserOrgId:          10215,
1829
-			Status:             1,
1830
-			Ctime:              time.Now().Unix(),
1831
-			Mtime:              time.Now().Unix(),
1832
-			PatientId:          item.PatientId,
1833
-			RecordDate:         0,
1834
-			Count:              1,
1835
-			FeedetlSn:          "",
1836
-			MedListCodg:        "",
1837
-			SingleDose:         "1",
1838
-			DeliveryWay:        "",
1839
-			ExecutionFrequency: "",
1840
-			Day:                "1",
1841
-			Remark:             "",
1842
-			Unit:               "",
1843
-			Type:               3,
1844
-			PrescriptionId:     info.ID,
1845
-			FrequencyType:      1,
1846
-			DayCount:           0,
1847
-			WeekDay:            "",
1848
-		}
1849
-		service.CreateHisPrescriptionProjectTemplate(pro2)
1783
+		//
1784
+		//pro := &models.HisPrescriptionProjectTemplate{
1785
+		//	ProjectId:          1750,
1786
+		//	Price:              6.00,
1787
+		//	UserOrgId:          10215,
1788
+		//	Status:             1,
1789
+		//	Ctime:              time.Now().Unix(),
1790
+		//	Mtime:              time.Now().Unix(),
1791
+		//	PatientId:          item.PatientId,
1792
+		//	RecordDate:         0,
1793
+		//	Count:              1,
1794
+		//	FeedetlSn:          "",
1795
+		//	MedListCodg:        "",
1796
+		//	SingleDose:         "1",
1797
+		//	DeliveryWay:        "",
1798
+		//	ExecutionFrequency: "",
1799
+		//	Day:                "1",
1800
+		//	Remark:             "",
1801
+		//	Unit:               "",
1802
+		//	Type:               2,
1803
+		//	PrescriptionId:     info.ID,
1804
+		//	FrequencyType:      1,
1805
+		//	DayCount:           0,
1806
+		//	WeekDay:            "",
1807
+		//}
1808
+		//service.CreateHisPrescriptionProjectTemplate(pro)
1809
+		//
1810
+		//pro2 := &models.HisPrescriptionProjectTemplate{
1811
+		//	ProjectId:          2462,
1812
+		//	Price:              4.94,
1813
+		//	UserOrgId:          10215,
1814
+		//	Status:             1,
1815
+		//	Ctime:              time.Now().Unix(),
1816
+		//	Mtime:              time.Now().Unix(),
1817
+		//	PatientId:          item.PatientId,
1818
+		//	RecordDate:         0,
1819
+		//	Count:              1,
1820
+		//	FeedetlSn:          "",
1821
+		//	MedListCodg:        "",
1822
+		//	SingleDose:         "1",
1823
+		//	DeliveryWay:        "",
1824
+		//	ExecutionFrequency: "",
1825
+		//	Day:                "1",
1826
+		//	Remark:             "",
1827
+		//	Unit:               "",
1828
+		//	Type:               3,
1829
+		//	PrescriptionId:     info.ID,
1830
+		//	FrequencyType:      1,
1831
+		//	DayCount:           0,
1832
+		//	WeekDay:            "",
1833
+		//}
1834
+		//service.CreateHisPrescriptionProjectTemplate(pro2)
1850 1835
 		//
1851 1836
 		//
1852 1837
 		infos, _ := service.GetAllPTInfo(10215, item.ID)
@@ -1857,90 +1842,50 @@ func (c *PublicApiController) Handle10215() {
1857 1842
 
1858 1843
 				for _, ssubItem := range subItem.HisPrescriptionAdviceTemplate {
1859 1844
 
1860
-					if ssubItem.DrugId == 1234 {
1861
-						pro := &models.HisPrescriptionProjectTemplate{
1862
-							ProjectId:          2326,
1863
-							Price:              0.86,
1864
-							UserOrgId:          ssubItem.UserOrgId,
1865
-							Status:             1,
1866
-							Ctime:              time.Now().Unix(),
1867
-							Mtime:              time.Now().Unix(),
1868
-							PatientId:          ssubItem.PatientId,
1869
-							RecordDate:         ssubItem.AdviceDate,
1870
-							Count:              1,
1871
-							FeedetlSn:          "",
1872
-							MedListCodg:        "",
1873
-							SingleDose:         "1",
1874
-							DeliveryWay:        "",
1875
-							ExecutionFrequency: "",
1876
-							Day:                "1",
1877
-							Remark:             "",
1878
-							Unit:               "",
1879
-							Type:               3,
1880
-							PrescriptionId:     info.ID,
1881
-							FrequencyType:      ssubItem.FrequencyType,
1882
-							DayCount:           ssubItem.DayCount,
1883
-							WeekDay:            ssubItem.WeekDay,
1884
-						}
1885
-						service.CreateHisPrescriptionProjectTemplate(pro)
1886
-
1887
-					}
1845
+					//if ssubItem.DrugId == 1234 {
1846
+					//	pro := &models.HisPrescriptionProjectTemplate{
1847
+					//		ProjectId:          2326,
1848
+					//		Price:              0.86,
1849
+					//		UserOrgId:          ssubItem.UserOrgId,
1850
+					//		Status:             1,
1851
+					//		Ctime:              time.Now().Unix(),
1852
+					//		Mtime:              time.Now().Unix(),
1853
+					//		PatientId:          ssubItem.PatientId,
1854
+					//		RecordDate:         ssubItem.AdviceDate,
1855
+					//		Count:              1,
1856
+					//		FeedetlSn:          "",
1857
+					//		MedListCodg:        "",
1858
+					//		SingleDose:         "1",
1859
+					//		DeliveryWay:        "",
1860
+					//		ExecutionFrequency: "",
1861
+					//		Day:                "1",
1862
+					//		Remark:             "",
1863
+					//		Unit:               "",
1864
+					//		Type:               3,
1865
+					//		PrescriptionId:     info.ID,
1866
+					//		FrequencyType:      ssubItem.FrequencyType,
1867
+					//		DayCount:           ssubItem.DayCount,
1868
+					//		WeekDay:            ssubItem.WeekDay,
1869
+					//	}
1870
+					//	service.CreateHisPrescriptionProjectTemplate(pro)
1871
+					//
1872
+					//}
1888 1873
 					if ssubItem.DrugId == 1288 {
1889
-
1890
-						pro := &models.HisPrescriptionProjectTemplate{
1891
-							ProjectId:          2326,
1892
-							Price:              0.86,
1893
-							UserOrgId:          ssubItem.UserOrgId,
1894
-							Status:             1,
1895
-							Ctime:              time.Now().Unix(),
1896
-							Mtime:              time.Now().Unix(),
1897
-							PatientId:          ssubItem.PatientId,
1898
-							RecordDate:         ssubItem.AdviceDate,
1899
-							Count:              1,
1900
-							FeedetlSn:          "",
1901
-							MedListCodg:        "",
1902
-							SingleDose:         "1",
1903
-							DeliveryWay:        "",
1904
-							ExecutionFrequency: "",
1905
-							Day:                "1",
1906
-							Remark:             "",
1907
-							Unit:               "",
1908
-							Type:               3,
1909
-							PrescriptionId:     info.ID,
1910
-							FrequencyType:      ssubItem.FrequencyType,
1911
-							DayCount:           ssubItem.DayCount,
1912
-							WeekDay:            ssubItem.WeekDay,
1874
+						info := &models.HisPrescriptionInfoTemplate{
1875
+							UserOrgId:   item.UserOrgId,
1876
+							RecordDate:  0,
1877
+							PatientId:   item.PatientId,
1878
+							Status:      1,
1879
+							Ctime:       time.Now().Unix(),
1880
+							Mtime:       time.Now().Unix(),
1881
+							Type:        2,
1882
+							Creator:     0,
1883
+							Modifier:    0,
1884
+							PType:       0,
1885
+							PTemplateId: item.ID,
1886
+							MedType:     "14",
1913 1887
 						}
1914
-						service.CreateHisPrescriptionProjectTemplate(pro)
1915
-
1916
-					}
1917
-					if ssubItem.DrugId == 1306 {
1918
-
1919
-						pro := &models.HisPrescriptionProjectTemplate{
1920
-							ProjectId:          2325,
1921
-							Price:              1.11,
1922
-							UserOrgId:          ssubItem.UserOrgId,
1923
-							Status:             1,
1924
-							Ctime:              time.Now().Unix(),
1925
-							Mtime:              time.Now().Unix(),
1926
-							PatientId:          ssubItem.PatientId,
1927
-							RecordDate:         ssubItem.AdviceDate,
1928
-							Count:              1,
1929
-							FeedetlSn:          "",
1930
-							MedListCodg:        "",
1931
-							SingleDose:         "1",
1932
-							DeliveryWay:        "",
1933
-							ExecutionFrequency: "",
1934
-							Day:                "1",
1935
-							Remark:             "",
1936
-							Unit:               "",
1937
-							Type:               3,
1938
-							PrescriptionId:     info.ID,
1939
-							FrequencyType:      ssubItem.FrequencyType,
1940
-							DayCount:           ssubItem.DayCount,
1941
-							WeekDay:            ssubItem.WeekDay,
1942
-						}
1943
-						service.CreateHisPrescriptionProjectTemplate(pro)
1888
+						service.CreateHisPrescriptionInfoTemplate(info)
1944 1889
 
1945 1890
 						pro2 := &models.HisPrescriptionProjectTemplate{
1946 1891
 							ProjectId:          1727,
@@ -1968,61 +1913,142 @@ func (c *PublicApiController) Handle10215() {
1968 1913
 						}
1969 1914
 						service.CreateHisPrescriptionProjectTemplate(pro2)
1970 1915
 
1971
-					}
1972
-					if ssubItem.DrugId == 1291 {
1916
+						//pro := &models.HisPrescriptionProjectTemplate{
1917
+						//	ProjectId:          2326,
1918
+						//	Price:              0.86,
1919
+						//	UserOrgId:          ssubItem.UserOrgId,
1920
+						//	Status:             1,
1921
+						//	Ctime:              time.Now().Unix(),
1922
+						//	Mtime:              time.Now().Unix(),
1923
+						//	PatientId:          ssubItem.PatientId,
1924
+						//	RecordDate:         ssubItem.AdviceDate,
1925
+						//	Count:              1,
1926
+						//	FeedetlSn:          "",
1927
+						//	MedListCodg:        "",
1928
+						//	SingleDose:         "1",
1929
+						//	DeliveryWay:        "",
1930
+						//	ExecutionFrequency: "",
1931
+						//	Day:                "1",
1932
+						//	Remark:             "",
1933
+						//	Unit:               "",
1934
+						//	Type:               3,
1935
+						//	PrescriptionId:     info.ID,
1936
+						//	FrequencyType:      ssubItem.FrequencyType,
1937
+						//	DayCount:           ssubItem.DayCount,
1938
+						//	WeekDay:            ssubItem.WeekDay,
1939
+						//}
1940
+						//service.CreateHisPrescriptionProjectTemplate(pro)
1973 1941
 
1974
-						pro := &models.HisPrescriptionProjectTemplate{
1975
-							ProjectId:          2322,
1976
-							Price:              0.68,
1977
-							UserOrgId:          ssubItem.UserOrgId,
1978
-							Status:             1,
1979
-							Ctime:              time.Now().Unix(),
1980
-							Mtime:              time.Now().Unix(),
1981
-							PatientId:          ssubItem.PatientId,
1982
-							RecordDate:         ssubItem.AdviceDate,
1983
-							Count:              1,
1984
-							FeedetlSn:          "",
1985
-							MedListCodg:        "",
1986
-							SingleDose:         "1",
1987
-							DeliveryWay:        "",
1988
-							ExecutionFrequency: "",
1989
-							Day:                "1",
1990
-							Remark:             "",
1991
-							Unit:               "",
1992
-							Type:               3,
1993
-							PrescriptionId:     info.ID,
1994
-							FrequencyType:      ssubItem.FrequencyType,
1995
-							DayCount:           ssubItem.DayCount,
1996
-							WeekDay:            ssubItem.WeekDay,
1997
-						}
1998
-						service.CreateHisPrescriptionProjectTemplate(pro)
1999
-
2000
-						pro2 := &models.HisPrescriptionProjectTemplate{
2001
-							ProjectId:          1727,
2002
-							Price:              2.50,
2003
-							UserOrgId:          ssubItem.UserOrgId,
2004
-							Status:             1,
2005
-							Ctime:              time.Now().Unix(),
2006
-							Mtime:              time.Now().Unix(),
2007
-							PatientId:          ssubItem.PatientId,
2008
-							RecordDate:         ssubItem.AdviceDate,
2009
-							Count:              1,
2010
-							FeedetlSn:          "",
2011
-							MedListCodg:        "",
2012
-							SingleDose:         "1",
2013
-							DeliveryWay:        "",
2014
-							ExecutionFrequency: "",
2015
-							Day:                "1",
2016
-							Remark:             "",
2017
-							Unit:               "",
2018
-							Type:               2,
2019
-							PrescriptionId:     info.ID,
2020
-							FrequencyType:      ssubItem.FrequencyType,
2021
-							DayCount:           ssubItem.DayCount,
2022
-							WeekDay:            ssubItem.WeekDay,
2023
-						}
2024
-						service.CreateHisPrescriptionProjectTemplate(pro2)
2025 1942
 					}
1943
+					//if ssubItem.DrugId == 1306 {
1944
+					//
1945
+					//	pro := &models.HisPrescriptionProjectTemplate{
1946
+					//		ProjectId:          2325,
1947
+					//		Price:              1.11,
1948
+					//		UserOrgId:          ssubItem.UserOrgId,
1949
+					//		Status:             1,
1950
+					//		Ctime:              time.Now().Unix(),
1951
+					//		Mtime:              time.Now().Unix(),
1952
+					//		PatientId:          ssubItem.PatientId,
1953
+					//		RecordDate:         ssubItem.AdviceDate,
1954
+					//		Count:              1,
1955
+					//		FeedetlSn:          "",
1956
+					//		MedListCodg:        "",
1957
+					//		SingleDose:         "1",
1958
+					//		DeliveryWay:        "",
1959
+					//		ExecutionFrequency: "",
1960
+					//		Day:                "1",
1961
+					//		Remark:             "",
1962
+					//		Unit:               "",
1963
+					//		Type:               3,
1964
+					//		PrescriptionId:     info.ID,
1965
+					//		FrequencyType:      ssubItem.FrequencyType,
1966
+					//		DayCount:           ssubItem.DayCount,
1967
+					//		WeekDay:            ssubItem.WeekDay,
1968
+					//	}
1969
+					//	service.CreateHisPrescriptionProjectTemplate(pro)
1970
+					//
1971
+					//	pro2 := &models.HisPrescriptionProjectTemplate{
1972
+					//		ProjectId:          1727,
1973
+					//		Price:              2.50,
1974
+					//		UserOrgId:          ssubItem.UserOrgId,
1975
+					//		Status:             1,
1976
+					//		Ctime:              time.Now().Unix(),
1977
+					//		Mtime:              time.Now().Unix(),
1978
+					//		PatientId:          ssubItem.PatientId,
1979
+					//		RecordDate:         ssubItem.AdviceDate,
1980
+					//		Count:              1,
1981
+					//		FeedetlSn:          "",
1982
+					//		MedListCodg:        "",
1983
+					//		SingleDose:         "1",
1984
+					//		DeliveryWay:        "",
1985
+					//		ExecutionFrequency: "",
1986
+					//		Day:                "1",
1987
+					//		Remark:             "",
1988
+					//		Unit:               "",
1989
+					//		Type:               2,
1990
+					//		PrescriptionId:     info.ID,
1991
+					//		FrequencyType:      ssubItem.FrequencyType,
1992
+					//		DayCount:           ssubItem.DayCount,
1993
+					//		WeekDay:            ssubItem.WeekDay,
1994
+					//	}
1995
+					//	service.CreateHisPrescriptionProjectTemplate(pro2)
1996
+					//
1997
+					//}
1998
+					//if ssubItem.DrugId == 1291 {
1999
+					//
2000
+					//	pro := &models.HisPrescriptionProjectTemplate{
2001
+					//		ProjectId:          2322,
2002
+					//		Price:              0.68,
2003
+					//		UserOrgId:          ssubItem.UserOrgId,
2004
+					//		Status:             1,
2005
+					//		Ctime:              time.Now().Unix(),
2006
+					//		Mtime:              time.Now().Unix(),
2007
+					//		PatientId:          ssubItem.PatientId,
2008
+					//		RecordDate:         ssubItem.AdviceDate,
2009
+					//		Count:              1,
2010
+					//		FeedetlSn:          "",
2011
+					//		MedListCodg:        "",
2012
+					//		SingleDose:         "1",
2013
+					//		DeliveryWay:        "",
2014
+					//		ExecutionFrequency: "",
2015
+					//		Day:                "1",
2016
+					//		Remark:             "",
2017
+					//		Unit:               "",
2018
+					//		Type:               3,
2019
+					//		PrescriptionId:     info.ID,
2020
+					//		FrequencyType:      ssubItem.FrequencyType,
2021
+					//		DayCount:           ssubItem.DayCount,
2022
+					//		WeekDay:            ssubItem.WeekDay,
2023
+					//	}
2024
+					//	service.CreateHisPrescriptionProjectTemplate(pro)
2025
+					//
2026
+					//	pro2 := &models.HisPrescriptionProjectTemplate{
2027
+					//		ProjectId:          1727,
2028
+					//		Price:              2.50,
2029
+					//		UserOrgId:          ssubItem.UserOrgId,
2030
+					//		Status:             1,
2031
+					//		Ctime:              time.Now().Unix(),
2032
+					//		Mtime:              time.Now().Unix(),
2033
+					//		PatientId:          ssubItem.PatientId,
2034
+					//		RecordDate:         ssubItem.AdviceDate,
2035
+					//		Count:              1,
2036
+					//		FeedetlSn:          "",
2037
+					//		MedListCodg:        "",
2038
+					//		SingleDose:         "1",
2039
+					//		DeliveryWay:        "",
2040
+					//		ExecutionFrequency: "",
2041
+					//		Day:                "1",
2042
+					//		Remark:             "",
2043
+					//		Unit:               "",
2044
+					//		Type:               2,
2045
+					//		PrescriptionId:     info.ID,
2046
+					//		FrequencyType:      ssubItem.FrequencyType,
2047
+					//		DayCount:           ssubItem.DayCount,
2048
+					//		WeekDay:            ssubItem.WeekDay,
2049
+					//	}
2050
+					//	service.CreateHisPrescriptionProjectTemplate(pro2)
2051
+					//}
2026 2052
 				}
2027 2053
 
2028 2054
 			}

+ 118 - 23
models/his_charge_models.go View File

@@ -1,15 +1,17 @@
1 1
 package models
2 2
 
3 3
 type HisChargePrescriptionProject struct {
4
-	ID         int64      `gorm:"column:id" json:"id" form:"id"`
5
-	ProjectId  int64      `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
-	UserOrgId  int64      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
-	Status     int64      `gorm:"column:status" json:"status" form:"status"`
8
-	PatientId  int64      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
-	RecordDate int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
-	Count      int64      `gorm:"column:count" json:"count" form:"count"`
11
-	HisProject HisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
12
-	GoodInfo   GoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
4
+	ID         int64   `gorm:"column:id" json:"id" form:"id"`
5
+	ProjectId  int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
+	UserOrgId  int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
+	Status     int64   `gorm:"column:status" json:"status" form:"status"`
8
+	PatientId  int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
+	RecordDate int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
+	Count      float64 `gorm:"column:count" json:"count" form:"count"`
11
+	Type       int64   `gorm:"column:type" json:"type" form:"type"`
12
+
13
+	HisChargeProject  HisChargeProject  `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
14
+	HisChargeGoodInfo HisChargeGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
13 15
 }
14 16
 
15 17
 func (HisChargePrescriptionProject) TableName() string {
@@ -22,6 +24,7 @@ type HisChargeDoctorAdviceInfo struct {
22 24
 	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
23 25
 	AdviceName string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
24 26
 	Status     int64  `gorm:"column:status" json:"status" form:"status"`
27
+	DrugId     int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
25 28
 }
26 29
 
27 30
 func (HisChargeDoctorAdviceInfo) TableName() string {
@@ -42,8 +45,8 @@ type HisChargeOrderInfo struct {
42 45
 	UserOrgId                    int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
43 46
 	ProjectId                    int64                        `gorm:"column:project_id" json:"project_id" form:"project_id"`
44 47
 	Type                         int64                        `gorm:"column:type" json:"type" form:"type"`
45
-	HisChargePrescriptionProject HisChargePrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"project"`
46
-	HisChargeDoctorAdviceInfo    HisChargeDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"advice"`
48
+	HisChargePrescriptionProject HisChargePrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
49
+	HisChargeDoctorAdviceInfo    HisChargeDoctorAdviceInfo    `gorm:"ForeignKey:AdviceId;AssociationForeignKey:ID" json:"advice"`
47 50
 }
48 51
 
49 52
 func (HisChargeOrderInfo) TableName() string {
@@ -56,27 +59,119 @@ type ChargePatient struct {
56 59
 	Name           string            `gorm:"column:name" json:"name" form:"name"`
57 60
 	Lapseto        int64             `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
58 61
 	Status         int64             `gorm:"column:status" json:"status" form:"status"`
59
-	HisChargeOrder []*HisChargeOrder `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"orders"`
62
+	HisChargeOrder []*HisChargeOrder `gorm:"ForeignKey:PatientID;AssociationForeignKey:ID" json:"orders"`
60 63
 }
61 64
 
62 65
 func (ChargePatient) TableName() string {
63 66
 	return "xt_patients"
64 67
 }
65 68
 
66
-type HisChargeOrder struct {
67
-	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
68
-	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
69
-	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
70
-	SettleAccountsDate int64  `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
71
-	Status             int64  `gorm:"column:status" json:"status" form:"status"`
72
-	Number             string `gorm:"column:number" json:"number" form:"number"`
73
-	OrderStatus        int64  `gorm:"column:order_status" json:"order_status" form:"order_status"`
74
-	MdtrtId            string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
75
-	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
69
+type SettlePatient struct {
70
+	ID                   int64                   `gorm:"column:id" json:"id" form:"id"`
71
+	UserOrgId            int64                   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
72
+	Name                 string                  `gorm:"column:name" json:"name" form:"name"`
73
+	Lapseto              int64                   `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
74
+	Status               int64                   `gorm:"column:status" json:"status" form:"status"`
75
+	HisChargeSettleOrder []*HisChargeSettleOrder `gorm:"ForeignKey:PatientID;AssociationForeignKey:ID" json:"orders"`
76
+}
77
+
78
+func (SettlePatient) TableName() string {
79
+	return "xt_patients"
80
+}
76 81
 
77
-	HisChargeOrderInfo []*HisChargeOrderInfo `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"orders"`
82
+type HisChargeOrder struct {
83
+	ID                 int64                 `gorm:"column:id" json:"id" form:"id"`
84
+	UserOrgId          int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
85
+	HisPatientId       int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
86
+	SettleAccountsDate int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
87
+	Status             int64                 `gorm:"column:status" json:"status" form:"status"`
88
+	Number             string                `gorm:"column:number" json:"number" form:"number"`
89
+	OrderStatus        int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
90
+	MdtrtId            string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
91
+	PatientId          int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
92
+	HisChargeOrderInfo []*HisChargeOrderInfo `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
78 93
 }
79 94
 
80 95
 func (HisChargeOrder) TableName() string {
81 96
 	return "his_order"
82 97
 }
98
+
99
+type HisChargeSettleOrder struct {
100
+	ID                  int64   `gorm:"column:id" json:"id" form:"id"`
101
+	UserOrgId           int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
102
+	HisPatientId        int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
103
+	SettleAccountsDate  int64   `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
104
+	Status              int64   `gorm:"column:status" json:"status" form:"status"`
105
+	PatientId           int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
106
+	Infcode             int64   `gorm:"column:infcode" json:"infcode" form:"infcode"`
107
+	WarnMsg             string  `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
108
+	Cainfo              string  `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
109
+	ErrMsg              string  `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
110
+	RespondTime         string  `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
111
+	InfRefmsgid         string  `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
112
+	OrderStatus         int64   `gorm:"column:order_status" json:"order_status" form:"order_status"`
113
+	MdtrtId             string  `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
114
+	SetlId              string  `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
115
+	Insutype            string  `gorm:"column:insutype" json:"insutype" form:"insutype"`
116
+	PsnType             string  `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
117
+	CvlservFlag         string  `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
118
+	SetlTime            string  `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
119
+	MdtrtCertType       string  `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
120
+	MedType             string  `gorm:"column:med_type" json:"med_type" form:"med_type"`
121
+	MedfeeSumamt        float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
122
+	FulamtOwnpayAmt     float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
123
+	OverlmtSelfPay      float64 `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
124
+	PreselfpayAmt       float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
125
+	InscpScpAmt         float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
126
+	ActPayDedc          float64 `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
127
+	HifpPay             float64 `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
128
+	CvlservPay          float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
129
+	PoolPropSelfpay     float64 `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
130
+	HifesPay            float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
131
+	HifmiPay            float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
132
+	HifobPay            float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
133
+	MafPay              float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
134
+	OthPay              float64 `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
135
+	FundPaySumamt       float64 `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
136
+	PsnPartAmt          float64 `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
137
+	AcctPay             float64 `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
138
+	PsnCashPay          float64 `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
139
+	HospPartAmt         float64 `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
140
+	Balc                float64 `gorm:"column:balc" json:"balc" form:"balc"`
141
+	AcctMulaidPay       float64 `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
142
+	MedinsSetlId        string  `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
143
+	ClrOptins           string  `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
144
+	ClrWay              string  `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
145
+	ClrType             string  `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
146
+	SetlDetail          string  `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
147
+	IsMedicineInsurance int64   `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
148
+	PType               int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
149
+	SettleType          int64   `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
150
+	SettleStartTime     int64   `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
151
+	SettleEndTime       int64   `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
152
+	IsPre               int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
153
+}
154
+
155
+func (HisChargeSettleOrder) TableName() string {
156
+	return "his_order"
157
+}
158
+
159
+type HisChargeProject struct {
160
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
161
+	ProjectName string `gorm:"column:project_name" json:"project_name" form:"project_name"`
162
+	Unit        string `gorm:"column:unit" json:"unit" form:"unit"`
163
+}
164
+
165
+func (HisChargeProject) TableName() string {
166
+	return "xt_his_project"
167
+}
168
+
169
+type HisChargeGoodInfo struct {
170
+	ID       int64  `gorm:"column:id" json:"id" form:"id"`
171
+	GoodName string `gorm:"column:good_name" json:"good_name" form:"good_name"`
172
+	GoodUnit int64  `gorm:"column:good_unit" json:"good_unit"`
173
+}
174
+
175
+func (HisChargeGoodInfo) TableName() string {
176
+	return "xt_good_information"
177
+}

+ 1 - 1
models/his_models.go View File

@@ -749,7 +749,7 @@ type HisPrescriptionProject struct {
749 749
 	HisPatientId       int64      `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
750 750
 	RecordDate         int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
751 751
 	PrescriptionId     int64      `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
752
-	Count              int64      `gorm:"column:count" json:"count" form:"count"`
752
+	Count              float64    `gorm:"column:count" json:"count" form:"count"`
753 753
 	FeedetlSn          string     `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
754 754
 	MedListCodg        string     `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
755 755
 	SingleDose         string     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`

+ 1 - 1
service/dialysis_service.go View File

@@ -1179,7 +1179,7 @@ func SaveHisDoctorAdvice(advice *models.HisDoctorAdviceInfo) (err error) {
1179 1179
 
1180 1180
 func GetGoodInfoMation(orgid int64) (goodinfo []*models.GoodInfo, err error) {
1181 1181
 
1182
-	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1", orgid).Find(&goodinfo).Error
1182
+	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Find(&goodinfo).Error
1183 1183
 	return goodinfo, err
1184 1184
 }
1185 1185
 

+ 16 - 17
service/his_charge_service.go View File

@@ -6,25 +6,24 @@ import (
6 6
 )
7 7
 
8 8
 func GetAllPatientChargeDetails(org_id int64, start_time int64, end_time int64) (patients []*models.ChargePatient, err error) {
9
-	err = readDb.Model(&models.ChargePatient{}).Select("id,user_org_id,name,lapseto,status").Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
10
-		return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").Where("status = 1  AND settle_accounts_date >= ? AND settle_accounts_date <= ?", start_time, end_time).
9
+	err = readDb.Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.settle_accounts_date >= ? AND orders.settle_accounts_date <= ? AND orders.user_org_id = ? AND orders.order_status = 2", start_time, end_time, org_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
10
+		return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").
11 11
 			Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
12 12
 				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").Preload("HisChargeDoctorAdviceInfo", "status = 1").Preload("HisChargePrescriptionProject", func(db *gorm.DB) *gorm.DB {
13
-					return db.Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1 ")
14
-				}).Where("status = 1 ")
15
-			})
16
-	}).Where("user_org_id = ? AND status = 1", org_id).Find(&patients).Error
13
+					return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").Preload("HisChargeProject", func(db *gorm.DB) *gorm.DB {
14
+						return db.Select("id,project_name,unit").Where("status = 1 ")
15
+					}).Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
16
+						return db.Select("id,good_name,good_unit").Where("status = 1 ")
17
+					}).Where("status = 1 ")
18
+				})
19
+			}).Where("status = 1  AND settle_accounts_date >= ? AND settle_accounts_date <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
20
+	}).Where("p.status = 1  AND p.user_org_id = ?", org_id).Group("id").Find(&patients).Error
17 21
 	return
18 22
 }
19 23
 
20
-//func GetAllPatientChargeDetails(org_id int64,start_time int64, end_time int64)(patients []*models.ChargePatient,err error){
21
-//	err = readDb.Model(&models.ChargePatient{}).Select("id,user_org_id,name,lapseto,status").Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
22
-//		return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").Where("status = 1  AND settle_accounts_date >= ? AND settle_accounts_date <= ?", start_time,end_time).
23
-//			Preload("HisChargeOrderInfo",  func(db *gorm.DB) *gorm.DB {
24
-//				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").Preload("HisChargeDoctorAdviceInfo","status = 1").Preload("HisChargePrescriptionProject",  func(db *gorm.DB) *gorm.DB {
25
-//					return db.Preload("HisProject","status = 1").Preload("GoodInfo","status = 1").Where("status = 1 ")
26
-//				}).Where("status = 1 ")
27
-//			})
28
-//	}).Where("user_org_id = ? AND status = 1",org_id).Find(&patients).Error
29
-//	return
30
-//}
24
+func GetAllPatientChargeSettle(org_id int64, start_time int64, end_time int64) (patients []*models.SettlePatient, err error) {
25
+	err = readDb.Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.settle_accounts_date >= ? AND orders.settle_accounts_date <= ? AND orders.user_org_id = ? AND orders.order_status = 2", start_time, end_time, org_id).Preload("HisChargeSettleOrder", func(db *gorm.DB) *gorm.DB {
26
+		return db.Where("status = 1  AND settle_accounts_date >= ? AND settle_accounts_date <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
27
+	}).Where("p.status = 1  AND p.user_org_id = ?", org_id).Group("id").Find(&patients).Error
28
+	return
29
+}

+ 21 - 8
service/his_hospital_service.go View File

@@ -80,14 +80,27 @@ func GetHisHospitalPatientList(org_id int64, record_date int64) (patients []*Hos
80 80
 	return
81 81
 }
82 82
 
83
-func GetHisHospitalSchPatientList(org_id int64, record_date int64) (patients []*HospitalPatient, err error) {
84
-	db := readDb.Model(&HospitalPatient{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
85
-	db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_date = ? ", org_id, record_date)
86
-	db = db.Preload("HisHospitalCheckRecord", func(db *gorm.DB) *gorm.DB {
87
-		return db.Where("user_org_id = ? AND status = 1  AND in_hospital_status = 1 AND out_hospital_status = 0", org_id).Order("id desc")
88
-	})
89
-	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type = 1", org_id, record_date).Group("id").Find(&patients).Error
90
-	return
83
+func GetHisHospitalSchPatientList(org_id int64, record_date int64, sch_type int64) (patients []*HospitalPatient, err error) {
84
+	if sch_type > 0 {
85
+		db := readDb.Model(&HospitalPatient{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
86
+		db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_date = ? AND sch.schedule_type = ? ", org_id, record_date, sch_type)
87
+		db = db.Preload("HisHospitalCheckRecord", func(db *gorm.DB) *gorm.DB {
88
+			return db.Where("user_org_id = ? AND status = 1  AND in_hospital_status = 1 AND out_hospital_status = 0", org_id).Order("id desc")
89
+		})
90
+		err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type = 1", org_id, record_date).Group("id").Find(&patients).Error
91
+		return
92
+
93
+	} else {
94
+		db := readDb.Model(&HospitalPatient{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
95
+		db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_date = ?  ", org_id, record_date)
96
+		db = db.Preload("HisHospitalCheckRecord", func(db *gorm.DB) *gorm.DB {
97
+			return db.Where("user_org_id = ? AND status = 1  AND in_hospital_status = 1 AND out_hospital_status = 0", org_id).Order("id desc")
98
+		})
99
+		err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type = 1", org_id, record_date).Group("id").Find(&patients).Error
100
+		return
101
+
102
+	}
103
+
91 104
 }
92 105
 
93 106
 func GetNewAllUnChargeHisHospitalPatientList(org_id int64, record_date int64) (patients []*HospitalPatient, err error) {

+ 1 - 1
service/his_service.go View File

@@ -1513,7 +1513,7 @@ type HisPrescriptionProject struct {
1513 1513
 	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1514 1514
 	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
1515 1515
 	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1516
-	Count              int64        `gorm:"column:count" json:"count" form:"count"`
1516
+	Count              float64      `gorm:"column:count" json:"count" form:"count"`
1517 1517
 	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1518 1518
 	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1519 1519
 	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`