Bladeren bron

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 1 week geleden
bovenliggende
commit
50239788ee

Diff onderdrukt omdat het te groot bestand
+ 1436 - 24
controllers/fapiao_controller.go


+ 6 - 0
controllers/his_api_controller.go Bestand weergeven

@@ -1186,6 +1186,9 @@ func (c *HisApiController) GetPrivateExpensesOrder() {
1186 1186
 						case 15:
1187 1187
 							item.MedChrgitmType = "14"
1188 1188
 							break
1189
+						case 101:
1190
+							item.MedChrgitmType = "04"
1191
+							break
1189 1192
 
1190 1193
 						}
1191 1194
 
@@ -1222,6 +1225,9 @@ func (c *HisApiController) GetPrivateExpensesOrder() {
1222 1225
 						case 9:
1223 1226
 							item.MedChrgitmType = "14"
1224 1227
 							break
1228
+						case 101:
1229
+							item.MedChrgitmType = "04"
1230
+							break
1225 1231
 						default:
1226 1232
 							item.MedChrgitmType = "14"
1227 1233
 							break

+ 44 - 3
controllers/his_export_data_controller.go Bestand weergeven

@@ -6,7 +6,7 @@ import (
6 6
 	"XT_New/service"
7 7
 	"github.com/astaxie/beego"
8 8
 	"github.com/shopspring/decimal"
9
-	"strings"
9
+	"time"
10 10
 )
11 11
 
12 12
 type HisExportDataController struct {
@@ -19,6 +19,38 @@ func HisExportDataApiRegistRouters() {
19 19
 
20 20
 	beego.Router("/api/batchsettle/get", &HisExportDataController{}, "Get:GetExportSettleData")
21 21
 
22
+	beego.Router("/api/export/10726/detail", &HisExportDataController{}, "Get:Get10726DetailExportData")
23
+	beego.Router("/api/export/10726/summary", &HisExportDataController{}, "Get:Get10726SummaryExportData")
24
+	beego.Router("/api/export/10697/summary", &HisExportDataController{}, "Get:Get10697SummaryExportData")
25
+
26
+}
27
+
28
+func (c *HisExportDataController) Get10726DetailExportData() {
29
+	start_time := c.GetString("start_time")
30
+	end_time := c.GetString("end_time")
31
+	result, _ := service.GetHisOrderBy10726Detail(start_time, end_time)
32
+	c.ServeSuccessJSON(map[string]interface{}{
33
+		"result": result,
34
+	})
35
+}
36
+
37
+func (c *HisExportDataController) Get10726SummaryExportData() {
38
+	start_time := c.GetString("start_time")
39
+	end_time := c.GetString("end_time")
40
+	result, _ := service.GetHisOrderBy10726Summary(start_time, end_time)
41
+	c.ServeSuccessJSON(map[string]interface{}{
42
+		"result": result,
43
+	})
44
+}
45
+
46
+func (c *HisExportDataController) Get10697SummaryExportData() {
47
+	start_time := c.GetString("start_time")
48
+	end_time := c.GetString("end_time")
49
+	ins := c.GetString("ins")
50
+	result, _ := service.GetHisOrderBy10697Summary(start_time, end_time, ins)
51
+	c.ServeSuccessJSON(map[string]interface{}{
52
+		"result": result,
53
+	})
22 54
 }
23 55
 
24 56
 func (c *HisExportDataController) GetExportSettleData() {
@@ -195,6 +227,15 @@ func (c *HisExportDataController) GetExportSettleData() {
195 227
 			otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
196 228
 		}
197 229
 	}
230
+
231
+	t := time.Unix(orders[0].SettleAccountsDate, 0)
232
+	t2 := time.Unix(orders[len(orders)-1].SettleAccountsDate, 0)
233
+
234
+	// 使用Format方法将时间转换为字符串
235
+	// 这里以 "2006-01-02 15:04:05" 为例,它是Go的预定义常量格式
236
+	f_time := t.Format("2006-01-02")
237
+
238
+	l_time := t2.Format("2006-01-02")
198 239
 	c.ServeSuccessJSON(map[string]interface{}{
199 240
 		"order_infos":                                 orderInfos,
200 241
 		"number":                                      order.MdtrtId,
@@ -238,8 +279,8 @@ func (c *HisExportDataController) GetExportSettleData() {
238 279
 		"org_name": miConfig.OrgName,
239 280
 		"org_code": miConfig.Code,
240 281
 		"num":      len(orders),
241
-		"f_time":   strings.Split(orders[0].SetlTime, " ")[0],
242
-		"l_time":   strings.Split(orders[len(orders)-1].SetlTime, " ")[0],
282
+		"f_time":   f_time,
283
+		"l_time":   l_time,
243 284
 	})
244 285
 
245 286
 }

+ 169 - 69
controllers/statistics_api_controller.go Bestand weergeven

@@ -4,6 +4,7 @@ import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/models"
6 6
 	"XT_New/service"
7
+	"XT_New/service/statistics_service"
7 8
 	"XT_New/utils"
8 9
 	"fmt"
9 10
 	"github.com/astaxie/beego"
@@ -1651,14 +1652,29 @@ func (c *StatisticsApiController) GetDialyzerConfig() {
1651 1652
 func (this *StatisticsApiController) GetInsepctionList() {
1652 1653
 	adminUser := this.GetAdminUserInfo()
1653 1654
 	orgid := adminUser.CurrentOrgId
1654
-	configurationlist, err := service.GetInsepctionConfigurationList(orgid)
1655
-	if err != nil {
1656
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1657
-		return
1655
+	count, _ := statistics_service.FindOrgInspectionCount(orgid)
1656
+	if count <= 0 {
1657
+		configurationlist, err := service.GetInsepctionConfigurationListTwo(orgid)
1658
+		if err != nil {
1659
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1660
+			return
1661
+		}
1662
+		this.ServeSuccessJSON(map[string]interface{}{
1663
+			"configurationlist": configurationlist,
1664
+		})
1665
+
1666
+	} else {
1667
+		configurationlist, err := service.GetInsepctionConfigurationList(orgid)
1668
+		if err != nil {
1669
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1670
+			return
1671
+		}
1672
+		this.ServeSuccessJSON(map[string]interface{}{
1673
+			"configurationlist": configurationlist,
1674
+		})
1675
+
1658 1676
 	}
1659
-	this.ServeSuccessJSON(map[string]interface{}{
1660
-		"configurationlist": configurationlist,
1661
-	})
1677
+
1662 1678
 }
1663 1679
 func (c *StatisticsApiController) GetAllCommonInspectionStatistisc() {
1664 1680
 	start_date := c.GetString("start_date")
@@ -1691,26 +1707,57 @@ func (c *StatisticsApiController) GetAllCommonInspectionStatistisc() {
1691 1707
 
1692 1708
 	//患者总数
1693 1709
 	patientCount := service.GetPatientCount(c.GetAdminUserInfo().CurrentOrgId)
1694
-	//获取配置
1695
-	reference, _ := service.GetInspectionReferenceFour(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1696
-	//获取数值在正常范围内的总数
1697
-	config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1698
-	max, _ := strconv.ParseFloat(config.LargeRange, 64)
1699
-	min, _ := strconv.ParseFloat(config.MinRange, 64)
1700
-
1701
-	normalTotal, _ := service.GetNormalInspectionTotalByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min)
1702
-	//获取数值异常的总数
1703
-	unusualTotal, _ := service.GetUnusualInspectionTotalByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min)
1704
-	//获取没有检查的患者总数
1705
-	noCheckTotal, _ := service.GetPatientNotInspectionTotal(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName)
1706
-	c.ServeSuccessJSON(map[string]interface{}{
1707
-		"patient_count":  patientCount,
1708
-		"normal_total":   normalTotal,
1709
-		"unusual_total":  unusualTotal,
1710
-		"no_check_total": noCheckTotal,
1711
-		"reference":      reference,
1712
-		"config":         config,
1713
-	})
1710
+
1711
+	count, _ := statistics_service.FindOrgInspectionCount(c.GetAdminUserInfo().CurrentOrgId)
1712
+
1713
+	if count <= 0 {
1714
+
1715
+		//获取配置
1716
+		reference, _ := service.GetInspectionReferenceFive(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1717
+		//获取数值在正常范围内的总数
1718
+		config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1719
+		max, _ := strconv.ParseFloat(config.LargeRange, 64)
1720
+		min, _ := strconv.ParseFloat(config.MinRange, 64)
1721
+
1722
+		normalTotal, _ := service.GetNormalInspectionTotalByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min)
1723
+		//获取数值异常的总数
1724
+		unusualTotal, _ := service.GetUnusualInspectionTotalByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min)
1725
+		//获取没有检查的患者总数
1726
+		noCheckTotal, _ := service.GetPatientNotInspectionTotal(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName)
1727
+		c.ServeSuccessJSON(map[string]interface{}{
1728
+			"patient_count":  patientCount,
1729
+			"normal_total":   normalTotal,
1730
+			"unusual_total":  unusualTotal,
1731
+			"no_check_total": noCheckTotal,
1732
+			"reference":      reference,
1733
+			"config":         config,
1734
+		})
1735
+
1736
+	} else {
1737
+
1738
+		//获取配置
1739
+		reference, _ := service.GetInspectionReferenceFour(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1740
+
1741
+		//获取数值在正常范围内的总数
1742
+		config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1743
+		max, _ := strconv.ParseFloat(config.LargeRange, 64)
1744
+		min, _ := strconv.ParseFloat(config.MinRange, 64)
1745
+
1746
+		normalTotal, _ := service.GetNormalInspectionTotalByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min)
1747
+		//获取数值异常的总数
1748
+		unusualTotal, _ := service.GetUnusualInspectionTotalByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min)
1749
+		//获取没有检查的患者总数
1750
+		noCheckTotal, _ := service.GetPatientNotInspectionTotal(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName)
1751
+		c.ServeSuccessJSON(map[string]interface{}{
1752
+			"patient_count":  patientCount,
1753
+			"normal_total":   normalTotal,
1754
+			"unusual_total":  unusualTotal,
1755
+			"no_check_total": noCheckTotal,
1756
+			"reference":      reference,
1757
+			"config":         config,
1758
+		})
1759
+
1760
+	}
1714 1761
 
1715 1762
 }
1716 1763
 func (c *StatisticsApiController) GetPersonCommonInspectionStatistisc() {
@@ -1743,18 +1790,35 @@ func (c *StatisticsApiController) GetPersonCommonInspectionStatistisc() {
1743 1790
 		endTime = theTime.Unix()
1744 1791
 	}
1745 1792
 
1746
-	patient, _ := service.GetFaPiaoPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
1747
-	config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1793
+	count, _ := statistics_service.FindOrgInspectionCount(c.GetAdminUserInfo().CurrentOrgId)
1794
+	if count <= 0 {
1795
+		patient, _ := service.GetFaPiaoPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
1796
+		config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1797
+		//获取配置
1798
+		reference, _ := service.GetInspectionReferenceFive(config.InspectionMajor, config.InspectionMinor, c.GetAdminUserInfo().CurrentOrgId)
1799
+		//获取数值在正常范围内的总数
1800
+		inspections, _ := service.GetPatientInspectionByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, patient_id, reference.ItemName)
1801
+		c.ServeSuccessJSON(map[string]interface{}{
1802
+			"patient":     patient,
1803
+			"reference":   reference,
1804
+			"inspections": inspections,
1805
+		})
1748 1806
 
1749
-	//获取配置
1750
-	reference, _ := service.GetInspectionReferenceFour(config.InspectionMajor, config.InspectionMinor, c.GetAdminUserInfo().CurrentOrgId)
1751
-	//获取数值在正常范围内的总数
1752
-	inspections, _ := service.GetPatientInspectionByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, patient_id, reference.ItemName)
1753
-	c.ServeSuccessJSON(map[string]interface{}{
1754
-		"patient":     patient,
1755
-		"reference":   reference,
1756
-		"inspections": inspections,
1757
-	})
1807
+	} else {
1808
+
1809
+		patient, _ := service.GetFaPiaoPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
1810
+		config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1811
+
1812
+		//获取配置
1813
+		reference, _ := service.GetInspectionReferenceFour(config.InspectionMajor, config.InspectionMinor, c.GetAdminUserInfo().CurrentOrgId)
1814
+		//获取数值在正常范围内的总数
1815
+		inspections, _ := service.GetPatientInspectionByID(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, patient_id, reference.ItemName)
1816
+		c.ServeSuccessJSON(map[string]interface{}{
1817
+			"patient":     patient,
1818
+			"reference":   reference,
1819
+			"inspections": inspections,
1820
+		})
1821
+	}
1758 1822
 
1759 1823
 }
1760 1824
 func (c *StatisticsApiController) GetPatientCommonInspectionStatistisc() {
@@ -1787,41 +1851,77 @@ func (c *StatisticsApiController) GetPatientCommonInspectionStatistisc() {
1787 1851
 		endTime = theTime.Unix()
1788 1852
 	}
1789 1853
 
1790
-	//获取配置
1791
-	reference, _ := service.GetInspectionReferenceFour(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1792
-	//获取数值在正常范围内的总数
1854
+	count, _ := statistics_service.FindOrgInspectionCount(c.GetAdminUserInfo().CurrentOrgId)
1855
+	if count <= 0 {
1856
+		//获取配置
1857
+		reference, _ := service.GetInspectionReferenceFive(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1858
+		//获取数值在正常范围内的总数
1793 1859
 
1794
-	config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1795
-	max, _ := strconv.ParseFloat(config.LargeRange, 64)
1796
-	min, _ := strconv.ParseFloat(config.MinRange, 64)
1860
+		config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1861
+		max, _ := strconv.ParseFloat(config.LargeRange, 64)
1862
+		min, _ := strconv.ParseFloat(config.MinRange, 64)
1797 1863
 
1798
-	//max, _ := strconv.ParseFloat(reference.RangeMax, 64)
1799
-	//min, _ := strconv.ParseFloat(reference.RangeMin, 64)
1800
-	//config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1864
+		switch item_type {
1865
+		case 1:
1866
+			list, _ := service.GetUnusualInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min, keyword)
1867
+			c.ServeSuccessJSON(map[string]interface{}{
1868
+				"list":      list,
1869
+				"reference": reference,
1870
+			})
1871
+			break
1872
+		case 2:
1873
+			list, _ := service.GetPatientNotInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, keyword)
1874
+			c.ServeSuccessJSON(map[string]interface{}{
1875
+				"list":      list,
1876
+				"reference": reference,
1877
+			})
1878
+			break
1879
+		case 3:
1880
+			list, _ := service.GetNormalInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min, keyword)
1881
+			c.ServeSuccessJSON(map[string]interface{}{
1882
+				"list":      list,
1883
+				"reference": reference,
1884
+			})
1885
+			break
1886
+		}
1801 1887
 
1802
-	switch item_type {
1803
-	case 1:
1804
-		list, _ := service.GetUnusualInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min, keyword)
1805
-		c.ServeSuccessJSON(map[string]interface{}{
1806
-			"list":      list,
1807
-			"reference": reference,
1808
-		})
1809
-		break
1810
-	case 2:
1811
-		list, _ := service.GetPatientNotInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, keyword)
1812
-		c.ServeSuccessJSON(map[string]interface{}{
1813
-			"list":      list,
1814
-			"reference": reference,
1815
-		})
1816
-		break
1817
-	case 3:
1818
-		list, _ := service.GetNormalInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min, keyword)
1819
-		c.ServeSuccessJSON(map[string]interface{}{
1820
-			"list":      list,
1821
-			"reference": reference,
1822
-		})
1823
-		break
1888
+	} else {
1889
+
1890
+		//获取配置
1891
+		reference, _ := service.GetInspectionReferenceFour(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1892
+		//获取数值在正常范围内的总数
1893
+
1894
+		config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1895
+		max, _ := strconv.ParseFloat(config.LargeRange, 64)
1896
+		min, _ := strconv.ParseFloat(config.MinRange, 64)
1897
+		//max, _ := strconv.ParseFloat(reference.RangeMax, 64)
1898
+		//min, _ := strconv.ParseFloat(reference.RangeMin, 64)
1899
+		//config, _ := service.GetConfigurationById(project_id, item_id, c.GetAdminUserInfo().CurrentOrgId)
1900
+		switch item_type {
1901
+		case 1:
1902
+			list, _ := service.GetUnusualInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min, keyword)
1903
+			c.ServeSuccessJSON(map[string]interface{}{
1904
+				"list":      list,
1905
+				"reference": reference,
1906
+			})
1907
+			break
1908
+		case 2:
1909
+			list, _ := service.GetPatientNotInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, keyword)
1910
+			c.ServeSuccessJSON(map[string]interface{}{
1911
+				"list":      list,
1912
+				"reference": reference,
1913
+			})
1914
+			break
1915
+		case 3:
1916
+			list, _ := service.GetNormalInspectionPatientList(startTime, endTime, c.GetAdminUserInfo().CurrentOrgId, reference.ItemName, max, min, keyword)
1917
+			c.ServeSuccessJSON(map[string]interface{}{
1918
+				"list":      list,
1919
+				"reference": reference,
1920
+			})
1921
+			break
1922
+		}
1824 1923
 	}
1924
+
1825 1925
 }
1826 1926
 
1827 1927
 func (c *StatisticsApiController) GetFivePatientInspectionStatistisc() {

+ 227 - 0
models/bwfapiao/baiwang.go Bestand weergeven

@@ -0,0 +1,227 @@
1
+package bwfapiao
2
+
3
+// 定义响应结构体
4
+type UnifiedLoginResponse struct {
5
+	Success       bool               `json:"success"`                 // 接口调用成功或失败的标志
6
+	Method        string             `json:"method"`                  // 接口的唯一标识
7
+	RequestId     string             `json:"requestId"`               // 请求唯一标识
8
+	Response      *LoginResponseData `json:"response,omitempty"`      // 业务响应信息
9
+	ErrorResponse *ErrorResponse     `json:"errorResponse,omitempty"` // 错误响应信息
10
+}
11
+
12
+type LoginResponseData struct {
13
+	DigitAccount  string `json:"digitAccount"`  // 数电账号
14
+	LoginType     string `json:"loginType"`     // 登录方式
15
+	BatchNo       string `json:"batchNo"`       // 批次号 (操作类型为2时返回)
16
+	Status        string `json:"status"`        // 状态: 1-成功, 2-进行中, 3-失败
17
+	StatusMessage string `json:"statusMessage"` // 状态描述
18
+	QRCode        string `json:"qrCode"`        // 二维码 (操作类型为2,状态为1时返回)
19
+	QRCodeId      string `json:"qrCodeId"`      // 二维码字符串
20
+	EndTime       string `json:"endTime"`       // 二维码/短信有效期截止时间
21
+}
22
+
23
+type ErrorResponse struct {
24
+	Code       int    `json:"code"`       // 错误码 (开放平台错误码)
25
+	Message    string `json:"message"`    // 错误信息 (开放平台错误信息)
26
+	SubCode    string `json:"subCode"`    // 业务端返回错误码
27
+	SubMessage string `json:"subMessage"` // 业务端返回错误信息
28
+}
29
+
30
+type SEinvoicebasicGetLoginResultResponse struct {
31
+	Success       bool          `json:"success"`       // 接口调用是否成功
32
+	Method        string        `json:"method"`        // 接口的唯一标识
33
+	RequestID     string        `json:"requestId"`     // 请求唯一标识
34
+	Response      LoginResponse `json:"response"`      // 业务响应数据
35
+	ErrorResponse ErrorResponse `json:"errorResponse"` // 错误响应信息
36
+}
37
+
38
+// 登录状态的业务数据
39
+type LoginResponse struct {
40
+	DigitAccount string `json:"digitAccount"` // 数电账号(电子税局实名手机号)
41
+	LoginStatus  string `json:"loginStatus"`  // 登录状态 (0-未登录, 1-已登录, 2-登录中)
42
+	LoginType    string `json:"loginType"`    // 登录方式 (0-账号密码, 1-短信验证码, 2-税务APP扫码, 3-个税APP扫码)
43
+}
44
+
45
+type GetCertifyQrcodeResponse struct {
46
+	Success       bool                  `json:"success"`
47
+	Response      GetCertifyQrcodeData  `json:"response"`
48
+	ErrorResponse GetCertifyQrcodeError `json:"error_response"`
49
+}
50
+
51
+type GetCertifyQrcodeData struct {
52
+	QRCode     string `json:"qrCode"`     // 二维码链接
53
+	ExpireTime string `json:"expireTime"` // 有效期截止时间
54
+}
55
+
56
+type GetCertifyQrcodeError struct {
57
+	Code    int    `json:"code"`
58
+	Message string `json:"message"`
59
+}
60
+
61
+type GetQrcodeCertifyResultResponse struct {
62
+	Success       bool                     `json:"success"`
63
+	Response      QrcodeCertifyResultData  `json:"response"`
64
+	ErrorResponse QrcodeCertifyResultError `json:"error_response"`
65
+}
66
+
67
+type QrcodeCertifyResultData struct {
68
+	TaxNo               string `json:"taxNo"`               // 税号
69
+	DigitAccount        string `json:"digitAccount"`        // 数电账号
70
+	AuthId              string `json:"authId"`              // 认证编号
71
+	CertificationStatus string `json:"certificationStatus"` // 认证状态
72
+	CertStatusMessage   string `json:"certStatusMessage"`   // 状态描述
73
+}
74
+
75
+type QrcodeCertifyResultError struct {
76
+	Code       int    `json:"code"`       // 错误码
77
+	Message    string `json:"message"`    // 错误信息
78
+	SubCode    string `json:"subCode"`    // 子错误码
79
+	SubMessage string `json:"subMessage"` // 子错误信息
80
+}
81
+
82
+// 公共响应参数
83
+type CommonResponse struct {
84
+	Success       bool          `json:"success"`       // 接口调用成功或失败的标志
85
+	Method        string        `json:"method"`        // 接口的唯一标识
86
+	RequestID     string        `json:"requestId"`     // 请求唯一标识
87
+	Response      interface{}   `json:"response"`      // 业务接口调用成功后的具体响应信息
88
+	ErrorResponse ErrorResponse `json:"errorResponse"` // 错误响应信息
89
+}
90
+
91
+// 定义响应结构体
92
+type RedAddResponse struct {
93
+	Success       bool                `json:"success"`                 // 接口调用成功或失败的标志
94
+	Method        string              `json:"method"`                  // 接口的唯一标识
95
+	RequestId     string              `json:"requestId"`               // 请求唯一标识
96
+	Response      []RedAddInvoiceData `json:"response,omitempty"`      // 业务响应信息
97
+	ErrorResponse ErrorResponse       `json:"errorResponse,omitempty"` // 错误响应信息
98
+}
99
+
100
+type RedAddInvoiceData struct {
101
+	RedConfirmUUID     string `json:"redConfirmUuid"`
102
+	RedInvoiceNo       string `json:"redInvoiceNo"`
103
+	ConfirmState       string `json:"confirmState"`
104
+	RedConfirmNo       string `json:"redConfirmNo"`
105
+	ConfirmBillingMark string `json:"confirmBillingMark"`
106
+	RedConfirmSerialNo string `json:"redConfirmSerialNo"`
107
+}
108
+
109
+// 定义响应结构体
110
+type RedOperaResponse struct {
111
+	Success       bool                  `json:"success"`                 // 接口调用成功或失败的标志
112
+	Method        string                `json:"method"`                  // 接口的唯一标识
113
+	RequestId     string                `json:"requestId"`               // 请求唯一标识
114
+	Response      []RedOperaInvoiceData `json:"response,omitempty"`      // 业务响应信息
115
+	ErrorResponse ErrorResponse         `json:"errorResponse,omitempty"` // 错误响应信息
116
+}
117
+
118
+type RedOperaInvoiceData struct {
119
+	RedConfirmUUID     string `json:"redConfirmUuid"`
120
+	RedInvoiceNo       string `json:"redInvoiceNo"`
121
+	ConfirmState       string `json:"confirmState"`
122
+	RedConfirmNo       string `json:"redConfirmNo"`
123
+	ConfirmBillingMark string `json:"confirmBillingMark"`
124
+	RedConfirmSerialNo string `json:"redConfirmSerialNo"`
125
+}
126
+
127
+type InvoiceIssueResponse struct {
128
+	Method        string                   `json:"method"`
129
+	Success       bool                     `json:"success"`
130
+	RequestID     string                   `json:"requestId"`
131
+	Response      InvoiceIssueResponseData `json:"response"`
132
+	ErrorResponse ErrorResponse            `json:"errorResponse,omitempty"` // 错误响应信息
133
+
134
+}
135
+
136
+type InvoiceIssueResponseData struct {
137
+	Fail    []InvoiceIssueFailData    `json:"fail"`
138
+	Success []InvoiceIssueSuccessData `json:"success"`
139
+}
140
+
141
+type InvoiceIssueFailData struct {
142
+	InvoiceTotalPrice    float64                      `json:"invoiceTotalPrice"`
143
+	InvoiceTotalTax      float64                      `json:"invoiceTotalTax"`
144
+	InvoiceTotalPriceTax float64                      `json:"invoiceTotalPriceTax"`
145
+	SerialNo             string                       `json:"serialNo"`
146
+	InvoiceDetailsList   []InvoiceDetailsFailItemData `json:"invoiceDetailsList"`
147
+}
148
+
149
+type InvoiceDetailsFailItemData struct {
150
+	PriceTaxMark         string  `json:"priceTaxMark"`
151
+	GoodsTaxRate         float64 `json:"goodsTaxRate"`
152
+	InvoiceLineNature    string  `json:"invoiceLineNature"`
153
+	GoodsTotalPrice      float64 `json:"goodsTotalPrice"`
154
+	GoodsSpecification   string  `json:"goodsSpecification"`
155
+	GoodsPrice           float64 `json:"goodsPrice"`
156
+	FreeTaxMark          string  `json:"freeTaxMark"`
157
+	GoodsQuantity        string  `json:"goodsQuantity"`
158
+	GoodsUnit            string  `json:"goodsUnit"`
159
+	GoodsTotalTax        float64 `json:"goodsTotalTax"`
160
+	GoodsCode            string  `json:"goodsCode"`
161
+	PreferentialMark     string  `json:"preferentialMark"`
162
+	GoodsName            string  `json:"goodsName"`
163
+	GoodsLineNo          string  `json:"goodsLineNo"`
164
+	VatSpecialManagement string  `json:"vatSpecialManagement"`
165
+}
166
+
167
+type InvoiceIssueSuccessData struct {
168
+	PaperInvoiceCode     string                          `json:"paperInvoiceCode"`
169
+	EInvoiceUrl          string                          `json:"eInvoiceUrl"`
170
+	InvoiceTotalTax      float64                         `json:"invoiceTotalTax"`
171
+	InvoiceDate          string                          `json:"invoiceDate"`
172
+	InvoiceCode          string                          `json:"invoiceCode"`
173
+	InvoiceTotalPriceTax float64                         `json:"invoiceTotalPriceTax"`
174
+	SerialNo             string                          `json:"serialNo"`
175
+	MulPurchaserList     []MulPurchaserItemData          `json:"mulPurchaserList"`
176
+	TaxControlCode       string                          `json:"taxControlCode"`
177
+	InvoiceCheckCode     string                          `json:"invoiceCheckCode"`
178
+	InvoiceQrCode        string                          `json:"invoiceQrCode"`
179
+	InvoiceTotalPrice    float64                         `json:"invoiceTotalPrice"`
180
+	InvoiceDetailsList   []InvoiceDetailsSuccessItemData `json:"invoiceDetailsList"`
181
+	InvoiceTypeCode      string                          `json:"invoiceTypeCode"`
182
+	PaperInvoiceNo       string                          `json:"paperInvoiceNo"`
183
+	InvoiceNo            string                          `json:"invoiceNo"`
184
+	MulPurchaserMark     string                          `json:"mulPurchaserMark"`
185
+}
186
+
187
+type MulPurchaserItemData struct {
188
+	Purchaser       string `json:"purchaser"`
189
+	CertificateNo   string `json:"certificateNo"`
190
+	CertificateType string `json:"certificateType"`
191
+}
192
+
193
+type InvoiceDetailsSuccessItemData struct {
194
+	PriceTaxMark       string  `json:"priceTaxMark"`
195
+	GoodsTaxRate       float64 `json:"goodsTaxRate"`
196
+	GoodsSpecification string  `json:"goodsSpecification"`
197
+	GoodsPrice         float64 `json:"goodsPrice"`
198
+	GoodsQuantity      float64 `json:"goodsQuantity"`
199
+	GoodsUnit          string  `json:"goodsUnit"`
200
+	GoodsTotalTax      float64 `json:"goodsTotalTax"`
201
+	GoodsCode          string  `json:"goodsCode"`
202
+	GoodsName          string  `json:"goodsName"`
203
+	GoodsLineNo        int     `json:"goodsLineNo"`
204
+	GoodsTotalPrice    float64 `json:"goodsTotalPrice"`
205
+}
206
+
207
+// 定义响应结构体
208
+type BanShiResponse struct {
209
+	Success       bool              `json:"success"`                 // 接口调用成功或失败的标志
210
+	Method        string            `json:"method"`                  // 接口的唯一标识
211
+	RequestId     string            `json:"requestId"`               // 请求唯一标识
212
+	Response      BanShiInvoiceData `json:"response,omitempty"`      // 业务响应信息
213
+	ErrorResponse ErrorResponse     `json:"errorResponse,omitempty"` // 错误响应信息
214
+}
215
+
216
+type BanShiInvoiceData struct {
217
+	EInvoiceUrl  string `json:"eInvoiceUrl"`
218
+	FileType     string `json:"fileType"`
219
+	ConfirmState string `json:"confirmState"`
220
+	UrlMap       Urls   `json:"urlMap"`
221
+}
222
+
223
+type Urls struct {
224
+	PdfUrl string `json:"pdfUrl"`
225
+	OfdUrl string `json:"ofdUrl"`
226
+	XmlUrl string `json:"xmlUrl"`
227
+}

+ 6 - 0
models/fapiao.go Bestand weergeven

@@ -92,6 +92,12 @@ type HisFaPiaoOrder struct {
92 92
 	Patients                Patients                   `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
93 93
 	SettleAccountsDateOrder []*SettleAccountsDateOrder `gorm:"-" json:"orders" form:"orders"`
94 94
 	Message                 string                     `gorm:"column:message" json:"message" form:"message"`
95
+	RedInvoiceUUID          string                     `gorm:"column:red_invoice_uuid" json:"red_invoice_uuid" form:"red_invoice_uuid"`
96
+
97
+	BlueRequestInfo  string `gorm:"column:blue_request_info" json:"blue_request_info" form:"blue_request_info"`
98
+	BlueResponseInfo string `gorm:"column:blue_response_info" json:"blue_response_info" form:"blue_response_info"`
99
+	RedRequestInfo   string `gorm:"column:red_request_info" json:"red_request_info" form:"red_request_info"`
100
+	RedResponseInfo  string `gorm:"column:red_response_info" json:"red_response_info" form:"red_response_info"`
95 101
 }
96 102
 
97 103
 func (HisFaPiaoOrder) TableName() string {

+ 48 - 0
models/his_models.go Bestand weergeven

@@ -2941,3 +2941,51 @@ type XtGoodTeamList struct {
2941 2941
 func (XtGoodTeamList) TableName() string {
2942 2942
 	return "xt_good_team_list"
2943 2943
 }
2944
+
2945
+type HisOrder10726 struct {
2946
+	ID                  uint    `gorm:"primaryKey"`
2947
+	UserOrgID           int     `gorm:"column:user_org_id"`
2948
+	OrderStatus         int     `gorm:"column:order_status"`
2949
+	SetlTime            string  `gorm:"column:setl_time"`
2950
+	IsMedicineInsurance int     `gorm:"column:is_medicine_insurance"`
2951
+	Status              int     `gorm:"column:status"`
2952
+	Certno              string  `gorm:"column:certno"`
2953
+	PsnName             string  `gorm:"column:psn_name"`
2954
+	Gend                string  `gorm:"column:gend"`
2955
+	PsnType             string  `gorm:"column:psn_type"`
2956
+	MedType             string  `gorm:"column:med_type"`
2957
+	MedfeeSumamt        float64 `gorm:"column:medfee_sumamt"`
2958
+	HifpPay             float64 `gorm:"column:hifp_pay"`
2959
+	ActPayDedc          float64 `gorm:"column:act_pay_dedc"`
2960
+	HifobPay            float64 `gorm:"column:hifob_pay"`
2961
+	HifmiPay            float64 `gorm:"column:hifmi_pay"`
2962
+	HifesPay            float64 `gorm:"column:hifes_pay"`
2963
+	CvlservPay          float64 `gorm:"column:cvlserv_pay"`
2964
+	MafPay              float64 `gorm:"column:maf_pay"`
2965
+	OthPay              float64 `gorm:"column:oth_pay"`
2966
+	HospPartAmt         float64 `gorm:"column:hosp_part_amt"`
2967
+	AcctPay             float64 `gorm:"column:acct_pay"`
2968
+	AcctMulaidPay       float64 `gorm:"column:acct_mulaid_pay"`
2969
+	FundPaySumamt       float64 `gorm:"column:fund_pay_sumamt"`
2970
+	PsnCashPay          float64 `gorm:"column:psn_cash_pay"`
2971
+}
2972
+
2973
+type HisOrder10726Summary struct {
2974
+	Insutype            string  `gorm:"column:insutype"`
2975
+	UserOrgID           int     `gorm:"column:user_org_id"`
2976
+	OrderStatus         int     `gorm:"column:order_status"`
2977
+	SetlTime            string  `gorm:"column:setl_time"`
2978
+	IsMedicineInsurance int     `gorm:"column:is_medicine_insurance"`
2979
+	Status              int     `gorm:"column:status"`
2980
+	PatientID           int     `gorm:"column:patient_id"`
2981
+	ID                  int     `gorm:"column:id"`
2982
+	MedfeeSumamt        float64 `gorm:"column:medfee_sumamt"`
2983
+	HifpPay             float64 `gorm:"column:hifp_pay"`
2984
+	HifmiPay            float64 `gorm:"column:hifmi_pay"`
2985
+	CvlservPay          float64 `gorm:"column:cvlserv_pay"`
2986
+	MafPay              float64 `gorm:"column:maf_pay"`
2987
+	OthPay              float64 `gorm:"column:oth_pay"`
2988
+	AcctPay             float64 `gorm:"column:acct_pay"`
2989
+	AcctMulaidPay       float64 `gorm:"column:acct_mulaid_pay"`
2990
+	PsnCashPay          float64 `gorm:"column:psn_cash_pay"`
2991
+}

+ 196 - 0
service/export_data_service.go Bestand weergeven

@@ -134,3 +134,199 @@ func GetBatchHisOrderInfoByNumber(order_number string) (order []models.BatchHisO
134 134
 	err = readDb.Model(&models.BatchHisOrderInfo{}).Where("order_number = ? and status = 1", order_number).Find(&order).Error
135 135
 	return
136 136
 }
137
+
138
+type Results struct {
139
+	SerialNo           string  `gorm:"column:序号"`
140
+	MedicalArea        string  `gorm:"column:医疗区划"`
141
+	CertNo             string  `gorm:"column:证件号码"`
142
+	PsnName            string  `gorm:"column:姓名"`
143
+	Gender             string  `gorm:"column:性别"`
144
+	Occupation         string  `gorm:"column:职业"`
145
+	MedicalType        string  `gorm:"column:医疗类别"`
146
+	AdmissionTime      string  `gorm:"column:入院时间"`
147
+	DischargeTime      string  `gorm:"column:出院时间"`
148
+	SettlementTime     string  `gorm:"column:结算时间"`
149
+	DischargeDiagnosis string  `gorm:"column:出院诊断"`
150
+	InpatientDays      int     `gorm:"column:住院天数"`
151
+	MedicalFeeTotal    float64 `gorm:"column:医疗费总额"`
152
+	HifpPay            float64 `gorm:"column:统筹支付金额"`
153
+	ActPayDedc         float64 `gorm:"column:起付线"`
154
+	HifobPay           float64 `gorm:"column:职工大额基金支付"`
155
+	HifmiPay           float64 `gorm:"column:居民大病基金支出"`
156
+	HifesPay           float64 `gorm:"column:企业补充"`
157
+	CvlservPay         float64 `gorm:"column:公务员补助"`
158
+	MafPay             float64 `gorm:"column:医疗救助"`
159
+	OthPay             float64 `gorm:"column:其他支付"`
160
+	HospPartAmt        float64 `gorm:"column:医院负担"`
161
+	AcctPay            float64 `gorm:"column:个账支付"`
162
+	AcctMulaidPay      float64 `gorm:"column:共济支付"`
163
+	FundPaySumamt      float64 `gorm:"column:基金支付金额"`
164
+	PsnCashPay         float64 `gorm:"column:现金支付"`
165
+}
166
+
167
+type SummaryResults struct {
168
+	InsuranceType      string  `gorm:"column:险种类型"`   // 险种类型
169
+	MedicalArea        string  `gorm:"column:统筹区"`    // 统筹区
170
+	SettlementCategory string  `gorm:"column:清算类别"`   // 清算类别
171
+	PeopleCount        int     `gorm:"column:人数"`     // 人数
172
+	VisitCount         int     `gorm:"column:人次"`     // 人次
173
+	TotalMedicalFee    float64 `gorm:"column:医保费用合计"` // 医保费用合计
174
+	PoolFundPay        float64 `gorm:"column:统筹支付金额"` // 统筹支付金额
175
+	BigDiseaseFundPay  float64 `gorm:"column:大病基金支付"` // 大病基金支付
176
+	PublicServantPay   float64 `gorm:"column:公务员补助"`  // 公务员补助
177
+	MedicalAssistance  float64 `gorm:"column:医疗救助"`   // 医疗救助
178
+	OtherPay           float64 `gorm:"column:其他支付"`   // 其他支付
179
+	AcctPay            float64 `gorm:"column:个账支付"`   // 个账支付
180
+	MutualAidPay       float64 `gorm:"column:共济支付"`   // 共济支付
181
+	CashPay            float64 `gorm:"column:现金支付"`   // 现金支付
182
+}
183
+
184
+func GetHisOrderBy10726Detail(start_time string, end_time string) ([]Results, error) {
185
+	//err = readDb.Model(&models.HisOrder10726{}).Select("").Where("setl_time >= ? and setl_time <= ? AND status = 1 and order_status = 2  and user_org_id = 10721", start_time+" 00:00:00", end_time+" 23:59:00").Find(&order).Error
186
+	var result []Results
187
+	readDb.Table("his_order").Select(`
188
+		'' AS 序号,
189
+		'乐安县' AS 医疗区划,
190
+		certno AS 证件号码,
191
+		psn_name AS 姓名,
192
+		CASE 
193
+			WHEN gend = '1' THEN '男' 
194
+			WHEN gend = '2' THEN '女' 
195
+		END AS 性别,
196
+		CASE 
197
+			WHEN psn_type IN ('14', '15') THEN '居民(成年)'
198
+		END AS 职业,
199
+		CASE 
200
+			WHEN med_type = '990101' THEN '单病种门诊'
201
+			WHEN med_type = '14' THEN '门诊慢特病'
202
+		END AS 医疗类别,
203
+		setl_time AS 入院时间,
204
+		setl_time AS 出院时间,
205
+		setl_time AS 结算时间,
206
+		CASE 
207
+			WHEN med_type = '990101' THEN '尿毒症(免费透析)'
208
+			WHEN med_type = '14' THEN '尿毒症期'
209
+		END AS 出院诊断,
210
+		1 AS 住院天数,
211
+		medfee_sumamt AS 医疗费总额,
212
+		hifp_pay AS 统筹支付金额,
213
+		act_pay_dedc AS 起付线,
214
+		hifob_pay AS 职工大额基金支付,
215
+		hifmi_pay AS 居民大病基金支出,
216
+		hifes_pay AS 企业补充,
217
+		cvlserv_pay AS 公务员补助,
218
+		maf_pay AS 医疗救助,
219
+		oth_pay AS 其他支付,
220
+		hosp_part_amt AS 医院负担,
221
+		acct_pay AS 个账支付,
222
+		acct_mulaid_pay AS 共济支付,
223
+		fund_pay_sumamt AS 基金支付金额,
224
+		psn_cash_pay AS 现金支付
225
+	`).Where("user_org_id = ?", 10726).
226
+		Where("order_status = ?", 2).
227
+		Where("setl_time >= ?", start_time).
228
+		Where("setl_time <= ?", end_time).
229
+		Where("is_medicine_insurance = ?", 1).
230
+		Where("status = ?", 1).
231
+		Scan(&result)
232
+	return result, err
233
+}
234
+
235
+func GetHisOrderBy10726Summary(start_time string, end_time string) ([]SummaryResults, error) {
236
+	var result []SummaryResults
237
+	err = readDb.Table("his_order").
238
+		Select(`
239
+			CASE
240
+				WHEN insutype = "390" THEN "城乡居民"
241
+				WHEN insutype = "310" THEN "职工"
242
+			END AS "险种类型",
243
+			"乐安县" AS 统筹区,
244
+			"门诊" AS 清算类别,
245
+			COUNT(DISTINCT patient_id) AS 人数,
246
+			COUNT(id) AS 人次,
247
+			SUM(medfee_sumamt) AS 医保费用合计,
248
+			SUM(hifp_pay) AS 统筹支付金额,
249
+			SUM(hifmi_pay) AS 大病基金支付,
250
+			SUM(cvlserv_pay) AS 公务员补助,
251
+			SUM(maf_pay) AS 医疗救助,
252
+			SUM(oth_pay) AS 其他支付,
253
+			SUM(acct_pay) AS 个账支付,
254
+			SUM(acct_mulaid_pay) AS 共济支付,
255
+			SUM(psn_cash_pay) AS 现金支付
256
+		`).
257
+		Where("user_org_id = ? AND order_status = ? AND setl_time >= ? AND setl_time <= ? AND is_medicine_insurance = ? AND status = ?",
258
+			10726, 2, start_time, end_time, 1, 1).
259
+		Group("insutype").
260
+		Scan(&result).Error
261
+	return result, err
262
+
263
+}
264
+
265
+type MedicalCharges struct {
266
+	SerialNo                 string  `gorm:"column:编号"`     // 编号
267
+	MedicalInsuranceNo       string  `gorm:"column:医疗保险号"`  // 医疗保险号
268
+	PsnName                  string  `gorm:"column:姓名"`     // 姓名
269
+	BedsFee                  float64 `gorm:"column:床位费"`    // 床位费
270
+	ConsultationFee          float64 `gorm:"column:诊察费"`    // 诊察费
271
+	ExaminationFee           float64 `gorm:"column:检查费"`    // 检查费
272
+	LaboratoryFee            float64 `gorm:"column:化验费"`    // 化验费
273
+	TreatmentFee             float64 `gorm:"column:治疗费"`    // 治疗费
274
+	NursingFee               float64 `gorm:"column:护理费"`    // 护理费
275
+	HealthMaterialsFee       float64 `gorm:"column:卫生材料费"`  // 卫生材料费
276
+	WesternMedicineFee       float64 `gorm:"column:西药费"`    // 西药费
277
+	ChineseMedicineFee       float64 `gorm:"column:中药饮片费"`  // 中药饮片费
278
+	ChinesePatentMedicineFee float64 `gorm:"column:中成药费"`   // 中成药费
279
+	GeneralTreatmentFee      float64 `gorm:"column:一般诊疗费"`  // 一般诊疗费
280
+	RegistrationFee          float64 `gorm:"column:挂号费"`    // 挂号费
281
+	OtherFee                 float64 `gorm:"column:其他费"`    // 其他费
282
+	TotalMedicalFee          float64 `gorm:"column:医疗费总额"`  // 医疗费总额
283
+	SelfPay                  float64 `gorm:"column:个人自付金额"` // 个人自付金额
284
+	AcctPay                  float64 `gorm:"column:基本账户支付"` // 基本账户支付
285
+	MutualAidAcctPay         float64 `gorm:"column:共济账户支付"` // 共济账户支付
286
+	PublicServantPay         float64 `gorm:"column:公务员补助"`  // 公务员补助
287
+	PoolFundPay              float64 `gorm:"column:统筹支付金额"` // 统筹支付金额
288
+	MedicalAssistance        float64 `gorm:"column:医疗救助"`   // 医疗救助
289
+	BigDiseasePay            float64 `gorm:"column:大病支付"`   // 大病支付
290
+	EnterpriseSupplement     float64 `gorm:"column:企业补充支付"` // 企业补充支付
291
+	MajorDiseaseSupplement   float64 `gorm:"column:重大疾病补充"` // 重大疾病补充 (Empty in SQL, will be left blank in Go)
292
+	OtherPayment             float64 `gorm:"column:其它支付"`   // 其它支付
293
+}
294
+
295
+func GetHisOrderBy10697Summary(start_time string, end_time string, ins string) (results []MedicalCharges, err error) {
296
+	err = readDb.Table("his_order").
297
+		Select(`
298
+        "" AS 编号,
299
+        his_order.certno AS 医疗保险号,
300
+        his_order.psn_name AS 姓名,
301
+        SUM(CASE WHEN i.med_chrgitm_type = '01' THEN i.det_item_fee_sumamt ELSE 0 END) AS 床位费,
302
+        SUM(CASE WHEN i.med_chrgitm_type = '02' THEN i.det_item_fee_sumamt ELSE 0 END) AS 诊察费,
303
+        SUM(CASE WHEN i.med_chrgitm_type = '03' THEN i.det_item_fee_sumamt ELSE 0 END) AS 检查费,
304
+        SUM(CASE WHEN i.med_chrgitm_type = '04' THEN i.det_item_fee_sumamt ELSE 0 END) AS 化验费,
305
+        SUM(CASE WHEN i.med_chrgitm_type = '05' THEN i.det_item_fee_sumamt ELSE 0 END) AS 治疗费,
306
+        SUM(CASE WHEN i.med_chrgitm_type = '07' THEN i.det_item_fee_sumamt ELSE 0 END) AS 护理费,
307
+        SUM(CASE WHEN i.med_chrgitm_type = '08' THEN i.det_item_fee_sumamt ELSE 0 END) AS 卫生材料费,
308
+        SUM(CASE WHEN i.med_chrgitm_type = '09' THEN i.det_item_fee_sumamt ELSE 0 END) AS 西药费,
309
+        SUM(CASE WHEN i.med_chrgitm_type = '10' THEN i.det_item_fee_sumamt ELSE 0 END) AS 中药饮片费,
310
+        SUM(CASE WHEN i.med_chrgitm_type = '11' THEN i.det_item_fee_sumamt ELSE 0 END) AS 中成药费,
311
+        SUM(CASE WHEN i.med_chrgitm_type = '12' THEN i.det_item_fee_sumamt ELSE 0 END) AS 一般诊疗费,
312
+        SUM(CASE WHEN i.med_chrgitm_type = '13' THEN i.det_item_fee_sumamt ELSE 0 END) AS 挂号费,
313
+        SUM(CASE WHEN i.med_chrgitm_type = '14' THEN i.det_item_fee_sumamt ELSE 0 END) AS 其他费,
314
+        SUM(his_order.medfee_sumamt) AS 医疗费总额,
315
+        SUM(his_order.psn_cash_pay) AS 个人自付金额,
316
+        SUM(his_order.acct_pay) AS 基本账户支付,
317
+        SUM(his_order.acct_mulaid_pay) AS 共济账户支付,
318
+        SUM(his_order.cvlserv_pay) AS 公务员补助,
319
+        SUM(his_order.hifp_pay) AS 统筹支付金额,
320
+        SUM(his_order.maf_pay) AS 医疗救助,
321
+        SUM(his_order.hifmi_pay) AS 大病支付,
322
+        SUM(his_order.hifes_pay) AS 企业补充支付,
323
+        "" AS 重大疾病补充,
324
+        SUM(his_order.oth_pay) AS 其它支付
325
+    `).
326
+		Joins("JOIN his_order_info i ON his_order.number = i.order_number").
327
+		Where("his_order.user_org_id = ? AND his_order.order_status = ? AND his_order.setl_time >= ? AND his_order.setl_time <= ? AND his_order.is_medicine_insurance = ? AND his_order.insutype = ? AND his_order.STATUS = ?",
328
+			10697, 2, start_time+" 00:00:00", end_time+" 23:59:59", 1, ins, 1).
329
+		Group("his_order.patient_id").
330
+		Scan(&results).Error
331
+	return
332
+}

+ 8 - 2
service/fapiao_service.go Bestand weergeven

@@ -11,10 +11,14 @@ func FindFaPiaoConfigInfo(org_id int64) (config models.FapiaoConfig, err error)
11 11
 	return
12 12
 }
13 13
 
14
-func GetFaPiaoSettleList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64, sort_type int64, start_time string, end_time string, is_open_fapiao int64, patient_id int64) (order []*models.HisOrderByFaPiao, err error, total int64) {
14
+func GetFaPiaoSettleList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64, sort_type int64, start_time string, end_time string, is_open_fapiao int64, patient_id int64, keywords string) (order []*models.HisOrderByFaPiao, err error, total int64) {
15 15
 	offset := (page - 1) * limit
16
+	keywords = "%" + keywords + "%"
16 17
 	db := readDb.Model(&models.HisOrderByFaPiao{})
17 18
 
19
+	if len(keywords) > 0 {
20
+		db = db.Joins("join xt_patients  on xt_patients.id = his_order.patient_id and xt_patients.name like ?", keywords)
21
+	}
18 22
 	// Join the patients table based on user_org_id
19 23
 	db = db.Joins("join xt_patients as patient on patient.id = his_order.patient_id and patient.user_org_id = ?", user_org_id)
20 24
 
@@ -75,11 +79,13 @@ func GetFaPiaoSettleList(user_org_id int64, page int64, limit int64, start_time_
75 79
 	return
76 80
 }
77 81
 
78
-func GetFaPiaoList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64) (order []*models.HisFaPiaoOrder, err error, total int64) {
82
+func GetFaPiaoList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64, keywords string) (order []*models.HisFaPiaoOrder, err error, total int64) {
79 83
 	offset := (page - 1) * limit
84
+	//keywords = "%" + keywords + "%"
80 85
 	db := readDb.Model(&models.HisFaPiaoOrder{})
81 86
 	db = db.Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id)
82 87
 	db = db.Where("ctime >= ? and ctime <= ? and user_org_id = ? and status = 1 and pdf_url <> ''", start_time_timestamp, end_time_timestamp, user_org_id)
88
+
83 89
 	// Count the total number of records
84 90
 	db = db.Count(&total)
85 91
 	// Apply pagination

+ 14 - 1
service/inspection_service.go Bestand weergeven

@@ -288,6 +288,10 @@ func GetInspectionReferenceFour(project_id int64, item_id int64, org_id int64) (
288 288
 	return
289 289
 }
290 290
 
291
+func GetInspectionReferenceFive(project_id int64, item_id int64, org_id int64) (reference models.InspectionReference, err error) {
292
+	err = readDb.Model(&models.InspectionReference{}).Where("project_id = ? and id = ? and status = 1 and org_id = ?", project_id, item_id, 0).Order("project_id").Find(&reference).Error
293
+	return
294
+}
291 295
 func GetInspectionTwo(startime int64, endtime int64, orgid int64, projectid int64, itemid int64) (inspection []*models.Inspection, total int64, err error) {
292 296
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
293 297
 	db = db.Where("project_id = ? and item_id = ?", projectid, itemid)
@@ -346,13 +350,22 @@ func GetLastInspectionDetail(patientid int64, date int64, projectid int64, orgid
346 350
 }
347 351
 
348 352
 func GetInsepctionConfigurationList(orgid int64) (standard []*models.QualityControlStandard, err error) {
353
+
349 354
 	db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
350
-	db = db.Where("x.user_org_id = ? and x.is_status =1", orgid)
355
+	db = db.Where("x.user_org_id = ? and x.is_status =1", orgid)
351 356
 	err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name,x.is_status").
352 357
 		Joins("left join xt_inspection_reference as s on s.item_id = x.inspection_minor and s.project_id = x.inspection_major").Where("s.org_id = ? and s.status = 1", orgid).Scan(&standard).Error
353 358
 	return standard, err
354 359
 }
355 360
 
361
+func GetInsepctionConfigurationListTwo(orgid int64) (standard []*models.QualityControlStandard, err error) {
362
+	db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
363
+	db = db.Where("x.user_org_id = ? and x.is_status =1", orgid)
364
+	err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name,x.is_status").
365
+		Joins("left join xt_inspection_reference as s on s.id = x.inspection_minor and s.project_id = x.inspection_major").Where("s.org_id = 0 and s.status = 1").Scan(&standard).Error
366
+	return standard, err
367
+}
368
+
356 369
 func GetInspectionGroup(patient_id int64, org_id int64) (inspection []*models.NewInspection, err error) {
357 370
 
358 371
 	db := XTReadDB().Table("xt_inspection").Where("status =1")

+ 21 - 4
service/statistis_qc_service.go Bestand weergeven

@@ -951,11 +951,28 @@ type QualityControlStandard struct {
951 951
 }
952 952
 
953 953
 func getQualityControlStandards(org_id int64) ([]QualityControlStandard, error) {
954
-	var standards []QualityControlStandard
955
-	if err := readDb.Model(&models.XtQualityControlStandard{}).Select("re.project_name as project_name,re.item_name as item_name,xt_quality_control_standard.inspection_major as inspection_major,xt_quality_control_standard.inspection_minor as inspection_minor").Joins("join xt_inspection_reference re on re.project_id = xt_quality_control_standard.inspection_major and re.item_id = xt_quality_control_standard.inspection_minor and re.org_id = ?", org_id).Where("xt_quality_control_standard.user_org_id = ? and xt_quality_control_standard.status = 1", org_id).Scan(&standards).Error; err != nil {
956
-		return nil, err
954
+	db := XTReadDB()
955
+	var count int64
956
+	err = db.Model(&models.InspectionReference{}).Where("status = 1 AND org_id = ?", org_id).Count(&count).Error
957
+
958
+	//count, _ := FindOrgInspectionCount(org_id)
959
+
960
+	if count == 0 {
961
+
962
+		var standards []QualityControlStandard
963
+		if err := readDb.Model(&models.XtQualityControlStandard{}).Select("re.project_name as project_name,re.item_name as item_name,xt_quality_control_standard.inspection_major as inspection_major,xt_quality_control_standard.inspection_minor as inspection_minor").Joins("join xt_inspection_reference re on re.project_id = xt_quality_control_standard.inspection_major and re.id = xt_quality_control_standard.inspection_minor and re.org_id = 0").Where("xt_quality_control_standard.user_org_id = ? and xt_quality_control_standard.status = 1", org_id).Scan(&standards).Error; err != nil {
964
+			return nil, err
965
+		}
966
+		return standards, nil
967
+	} else {
968
+		var standards []QualityControlStandard
969
+		if err := readDb.Model(&models.XtQualityControlStandard{}).Select("re.project_name as project_name,re.item_name as item_name,xt_quality_control_standard.inspection_major as inspection_major,xt_quality_control_standard.inspection_minor as inspection_minor").Joins("join xt_inspection_reference re on re.project_id = xt_quality_control_standard.inspection_major and re.item_id = xt_quality_control_standard.inspection_minor and re.org_id = ?", org_id).Where("xt_quality_control_standard.user_org_id = ? and xt_quality_control_standard.status = 1", org_id).Scan(&standards).Error; err != nil {
970
+			return nil, err
971
+		}
972
+		return standards, nil
973
+
957 974
 	}
958
-	return standards, nil
975
+
959 976
 }
960 977
 
961 978
 type DialysisQualityStat struct {