Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

陈少旭 6 months ago
parent
commit
ae7024e68a
42 changed files with 56159 additions and 22455 deletions
  1. 18 175
      conf/app.conf
  2. 1746 0
      controllers/ah/ahyb_controller.go
  3. 7156 604
      controllers/coordinate/coordinate_controller.go
  4. 888 0
      controllers/coordinate/coordinate_net_controller.go
  5. 15 3
      controllers/gz/new_his_api_controller.go
  6. 548 1
      controllers/hb/hbyb_controller.go
  7. 781 46
      controllers/js/jsyb_controller.go
  8. 194 67
      controllers/nm/nm_controller.go
  9. 279 193
      controllers/sg/gdyb_controller.go
  10. 28071 16845
      controllers/sg/his_api_controller.go
  11. 2887 170
      controllers/zh/zh_his_api_controller.go
  12. 4 0
      enums/error_code.go
  13. BIN
      gdyb
  14. 3613 3346
      main.go
  15. 26 0
      models/cfyljg.go
  16. 2 0
      models/doctor_advice_models.go
  17. 5 0
      models/drug.go
  18. 8 0
      models/good_models.go
  19. 291 8
      models/his_models.go
  20. 2 0
      models/stock_models.go
  21. 17 0
      models/yb_models.go
  22. 1 0
      models/zb_his_models.go
  23. 62 0
      models/zuobiao_models.go
  24. 4 1
      routers/router.go
  25. 3439 0
      service/ahyb_service.go
  26. 32 29
      service/auto_create_week_schedules_service.go
  27. 1238 152
      service/coordinate_service.go
  28. 21 161
      service/db.go
  29. 110 19
      service/dianzichufang.go
  30. 209 0
      service/fj_service.go
  31. 2176 415
      service/gdyb_service.go
  32. 331 0
      service/gxyb_service.go
  33. 3 3
      service/hb_service.go
  34. 899 37
      service/hbyb_service.go
  35. 28 0
      service/his_project_service.go
  36. 125 15
      service/his_service.go
  37. 84 1
      service/hn_service.go
  38. 47 22
      service/jsyb_service.go
  39. 380 102
      service/jx_service.go
  40. 218 38
      service/nm_service.go
  41. 201 2
      service/zh_his_service.go
  42. BIN
      simkai.ttf

+ 18 - 175
conf/app.conf View File

@@ -51,73 +51,42 @@ sso_domain = https://sso.kuyicloud.com
51 51
 call_domain = https://hf.sgjyun.com
52 52
 front_end_domain = "https://xt.kuyicloud.com/#"
53 53
 
54
-org_id = 9919
55
-gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56
-gdyb_paasid = "sg02_prd"
54
+org_id = 10485
55
+#gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
56
+#gdyb_paasid = "sg02_prd"
57 57
 
58
-readmysqlhost = shengws1.mysql.rds.aliyuncs.com
58
+gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/"
59
+gdyb_paasid = test_hosp
60
+
61
+readmysqlhost = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
59 62
 readmysqlport = 3306
60
-readmysqluser = syh
61
-readmysqlpass = xhPECP2nFObR8aUK
63
+readmysqluser = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
64
+readmysqlpass = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
62 65
 readmysqlname = sgj_xt
63 66
 
64
-writemysqlhost = shengws1.mysql.rds.aliyuncs.com
67
+writemysqlhost = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
65 68
 writemysqlport = 3306
66
-writemysqluser = syh
67
-writemysqlpass = xhPECP2nFObR8aUK
69
+writemysqluser = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
70
+writemysqlpass = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
68 71
 writemysqlname = sgj_xt
69 72
 
70 73
 
71
-readuserhost = shengws1.mysql.rds.aliyuncs.com
74
+readuserhost = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
72 75
 readuserport = 3306
73
-readuseruser = syh
74
-readuserpass = xhPECP2nFObR8aUK
76
+readuseruser = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
77
+readuserpass = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
75 78
 readusername = sgj_users
76 79
 
77
-writeuserhost = shengws1.mysql.rds.aliyuncs.com
80
+writeuserhost = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
78 81
 writeuserport = 3306
79
-writeuseruser = syh
80
-writeuserpass = xhPECP2nFObR8aUK
82
+writeuseruser = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
83
+writeuserpass = d7d152f2bc9050ae96752337128bcf8d1f44dd368acb9a86a972f52a0feaf4661c736fa9c0ed44e0aabfb4faf44480cbdf14da00313d
81 84
 writeusername = sgj_users
82 85
 
83
-readmiddlehost = shengws1.mysql.rds.aliyuncs.com
84
-readmiddleport = 3306
85
-readmiddleuser = syh
86
-readmiddlepass = xhPECP2nFObR8aUK
87
-readmiddlename = ky_xt_middle
88
-
89
-writemiddlehost = shengws1.mysql.rds.aliyuncs.com
90
-writemiddleport = 3306
91
-writemiddleuser = syh
92
-writemiddlepass = xhPECP2nFObR8aUK
93
-writemiddlename = ky_xt_middle
94
-
95 86
 
96
-readsgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
97
-readsgjpatientmysqlport = 3306
98
-readsgjpatientmysqluser = syh
99
-readsgjpatientmysqlpass = xhPECP2nFObR8aUK
100
-readsgjpatientmysqlname = sgj_patient
101 87
 
102
-writesgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
103
-writesgjpatientmysqlport = 3306
104
-writesgjpatientmysqluser = syh
105
-writesgjpatientmysqlpass = xhPECP2nFObR8aUK
106
-writesgjpatientmysqlname = sgj_patient
107 88
 
108 89
 
109
-readpatienthost = shengws1.mysql.rds.aliyuncs.com
110
-readpatientport = 3306
111
-readpatientuser = syh
112
-readpatientpass = xhPECP2nFObR8aUK
113
-readpatientname = sgj_cdm
114
-
115
-writepatienthost = shengws1.mysql.rds.aliyuncs.com
116
-writepatientport = 3306
117
-writepatientuser = syh
118
-writepatientpass = xhPECP2nFObR8aUK
119
-writepatientname = sgj_cdm
120
-
121 90
 redishost = 349e580b2a524290.redis.rds.aliyuncs.com
122 91
 redisport = 6379
123 92
 redispasswrod = TZtBW098WId3i27clkpj3q8dnUaVFP
@@ -128,129 +97,3 @@ redisdb = 0
128 97
 
129 98
 
130 99
 
131
-
132
-niprocart =  63
133
-jms = 58
134
-fistula_needle_set = 65
135
-fistula_needle_set_16 = 64
136
-hemoperfusion = 55
137
-dialyser_sterilised = 12
138
-filtryzer = 53
139
-dialyzers = 8
140
-injector = 81
141
-bloodlines = 42
142
-tubingHemodialysis = 30
143
-package = 82
144
-aliquid = 83
145
-
146
-
147
-
148
-[dev]
149
-mobile_token_expiration_second = 3600
150
-httpdomain = http://new_mobile.xt.api.sgjyun.com
151
-sso_domain = https://testsso.sgjyun.com
152
-call_domain = http://hf.szjkhd.com
153
-front_end_domain = "http://xt.test.sgjyun.com/#"
154
-
155
-org_id = 4
156
-#url  = "http://192.168.1.228:17001/szsi-portal/transData"
157
-# gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/"
158
-#gdyb_url = "http://10.97.240.206/ebus/sztest_hosp/poc/hsa/hgs/"
159
-#url = "http://192.168.1.88:6666/szsi-portal/transData"
160
-gdyb_url = "http://10.97.240.206/ebus/sztest_hosp/poc/hsa/hgs/"
161
-#gdyb_url = "http://10.87.67.83:8080/mbs-hi-intf/web/api/webservices/hb/interface/"
162
-gdyb_paasid = "sztest_hosp"
163
-#gdyb_paasid = zh_cs
164
-# gdyb_paasid = test_hosp
165
-#gdyb_paasid = zq_prd_yjyy
166
-
167
-#gdyb_paasid = "zh_prd_yjyy"
168
-readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169
-readmysqlport = 3306
170
-readmysqluser = root
171
-readmysqlpass = 1Q2W3e4r!@#$
172
-readmysqlname = sgj_xt
173
-
174
-writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
175
-writemysqlport = 3306
176
-writemysqluser = root
177
-writemysqlpass = 1Q2W3e4r!@#$ 
178
-writemysqlname = sgj_xt
179
-
180
-readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
181
-readuserport = 3306
182
-readuseruser = root
183
-readuserpass = 1Q2W3e4r!@#$
184
-readusername = sgj_users
185
-
186
-
187
-writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
188
-writeuserport = 3306
189
-writeuseruser = root
190
-writeuserpass = 1Q2W3e4r!@#$
191
-writeusername = sgj_users
192
-
193
-
194
-
195
-readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
196
-readmiddleport = 3306
197
-readmiddleuser = root
198
-readmiddlepass = 1Q2W3e4r!@#$
199
-readmiddlename = ky_xt_middle
200
-
201
-writemiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
202
-writemiddleport = 3306
203
-writemiddleuser = root
204
-writemiddlepass = 1Q2W3e4r!@#$
205
-writemiddlename = ky_xt_middle
206
-
207
-readpatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
208
-readpatientport = 3306
209
-readpatientuser = root
210
-readpatientpass = 1Q2W3e4r!@#$
211
-readpatientname = sgj_cdm
212
-
213
-writepatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
214
-writepatientport = 3306
215
-writepatientuser = root
216
-writepatientpass = 1Q2W3e4r!@#$
217
-writepatientname = sgj_cdm
218
-
219
-readsgjpatientmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
220
-readsgjpatientmysqlport = 3306
221
-readsgjpatientmysqluser = root
222
-readsgjpatientmysqlpass = 1Q2W3e4r!@#$
223
-readsgjpatientmysqlname = sgj_patient
224
-
225
-writesgjpatientmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
226
-writesgjpatientmysqlport = 3306
227
-writesgjpatientmysqluser = root
228
-writesgjpatientmysqlpass = 1Q2W3e4r!@#$
229
-writesgjpatientmysqlname = sgj_patient
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-#redishost = 120.77.235.13
238
-#redishost = 112.74.16.180
239
-redishost = localhost
240
-redisport = 6379
241
-redispasswrod = syh@#$%123456!
242
-redisdb = 0
243
-
244
-niprocart =  83
245
-jms = 80
246
-fistula_needle_set = 81
247
-fistula_needle_set_16 = 82
248
-hemoperfusion = 85
249
-dialyser_sterilised = 84
250
-filtryzer = 79
251
-dialyzers = 10000
252
-injector = 10001
253
-bloodlines = 10002
254
-tubingHemodialysis = 10003
255
-package = 10004
256
-aliquid = 10005

File diff suppressed because it is too large
+ 1746 - 0
controllers/ah/ahyb_controller.go


File diff suppressed because it is too large
+ 7156 - 604
controllers/coordinate/coordinate_controller.go


+ 888 - 0
controllers/coordinate/coordinate_net_controller.go View File

@@ -0,0 +1,888 @@
1
+package coordinate
2
+
3
+import (
4
+
5
+	"fmt"
6
+	"gdyb/controllers"
7
+
8
+	"gdyb/models"
9
+	"gdyb/service"
10
+	"gdyb/utils"
11
+	"github.com/astaxie/beego"
12
+	"io/ioutil"
13
+	"encoding/xml"
14
+
15
+	"os"
16
+
17
+	"time"
18
+	"encoding/json"
19
+)
20
+
21
+type CoordinatenetController struct {
22
+	controllers.BaseAuthAPIController
23
+}
24
+
25
+
26
+func CoordinatenetRcegistRouters() {
27
+	////内蒙古
28
+	//beego.Router("/nmg/coordinate/settleAccount", &CoordinatenetController{}, "get:NMGSettleAccount")
29
+	//beego.Router("/nmg/coordinate/settleAccount/cancel", &CoordinatenetController{}, "get:NMGCancelSettleAccount")
30
+
31
+	beego.Router("/nmg/coordinate/querystock", &CoordinatenetController{}, "get:QueryStock")
32
+	beego.Router("/nmg/coordinate/patient", &CoordinatenetController{}, "get:NMGpatientinfo")
33
+	beego.Router("/nmg/coordinate/patienttwo", &CoordinatenetController{}, "get:NMGpatientinfotwo")
34
+
35
+	beego.Router("/nmg/coordinate/del", &CoordinatenetController{}, "post:NMGdelinfo")
36
+	beego.Router("/nmg/coordinate/upload", &CoordinatenetController{}, "post:NMGuploadinfo")
37
+	beego.Router("/nmg/coordinate/settle", &CoordinatenetController{}, "post:NMGsettle")
38
+
39
+
40
+}
41
+
42
+////删医嘱
43
+//func (c *CoordinateController)NMGdeladvice(){
44
+//	patient_id, _ := c.GetInt64("patient_id")
45
+//	id, _ := c.GetInt64("id")
46
+//
47
+//
48
+//	patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
49
+//	result, _ := service.GetNMGHisPatientForCoordinate(0,0,0,patient.Name)
50
+//	var res Data
51
+//	if err := json.Unmarshal([]byte(result), &res); err != nil {
52
+//		utils.ErrorLog("解析失败:%v", err)
53
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
54
+//		return
55
+//	}
56
+//	service.CancleNMGPrescriptionForCoordinate(res.List[0].Acf01,)
57
+//
58
+//}
59
+
60
+
61
+
62
+
63
+
64
+type ProjectStruct struct {
65
+	Data []struct {
66
+		Bbx01   int64       `json:"bbx01"`
67
+		Bda02   string    `json:"bda02"`
68
+		Bby01 int64 `json:"bby01"`
69
+		Bbx04   string    `json:"bbx04"`
70
+		Bbx05   string    `json:"bbx05"`
71
+		Bby06   string    `json:"bby06"`
72
+		Bdg02   string    `json:"bdg02"`
73
+		Acf01   int64       `json:"acf01"`
74
+		Price   float64       `json:"price"`
75
+		Bck01   int64      `json:"bck01"`
76
+		Lsqty   float64       `json:"lsqty"`
77
+		Bce03a  string    `json:"bce03a"`
78
+		Bbx24   string `json:"bbx24"`
79
+		Bbx25   string `json:"bbx25"`
80
+	} `json:"data"`
81
+}
82
+
83
+type Medicine struct {
84
+	Data []struct {
85
+		Bby01 int `json:"bby01"`
86
+		Ypmc string  `json:"ypmc"`
87
+		Gg   string  `json:"gg"`
88
+		Dw   string  `json:"dw"`
89
+		Jhj  float64     `json:"jhj"`
90
+		Pfj  float64 `json:"pfj"`
91
+		Lsj  float64 `json:"lsj"`
92
+		Sysl float64     `json:"sysl"`
93
+		Ypjx string  `json:"ypjx"`
94
+		Jldw string  `json:"jldw"`
95
+		Sccj string  `json:"sccj"`
96
+		Cd   string  `json:"cd"`
97
+	} `json:"data"`
98
+}
99
+
100
+func (c *CoordinatenetController)QueryStock(){
101
+	result, _ := service.GetDrugs()
102
+	result2, _ := service.GetProject()
103
+	fmt.Println(result)
104
+	fmt.Println(result2)
105
+
106
+	saveLog(result, "", "查询", "查询", "")
107
+	saveLog(result2, "", "查询", "查询", "")
108
+	//var dat map[string]interface{}
109
+	//if err := json.Unmarshal([]byte(result), &dat); err == nil {
110
+	//
111
+	//} else {
112
+	//
113
+	//}
114
+	//var dat2 map[string]interface{}
115
+	//if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
116
+	//
117
+	//} else {
118
+	//
119
+	//}
120
+	//c.ServeSuccessJSON(map[string]interface{}{
121
+	//	"drug": dat,
122
+	//	"project":       dat2,
123
+	//})
124
+}
125
+
126
+
127
+
128
+
129
+//获取患者信息
130
+func (c *CoordinatenetController) NMGpatientinfo() {
131
+	name := c.GetString("name")
132
+	//住院
133
+	result, _ := service.GetNMGHisPatientForCoordinate(0,0,2,name)
134
+	////门诊
135
+	//result1, request1 := service.GetNMGHisPatientForCoordinate(0,0,1,name)
136
+	saveLog(result, "", "住院查询", "住院查询", "")
137
+	//saveLog(result1, request1, "门诊查询", "门诊查询", "")
138
+
139
+	var dat map[string]interface{}
140
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
141
+
142
+	} else {
143
+
144
+	}
145
+	//var dat2 map[string]interface{}
146
+	//if err := json.Unmarshal([]byte(result1), &dat2); err == nil {
147
+	//
148
+	//} else {
149
+	//
150
+	//}
151
+
152
+
153
+	c.ServeSuccessJSON(map[string]interface{}{
154
+			"res":        dat,
155
+			//"res1":			dat2,
156
+	})
157
+}
158
+
159
+func (c *CoordinatenetController) NMGpatientinfotwo() {
160
+	name := c.GetString("name")
161
+	//住院
162
+	//result, request := service.GetNMGHisPatientForCoordinate(0,0,2,name)
163
+	//门诊
164
+	result1, request1 := service.GetNMGHisPatientForCoordinate(0,0,1,name)
165
+	//saveLog(result, request, "住院查询", "住院查询", "")
166
+	saveLog(result1, request1, "门诊查询", "门诊查询", "")
167
+	//
168
+	//var dat map[string]interface{}
169
+	//if err := json.Unmarshal([]byte(result), &dat); err == nil {
170
+	//
171
+	//} else {
172
+	//
173
+	//}
174
+	var dat2 map[string]interface{}
175
+	if err := json.Unmarshal([]byte(result1), &dat2); err == nil {
176
+
177
+	} else {
178
+
179
+	}
180
+
181
+
182
+	c.ServeSuccessJSON(map[string]interface{}{
183
+		//"res":        dat,
184
+		"res":			dat2,
185
+	})
186
+}
187
+
188
+type Responsexml1 struct {
189
+	XMLName   xml.Name `xml:"root"`
190
+	ErrorCode int      `xml:"errorcode"`
191
+	ErrorMsg  string   `xml:"errormsg"`
192
+	Data      string   `xml:"data"`
193
+}
194
+
195
+
196
+func (c *CoordinatenetController) NMGdelinfo() {
197
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
198
+	var respJSON map[string]interface{}
199
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
200
+		utils.ErrorLog("接口返回: %v", err)
201
+		return
202
+	}
203
+	//utils.ErrorLog()
204
+	result, log := service.CancleNMGPrescriptionForCoordinatetwo("0002", respJSON["xmlStr"].(string))
205
+	saveLog(result, log, "删除", "删除", "")
206
+	var res8 Responsexml1
207
+	if err2 := xml.Unmarshal([]byte(result), &res8); err2 != nil {
208
+		fmt.Println(err2)
209
+		return
210
+	}
211
+	if res8.ErrorCode == 0{
212
+		c.ServeSuccessJSON(map[string]interface{}{
213
+			"msg":       "成功",
214
+		})
215
+
216
+	}else{
217
+		c.ServeSuccessJSON(map[string]interface{}{
218
+			"msg":      res8.ErrorMsg ,
219
+		})
220
+	}
221
+}
222
+func (c *CoordinatenetController) NMGuploadinfo() {
223
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
224
+	var respJSON map[string]interface{}
225
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
226
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
227
+		return
228
+	}
229
+
230
+
231
+	result, request := service.UploadNMGPrescriptionForCoordinatetwo("0001", respJSON["xmlStr"].(string))
232
+	saveLog(result, request, "上传", "上传", "")
233
+
234
+	var res3 Responsexml
235
+	if err2 := xml.Unmarshal([]byte(result), &res3); err2 != nil {
236
+		fmt.Println(err2)
237
+	}
238
+
239
+
240
+	if res3.ErrorCode == 0{
241
+		c.ServeSuccessJSON(map[string]interface{}{
242
+			"res":       res3.Data,
243
+			"msg":       "成功",
244
+		})
245
+
246
+	}else{
247
+		c.ServeSuccessJSON(map[string]interface{}{
248
+			"msg":      res3.ErrorMsg ,
249
+			"res":       "",
250
+		})
251
+	}
252
+
253
+}
254
+func (c *CoordinatenetController) NMGsettle() {
255
+	//xmlStr := c.GetString("xmlStr")
256
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
257
+	var respJSON map[string]interface{}
258
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
259
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
260
+		return
261
+	}
262
+	userJSONBytes, _ := json.Marshal(respJSON["info"])
263
+	var info models.UploadInfo
264
+	if err := json.Unmarshal(userJSONBytes, &info); err != nil {
265
+		utils.ErrorLog("解析失败:%v", err)
266
+		return
267
+	}
268
+
269
+
270
+
271
+	result, request := service.NMGSettleForCoordinate(info)
272
+
273
+	var dat map[string]interface{}
274
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
275
+
276
+	} else {
277
+
278
+	}
279
+	saveLog(result, request, "记账", "记账", "")
280
+	c.ServeSuccessJSON(map[string]interface{}{
281
+		"res":        dat,
282
+	})
283
+}
284
+
285
+//func (c *CoordinateController)NMGgetcheck(){
286
+//	patient_id, _ := c.GetInt64("patient_id")
287
+//	record_date := c.GetString("record_date")
288
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
289
+//	//diagnosis_id := c.GetString("diagnosis")
290
+//	//sick_type, _ := c.GetInt64("sick_type")
291
+//	//reg_type, _ := c.GetInt64("p_type")
292
+//	org_id, _ := c.GetInt64("org_id")
293
+//	org_id = 10454
294
+//	org, _ := service.GetOrgById(org_id)
295
+//	patient, _ := service.GetPatientByID(org.Id, patient_id)
296
+//	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
297
+//	result, request := service.GetNMGHisPatientForCoordinate(0,0,2,patient.Name)
298
+//	result5, request5 := service.GetNMGHisPatientForCoordinate(0,0,1,patient.Name)
299
+//
300
+//	saveLog(result, request, "查询", "查询", "")
301
+//	saveLog(result5, request5, "查询", "查询", "")
302
+//
303
+//	var res Data
304
+//	if err := json.Unmarshal([]byte(result), &res); err != nil {
305
+//		utils.ErrorLog("解析失败:%v", err)
306
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
307
+//		return
308
+//	}
309
+//
310
+//	var res8 Data
311
+//	if err := json.Unmarshal([]byte(result5), &res8); err != nil {
312
+//		utils.ErrorLog("解析失败:%v", err)
313
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
314
+//		return
315
+//	}
316
+//
317
+//	if res.Code == 200 || res8.Code == 200 {
318
+//		var res9  Data
319
+//		res9.List = append(res9.List,res.List...)
320
+//		res9.List = append(res9.List,res8.List...)
321
+//
322
+//
323
+//		var li ListItem
324
+//		for _, item := range  res9.List{
325
+//			cure_date := strings.Split(item.Vae11, " ")
326
+//			if cure_date[0] == record_date && patient.Name == item.Vaa05{
327
+//				li = item
328
+//			}
329
+//		}
330
+//		fmt.Println("11111111")
331
+//		fmt.Println(li)
332
+//		fmt.Println("11111111")
333
+//		timeLayout := "2006-01-02"
334
+//		loc, _ := time.LoadLocation("Local")
335
+//		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
336
+//		if err != nil {
337
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
338
+//			return
339
+//		}
340
+//		org_id := org.Id
341
+//		recordDateTime := theTime.Unix()
342
+//		patientPrescription, _ := service.FindPatientPrescriptionInfoTwo(org_id, patient.ID, recordDateTime, 2)
343
+//		if patientPrescription.ID == 0 {
344
+//			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(org_id, patient.ID, recordDateTime)
345
+//		}
346
+//		//departmwnt, _ := service.GetDepartMentDetail(patientPrescription.Departments)
347
+//		//admin_user_info, _ := service.GetAdminUserInfoByID(org_id, admin_user_id)
348
+//		//doctor_info, _ := service.GetAdminUserInfoByID(org_id, patientPrescription.DoctorId)
349
+//
350
+//
351
+//
352
+//
353
+//		//service.QueryNMGChenckForCoordinate(li.Acf01,li.Vaa01,li.Vaa07,"")
354
+//
355
+//
356
+//	} else {
357
+//		c.ServeSuccessJSON(map[string]interface{}{
358
+//			"failed_code": -10,
359
+//			"msg":         res.Msg,
360
+//		})
361
+//	}
362
+//
363
+//
364
+//}
365
+//func (c *CoordinateController) SettleAccount() {
366
+//	patient_id, _ := c.GetInt64("patient_id")
367
+//	record_date := c.GetString("record_date")
368
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
369
+//	diagnosis_id := c.GetString("diagnosis")
370
+//	sick_type, _ := c.GetInt64("sick_type")
371
+//	reg_type, _ := c.GetInt64("p_type")
372
+//	org_id, _ := c.GetInt64("org_id")
373
+//	org_id = 3877
374
+//	org, _ := service.GetOrgById(org_id)
375
+//	patient, _ := service.GetPatientByID(org.Id, patient_id)
376
+//	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
377
+//
378
+//	result, request := service.GetHisPatientForCoordinate(patient.IdCardNo)
379
+//	saveLog(result, request, "查询", "查询", org.OrgName)
380
+//	var res ResultQuery
381
+//	if err := json.Unmarshal([]byte(result), &res); err != nil {
382
+//		utils.ErrorLog("解析失败:%v", err)
383
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
384
+//		return
385
+//	}
386
+//	if res.Code == "10000" {
387
+//		if len(res.Result) == 0 {
388
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientNoRegException)
389
+//			return
390
+//		}
391
+//		timeLayout := "2006-01-02"
392
+//		loc, _ := time.LoadLocation("Local")
393
+//		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
394
+//		if err != nil {
395
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
396
+//			return
397
+//		}
398
+//		org_id := org.Id
399
+//		recordDateTime := theTime.Unix()
400
+//		patientPrescription, _ := service.FindPatientPrescriptionInfoTwo(org_id, patient.ID, recordDateTime, 2)
401
+//		if patientPrescription.ID == 0 {
402
+//			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(org_id, patient.ID, recordDateTime)
403
+//		}
404
+//		departmwnt, _ := service.GetDepartMentDetail(patientPrescription.Departments)
405
+//		doctor_info, _ := service.GetAdminUserInfoByID(org_id, patientPrescription.DoctorId)
406
+//		//admin_user_info, _ := service.GetAdminUserInfoByID(org_id, admin_user_id)
407
+//
408
+//		var prescriptions []*models.HisPrescription
409
+//
410
+//		if settle_accounts_type == 1 { //日结
411
+//			prescriptions, _ = service.GetUnSettleHisPrescriptionFive(org_id, patient_id, recordDateTime, 2)
412
+//		} else { //月结
413
+//
414
+//			start_time_str := c.GetString("start_time")
415
+//			end_time_str := c.GetString("end_time")
416
+//			timeLayout := "2006-01-02"
417
+//			loc, _ := time.LoadLocation("Local")
418
+//			theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
419
+//			if err != nil {
420
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
421
+//				return
422
+//			}
423
+//			recordStartTime := theStartTime.Unix()
424
+//			theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
425
+//			if err != nil {
426
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
427
+//				return
428
+//			}
429
+//			recordEndTime := theEndTime.Unix()
430
+//			prescriptions, _ = service.GetUnSettleMonthHisPrescription(org_id, patient_id, recordStartTime, recordEndTime)
431
+//		}
432
+//		var total float64
433
+//
434
+//		for _, item := range prescriptions {
435
+//			fmt.Println(item)
436
+//			if item.Type == 1 { //药品
437
+//				for _, subItem := range item.HisDoctorAdviceInfo {
438
+//					total = total + (subItem.Price * subItem.PrescribingNumber)
439
+//				}
440
+//			}
441
+//			if item.Type == 2 { //项目
442
+//				for _, subItem := range item.HisPrescriptionProject {
443
+//					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
444
+//					total = total + (subItem.Price * cnt)
445
+//				}
446
+//			}
447
+//
448
+//		}
449
+//
450
+//		var ids []int64
451
+//
452
+//		for _, item := range prescriptions {
453
+//			ids = append(ids, item.ID)
454
+//		}
455
+//
456
+//		var customs []*models.NewCustomTwo
457
+//		for _, item := range prescriptions {
458
+//			if item.Type == 1 { //药品
459
+//				for _, subItem := range item.HisDoctorAdviceInfo {
460
+//					cus := &models.NewCustomTwo{
461
+//						AdviceId:         subItem.ID,
462
+//						ProjectId:        0,
463
+//						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
464
+//						Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
465
+//						FeedetlSn:        subItem.FeedetlSn,
466
+//						Price:            fmt.Sprintf("%.2f", subItem.Price),
467
+//						MedListCodg:      subItem.BaseDrugLib.MedicalInsuranceNumber,
468
+//						Type:             1,
469
+//					}
470
+//					customs = append(customs, cus)
471
+//				}
472
+//			}
473
+//			if item.Type == 2 { //项目
474
+//				for _, subItem := range item.HisPrescriptionProject {
475
+//					if subItem.Type == 2 {
476
+//						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
477
+//						cus := &models.NewCustomTwo{
478
+//							AdviceId:         0,
479
+//							ProjectId:        subItem.ID,
480
+//							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
481
+//							Cut:              fmt.Sprintf("%.4f", cnt),
482
+//							FeedetlSn:        subItem.FeedetlSn,
483
+//							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
484
+//							MedListCodg:      subItem.HisProject.MedicalCode,
485
+//							Type:             2,
486
+//						}
487
+//						customs = append(customs, cus)
488
+//
489
+//					} else {
490
+//						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
491
+//						cus := &models.NewCustomTwo{
492
+//							AdviceId:         0,
493
+//							ProjectId:        subItem.ID,
494
+//							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
495
+//							Cut:              fmt.Sprintf("%.4f", cnt),
496
+//							FeedetlSn:        subItem.FeedetlSn,
497
+//							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
498
+//							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
499
+//							Type:             3,
500
+//						}
501
+//						customs = append(customs, cus)
502
+//					}
503
+//
504
+//				}
505
+//			}
506
+//		}
507
+//
508
+//		var info models.UploadInfo
509
+//		info.Vaa01 = int64(res.Result[0].Vaa01)
510
+//		info.Fasong = "1"
511
+//		info.Vaa07 = int64(res.Result[0].Vaa07)
512
+//		info.Bck01c = departmwnt.Number
513
+//		info.Bce02a = doctor_info.DoctorNumber
514
+//
515
+//		diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
516
+//		var config []*models.HisXtDiagnoseConfig
517
+//		for _, item := range diagnosis_ids {
518
+//			id, _ := strconv.ParseInt(item, 10, 64)
519
+//			diagnosisConfig, _ := service.FindDiagnoseById(id)
520
+//			config = append(config, &diagnosisConfig)
521
+//		}
522
+//		for index, item := range config {
523
+//			var diag models.Diag
524
+//			diag.Vao06 = strconv.FormatInt(int64(index+1), 10)
525
+//			diag.Bak02 = item.CountryCode
526
+//			info.Diag = append(info.Diag, &diag)
527
+//		}
528
+//		var presInfos []*models.PresInfo
529
+//		var presDetails []*models.PresDetail
530
+//		for index, item := range prescriptions {
531
+//			var presDetail models.PresDetail
532
+//			var presInfo models.PresInfo
533
+//			presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
534
+//			if item.Type == 1 {
535
+//				presInfo.Cbm06 = "0"
536
+//			} else {
537
+//				presInfo.Cbm06 = "5"
538
+//			}
539
+//
540
+//			if item.Type == 1 {
541
+//				presInfo.Cbm07 = item.MedType
542
+//			} else {
543
+//				presInfo.Cbm07 = item.MedType
544
+//			}
545
+//
546
+//			presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
547
+//			var infoItems []*models.Item
548
+//			for _, subItem := range item.HisDoctorAdviceInfo {
549
+//				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
550
+//
551
+//				var infoItem models.Item
552
+//				infoItem.Rownr = "0"
553
+//				infoItem.Vaf11 = "1"
554
+//				infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
555
+//				infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
556
+//				infoItem.Bda01 = "1"
557
+//				infoItem.Bby01 = ""
558
+//				if subItem.BaseDrugLib.MinUnit != subItem.BaseDrugLib.DoseUnit {
559
+//					infoItem.Vaf22 = subItem.BaseDrugLib.DrugName + " " + subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
560
+//				}
561
+//				infoItem.Vaf14 = subItem.BaseDrugLib.DrugName
562
+//				infoItem.Bdi01 = ef.Code
563
+//				infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
564
+//				infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
565
+//				infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
566
+//				infoItem.Vaf35 = "0"
567
+//				infoItem.Vaf32 = "0"
568
+//				infoItem.Bck01b = departmwnt.Number
569
+//				infoItem.Bck01d = departmwnt.Number
570
+//				infoItem.Vaf58 = "0"
571
+//				infoItem.Vaf61 = "1"
572
+//				infoItems = append(infoItems, &infoItem)
573
+//			}
574
+//			for _, subItem := range item.HisPrescriptionProject {
575
+//				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
576
+//
577
+//				if subItem.Type == 2 {
578
+//					var infoItem models.Item
579
+//					infoItem.Rownr = "0"
580
+//					infoItem.Vaf11 = "1"
581
+//					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
582
+//					infoItem.Bbx01 = subItem.HisProject.MedicalCode
583
+//
584
+//					if subItem.HisProject.CostClassify == 2 {
585
+//						infoItem.Bda01 = "T"
586
+//					} else if subItem.HisProject.CostClassify == 3 {
587
+//						infoItem.Bda01 = "L"
588
+//					} else {
589
+//						infoItem.Bda01 = "T"
590
+//					}
591
+//					infoItem.Bby01 = ""
592
+//					infoItem.Vaf22 = subItem.HisProject.ProjectName
593
+//					infoItem.Bdi01 = ef.Code
594
+//					infoItem.Vaf17 = subItem.Day
595
+//					infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
596
+//					infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.Count)
597
+//					infoItem.Vaf35 = "0"
598
+//					infoItem.Vaf18 = "0"
599
+//					infoItem.Vaf32 = "0"
600
+//					infoItem.Bck01b = departmwnt.Number
601
+//					infoItem.Bck01d = departmwnt.Number
602
+//					infoItem.Vaf58 = "0"
603
+//					infoItem.Vaf61 = "1"
604
+//					infoItems = append(infoItems, &infoItem)
605
+//
606
+//				} else {
607
+//					var infoItem models.Item
608
+//					infoItem.Rownr = "0"
609
+//					infoItem.Vaf11 = "1"
610
+//					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
611
+//					infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
612
+//					infoItem.Bda01 = "M"
613
+//					infoItem.Bby01 = ""
614
+//					infoItem.Vaf22 = subItem.GoodInfo.GoodName + " " + subItem.GoodInfo.SpecificationName
615
+//					infoItem.Bdi01 = ef.Code
616
+//					infoItem.Vaf17 = subItem.Day
617
+//					infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
618
+//					infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.Count)
619
+//					infoItem.Vaf35 = "0"
620
+//					infoItem.Vaf32 = "0"
621
+//					infoItem.Bck01b = departmwnt.Number
622
+//					infoItem.Bck01d = departmwnt.Number
623
+//					infoItem.Vaf58 = "0"
624
+//					infoItem.Vaf61 = "1"
625
+//					infoItems = append(infoItems, &infoItem)
626
+//
627
+//				}
628
+//
629
+//			}
630
+//			presDetail.Item = infoItems
631
+//			presDetails = append(presDetails, &presDetail)
632
+//			presInfo.PresDetail = presDetails
633
+//			presInfos = append(presInfos, &presInfo)
634
+//		}
635
+//		info.PresInfo = presInfos
636
+//
637
+//		result2, request2 := service.UploadPrescriptionForCoordinate(info)
638
+//		saveLog(result2, request2, "上传明细", "上传明细", org.OrgName)
639
+//
640
+//		var res2 ResultUpload
641
+//		if err := json.Unmarshal([]byte(result2), &res2); err != nil {
642
+//			utils.ErrorLog("解析失败:%v", err)
643
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
644
+//			return
645
+//		}
646
+//		if res2.Code == "10000" {
647
+//
648
+//			timestamp := time.Now().Unix()
649
+//			tempTime := time.Unix(timestamp, 0)
650
+//			timeFormat := tempTime.Format("20060102150405")
651
+//			chrgBchno := rand.Intn(100000) + 10000
652
+//			ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(patient.ID, 10)
653
+//			his := models.VMHisPatient{
654
+//				Name:                   patient.Name,
655
+//				Gender:                 patient.Gender,
656
+//				Birthday:               patient.Birthday,
657
+//				MedicalTreatmentType:   0,
658
+//				IdType:                 1,
659
+//				IdCardNo:               patient.IdCardNo,
660
+//				BalanceAccountsType:    1,
661
+//				MedicalInsuranceNumber: "",
662
+//				RegisterType:           0,
663
+//				RegisterCost:           0,
664
+//				TreatmentCost:          0,
665
+//				Status:                 1,
666
+//				Ctime:                  time.Now().Unix(),
667
+//				Mtime:                  time.Now().Unix(),
668
+//				PsnNo:                  strconv.FormatInt(int64(res.Result[0].Vaa01), 10),
669
+//				PsnCertType:            "",
670
+//				Certno:                 patient.IdCardNo,
671
+//				PsnName:                patient.Name,
672
+//				Gend:                   "",
673
+//				Naty:                   "",
674
+//				Brdy:                   "",
675
+//				Age:                    0,
676
+//				Iinfo:                  "",
677
+//				Idetinfo:               "",
678
+//				PatientId:              patient.ID,
679
+//				RecordDate:             theTime.Unix(),
680
+//				UserOrgId:              org_id,
681
+//				AdminUserId:            admin_user_id,
682
+//				IsReturn:               1,
683
+//				Doctor:                 patientPrescription.DoctorId,
684
+//				Departments:            patientPrescription.Departments,
685
+//				IptOtpNo:               ipt_otp_no,
686
+//				Number:                 strconv.FormatInt(int64(res.Result[0].Vaa07), 10),
687
+//				PhoneNumber:            patient.Phone,
688
+//			}
689
+//			service.UpdateHisPatientStatusten(&his)
690
+//			service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, org_id)
691
+//			tm := time.Unix(time.Now().Unix(), 0)
692
+//
693
+//			order := &models.HisOrder{
694
+//				PsnNo:              his.PsnNo,
695
+//				UserOrgId:          org_id,
696
+//				HisPatientId:       his.ID,
697
+//				PatientId:          patient_id,
698
+//				SettleAccountsDate: recordDateTime,
699
+//				Ctime:              time.Now().Unix(),
700
+//				Mtime:              time.Now().Unix(),
701
+//				Status:             1,
702
+//				OrderStatus:        1,
703
+//				MdtrtId:            his.Number,
704
+//				Number:             ipt_otp_no,
705
+//				SetlId:             "",
706
+//				MedfeeSumamt:       total,
707
+//				MedType:            strconv.Itoa(int(reg_type)),
708
+//				SettleEndTime:      0,
709
+//				SettleStartTime:    0,
710
+//				SettleType:         settle_accounts_type,
711
+//				Diagnosis:          diagnosis_id,
712
+//				PType:              2,
713
+//				SetlTime:           tm.Format("2006-01-02 15:04:05"),
714
+//			}
715
+//			err = service.CreateOrder(order)
716
+//			if err != nil {
717
+//				//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
718
+//				return
719
+//			}
720
+//
721
+//			for _, item := range customs {
722
+//				var advice_id int64 = 0
723
+//				var project_id int64 = 0
724
+//				var item_id int64 = 0
725
+//
726
+//				var types int64 = 0
727
+//
728
+//				if item.Type == 1 {
729
+//					advice_id = item.AdviceId
730
+//					project_id = 0
731
+//					item_id = 0
732
+//				} else if item.Type == 2 {
733
+//					advice_id = 0
734
+//					item_id = 0
735
+//
736
+//					project_id = item.ProjectId
737
+//				} else if item.Type == 3 {
738
+//					advice_id = 0
739
+//					item_id = item.ItemId
740
+//					project_id = 0
741
+//				}
742
+//				detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
743
+//				cut, _ := strconv.ParseFloat(item.Cut, 32)
744
+//				pric, _ := strconv.ParseFloat(item.Price, 32)
745
+//				info := &models.HisOrderInfo{
746
+//					OrderNumber:      order.Number,
747
+//					UploadDate:       time.Now().Unix(),
748
+//					AdviceId:         advice_id,
749
+//					DetItemFeeSumamt: detItemFeeSumamt,
750
+//					Cnt:              cut,
751
+//					Pric:             pric,
752
+//					PatientId:        patient_id,
753
+//					Status:           1,
754
+//					Mtime:            time.Now().Unix(),
755
+//					Ctime:            time.Now().Unix(),
756
+//					UserOrgId:        org_id,
757
+//					HisPatientId:     his.ID,
758
+//					OrderId:          order.ID,
759
+//					ProjectId:        project_id,
760
+//					Type:             types,
761
+//					ItemId:           item_id,
762
+//				}
763
+//				service.CreateOrderInfo(info)
764
+//			}
765
+//			his.Diagnosis = diagnosis_id
766
+//			his.SickType = sick_type
767
+//			his.RegisterType = reg_type
768
+//			his.MedicalTreatmentType = reg_type
769
+//			service.UpdataHisPateintTwo(&his)
770
+//			err = service.UpDatePrescriptionNumber(org_id, ids, strconv.FormatInt(int64(chrgBchno), 10))
771
+//			err = service.UpDateHisPrescriptionInfoNumbertwo(org_id, patient_id, strconv.FormatInt(int64(chrgBchno), 10), recordDateTime, his.ID)
772
+//			err = service.UpdataOrderStatusThreef(strconv.FormatInt(int64(chrgBchno), 10), org_id)
773
+//
774
+//			c.ServeSuccessJSON(map[string]interface{}{
775
+//				"msg": "医嘱保存成功",
776
+//			})
777
+//
778
+//		} else {
779
+//			c.ServeSuccessJSON(map[string]interface{}{
780
+//				"failed_code": -10,
781
+//				"msg":         res.Msg,
782
+//			})
783
+//
784
+//		}
785
+//
786
+//	} else {
787
+//		c.ServeSuccessJSON(map[string]interface{}{
788
+//			"failed_code": -10,
789
+//			"msg":         res.Msg,
790
+//		})
791
+//
792
+//	}
793
+//
794
+//}
795
+
796
+
797
+
798
+
799
+//func saveLog(result string, request string, infno string, desc string) {
800
+//
801
+//	org_id, _ := beego.AppConfig.Int64("org_id")
802
+//	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
803
+//	dir := miConfig.OrgName + "日志"
804
+//	utils.Mkdir(dir)
805
+//	month := time.Unix(1557042972, 0).Format("1")
806
+//	year := time.Now().Format("2006")
807
+//	month = time.Now().Format("01")
808
+//	day := time.Now().Format("02")
809
+//	hour := time.Now().Format("15")
810
+//	min := time.Now().Format("04")
811
+//	sec := time.Now().Format("05")
812
+//
813
+//	result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
814
+//
815
+//	file := strconv.FormatInt(org_id, 10) + "_" + year + month + day + "_log"
816
+//	file_name := file + ".txt"
817
+//	file_path := miConfig.OrgName + "日志" + "/" + file_name
818
+//	exist, _ := utils.PathExists(file_path)
819
+//	if exist { //存在
820
+//		fmt.Println("存在")
821
+//		f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
822
+//		if err != nil {
823
+//			fmt.Println("read fail")
824
+//		}
825
+//		content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
826
+//		n, _ := f.Seek(0, 2)
827
+//		_, err = f.WriteAt([]byte(content), n)
828
+//
829
+//	} else { //不存在
830
+//		fmt.Println("文件不存在,创建文件")
831
+//		f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
832
+//		defer f.Close()
833
+//		if err != nil {
834
+//		} else {
835
+//			_, err = f.Write([]byte("记录日志"))
836
+//		}
837
+//	}
838
+//
839
+//}
840
+
841
+type Charset string
842
+
843
+const (
844
+	UTF8    = Charset("UTF-8")
845
+	GB18030 = Charset("GB18030")
846
+)
847
+
848
+func saveLog(result string, request string, infno string, desc string, org_name string) {
849
+
850
+	//org_id, _ := beego.AppConfig.Int64("org_id")
851
+	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
852
+	dir := org_name + "日志"
853
+	utils.Mkdir(dir)
854
+	month := time.Unix(1557042972, 0).Format("1")
855
+	year := time.Now().Format("2006")
856
+	month = time.Now().Format("01")
857
+	day := time.Now().Format("02")
858
+	hour := time.Now().Format("15")
859
+	min := time.Now().Format("04")
860
+	sec := time.Now().Format("05")
861
+
862
+	result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
863
+
864
+	file := org_name + "_" + year + month + day + "_log"
865
+	file_name := file + ".txt"
866
+	file_path := org_name + "日志" + "/" + file_name
867
+	exist, _ := utils.PathExists(file_path)
868
+	if exist { //存在
869
+		fmt.Println("存在")
870
+		f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
871
+		if err != nil {
872
+			fmt.Println("read fail")
873
+		}
874
+		content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
875
+		n, _ := f.Seek(0, 2)
876
+		_, err = f.WriteAt([]byte(content), n)
877
+
878
+	} else { //不存在
879
+		fmt.Println("文件不存在,创建文件")
880
+		f, err := os.Create(org_name + "日志" + "/" + file_name)
881
+		defer f.Close()
882
+		if err != nil {
883
+		} else {
884
+			_, err = f.Write([]byte("记录日志"))
885
+		}
886
+	}
887
+
888
+}

+ 15 - 3
controllers/gz/new_his_api_controller.go View File

@@ -10118,7 +10118,7 @@ func (c *HisApiController) GetSettleAccounts() {
10118 10118
 
10119 10119
 		}
10120 10120
 
10121
-		if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
10121
+		if item.MedChrgitmType == "05" { //治疗费
10122 10122
 
10123 10123
 			treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
10124 10124
 			treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
@@ -10126,13 +10126,25 @@ func (c *HisApiController) GetSettleAccounts() {
10126 10126
 
10127 10127
 		}
10128 10128
 
10129
-		if item.MedChrgitmType == "06" { //手术费
10129
+		if item.MedChrgitmType == "06" && adminUser.CurrentOrgId == 9504  { //手术费
10130
+				fmt.Println("------------")
10131
+
10132
+			treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
10133
+			treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
10134
+			treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
10135
+
10136
+
10137
+		}
10138
+		if item.MedChrgitmType == "06" && adminUser.CurrentOrgId != 9504  { //手术费
10130 10139
 			operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
10131 10140
 			operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
10132 10141
 			operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
10142
+
10133 10143
 		}
10134 10144
 
10135
-		if item.MedChrgitmType == "08" { //材料费
10145
+
10146
+
10147
+		if item.MedChrgitmType == "08"  || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403"{ //材料费
10136 10148
 			materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
10137 10149
 			materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
10138 10150
 			materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()

+ 548 - 1
controllers/hb/hbyb_controller.go View File

@@ -3,6 +3,10 @@ package hb
3 3
 import (
4 4
 	"encoding/json"
5 5
 	"fmt"
6
+	"time"
7
+	"os"
8
+
9
+
6 10
 	"gdyb/controllers"
7 11
 	"gdyb/models"
8 12
 	"gdyb/service"
@@ -28,9 +32,423 @@ func HbybRegistRouters() {
28 32
 	beego.Router("/hbyb/5203", &HBybController{}, "get:PostTen")
29 33
 	beego.Router("/hbyb/2001", &HBybController{}, "get:Post2001")
30 34
 	beego.Router("/hbyb/3202", &HBybController{}, "post:Post3202a")
35
+	beego.Router("/hbyb/1608", &HBybController{}, "post:Post1608")
36
+
37
+	beego.Router("/hbyb/3202b", &HBybController{}, "post:Post3202b")
38
+	//beego.Router("/hbyb/3202c", &HBybController{}, "post:Post3202")
39
+
40
+
31 41
 	beego.Router("/hbyb/4101", &HBybController{}, "post:Post4101")
32 42
 
43
+	beego.Router("/hbyb/5262", &HBybController{}, "post:Post5262")
44
+	beego.Router("/hbyb/5267", &HBybController{}, "post:Post5267")
45
+	beego.Router("/hbyb/5301", &HBybController{}, "get:Post5301")
46
+
47
+
48
+	beego.Router("/hbyb/2401", &HBybController{}, "post:Post2401")
49
+	beego.Router("/hbyb/2402", &HBybController{}, "post:Post2402")
50
+	beego.Router("/hbyb/2404", &HBybController{}, "get:Post2404")
51
+	beego.Router("/hbyb/2405", &HBybController{}, "get:Post2405")
52
+	beego.Router("/hbyb/2301", &HBybController{}, "post:Post2301")
53
+	beego.Router("/hbyb/2302", &HBybController{}, "get:Post2302")
54
+	beego.Router("/hbyb/2303", &HBybController{}, "get:Post2303")
55
+	beego.Router("/hbyb/2304", &HBybController{}, "get:Post2304")
56
+	beego.Router("/hbyb/2305", &HBybController{}, "get:Post2305")
57
+
58
+
59
+
60
+}
61
+
62
+func (c *HBybController) Post2401() {
63
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
64
+	var respJSON map[string]interface{}
65
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
66
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
67
+		return
68
+	}
69
+	userJSONBytes, _ := json.Marshal(respJSON["struct_2401"])
70
+	var struct2401 service.Struct2401
71
+	if err := json.Unmarshal(userJSONBytes, &struct2401); err != nil {
72
+		utils.ErrorLog("解析失败:%v", err)
73
+		return
74
+	}
75
+	org_name := respJSON["org_name"].(string)
76
+	fixmedins_code := respJSON["fixmedins_code"].(string)
77
+	doctor := respJSON["doctor"].(string)
78
+	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
79
+	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
80
+	secret_key := respJSON["secret_key"].(string)
81
+	result, request_log := service.Hbyb2401(struct2401, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
82
+	saveJsLog(result, request_log, "2401", "入院登记", org_name)
83
+	var dat2 map[string]interface{}
84
+	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
85
+	} else {
86
+	}
87
+	var dat map[string]interface{}
88
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
89
+	} else {
90
+	}
91
+	c.ServeSuccessJSON(map[string]interface{}{
92
+		"pre":         dat,
93
+		"request_log": dat2,
94
+	})
95
+
96
+}
97
+func (c *HBybController) Post2404() {
98
+	mdtrt_id := c.GetString("mdtrt_id")
99
+	psn_no := c.GetString("psn_no")
100
+	doctor := c.GetString("doctor")
101
+	fixmedins_code := c.GetString("fixmedins_code")
102
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
103
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
104
+	secret_key := c.GetString("secret_key")
105
+	org_name := c.GetString("org_name")
106
+
107
+	result, requestLog := service.Hbyb2404(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
108
+	saveJsLog(result, requestLog, "2404", "入院登记撤销", org_name)
109
+	var dat map[string]interface{}
110
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
111
+	} else {
112
+	}
113
+	var dat2 map[string]interface{}
114
+	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
115
+	} else {
116
+	}
117
+	c.ServeSuccessJSON(map[string]interface{}{
118
+		"pre": dat,
119
+		"log": dat2,
120
+	})
121
+
122
+}
123
+func (c *HBybController) Post2405() {
124
+	mdtrt_id := c.GetString("mdtrt_id")
125
+	psn_no := c.GetString("psn_no")
126
+	doctor := c.GetString("doctor")
127
+	fixmedins_code := c.GetString("fixmedins_code")
128
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
129
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
130
+	secret_key := c.GetString("secret_key")
131
+	org_name := c.GetString("org_name")
132
+
133
+	result, requestLog := service.Hb2405(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
134
+	saveJsLog(result, requestLog, "2405", "出院登记撤销", org_name)
135
+	var dat map[string]interface{}
136
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
137
+	} else {
138
+	}
139
+	var dat2 map[string]interface{}
140
+	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
141
+	} else {
142
+	}
143
+	c.ServeSuccessJSON(map[string]interface{}{
144
+		"pre": dat,
145
+		"log": dat2,
146
+	})
147
+
148
+}
149
+func (c *HBybController) Post2402() {
150
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
151
+	var respJSON map[string]interface{}
152
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
153
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
154
+		return
155
+	}
156
+	userJSONBytes, _ := json.Marshal(respJSON["struct_2402"])
157
+	var struct2402 service.Struct2402
158
+	if err := json.Unmarshal(userJSONBytes, &struct2402); err != nil {
159
+		utils.ErrorLog("解析失败:%v", err)
160
+		return
161
+	}
162
+	org_name := respJSON["org_name"].(string)
163
+	fixmedins_code := respJSON["fixmedins_code"].(string)
164
+	doctor := respJSON["doctor"].(string)
165
+	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
166
+	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
167
+	secret_key := respJSON["secret_key"].(string)
168
+	result, request_log := service.Hb2402(struct2402, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
169
+	saveJsLog(result, request_log, "2402", "出院", org_name)
170
+	var dat2 map[string]interface{}
171
+	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
172
+	} else {
173
+	}
174
+	var dat map[string]interface{}
175
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
176
+	} else {
177
+	}
178
+	c.ServeSuccessJSON(map[string]interface{}{
179
+		"pre":         dat,
180
+		"request_log": dat2,
181
+	})
182
+}
183
+func (c *HBybController) Post2301() {
184
+
185
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
186
+	var respJSON map[string]interface{}
187
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
188
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
189
+		return
190
+	}
191
+	userJSONBytes, _ := json.Marshal(respJSON["customs"])
192
+	var customs []*models.NewCustom
193
+	if err := json.Unmarshal(userJSONBytes, &customs); err != nil {
194
+		utils.ErrorLog("解析失败:%v", err)
195
+		return
196
+	}
197
+
198
+	number := respJSON["number"].(string)
199
+
200
+	chrg_bchno := respJSON["chrg_bchno"].(string)
201
+	dept := respJSON["dept"].(string)
202
+	dept_code := respJSON["dept_code"].(string)
203
+	doctor_code := respJSON["doctor_code"].(string)
204
+
205
+	doctor_name := respJSON["doctor_name"].(string)
206
+	opertor := respJSON["opertor"].(string)
207
+
208
+	org_name := respJSON["org_name"].(string)
209
+	fixmedins_code := respJSON["fixmedins_code"].(string)
210
+	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
211
+	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
212
+	secret_key := respJSON["secret_key"].(string)
213
+	med_type := respJSON["med_type"].(string)
214
+	//med_type := strconv.FormatInt(int64(respJSON["med_type"].(float64)), 10)
215
+	psn_no := respJSON["psn_no"].(string)
216
+
217
+	result, requestLog := service.Hb2301A(psn_no, number, customs, chrg_bchno, org_name, doctor_name, dept, fixmedins_code, dept_code, doctor_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, opertor)
218
+	saveJsLog(result, requestLog, "2301", "上传明细", org_name)
219
+
220
+	var dat2 map[string]interface{}
221
+	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
222
+	} else {
223
+	}
224
+	var dat map[string]interface{}
225
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
226
+	} else {
227
+	}
228
+	c.ServeSuccessJSON(map[string]interface{}{
229
+		"pre":         dat,
230
+		"request_log": dat2,
231
+	})
232
+}
233
+func (c *HBybController) Post2302() {
234
+	mdtrt_id := c.GetString("mdtrtId")
235
+	psn_no := c.GetString("psn_no")
236
+	number := c.GetString("feedetl_sn")
237
+	doctor := c.GetString("doctor")
238
+	fixmedins_code := c.GetString("fixmedins_code")
239
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
240
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
241
+	secret_key := c.GetString("secret_key")
242
+	org_name := c.GetString("org_name")
243
+	refund_type, _ := c.GetInt64("refund_type")
244
+
245
+	result, requestLog := service.Hb2302(psn_no, mdtrt_id, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, number, refund_type)
246
+	saveJsLog(result, requestLog, "2302", "退明细", org_name)
247
+	var dat2 map[string]interface{}
248
+	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
249
+	} else {
250
+	}
251
+	var dat map[string]interface{}
252
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
253
+	} else {
254
+	}
255
+	c.ServeSuccessJSON(map[string]interface{}{
256
+		"pre":         dat,
257
+		"request_log": dat2,
258
+	})
259
+}
260
+func (c *HBybController) Post2303() {
261
+	mdtrt_id := c.GetString("mdtrt_id")
262
+	psn_no := c.GetString("psn_no")
263
+	chrg_bchno := c.GetString("chrg_bchno")
264
+	cert_no := c.GetString("cert_no")
265
+	insutype_type := c.GetString("insutype_type")
266
+
267
+	allTotal := c.GetString("total")
268
+	id_card_type, _ := c.GetInt64("id_card_type")
269
+
270
+	doctor := c.GetString("doctor")
271
+	certificates, _ := c.GetInt64("certificates")
272
+
273
+	fixmedins_code := c.GetString("fixmedins_code")
274
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
275
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
276
+	secret_key := c.GetString("secret_key")
277
+	org_name := c.GetString("org_name")
278
+
279
+	result, src_resquest := service.Hb2303(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates)
280
+	saveJsLog(result, src_resquest, "2303", "预结算", org_name)
281
+	var dat2 map[string]interface{}
282
+	if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
283
+	} else {
284
+	}
285
+	var dat map[string]interface{}
286
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
287
+	} else {
288
+	}
289
+	c.ServeSuccessJSON(map[string]interface{}{
290
+		"pre":         dat,
291
+		"request_log": dat2,
292
+	})
293
+}
294
+func (c *HBybController) Post2304() {
295
+	mdtrt_id := c.GetString("mdtrt_id")
296
+	psn_no := c.GetString("psn_no")
297
+	chrg_bchno := c.GetString("chrg_bchno")
298
+	cert_no := c.GetString("cert_no")
299
+	insutype_type := c.GetString("insutype_type")
300
+
301
+	allTotal := c.GetString("total")
302
+	id_card_type, _ := c.GetInt64("id_card_type")
303
+
304
+	doctor := c.GetString("doctor")
305
+	certificates, _ := c.GetInt64("certificates")
306
+
307
+	fixmedins_code := c.GetString("fixmedins_code")
308
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
309
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
310
+	secret_key := c.GetString("secret_key")
311
+	org_name := c.GetString("org_name")
312
+	fapiao_number := c.GetString("fapiao_number")
313
+	acct_used_flag := c.GetString("acct_used_flag")
314
+
315
+	result, src_resquest := service.Hb2304(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates, fapiao_number, acct_used_flag)
316
+	saveJsLog(result, src_resquest, "2304", "住院结算", org_name)
317
+	var dat2 map[string]interface{}
318
+	if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
319
+	} else {
320
+	}
321
+	var dat map[string]interface{}
322
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
323
+	} else {
324
+	}
325
+	c.ServeSuccessJSON(map[string]interface{}{
326
+		"pre":         dat,
327
+		"request_log": dat2,
328
+	})
329
+}
330
+func (c *HBybController) Post2305() {
331
+	mdtrt_id := c.GetString("mdtrt_id")
332
+	psn_no := c.GetString("psn_no")
333
+	doctor := c.GetString("doctor")
334
+	setl_id := c.GetString("setl_id")
335
+
336
+	fixmedins_code := c.GetString("fixmedins_code")
337
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
338
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
339
+	secret_key := c.GetString("secret_key")
340
+	org_name := c.GetString("org_name")
341
+
342
+	result, requestLog := service.Hb2305(psn_no, mdtrt_id, setl_id, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
343
+	saveJsLog(result, requestLog, "2305", "退费", org_name)
344
+	var dat2 map[string]interface{}
345
+	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
346
+	} else {
347
+	}
348
+	var dat map[string]interface{}
349
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
350
+	} else {
351
+	}
352
+	c.ServeSuccessJSON(map[string]interface{}{
353
+		"pre":         dat,
354
+		"request_log": dat2,
355
+	})
356
+}
357
+
358
+func (c *HBybController)Post5301(){
359
+	org_name := c.GetString("org_name")
360
+	doctor := c.GetString("doctor")
361
+	fixmedins_code := c.GetString("fixmedins_code")
362
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
363
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
364
+	secret_key := c.GetString("secret_key")
365
+	psn_no := c.GetString("psn_no")
366
+	result := service.Hbyb5301(psn_no,"",org_name, doctor,fixmedins_code,"",insuplc_admdvs,mdtrtarea_admvs,secret_key,"","")
367
+	var dat map[string]interface{}
368
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
369
+		fmt.Println(dat)
370
+	} else {
371
+		fmt.Println(err)
372
+	}
373
+	c.ServeSuccessJSON(map[string]interface{}{
374
+		"pre": dat,
375
+	})
376
+
377
+}
378
+func (c *HBybController)Post5262(){
379
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
380
+	var respJSON map[string]interface{}
381
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
382
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
383
+		return
384
+	}
385
+	userJSONBytes, _ := json.Marshal(respJSON["bps"])
386
+	var bps models.BusinessParams5262
387
+	if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
388
+		utils.ErrorLog("解析失败:%v", err)
389
+		return
390
+	}
391
+
392
+	var baseParams models.BaseParams
393
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
394
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
395
+	baseParams.OrgName = respJSON["org_name"].(string)
396
+	baseParams.Doctor = respJSON["doctor"].(string)
397
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
398
+	page := respJSON["page"].(string)
399
+	limit := respJSON["limit"].(string)
400
+
401
+
402
+	result := service.Hbyb5262(baseParams, bps,page,limit)
403
+	var dat map[string]interface{}
404
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
405
+		fmt.Println(dat)
406
+	} else {
407
+		fmt.Println(err)
408
+	}
409
+	c.ServeSuccessJSON(map[string]interface{}{
410
+		"pre": dat,
411
+	})
412
+
413
+
414
+}
415
+func (c *HBybController)Post5267(){
416
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
417
+	var respJSON map[string]interface{}
418
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
419
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
420
+		return
421
+	}
422
+	userJSONBytes, _ := json.Marshal(respJSON["bps"])
423
+	var bps models.BusinessParams5262
424
+	if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
425
+		utils.ErrorLog("解析失败:%v", err)
426
+		return
427
+	}
428
+
429
+	var baseParams models.BaseParams
430
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
431
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
432
+	baseParams.OrgName = respJSON["org_name"].(string)
433
+	baseParams.Doctor = respJSON["doctor"].(string)
434
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
435
+	page := respJSON["page"].(string)
436
+	limit := respJSON["limit"].(string)
437
+
438
+	result := service.Hbyb5267(baseParams, bps,page,limit)
439
+	var dat map[string]interface{}
440
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
441
+		fmt.Println(dat)
442
+	} else {
443
+		fmt.Println(err)
444
+	}
445
+	c.ServeSuccessJSON(map[string]interface{}{
446
+		"pre": dat,
447
+	})
448
+
33 449
 }
450
+
451
+
34 452
 func (c *HBybController) Post3202a() {
35 453
 
36 454
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
@@ -65,6 +483,82 @@ func (c *HBybController) Post3202a() {
65 483
 	})
66 484
 }
67 485
 
486
+
487
+func (c *HBybController) Post1608() {
488
+
489
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
490
+	var respJSON map[string]interface{}
491
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
492
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
493
+		return
494
+	}
495
+
496
+
497
+	var baseParams models.BaseParams
498
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
499
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
500
+	baseParams.OrgName = respJSON["org_name"].(string)
501
+	baseParams.Doctor = respJSON["doctor"].(string)
502
+
503
+
504
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
505
+	cnt := respJSON["cnt"].(string)
506
+	medfee_sumamt := respJSON["medfee_sumamt"].(string)
507
+	func_smamt := respJSON["func_smamt"].(string)
508
+
509
+	start_time := respJSON["start_time"].(string)
510
+	end_time := respJSON["end_time"].(string)
511
+
512
+	result := service.Hbyb1608(baseParams,cnt,medfee_sumamt,start_time,end_time,func_smamt)
513
+	var dat map[string]interface{}
514
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
515
+		fmt.Println(dat)
516
+	} else {
517
+		fmt.Println(err)
518
+	}
519
+	c.ServeSuccessJSON(map[string]interface{}{
520
+		"pre": dat,
521
+	})
522
+}
523
+
524
+
525
+
526
+
527
+func (c *HBybController) Post3202b() {
528
+
529
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
530
+	var respJSON map[string]interface{}
531
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
532
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
533
+		return
534
+	}
535
+	userJSONBytes, _ := json.Marshal(respJSON["bps"])
536
+	var bps []*models.BusinessParamsTwo
537
+	if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
538
+		utils.ErrorLog("解析失败:%v", err)
539
+		return
540
+	}
541
+
542
+	var baseParams models.BaseParams
543
+	baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
544
+	baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
545
+	baseParams.OrgName = respJSON["org_name"].(string)
546
+	baseParams.Doctor = respJSON["doctor"].(string)
547
+	baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
548
+
549
+	result := service.Hbyb3202b(baseParams, bps)
550
+	var dat map[string]interface{}
551
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
552
+		fmt.Println(dat)
553
+	} else {
554
+		fmt.Println(err)
555
+	}
556
+	c.ServeSuccessJSON(map[string]interface{}{
557
+		"pre": dat,
558
+	})
559
+}
560
+
561
+
68 562
 func (c *HBybController) Post4101() {
69 563
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
70 564
 	var respJSON map[string]interface{}
@@ -497,8 +991,18 @@ func (c *HBybController) PostTen() {
497 991
 		MdtrtId: mdtrtId,
498 992
 		SetlId:  setlId,
499 993
 	}
994
+	var result string
995
+	if mdtrtarea_admvs == "421182"{
996
+
997
+
998
+		result = service.Hbyb5203(baseParams, businessParams,med_type)
999
+
1000
+	}else{
1001
+
1002
+		result = service.Hbyb5203aa(baseParams, businessParams)
1003
+
1004
+	}
500 1005
 
501
-	result := service.Hbyb5203(baseParams, businessParams, med_type)
502 1006
 	var dat map[string]interface{}
503 1007
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
504 1008
 		fmt.Println(dat)
@@ -509,3 +1013,46 @@ func (c *HBybController) PostTen() {
509 1013
 		"pre": dat,
510 1014
 	})
511 1015
 }
1016
+
1017
+
1018
+func saveJsLog(result string, request string, infno string, desc string, org_name string) {
1019
+
1020
+	//org_id, _ := beego.AppConfig.Int64("org_id")
1021
+	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
1022
+	dir := org_name + "日志"
1023
+	utils.Mkdir(dir)
1024
+	month := time.Unix(1557042972, 0).Format("1")
1025
+	year := time.Now().Format("2006")
1026
+	month = time.Now().Format("01")
1027
+	day := time.Now().Format("02")
1028
+	hour := time.Now().Format("15")
1029
+	min := time.Now().Format("04")
1030
+	sec := time.Now().Format("05")
1031
+
1032
+	result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
1033
+
1034
+	file := org_name + "_" + year + month + day + "_log"
1035
+	file_name := file + ".txt"
1036
+	file_path := org_name + "日志" + "/" + file_name
1037
+	exist, _ := utils.PathExists(file_path)
1038
+	if exist { //存在
1039
+		fmt.Println("存在")
1040
+		f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
1041
+		if err != nil {
1042
+			fmt.Println("read fail")
1043
+		}
1044
+		content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
1045
+		n, _ := f.Seek(0, 2)
1046
+		_, err = f.WriteAt([]byte(content), n)
1047
+
1048
+	} else { //不存在
1049
+		fmt.Println("文件不存在,创建文件")
1050
+		f, err := os.Create(org_name + "日志" + "/" + file_name)
1051
+		defer f.Close()
1052
+		if err != nil {
1053
+		} else {
1054
+			_, err = f.Write([]byte("记录日志"))
1055
+		}
1056
+	}
1057
+
1058
+}

+ 781 - 46
controllers/js/jsyb_controller.go View File

@@ -10,8 +10,11 @@ import (
10 10
 	"gdyb/utils"
11 11
 	"github.com/astaxie/beego"
12 12
 	"github.com/axgle/mahonia"
13
+	"github.com/gorilla/websocket"
13 14
 	"golang.org/x/text/encoding/simplifiedchinese"
14 15
 	"io/ioutil"
16
+	"log"
17
+	"net/url"
15 18
 	"os"
16 19
 	"regexp"
17 20
 	"strconv"
@@ -50,6 +53,12 @@ func JSybRegistRouters() {
50 53
 	beego.Router("/jsyb/4101", &JSybController{}, "post:Get4101")
51 54
 	beego.Router("/jsyb/readcard", &JSybController{}, "get:ReadCard")
52 55
 
56
+
57
+	beego.Router("/jsyb/readcardcharge", &JSybController{}, "get:Readcardcharge")
58
+	beego.Router("/jsyb/readcardchargeother", &JSybController{}, "get:Readcardchargeother")
59
+	beego.Router("/jsyb/readcardface", &JSybController{}, "get:Readcardface")
60
+
61
+
53 62
 	beego.Router("/jsyb/3260", &JSybController{}, "get:Get3260")
54 63
 	beego.Router("/jsyb/3261", &JSybController{}, "get:Get3261")
55 64
 	beego.Router("/jsyb/3262", &JSybController{}, "post:Get3262")
@@ -66,11 +75,57 @@ func JSybRegistRouters() {
66 75
 	beego.Router("/jsyb/3273", &JSybController{}, "post:Get3273")
67 76
 	beego.Router("/jsyb/3274", &JSybController{}, "post:Get3274")
68 77
 	beego.Router("/jsyb/3275", &JSybController{}, "post:Get3275")
78
+
79
+
80
+
81
+
82
+	beego.Router("/jsyb/3501", &JSybController{}, "post:Get3501")
83
+	beego.Router("/jsyb/3502", &JSybController{}, "post:Get3502")
84
+	beego.Router("/jsyb/3503", &JSybController{}, "post:Get3503")
85
+	beego.Router("/jsyb/3504", &JSybController{}, "post:Get3504")
86
+	beego.Router("/jsyb/3505", &JSybController{}, "post:Get3505")
87
+	beego.Router("/jsyb/3506", &JSybController{}, "post:Get3506")
88
+	beego.Router("/jsyb/3507", &JSybController{}, "post:Get3507")
89
+
90
+
91
+
92
+	beego.Router("/jsyb/1318", &JSybController{}, "get:Get1318")
93
+
94
+
95
+
69 96
 	//beego.Router("/jsyb/3276", &JSybController{}, "post:Get3276")
70 97
 	//beego.Router("/jsyb/3277", &JSybController{}, "post:Get3277")
71 98
 
72 99
 }
73 100
 
101
+func (c *JSybController)Get1318(){
102
+	org_name := c.GetString("org_name")
103
+	doctor := c.GetString("doctor")
104
+	fixmedins_code := c.GetString("fixmedins_code")
105
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
106
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
107
+	secret_key := c.GetString("secret_key")
108
+	url := c.GetString("url")
109
+	ak := c.GetString("ak")
110
+	h_code := c.GetString("h_code")
111
+	cainfo := c.GetString("cainfo")
112
+	result, request := service.Jsyb1318(h_code,org_name,doctor,fixmedins_code,insuplc_admdvs,mdtrtarea_admvs,secret_key,url,ak,cainfo)
113
+	var dat2 map[string]interface{}
114
+	if err := json.Unmarshal([]byte(request), &dat2); err == nil {
115
+	} else {
116
+	}
117
+	var dat map[string]interface{}
118
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
119
+	} else {
120
+
121
+	}
122
+	c.ServeSuccessJSON(map[string]interface{}{
123
+		"pre":         dat,
124
+		"request_log": dat2,
125
+	})
126
+
127
+}
128
+
74 129
 func (c *JSybController) Get3260() {
75 130
 	org_name := c.GetString("org_name")
76 131
 	doctor := c.GetString("doctor")
@@ -119,7 +174,7 @@ func (c *JSybController) Get3261() {
119 174
 	url := c.GetString("url")
120 175
 	ak := c.GetString("ak")
121 176
 	cainfo := c.GetString("cainfo")
122
-	setl_mon := c.GetString("setl_mon")
177
+	setl_mon := c.GetString("month")
123 178
 	result, request := service.Jxyb3261(setl_mon, mdtrtarea_admvs, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, ak, secret_key, cainfo)
124 179
 	saveJsLog(result, request, "3261", "3261", org_name)
125 180
 	var dat2 map[string]interface{}
@@ -1323,9 +1378,12 @@ func (c *JSybController) PostFive() {
1323 1378
 		utils.ErrorLog("解析失败:%v", err)
1324 1379
 		return
1325 1380
 	}
1381
+
1382
+
1383
+
1326 1384
 	//fmt.Println("2203A的time_stamp=" + respJSON["time_stamp"].(string))
1327 1385
 	result, request_log := service.Jsyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
1328
-		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["diag_code"].(string), respJSON["url"].(string), respJSON["ak"].(string), respJSON["new_doctor_name"].(string), "", respJSON["cainfo"].(string))
1386
+		respJSON["opter"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), "", respJSON["url"].(string), respJSON["ak"].(string), respJSON["new_doctor_name"].(string), "", respJSON["cainfo"].(string))
1329 1387
 
1330 1388
 	saveJsLog(result, request_log, "2204", "上传明细", respJSON["org_name"].(string))
1331 1389
 	var dat map[string]interface{}
@@ -1682,7 +1740,101 @@ type ELeCertData struct {
1682 1740
 	Message string `json:"message"`
1683 1741
 }
1684 1742
 
1685
-func (c *JSybController) ReadCard() {
1743
+type ELeCertDatathree struct {
1744
+	Data struct {
1745
+		AuthNo       string `json:"authNo"`
1746
+		Extra       string `json:"extra"`
1747
+		IDNo        string `json:"idNo"`
1748
+		IDType      string `json:"idType"`
1749
+		EcToken     string `json:"ecToken"`
1750
+		InsuOrg     string `json:"insuOrg"`
1751
+		UserName    string `json:"userName"`
1752
+		EcIndexNo   string `json:"ecIndexNo"`
1753
+		Gender      string `json:"gender"`
1754
+		Birthday    string `json:"birthday"`
1755
+		Nationality string `json:"nationality"`
1756
+		Email       string `json:"email"`
1757
+	} `json:"data"`
1758
+	Code    int    `json:"code"`
1759
+	Message string `json:"message"`
1760
+}
1761
+
1762
+
1763
+
1764
+type ELeCertDatatwo struct {
1765
+	Data struct {
1766
+		AuthNo       string `json:"authNo"`
1767
+		OutBizNo        string `json:"outBizNo"`
1768
+	} `json:"data"`
1769
+	Code    int    `json:"code"`
1770
+	Message string `json:"message"`
1771
+}
1772
+func (c *JSybController) Readcardface() {
1773
+	fixmedins_code := c.GetString("fixmedins_code")
1774
+	secret_key := c.GetString("secret_key")
1775
+	ak := c.GetString("ak")
1776
+	org_name := c.GetString("org_name")
1777
+	doctor := c.GetString("doctor")
1778
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
1779
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
1780
+	url := c.GetString("url")
1781
+	cainfo := c.GetString("cainfo")
1782
+	operator_id := c.GetString("operator_id")
1783
+	operator := c.GetString("operator")
1784
+
1785
+	fmt.Println(operator_id)
1786
+	fmt.Println(operator)
1787
+	_, pBusiCardInfo := c.GetELeCertInfoByFace(fixmedins_code, operator_id, operator,"01301")
1788
+	fmt.Println(pBusiCardInfo)
1789
+	pBusiCardInfo = Remove0000(pBusiCardInfo)
1790
+	var eletwo ELeCertDatatwo
1791
+	json.Unmarshal([]byte(pBusiCardInfo), &eletwo)
1792
+
1793
+	_, pBusiCardInfotwo := GetELeCertInfoByFacetwo(fixmedins_code, operator_id, operator,eletwo.Data.AuthNo,eletwo.Data.OutBizNo,"01301")
1794
+
1795
+	var ele ELeCertDatathree
1796
+	err2 := json.Unmarshal([]byte(pBusiCardInfotwo), &ele)
1797
+	if err2 != nil {
1798
+		utils.ErrorLog("解析失败:%v", err2)
1799
+	}
1800
+	token := ele.Data.EcToken
1801
+	fmt.Println(token)
1802
+	if len(token) > 0 {
1803
+		userName := ele.Data.UserName
1804
+		fmt.Println(userName)
1805
+		userName = Remove0000(userName)
1806
+		userName = DeleteExtraSpace(userName)
1807
+		fmt.Println(userName)
1808
+		enc := mahonia.NewEncoder("gbk")
1809
+		fmt.Println(enc.ConvertString(userName))
1810
+		result, _ := service.Jsyb1101ForEleCert(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
1811
+		var dat map[string]interface{}
1812
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
1813
+			fmt.Println(dat)
1814
+		} else {
1815
+			fmt.Println(err)
1816
+		}
1817
+		c.ServeSuccessJSON(map[string]interface{}{
1818
+			"status":         "0",
1819
+			"card_info":      "",
1820
+			"busi_card_info": pBusiCardInfotwo,
1821
+			"token":          token,
1822
+			"result":         dat,
1823
+			"eletwo":	pBusiCardInfo,
1824
+
1825
+		})
1826
+	} else {
1827
+		c.ServeSuccessJSON(map[string]interface{}{
1828
+			"status": "-1",
1829
+		})
1830
+
1831
+	}
1832
+
1833
+
1834
+}
1835
+
1836
+
1837
+func (c *JSybController) Readcardcharge() {
1686 1838
 	fixmedins_code := c.GetString("fixmedins_code")
1687 1839
 	secret_key := c.GetString("secret_key")
1688 1840
 	ak := c.GetString("ak")
@@ -1777,11 +1929,9 @@ func (c *JSybController) ReadCard() {
1777 1929
 	case "4": //电子凭证
1778 1930
 		fmt.Println(operator_id)
1779 1931
 		fmt.Println(operator)
1780
-		pCardInfo, pBusiCardInfo := c.GetELeCertInfo(fixmedins_code, operator_id, operator)
1781
-		fmt.Println(pCardInfo)
1932
+		_, pBusiCardInfo := c.GetELeCertInfoThree(fixmedins_code, operator_id, operator)
1782 1933
 		fmt.Println(pBusiCardInfo)
1783 1934
 		pBusiCardInfo = Remove0000(pBusiCardInfo)
1784
-		pCardInfo = Remove0000(pCardInfo)
1785 1935
 		var ele ELeCertData
1786 1936
 		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
1787 1937
 		if err != nil {
@@ -1806,7 +1956,7 @@ func (c *JSybController) ReadCard() {
1806 1956
 			}
1807 1957
 			c.ServeSuccessJSON(map[string]interface{}{
1808 1958
 				"status":         "0",
1809
-				"card_info":      pCardInfo,
1959
+				"card_info":      "",
1810 1960
 				"busi_card_info": pBusiCardInfo,
1811 1961
 				"token":          token,
1812 1962
 				"result":         dat,
@@ -1818,55 +1968,383 @@ func (c *JSybController) ReadCard() {
1818 1968
 
1819 1969
 		}
1820 1970
 		break
1821
-
1822 1971
 	}
1823 1972
 
1824 1973
 }
1974
+func (c *JSybController) Readcardchargeother() {
1975
+	fixmedins_code := c.GetString("fixmedins_code")
1976
+	secret_key := c.GetString("secret_key")
1977
+	ak := c.GetString("ak")
1978
+	org_name := c.GetString("org_name")
1979
+	doctor := c.GetString("doctor")
1980
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
1981
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
1982
+	url := c.GetString("url")
1983
+	cainfo := c.GetString("cainfo")
1984
+	id_card_type := c.GetString("id_card_type")
1985
+	operator_id := c.GetString("operator_id")
1986
+	operator := c.GetString("operator")
1825 1987
 
1826
-func (c *JSybController) TestGetBasBaseInit(code string, secret_key string, ak string) {
1827
-	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
1828
-	Iinit := DllDef.MustFindProc("Init")
1829
-	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
1830
-	str := make([]byte, 2048)
1831
-	inputData := make(map[string]interface{})
1832
-	inputData["IP"] = "10.58.65.240"
1833
-	inputData["PORT"] = "8086"
1834
-	inputData["TIMEOUT"] = "180"
1835
-	inputData["LOG_PATH"] = "C:\\log\\"
1988
+	//result, request := service.Jsyb9001(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, url, cainfo, ak)
1989
+	//fmt.Println(request)
1990
+	//fmt.Println(result)
1836 1991
 
1837
-	//inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
1992
+	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
1993
+	switch id_card_type {
1994
+	case "1":
1995
+		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
1996
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
1997
+		pCardInfo = Remove0000(pCardInfo)
1998
+		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
1838 1999
 
1839
-	inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
1840
-	inputData["CARD_PASSTYPE"] = "1"
1841
-	inputData["API_NAME"] = "hssServives"
1842
-	inputData["API_VERSION"] = "1.0.0"
1843
-	inputData["ACCESS_KEY"] = ak
2000
+		fmt.Println(pBusiCardInfo)
2001
+		fmt.Println(pCardInfo)
2002
+		bas := strings.Split(pCardInfo, "|")
2003
+		basNumber := bas[2]
2004
+		id_card_no := bas[1]
2005
+		card_sn := bas[3]
1844 2006
 
1845
-	inputData["SECRETKEY"] = secret_key
1846
-	inputData["ORG_ID"] = code
1847
-	inputData["EXT"] = ""
1848
-	bytesData, _ := json.Marshal(inputData)
1849
-	fmt.Println(inputData)
1850
-	fmt.Println(bytesData)
2007
+		id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
1851 2008
 
1852
-	ret, _, err := Iinit.Call((uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&str[0])))
1853
-	if ret != 0 {
1854
-		fmt.Println("SSCard的报错原因:", err)
1855
-		fmt.Println("SSCard的运算结果为:", ret)
1856
-		fmt.Println("SSCard的返回结果为:", string(str))
1857
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
1858
-		return
2009
+		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2010
+			result, _ := service.Jsyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
2011
+			var dat map[string]interface{}
2012
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2013
+				fmt.Println(dat)
2014
+			} else {
2015
+				fmt.Println(err)
2016
+			}
2017
+			c.ServeSuccessJSON(map[string]interface{}{
2018
+				"status":         "0",
2019
+				"card_info":      pCardInfo,
2020
+				"busi_card_info": pBusiCardInfo,
2021
+				"result":         dat,
2022
+				"type":           "1",
2023
+			})
2024
+		} else {
2025
+			c.ServeSuccessJSON(map[string]interface{}{
2026
+				"status": "-1",
2027
+			})
2028
+
2029
+		}
2030
+		break
2031
+	case "3": //电子社保卡
2032
+		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
2033
+		//fmt.Println(pCardInfo)
2034
+		fmt.Println(pBusiCardInfo)
2035
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
2036
+		//pCardInfo = Remove0000(pCardInfo)
2037
+		var ele ELeData
2038
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
2039
+		if err != nil {
2040
+			utils.ErrorLog("解析失败:%v", err)
2041
+		}
2042
+		token := ele.Data.EcCardToken
2043
+		if len(token) > 0 {
2044
+			result, _ := service.Jsyb1101B(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IdNo)
2045
+			var dat map[string]interface{}
2046
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2047
+				fmt.Println(dat)
2048
+			} else {
2049
+				fmt.Println(err)
2050
+			}
2051
+			c.ServeSuccessJSON(map[string]interface{}{
2052
+				"status": "0",
2053
+				//"card_info":      pCardInfo,
2054
+				"busi_card_info": pBusiCardInfo,
2055
+				"token":          token,
2056
+				"result":         dat,
2057
+				"type":           "2",
2058
+			})
2059
+		} else {
2060
+			c.ServeSuccessJSON(map[string]interface{}{
2061
+				"status": "-1",
2062
+			})
2063
+
2064
+		}
2065
+		break
2066
+	case "4": //电子凭证
2067
+		fmt.Println(operator_id)
2068
+		fmt.Println(operator)
2069
+		_, pBusiCardInfo := c.GetELeCertInfoFour(fixmedins_code, operator_id, operator)
2070
+		fmt.Println(pBusiCardInfo)
2071
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
2072
+		var ele ELeCertData
2073
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
2074
+		if err != nil {
2075
+			utils.ErrorLog("解析失败:%v", err)
2076
+		}
2077
+		token := ele.Data.EcToken
2078
+		fmt.Println(token)
2079
+		if len(token) > 0 {
2080
+			userName := ele.Data.UserName
2081
+			fmt.Println(userName)
2082
+			userName = Remove0000(userName)
2083
+			userName = DeleteExtraSpace(userName)
2084
+			fmt.Println(userName)
2085
+			enc := mahonia.NewEncoder("gbk")
2086
+			fmt.Println(enc.ConvertString(userName))
2087
+			result, _ := service.Jsyb1101ForEleCert(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
2088
+			var dat map[string]interface{}
2089
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2090
+				fmt.Println(dat)
2091
+			} else {
2092
+				fmt.Println(err)
2093
+			}
2094
+			c.ServeSuccessJSON(map[string]interface{}{
2095
+				"status":         "0",
2096
+				"card_info":      "",
2097
+				"busi_card_info": pBusiCardInfo,
2098
+				"token":          token,
2099
+				"result":         dat,
2100
+			})
2101
+		} else {
2102
+			c.ServeSuccessJSON(map[string]interface{}{
2103
+				"status": "-1",
2104
+			})
2105
+
2106
+		}
2107
+		break
1859 2108
 	}
1860
-	fmt.Println("SSCard的返回结果为:", string(str))
1861 2109
 
1862
-	result := int(ret)
1863
-	fmt.Println("SSCard的运算结果为1:", result)
1864
-	//initFlag = 1
1865
-	return
1866 2110
 }
1867
-func (c *JSybController) GetBasBaseInfo() (string, string) {
1868
-	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
1869
-	readCard := DllDef.MustFindProc("ReadCardBas")
2111
+
2112
+func (c *JSybController) ReadCard() {
2113
+	fixmedins_code := c.GetString("fixmedins_code")
2114
+	secret_key := c.GetString("secret_key")
2115
+	ak := c.GetString("ak")
2116
+	org_name := c.GetString("org_name")
2117
+	doctor := c.GetString("doctor")
2118
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
2119
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
2120
+	url := c.GetString("url")
2121
+	cainfo := c.GetString("cainfo")
2122
+	id_card_type := c.GetString("id_card_type")
2123
+	operator_id := c.GetString("operator_id")
2124
+	operator := c.GetString("operator")
2125
+
2126
+	//result, request := service.Jsyb9001(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, url, cainfo, ak)
2127
+	//fmt.Println(request)
2128
+	//fmt.Println(result)
2129
+
2130
+	c.TestGetBasBaseInit(fixmedins_code, secret_key, ak)
2131
+	switch id_card_type {
2132
+	case "1":
2133
+		pCardInfo, pBusiCardInfo := c.GetBasBaseInfo()
2134
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
2135
+		pCardInfo = Remove0000(pCardInfo)
2136
+		fmt.Println(":", ConvertToString(pCardInfo, "gbk", "utf-8"))
2137
+
2138
+		fmt.Println(pBusiCardInfo)
2139
+		fmt.Println(pCardInfo)
2140
+		bas := strings.Split(pCardInfo, "|")
2141
+		basNumber := bas[2]
2142
+		id_card_no := bas[1]
2143
+		card_sn := bas[3]
2144
+
2145
+		id_card_type_int, _ := strconv.ParseInt(id_card_type, 10, 64)
2146
+
2147
+		if len(pCardInfo) > 0 && len(pBusiCardInfo) > 0 {
2148
+			result, _ := service.Jsyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, pBusiCardInfo, id_card_no, cainfo)
2149
+			var dat map[string]interface{}
2150
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2151
+				fmt.Println(dat)
2152
+			} else {
2153
+				fmt.Println(err)
2154
+			}
2155
+			c.ServeSuccessJSON(map[string]interface{}{
2156
+				"status":         "0",
2157
+				"card_info":      pCardInfo,
2158
+				"busi_card_info": pBusiCardInfo,
2159
+				"result":         dat,
2160
+				"type":           "1",
2161
+			})
2162
+		} else {
2163
+			c.ServeSuccessJSON(map[string]interface{}{
2164
+				"status": "-1",
2165
+			})
2166
+
2167
+		}
2168
+		break
2169
+	case "3": //电子社保卡
2170
+		_, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
2171
+		//fmt.Println(pCardInfo)
2172
+		fmt.Println(pBusiCardInfo)
2173
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
2174
+		//pCardInfo = Remove0000(pCardInfo)
2175
+		var ele ELeData
2176
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
2177
+		if err != nil {
2178
+			utils.ErrorLog("解析失败:%v", err)
2179
+		}
2180
+		token := ele.Data.EcCardToken
2181
+		if len(token) > 0 {
2182
+			result, _ := service.Jsyb1101B(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IdNo)
2183
+			var dat map[string]interface{}
2184
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2185
+				fmt.Println(dat)
2186
+			} else {
2187
+				fmt.Println(err)
2188
+			}
2189
+			c.ServeSuccessJSON(map[string]interface{}{
2190
+				"status": "0",
2191
+				//"card_info":      pCardInfo,
2192
+				"busi_card_info": pBusiCardInfo,
2193
+				"token":          token,
2194
+				"result":         dat,
2195
+				"type":           "2",
2196
+			})
2197
+		} else {
2198
+			c.ServeSuccessJSON(map[string]interface{}{
2199
+				"status": "-1",
2200
+			})
2201
+
2202
+		}
2203
+		break
2204
+	case "4": //电子凭证
2205
+		fmt.Println(operator_id)
2206
+		fmt.Println(operator)
2207
+		_, pBusiCardInfo := c.GetELeCertInfoTwo(fixmedins_code, operator_id, operator)
2208
+		fmt.Println(pBusiCardInfo)
2209
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
2210
+		var ele ELeCertData
2211
+		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
2212
+		if err != nil {
2213
+			utils.ErrorLog("解析失败:%v", err)
2214
+		}
2215
+		token := ele.Data.EcToken
2216
+		fmt.Println(token)
2217
+		if len(token) > 0 {
2218
+			userName := ele.Data.UserName
2219
+			fmt.Println(userName)
2220
+			userName = Remove0000(userName)
2221
+			userName = DeleteExtraSpace(userName)
2222
+			fmt.Println(userName)
2223
+			enc := mahonia.NewEncoder("gbk")
2224
+			fmt.Println(enc.ConvertString(userName))
2225
+			result, _ := service.Jsyb1101ForEleCert(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
2226
+			var dat map[string]interface{}
2227
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2228
+				fmt.Println(dat)
2229
+			} else {
2230
+				fmt.Println(err)
2231
+			}
2232
+			c.ServeSuccessJSON(map[string]interface{}{
2233
+				"status":         "0",
2234
+				"card_info":      "",
2235
+				"busi_card_info": pBusiCardInfo,
2236
+				"token":          token,
2237
+				"result":         dat,
2238
+			})
2239
+		} else {
2240
+			c.ServeSuccessJSON(map[string]interface{}{
2241
+				"status": "-1",
2242
+			})
2243
+
2244
+		}
2245
+		break
2246
+	case "5": //电子凭证
2247
+		fmt.Println(operator_id)
2248
+		fmt.Println(operator)
2249
+		_, pBusiCardInfo := c.GetELeCertInfoByFace(fixmedins_code, operator_id, operator,"01101")
2250
+		fmt.Println(pBusiCardInfo)
2251
+		pBusiCardInfo = Remove0000(pBusiCardInfo)
2252
+		var eletwo ELeCertDatatwo
2253
+		json.Unmarshal([]byte(pBusiCardInfo), &eletwo)
2254
+
2255
+
2256
+		_, pBusiCardInfotwo := GetELeCertInfoByFacetwo(fixmedins_code, operator_id, operator,eletwo.Data.AuthNo,eletwo.Data.OutBizNo,"01301")
2257
+
2258
+
2259
+
2260
+		var ele ELeCertDatathree
2261
+		err2 := json.Unmarshal([]byte(pBusiCardInfotwo), &ele)
2262
+		if err2 != nil {
2263
+			utils.ErrorLog("解析失败:%v", err2)
2264
+		}
2265
+		token := ele.Data.EcToken
2266
+		fmt.Println(token)
2267
+		if len(token) > 0 {
2268
+			userName := ele.Data.UserName
2269
+			fmt.Println(userName)
2270
+			userName = Remove0000(userName)
2271
+			userName = DeleteExtraSpace(userName)
2272
+			fmt.Println(userName)
2273
+			enc := mahonia.NewEncoder("gbk")
2274
+			fmt.Println(enc.ConvertString(userName))
2275
+			result, _ := service.Jsyb1101ForEleCert(org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
2276
+			var dat map[string]interface{}
2277
+			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2278
+				fmt.Println(dat)
2279
+			} else {
2280
+				fmt.Println(err)
2281
+			}
2282
+			c.ServeSuccessJSON(map[string]interface{}{
2283
+				"status":         "0",
2284
+				"card_info":      "",
2285
+				"busi_card_info": pBusiCardInfotwo,
2286
+				"token":          token,
2287
+				"result":         dat,
2288
+				"eletwo":	pBusiCardInfo,
2289
+
2290
+			})
2291
+		} else {
2292
+			c.ServeSuccessJSON(map[string]interface{}{
2293
+				"status": "-1",
2294
+			})
2295
+
2296
+		}
2297
+		break
2298
+
2299
+
2300
+	}
2301
+
2302
+}
2303
+
2304
+func (c *JSybController) TestGetBasBaseInit(code string, secret_key string, ak string) {
2305
+	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
2306
+	Iinit := DllDef.MustFindProc("Init")
2307
+	//miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
2308
+	str := make([]byte, 2048)
2309
+	inputData := make(map[string]interface{})
2310
+	inputData["IP"] = "10.58.65.240"
2311
+	inputData["PORT"] = "8086"
2312
+	inputData["TIMEOUT"] = "180"
2313
+	inputData["LOG_PATH"] = "C:\\log\\"
2314
+
2315
+	//inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2316
+
2317
+	inputData["EC_URL"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2318
+	inputData["CARD_PASSTYPE"] = "1"
2319
+	inputData["API_NAME"] = "hssServives"
2320
+	inputData["API_VERSION"] = "1.0.0"
2321
+	inputData["ACCESS_KEY"] = ak
2322
+
2323
+	inputData["SECRETKEY"] = secret_key
2324
+	inputData["ORG_ID"] = code
2325
+	inputData["EXT"] = ""
2326
+	bytesData, _ := json.Marshal(inputData)
2327
+	fmt.Println(inputData)
2328
+	fmt.Println(bytesData)
2329
+
2330
+	ret, _, err := Iinit.Call((uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&str[0])))
2331
+	if ret != 0 {
2332
+		fmt.Println("SSCard的报错原因:", err)
2333
+		fmt.Println("SSCard的运算结果为:", ret)
2334
+		fmt.Println("SSCard的返回结果为:", string(str))
2335
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
2336
+		return
2337
+	}
2338
+	fmt.Println("SSCard的返回结果为:", string(str))
2339
+
2340
+	result := int(ret)
2341
+	fmt.Println("SSCard的运算结果为1:", result)
2342
+	//initFlag = 1
2343
+	return
2344
+}
2345
+func (c *JSybController) GetBasBaseInfo() (string, string) {
2346
+	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
2347
+	readCard := DllDef.MustFindProc("ReadCardBas")
1870 2348
 	fmt.Println(readCard)
1871 2349
 	fmt.Println("!!!!!")
1872 2350
 	pCardInfo := make([]byte, 2048)
@@ -1918,8 +2396,70 @@ func (c *JSybController) GetELeInfo(code string, operator_id string, operator_na
1918 2396
 	}
1919 2397
 	return DeleteExtraSpace(""), DeleteExtraSpace(string(pBusiCardInfo))
1920 2398
 }
2399
+func (c *JSybController) GetELeCertInfoFour1(code string, operator_id string, operator_name string) (string, string) {
2400
+	DllDef := syscall.MustLoadDLL("NationEcCode.dll")
2401
+	readCard := DllDef.MustFindProc("EcQuery")
1921 2402
 
1922
-func (c *JSybController) GetELeCertInfo(code string, operator_id string, operator_name string) (string, string) {
2403
+	pCardInfo := make([]byte, 8192)
2404
+	pBusiCardInfo := make([]byte, 8192)
2405
+	data := make(map[string]interface{})
2406
+
2407
+	inputData := make(map[string]interface{})
2408
+	inputData["orgId"] = code
2409
+	inputData["businessType"] = "01301"
2410
+	inputData["operatorId"] = operator_id
2411
+	inputData["operatorName"] = operator_name
2412
+	inputData["officeId"] = "001"
2413
+	inputData["officeName"] = "xuetou"
2414
+	data["data"] = inputData
2415
+	data["transType"] = "ec.query"
2416
+	data["orgId"] = code
2417
+	bytesData, _ := json.Marshal(data)
2418
+	pCardInfo = bytesData
2419
+	pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
2420
+
2421
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
2422
+	fmt.Println(ret2)
2423
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
2424
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
2425
+	if ret2 != 0 {
2426
+		return "", ""
2427
+	}
2428
+	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
2429
+}
2430
+
2431
+func (c *JSybController) GetELeCertInfoFour(code string, operator_id string, operator_name string) (string, string) {
2432
+	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
2433
+	readCard := DllDef.MustFindProc("GetPersonInfo")
2434
+
2435
+	pCardInfo := make([]byte, 8192)
2436
+	pBusiCardInfo := make([]byte, 8192)
2437
+	data := make(map[string]interface{})
2438
+
2439
+	inputData := make(map[string]interface{})
2440
+	inputData["orgId"] = code
2441
+	inputData["businessType"] = "01301"
2442
+	inputData["operatorId"] = operator_id
2443
+	inputData["operatorName"] = operator_name
2444
+	inputData["officeId"] = "001"
2445
+	inputData["officeName"] = "xuetou"
2446
+	data["data"] = inputData
2447
+	data["transType"] = "ec.query"
2448
+	data["orgId"] = code
2449
+	bytesData, _ := json.Marshal(data)
2450
+	pCardInfo = bytesData
2451
+	pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
2452
+
2453
+	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])))
2454
+	fmt.Println(ret2)
2455
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
2456
+	fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
2457
+	if ret2 != 0 {
2458
+		return "", ""
2459
+	}
2460
+	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
2461
+}
2462
+func (c *JSybController) GetELeCertInfoFour2223(code string, operator_id string, operator_name string) (string, string) {
1923 2463
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
1924 2464
 	readCard := DllDef.MustFindProc("GetPersonInfo")
1925 2465
 
@@ -1951,6 +2491,201 @@ func (c *JSybController) GetELeCertInfo(code string, operator_id string, operato
1951 2491
 	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
1952 2492
 }
1953 2493
 
2494
+func (c *JSybController) GetELeCertInfoByFace(code string, operator_id string, operator_name string,businessType string) (string, string) {
2495
+	// WebSocket服务器地址
2496
+	serverURL := "ws://127.0.0.1:8899"
2497
+
2498
+	// 解析WebSocket服务器地址
2499
+	u, err := url.Parse(serverURL)
2500
+	if err != nil {
2501
+		log.Fatal(err)
2502
+	}
2503
+
2504
+	// 建立WebSocket连接
2505
+	conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
2506
+	if err != nil {
2507
+		log.Fatal(err)
2508
+	}
2509
+	defer conn.Close()
2510
+	input2 := make(map[string]interface{})
2511
+
2512
+	input := make(map[string]interface{})
2513
+	inputData := make(map[string]interface{})
2514
+	inputData["orgId"] = code
2515
+	inputData["outBizNo"] = time.Now().Unix()
2516
+	inputData["businessType"] = businessType
2517
+	inputData["operatorId"] = operator_id
2518
+	inputData["operatorName"] = operator_name
2519
+	inputData["officeId"] = "001"
2520
+	inputData["officeName"] = "血透室"
2521
+	inputData["deviceType"] = ""
2522
+	input["data"] = inputData
2523
+	input["orgId"] = code
2524
+	input["transType"] = "cn.nhsa.ec.auth"
2525
+	input2["url"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2526
+	input2["indata"] = input
2527
+
2528
+	bytesData, _ := json.Marshal(input2)
2529
+	err = conn.WriteMessage(websocket.TextMessage, bytesData)
2530
+	if err != nil {
2531
+		fmt.Println(err)
2532
+	}
2533
+
2534
+	// 接收消息
2535
+	_, receivedMessage, err := conn.ReadMessage()
2536
+	if err != nil {
2537
+		fmt.Println(err)
2538
+	}
2539
+
2540
+	return "", string(receivedMessage)
2541
+}
2542
+func GetELeCertInfoByFacetwo(code string, operator_id string, operator_name string,authNo string,outBizNo string,businessType string) (string, string) {
2543
+	//	// WebSocket服务器地址
2544
+	serverURL := "ws://127.0.0.1:8899"
2545
+
2546
+	// 解析WebSocket服务器地址
2547
+	u, err := url.Parse(serverURL)
2548
+	if err != nil {
2549
+		log.Fatal(err)
2550
+	}
2551
+
2552
+	// 建立WebSocket连接
2553
+	conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
2554
+	if err != nil {
2555
+		log.Fatal(err)
2556
+	}
2557
+	defer conn.Close()
2558
+	input2 := make(map[string]interface{})
2559
+
2560
+	input := make(map[string]interface{})
2561
+	inputData := make(map[string]interface{})
2562
+	inputData["orgId"] = code
2563
+	inputData["outBizNo"] = outBizNo
2564
+	inputData["authNo"] = authNo
2565
+	inputData["businessType"] = businessType
2566
+	inputData["operatorId"] = operator_id
2567
+	inputData["operatorName"] = operator_name
2568
+	inputData["officeId"] = "001"
2569
+	inputData["officeName"] = "血透室"
2570
+	inputData["deviceType"] = ""
2571
+	input["data"] = inputData
2572
+	input["orgId"] = code
2573
+	input["transType"] = "cn.nhsa.auth.check"
2574
+	input2["url"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2575
+	input2["indata"] = input
2576
+
2577
+	bytesData, _ := json.Marshal(input2)
2578
+	err = conn.WriteMessage(websocket.TextMessage, bytesData)
2579
+	if err != nil {
2580
+		fmt.Println(err)
2581
+	}
2582
+
2583
+	// 接收消息
2584
+	_, receivedMessage, err := conn.ReadMessage()
2585
+	if err != nil {
2586
+		fmt.Println(err)
2587
+	}
2588
+
2589
+	return "", string(receivedMessage)
2590
+}
2591
+
2592
+func (c *JSybController) GetELeCertInfoTwo(code string, operator_id string, operator_name string) (string, string) {
2593
+	// WebSocket服务器地址
2594
+	serverURL := "ws://127.0.0.1:8899"
2595
+
2596
+	// 解析WebSocket服务器地址
2597
+	u, err := url.Parse(serverURL)
2598
+	if err != nil {
2599
+		log.Fatal(err)
2600
+	}
2601
+
2602
+	// 建立WebSocket连接
2603
+	conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
2604
+	if err != nil {
2605
+		log.Fatal(err)
2606
+	}
2607
+	defer conn.Close()
2608
+	input2 := make(map[string]interface{})
2609
+
2610
+	input := make(map[string]interface{})
2611
+	inputData := make(map[string]interface{})
2612
+	inputData["orgId"] = code
2613
+	inputData["businessType"] = "01101"
2614
+	inputData["operatorId"] = operator_id
2615
+	inputData["operatorName"] = operator_name
2616
+	inputData["officeId"] = "001"
2617
+	inputData["officeName"] = "血透室"
2618
+	inputData["deviceType"] = ""
2619
+	input["data"] = inputData
2620
+	input["orgId"] = code
2621
+	input["transType"] = "ec.query"
2622
+	input2["url"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2623
+	input2["indata"] = input
2624
+
2625
+	bytesData, _ := json.Marshal(input2)
2626
+	err = conn.WriteMessage(websocket.TextMessage, bytesData)
2627
+	if err != nil {
2628
+		fmt.Println(err)
2629
+	}
2630
+
2631
+	// 接收消息
2632
+	_, receivedMessage, err := conn.ReadMessage()
2633
+	if err != nil {
2634
+		fmt.Println(err)
2635
+	}
2636
+
2637
+	return "", string(receivedMessage)
2638
+}
2639
+func (c *JSybController) GetELeCertInfoThree(code string, operator_id string, operator_name string) (string, string) {
2640
+	// WebSocket服务器地址
2641
+	serverURL := "ws://127.0.0.1:8899"
2642
+
2643
+	// 解析WebSocket服务器地址
2644
+	u, err := url.Parse(serverURL)
2645
+	if err != nil {
2646
+		log.Fatal(err)
2647
+	}
2648
+
2649
+	// 建立WebSocket连接
2650
+	conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
2651
+	if err != nil {
2652
+		log.Fatal(err)
2653
+	}
2654
+	defer conn.Close()
2655
+	input2 := make(map[string]interface{})
2656
+
2657
+	input := make(map[string]interface{})
2658
+	inputData := make(map[string]interface{})
2659
+	inputData["orgId"] = code
2660
+	inputData["businessType"] = "01301"
2661
+	inputData["operatorId"] = operator_id
2662
+	inputData["operatorName"] = operator_name
2663
+	inputData["officeId"] = "001"
2664
+	inputData["officeName"] = "血透室"
2665
+	inputData["deviceType"] = ""
2666
+	input["data"] = inputData
2667
+	input["orgId"] = code
2668
+	input["transType"] = "ec.query"
2669
+	input2["url"] = "http://10.58.33.207:10086/localcfc/api/hsecfc/localQrCodeQuery"
2670
+	input2["indata"] = input
2671
+
2672
+	bytesData, _ := json.Marshal(input2)
2673
+	err = conn.WriteMessage(websocket.TextMessage, bytesData)
2674
+	if err != nil {
2675
+		fmt.Println(err)
2676
+	}
2677
+
2678
+	// 接收消息
2679
+	_, receivedMessage, err := conn.ReadMessage()
2680
+	if err != nil {
2681
+		fmt.Println(err)
2682
+	}
2683
+
2684
+	return "", string(receivedMessage)
2685
+}
2686
+
2687
+
2688
+
1954 2689
 func GetELeCertInfoSettle(code string, operator_id string, operator_name string) (string, string) {
1955 2690
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
1956 2691
 	readCard := DllDef.MustFindProc("GetPersonInfo")

+ 194 - 67
controllers/nm/nm_controller.go View File

@@ -47,19 +47,23 @@ func NmybRegistRouters() {
47 47
 	beego.Router("/nmyb/4101", &NmController{}, "post:Post4101")
48 48
 	beego.Router("/nmyb/2601", &NmController{}, "get:Get2601")
49 49
 	beego.Router("/api/token", &NmController{}, "get:GetToken")
50
-	beego.Router("/api/eleinfo", &NmController{}, "get:GetNewELeInfo")
50
+	//beego.Router("/api/eleinfo", &NmController{}, "get:GetNewELeInfo")
51 51
 	beego.Router("/nmyb/4102", &NmController{}, "get:Post4102")
52 52
 	beego.Router("/nmyb/4103", &NmController{}, "get:Post4103")
53 53
 
54 54
 	beego.Router("/nmyb/2201", &NmController{}, "get:Post2201")
55 55
 	beego.Router("/nmyb/2202", &NmController{}, "get:Post2202")
56
-	beego.Router("/nmyb/2203", &NmController{}, "get:Post2203")
57
-	beego.Router("/nmyb/2204", &NmController{}, "get:Post2204")
56
+	beego.Router("/nmyb/2203", &NmController{}, "post:Post2203")
57
+	beego.Router("/nmyb/2203C", &NmController{}, "post:Post2203C")
58
+
59
+	beego.Router("/nmyb/2204", &NmController{}, "post:Post2204")
58 60
 	beego.Router("/nmyb/2205", &NmController{}, "get:Post2205")
59 61
 	beego.Router("/nmyb/2206", &NmController{}, "get:Post2206")
60 62
 	beego.Router("/nmyb/2207", &NmController{}, "get:Post2207")
61 63
 	beego.Router("/nmyb/2208", &NmController{}, "get:Post2208")
62 64
 
65
+	beego.Router("/nmyb/2503", &NmController{}, "get:Post2503")
66
+
63 67
 }
64 68
 
65 69
 func (c *NmController) Post2201() {
@@ -67,7 +71,6 @@ func (c *NmController) Post2201() {
67 71
 	insutype := c.GetString("insutype")
68 72
 	certNo := c.GetString("cert_no")
69 73
 	org_name := c.GetString("org_name")
70
-	doctor := c.GetString("doctor")
71 74
 	ipt_otp_no := c.GetString("ipt_otp_no")
72 75
 	dept := c.GetString("dept")
73 76
 	verify_number := c.GetString("verify_number")
@@ -80,7 +83,9 @@ func (c *NmController) Post2201() {
80 83
 	id_card_type, _ := c.GetInt64("id_card_type")
81 84
 	doctor_name := c.GetString("doctor_name")
82 85
 	cainfo := c.GetString("cainfo")
83
-	result, request_log := service.Nmyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, doctor_name, url, verify_number, cainfo)
86
+	opter := c.GetString("opter")
87
+
88
+	result, request_log := service.Nmyb2201(psnNo, insutype, certNo, org_name, opter, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, doctor_name, verify_number, cainfo)
84 89
 	saveJsLog(result, request_log, "2201", "挂号", org_name)
85 90
 	var dat map[string]interface{}
86 91
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -180,18 +185,73 @@ func (c *NmController) Post2203() {
180 185
 
181 186
 	}
182 187
 
183
-	var dat3 int64
184
-	if err := json.Unmarshal([]byte(strconv.FormatInt(timeStamp, 10)), &dat3); err == nil {
188
+	c.ServeSuccessJSON(map[string]interface{}{
189
+		"pre":         dat,
190
+		"request_log": dat2,
191
+	})
192
+}
193
+func (c *NmController) Post2203C() {
194
+
195
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
196
+	var respJSON map[string]interface{}
197
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
198
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
199
+		return
200
+	}
201
+	userJSONBytes, _ := json.Marshal(respJSON["config"])
202
+	var config []*models.HisXtDiagnoseConfig
203
+	if err := json.Unmarshal(userJSONBytes, &config); err != nil {
204
+		utils.ErrorLog("解析失败:%v", err)
205
+		return
206
+	}
207
+	fmt.Println(respJSON["psn_no"].(string))
208
+	fmt.Println(respJSON["mdtrt_id"].(string))
209
+
210
+	psnNo := respJSON["psn_no"].(string)
211
+	mdtrtId := respJSON["mdtrt_id"].(string)
212
+	doctor := respJSON["doctor"].(string)
213
+	department := respJSON["department"].(string)
214
+
215
+	org_name := respJSON["org_name"].(string)
216
+	med_type := respJSON["med_type"].(string)
217
+	doctor_id := respJSON["doctor_id"].(string)
218
+	fixmedins_code := respJSON["fixmedins_code"].(string)
219
+	sick_code := respJSON["sick_code"].(string)
220
+	sick_name := respJSON["sick_name"].(string)
221
+	dept := respJSON["dept"].(string)
222
+
223
+	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
224
+	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
225
+	secret_key := respJSON["secret_key"].(string)
226
+
227
+	begin_time := respJSON["begin_time"].(string)
228
+	cainfo := respJSON["cainfo"].(string)
229
+	//is_vaild := respJSON["is_vaild"].(string)
230
+
231
+	//cainfo := c.GetString("cainfo")
232
+
233
+	result, request_log := service.Nmyb2203C(psnNo, mdtrtId, doctor, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, begin_time, cainfo)
234
+	saveJsLog(result, request_log, "2203", "上传就诊信息", org_name)
235
+	var dat2 map[string]interface{}
236
+	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
185 237
 
186 238
 	} else {
187 239
 
188 240
 	}
241
+
242
+	var dat map[string]interface{}
243
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
244
+
245
+	} else {
246
+
247
+	}
248
+
189 249
 	c.ServeSuccessJSON(map[string]interface{}{
190 250
 		"pre":         dat,
191 251
 		"request_log": dat2,
192
-		"time_stamp":  dat3,
193 252
 	})
194 253
 }
254
+
195 255
 func (c *NmController) Post2204() {
196 256
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
197 257
 	var respJSON map[string]interface{}
@@ -403,57 +463,88 @@ func (c *NmController) Post2208() {
403 463
 		"request_log": dat2,
404 464
 	})
405 465
 }
466
+func (c *NmController) Post2503() {
467
+	psnNo := c.GetString("psn_no")
468
+	insutype := c.GetString("insutype")
469
+	opera := c.GetString("opera")
470
+	org_name := c.GetString("org_name")
471
+	doctor := c.GetString("doctor")
472
+	doctor_id := c.GetString("doctor_id")
473
+	secret_key := c.GetString("secret_key")
474
+	fixmedins_code := c.GetString("fixmedins_code")
475
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
476
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
477
+	sick_name := c.GetString("sick_name")
478
+	sick_code := c.GetString("sick_code")
479
+	start_time := c.GetString("start_time")
480
+	end_time := c.GetString("end_time")
481
+	check_time := c.GetString("check_time")
482
+	hospital_name := c.GetString("hospital_name")
483
+	hospital_code := c.GetString("hospital_code")
406 484
 
407
-func (c *NmController) GetNewELeInfo() {
408
-	token := c.GetString("token")
409
-	user_name := c.GetString("user_name")
410
-	id_card_no := c.GetString("id_card_no")
485
+	result := service.Nmyb2503(psnNo, insutype, org_name, opera, doctor, fixmedins_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_name, sick_code, start_time, end_time, check_time, hospital_code, hospital_name)
411 486
 
412
-	result, _ := service.Gdyb1101ForEleCert("赤峰费森血液透析中心", "关学丽", "H15049901371", "150499", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57", token, user_name, id_card_no)
413 487
 	var dat map[string]interface{}
414 488
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
415 489
 		fmt.Println(dat)
416 490
 	} else {
417 491
 		fmt.Println(err)
418 492
 	}
419
-	userJSONBytes, _ := json.Marshal(dat)
420
-	var res ResultTwo
421
-
422
-	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
423
-		utils.ErrorLog("解析失败:%v", err)
424
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
425
-		return
426
-	}
427
-
428
-	infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
429
-	if infocode == 0 {
430
-		data := make(map[string]interface{})
431
-		data["token"] = token
432
-		data["result"] = dat
433
-		var req *http.Request
434
-		bytesData, _ := json.Marshal(data)
435
-		req, _ = http.NewRequest("POST", "http://172.16.13.253:9532/"+"api/ele/info", bytes.NewReader(bytesData))
436
-		client := &http.Client{}
437
-		resp, _ := client.Do(req)
438
-		defer resp.Body.Close()
439
-		body, ioErr := ioutil.ReadAll(resp.Body)
440
-		if ioErr != nil {
441
-			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
442
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
443
-			return
444
-		}
445
-		var respJSON map[string]interface{}
446
-		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
447
-			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
448
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
449
-			return
450
-		}
451
-		c.ServeSuccessJSON(map[string]interface{}{
452
-			"msg": "成功",
453
-		})
454
-
455
-	}
493
+	c.ServeSuccessJSON(map[string]interface{}{
494
+		"pre": dat,
495
+	})
456 496
 }
497
+
498
+//func (c *NmController) GetNewELeInfo() {
499
+//	token := c.GetString("token")
500
+//	user_name := c.GetString("user_name")
501
+//	id_card_no := c.GetString("id_card_no")
502
+//
503
+//	result, _ := service.Gdyb1101ForEleCert("赤峰费森血液透析中心", "关学丽", "H15049901371", "150499", "150499", "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57", token, user_name, id_card_no)
504
+//	var dat map[string]interface{}
505
+//	if err := json.Unmarshal([]byte(result), &dat); err == nil {
506
+//		fmt.Println(dat)
507
+//	} else {
508
+//		fmt.Println(err)
509
+//	}
510
+//	userJSONBytes, _ := json.Marshal(dat)
511
+//	var res ResultTwo
512
+//
513
+//	if err := json.Unmarshal(userJSONBytes, &res); err != nil {
514
+//		utils.ErrorLog("解析失败:%v", err)
515
+//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
516
+//		return
517
+//	}
518
+//
519
+//	infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
520
+//	if infocode == 0 {
521
+//		data := make(map[string]interface{})
522
+//		data["token"] = token
523
+//		data["result"] = dat
524
+//		var req *http.Request
525
+//		bytesData, _ := json.Marshal(data)
526
+//		req, _ = http.NewRequest("POST", "http://172.16.13.253:9532/"+"api/ele/info", bytes.NewReader(bytesData))
527
+//		client := &http.Client{}
528
+//		resp, _ := client.Do(req)
529
+//		defer resp.Body.Close()
530
+//		body, ioErr := ioutil.ReadAll(resp.Body)
531
+//		if ioErr != nil {
532
+//			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
533
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
534
+//			return
535
+//		}
536
+//		var respJSON map[string]interface{}
537
+//		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
538
+//			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
539
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
540
+//			return
541
+//		}
542
+//		c.ServeSuccessJSON(map[string]interface{}{
543
+//			"msg": "成功",
544
+//		})
545
+//
546
+//	}
547
+//}
457 548
 func (c *NmController) GetToken() {
458 549
 	token := c.GetString("token")
459 550
 	results := strings.Split(token, "-")
@@ -642,7 +733,7 @@ func (c *NmController) Post4101() {
642 733
 		utils.ErrorLog("解析失败:%v", err)
643 734
 		return
644 735
 	}
645
-	result, _ := service.Gdyb4101(struct4101, pp.SecretKey, pp.FixmedinsName, pp.OpterName, pp.FixmedinsCode, pp.InsuplcAdmdvs, pp.MdtrtareaAdmvs, 0)
736
+	result, _ := service.Gdyb4101fornm(struct4101, pp.SecretKey, pp.FixmedinsName, pp.OpterName, pp.FixmedinsCode, pp.InsuplcAdmdvs, pp.MdtrtareaAdmvs, 0,0)
646 737
 	var dat map[string]interface{}
647 738
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
648 739
 		fmt.Println(dat)
@@ -755,7 +846,11 @@ func (c *NmController) Post4103() {
755 846
 		SetlId:  setl_id,
756 847
 	}
757 848
 	result := service.ZHyb4103(bp, bps)
849
+	result2 := service.ZHyb4104(bp, bps)
850
+
758 851
 	saveJsLog(result, "", "4103", "查询结算清单", org_name)
852
+	saveJsLog(result2, "", "4104", "指控结算清单", org_name)
853
+
759 854
 	var dat map[string]interface{}
760 855
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
761 856
 
@@ -766,6 +861,42 @@ func (c *NmController) Post4103() {
766 861
 		"pre": dat,
767 862
 	})
768 863
 }
864
+func (c *NmController) Post4104() {
865
+	org_name := c.GetString("org_name")
866
+	doctor := c.GetString("doctor")
867
+	fixmedins_code := c.GetString("fixmedins_code")
868
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
869
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
870
+	secret_key := c.GetString("secret_key")
871
+	psn_no := c.GetString("psn_no")
872
+	mdtrt_id := c.GetString("mdtrt_id")
873
+	setl_id := c.GetString("setl_id")
874
+	bp := models.BaseParams{
875
+		SecretKey:      secret_key,
876
+		FixmedinsCode:  fixmedins_code,
877
+		InsuplcAdmdvs:  insuplc_admdvs,
878
+		MdtrtareaAdmvs: mdtrtarea_admvs,
879
+		OrgName:        org_name,
880
+		Doctor:         doctor,
881
+	}
882
+	bps := models.BusinessParams{
883
+		PsnNo:   psn_no,
884
+		MdtrtId: mdtrt_id,
885
+		SetlId:  setl_id,
886
+	}
887
+	result := service.ZHyb4104(bp, bps)
888
+	saveJsLog(result, "", "4104", "质控结算清单结果", org_name)
889
+	var dat map[string]interface{}
890
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
891
+
892
+	} else {
893
+
894
+	}
895
+	c.ServeSuccessJSON(map[string]interface{}{
896
+		"pre": dat,
897
+	})
898
+}
899
+
769 900
 
770 901
 func (c *NmController) Post1101() {
771 902
 	certNo := c.GetString("cert_no")
@@ -780,7 +911,7 @@ func (c *NmController) Post1101() {
780 911
 	certificates := c.GetString("certificates")
781 912
 	name := c.GetString("name")
782 913
 	certificate, _ := strconv.ParseInt(certificates, 10, 64)
783
-	result, request_log, result_log := service.ZHGdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, certificate, name)
914
+	result, request_log, result_log := service.ZHGdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, certificate, name,0)
784 915
 
785 916
 	saveJsLog(result_log, request_log, "1101", "查询个人信息", org_name)
786 917
 	var dat map[string]interface{}
@@ -822,7 +953,7 @@ func (c *NmController) Post2401() {
822 953
 	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
823 954
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
824 955
 	secret_key := respJSON["secret_key"].(string)
825
-	result, request_log := service.ZHGdyb2401(struct2401, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
956
+	result, request_log := service.Hbyb2401(struct2401, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
826 957
 	saveJsLog(result, request_log, "2401", "入院登记", org_name)
827 958
 	var dat2 map[string]interface{}
828 959
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
@@ -849,7 +980,7 @@ func (c *NmController) Post2404() {
849 980
 	secret_key := c.GetString("secret_key")
850 981
 	org_name := c.GetString("org_name")
851 982
 
852
-	result, requestLog := service.ZHGdyb2404(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
983
+	result, requestLog := service.Hbyb2404(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
853 984
 	saveJsLog(result, requestLog, "2404", "入院登记撤销", org_name)
854 985
 	var dat map[string]interface{}
855 986
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -865,7 +996,6 @@ func (c *NmController) Post2404() {
865 996
 	})
866 997
 
867 998
 }
868
-
869 999
 func (c *NmController) Post2405() {
870 1000
 	mdtrt_id := c.GetString("mdtrt_id")
871 1001
 	psn_no := c.GetString("psn_no")
@@ -876,7 +1006,7 @@ func (c *NmController) Post2405() {
876 1006
 	secret_key := c.GetString("secret_key")
877 1007
 	org_name := c.GetString("org_name")
878 1008
 
879
-	result, requestLog := service.ZHGdyb2405(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
1009
+	result, requestLog := service.Hb2405(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
880 1010
 	saveJsLog(result, requestLog, "2405", "出院登记撤销", org_name)
881 1011
 	var dat map[string]interface{}
882 1012
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -892,7 +1022,6 @@ func (c *NmController) Post2405() {
892 1022
 	})
893 1023
 
894 1024
 }
895
-
896 1025
 func (c *NmController) Post2402() {
897 1026
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
898 1027
 	var respJSON map[string]interface{}
@@ -912,7 +1041,7 @@ func (c *NmController) Post2402() {
912 1041
 	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
913 1042
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
914 1043
 	secret_key := respJSON["secret_key"].(string)
915
-	result, request_log := service.ZHGdyb2402(struct2402, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
1044
+	result, request_log := service.Hb2402(struct2402, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
916 1045
 	saveJsLog(result, request_log, "2402", "出院", org_name)
917 1046
 	var dat2 map[string]interface{}
918 1047
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
@@ -927,7 +1056,6 @@ func (c *NmController) Post2402() {
927 1056
 		"request_log": dat2,
928 1057
 	})
929 1058
 }
930
-
931 1059
 func (c *NmController) Post2301() {
932 1060
 
933 1061
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
@@ -962,7 +1090,7 @@ func (c *NmController) Post2301() {
962 1090
 	//med_type := strconv.FormatInt(int64(respJSON["med_type"].(float64)), 10)
963 1091
 	psn_no := respJSON["psn_no"].(string)
964 1092
 
965
-	result, requestLog := service.ZHGdyb2301A(psn_no, number, customs, chrg_bchno, org_name, doctor_name, dept, fixmedins_code, dept_code, doctor_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, opertor)
1093
+	result, requestLog := service.Hb2301A(psn_no, number, customs, chrg_bchno, org_name, doctor_name, dept, fixmedins_code, dept_code, doctor_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, opertor)
966 1094
 	saveJsLog(result, requestLog, "2301", "上传明细", org_name)
967 1095
 
968 1096
 	var dat2 map[string]interface{}
@@ -990,7 +1118,7 @@ func (c *NmController) Post2302() {
990 1118
 	org_name := c.GetString("org_name")
991 1119
 	refund_type, _ := c.GetInt64("refund_type")
992 1120
 
993
-	result, requestLog := service.Gdyb2302(psn_no, mdtrt_id, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, number, refund_type)
1121
+	result, requestLog := service.Hb2302(psn_no, mdtrt_id, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, number, refund_type)
994 1122
 	saveJsLog(result, requestLog, "2302", "退明细", org_name)
995 1123
 	var dat2 map[string]interface{}
996 1124
 	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
@@ -1005,7 +1133,6 @@ func (c *NmController) Post2302() {
1005 1133
 		"request_log": dat2,
1006 1134
 	})
1007 1135
 }
1008
-
1009 1136
 func (c *NmController) Post2303() {
1010 1137
 	mdtrt_id := c.GetString("mdtrt_id")
1011 1138
 	psn_no := c.GetString("psn_no")
@@ -1025,7 +1152,7 @@ func (c *NmController) Post2303() {
1025 1152
 	secret_key := c.GetString("secret_key")
1026 1153
 	org_name := c.GetString("org_name")
1027 1154
 
1028
-	result, src_resquest := service.ZHGdyb2303(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates)
1155
+	result, src_resquest := service.Hb2303(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates)
1029 1156
 	saveJsLog(result, src_resquest, "2303", "预结算", org_name)
1030 1157
 	var dat2 map[string]interface{}
1031 1158
 	if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
@@ -1061,7 +1188,7 @@ func (c *NmController) Post2304() {
1061 1188
 	fapiao_number := c.GetString("fapiao_number")
1062 1189
 	acct_used_flag := c.GetString("acct_used_flag")
1063 1190
 
1064
-	result, src_resquest := service.ZHGdyb2304(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates, fapiao_number, acct_used_flag)
1191
+	result, src_resquest := service.Hb2304(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates, fapiao_number, acct_used_flag)
1065 1192
 	saveJsLog(result, src_resquest, "2304", "住院结算", org_name)
1066 1193
 	var dat2 map[string]interface{}
1067 1194
 	if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
@@ -1088,7 +1215,7 @@ func (c *NmController) Post2305() {
1088 1215
 	secret_key := c.GetString("secret_key")
1089 1216
 	org_name := c.GetString("org_name")
1090 1217
 
1091
-	result, requestLog := service.Gdyb2305(psn_no, mdtrt_id, setl_id, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1218
+	result, requestLog := service.Hb2305(psn_no, mdtrt_id, setl_id, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1092 1219
 	saveJsLog(result, requestLog, "2305", "退费", org_name)
1093 1220
 	var dat2 map[string]interface{}
1094 1221
 	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
@@ -1460,7 +1587,7 @@ func (c *NmController) GetELeInfo(code string, operator_id string, operator_name
1460 1587
 	input := make(map[string]interface{})
1461 1588
 	inputData := make(map[string]interface{})
1462 1589
 	inputData["orgId"] = code
1463
-	inputData["businessType"] = "01103"
1590
+	inputData["businessType"] = "01101"
1464 1591
 	inputData["operatorId"] = operator_id
1465 1592
 	inputData["operatorName"] = operator_name
1466 1593
 	inputData["officeId"] = "001"
@@ -1658,7 +1785,7 @@ func (c *NmController) Get3201() {
1658 1785
 		AcctPay:          acctPay,
1659 1786
 		FixmedinsSetlCnt: fixmedinsSetlCnt,
1660 1787
 	}
1661
-	result := service.Gdyb3201(baseParams, businessParams)
1788
+	result := service.Gdyb3201(baseParams, businessParams,0)
1662 1789
 	saveJsLog(result, "", "3201", "对总账", org_name)
1663 1790
 	var dat map[string]interface{}
1664 1791
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {

+ 279 - 193
controllers/sg/gdyb_controller.go View File

@@ -16,23 +16,84 @@ type GdybController struct {
16 16
 }
17 17
 
18 18
 func GdybRegistRouters() {
19
-	beego.Router("/gdyb/one", &GdybController{}, "get:PostOne")
20
-	beego.Router("/gdyb/two", &GdybController{}, "get:PostTwo")
21
-	beego.Router("/gdyb/three", &GdybController{}, "get:PostThree")
22
-	//beego.Router("/gdyb/four", &GdybController{}, "get:PostFour")
23
-	//beego.Router("/gdyb/five", &GdybController{}, "post:PostFive")
19
+	beego.Router("/gdyb/1101", &GdybController{}, "get:PostOne")
20
+	beego.Router("/gdyb/2201", &GdybController{}, "get:PostTwo")
21
+	beego.Router("/gdyb/2202", &GdybController{}, "get:PostThree")
22
+	beego.Router("/gdyb/2203", &GdybController{}, "post:PostFour")
23
+	beego.Router("/gdyb/2204", &GdybController{}, "post:PostFive")
24 24
 	beego.Router("/gdyb/six", &GdybController{}, "get:PostSix")
25
-	//beego.Router("/gdyb/seven", &GdybController{}, "get:PostSeven")
26
-	beego.Router("/gdyb/eight", &GdybController{}, "get:PostEight")
27
-	//beego.Router("/gdyb/nine", &GdybController{}, "get:PostNine")
25
+	beego.Router("/gdyb/2206", &GdybController{}, "get:PostSeven")
26
+	beego.Router("/gdyb/2207", &GdybController{}, "get:PostEight")
27
+	beego.Router("/gdyb/2208", &GdybController{}, "get:PostNine")
28 28
 	beego.Router("/gdyb/ten", &GdybController{}, "get:PostTen")
29 29
 	beego.Router("/gdyb/eleven", &GdybController{}, "get:PostEleven")
30 30
 	beego.Router("/gdyb/twelve", &GdybController{}, "get:PostTwelve")
31
+	beego.Router("/gdyb/5203", &GdybController{}, "get:Post5203")
32
+	beego.Router("/gdyb/4101", &GdybController{}, "post:Post4101")
33
+	beego.Router("/gdyb/5301", &GdybController{}, "get:Post5301")
31 34
 
32
-	beego.Router("/gdyb/zh/five", &GdybController{}, "post:PostZHFive")
33 35
 
36
+
37
+}
38
+func (c *GdybController) Post5301() {
39
+	psnNo := c.GetString("psn_no")
40
+	org_name := c.GetString("org_name")
41
+	doctor := c.GetString("doctor")
42
+	fixmedins_code := c.GetString("fixmedins_code")
43
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
44
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
45
+	secret_key := c.GetString("secret_key")
46
+
47
+	result := service.Gdyb5301(psnNo,org_name,doctor,fixmedins_code,insuplc_admdvs,mdtrtarea_admvs,secret_key,0)
48
+	var dat map[string]interface{}
49
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
50
+		fmt.Println(dat)
51
+	} else {
52
+		fmt.Println(err)
53
+	}
54
+	saveLogq(result, "", "5301", "备案")
55
+
56
+	//saveLog(result, "", "4101", "上传明细清单")
57
+	c.ServeSuccessJSON(map[string]interface{}{
58
+		"pre": dat,
59
+	})
34 60
 }
35 61
 
62
+func (c *GdybController) Post4101() {
63
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
64
+	var respJSON map[string]interface{}
65
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
66
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
67
+		return
68
+	}
69
+	struct4101UserJSONBytes, _ := json.Marshal(respJSON["struct4101"])
70
+	var struct4101 service.Struct4101
71
+	if err := json.Unmarshal(struct4101UserJSONBytes, &struct4101); err != nil {
72
+		utils.ErrorLog("解析失败:%v", err)
73
+		return
74
+	}
75
+	ppUserJSONBytes, _ := json.Marshal(respJSON["pp"])
76
+	var pp models.PublicParams
77
+	if err := json.Unmarshal(ppUserJSONBytes, &pp); err != nil {
78
+		utils.ErrorLog("解析失败:%v", err)
79
+		return
80
+	}
81
+	result, _ := service.Gdyb4101(struct4101, pp.SecretKey, pp.FixmedinsName, pp.OpterName, pp.FixmedinsCode, pp.InsuplcAdmdvs, pp.MdtrtareaAdmvs, 0,0)
82
+	var dat map[string]interface{}
83
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
84
+		fmt.Println(dat)
85
+	} else {
86
+		fmt.Println(err)
87
+	}
88
+	saveLogq(result, "", "4101", "上传明细清单")
89
+
90
+	//saveLog(result, "", "4101", "上传明细清单")
91
+	c.ServeSuccessJSON(map[string]interface{}{
92
+		"pre": dat,
93
+	})
94
+}
95
+
96
+
36 97
 type Result struct {
37 98
 	ErrMsg      interface{} `json:"err_msg"`
38 99
 	InfRefmsgid string      `json:"inf_refmsgid"`
@@ -100,23 +161,27 @@ func (c *GdybController) PostOne() {
100 161
 		"log": dat2,
101 162
 	})
102 163
 }
103
-
104 164
 func (c *GdybController) PostTwo() {
105 165
 	psnNo := c.GetString("psn_no")
106 166
 	insutype := c.GetString("insutype")
107 167
 	certNo := c.GetString("cert_no")
108 168
 	org_name := c.GetString("org_name")
109
-	doctor := c.GetString("doctor")
169
+	operator := c.GetString("operator")
110 170
 	ipt_otp_no := c.GetString("ipt_otp_no")
111 171
 	dept := c.GetString("dept")
112 172
 	fixmedins_code := c.GetString("fixmedins_code")
113 173
 	dept_code := c.GetString("dept_code")
114 174
 	doctor_id := c.GetString("doctor_id")
175
+	doctor_name := c.GetString("doctor_name")
176
+	verify_number := c.GetString("verify_number")
115 177
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
116 178
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
117 179
 	secret_key := c.GetString("secret_key")
118 180
 	id_card_type, _ := c.GetInt64("id_card_type")
119
-	result, _ := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, "")
181
+	record_time  := c.GetString("record_time")
182
+
183
+	result, inputLog := service.Gdyb2201A(psnNo, insutype, certNo, org_name, operator, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, doctor_name, record_time, verify_number,0)
184
+	saveLogq(result, inputLog, "2201", "退号")
120 185
 
121 186
 	var dat map[string]interface{}
122 187
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -125,6 +190,7 @@ func (c *GdybController) PostTwo() {
125 190
 
126 191
 	}
127 192
 
193
+
128 194
 	c.ServeSuccessJSON(map[string]interface{}{
129 195
 		"pre": dat,
130 196
 	})
@@ -135,13 +201,15 @@ func (c *GdybController) PostThree() {
135 201
 	mdtrtId := c.GetString("mdtrt_id")
136 202
 	iptOtpNo := c.GetString("ipt_otp_no")
137 203
 	org_name := c.GetString("org_name")
138
-	doctor := c.GetString("doctor")
204
+	operator := c.GetString("operator")
139 205
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
140 206
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
141 207
 	secret_key := c.GetString("secret_key")
142 208
 	fixmedins_code := c.GetString("fixmedins_code")
143
-	result, requestLog := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
144
-	saveLog(result, requestLog, "2202", "退号")
209
+	admin_user_id,_ := c.GetInt64("admin_user_id")
210
+
211
+	result, requestLog := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, operator, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code,admin_user_id)
212
+	saveLogq(result, requestLog, "2202", "退号")
145 213
 	var dat map[string]interface{}
146 214
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
147 215
 	} else {
@@ -151,41 +219,60 @@ func (c *GdybController) PostThree() {
151 219
 	})
152 220
 }
153 221
 
154
-//func (c *GdybController) PostFour() {
155
-//	psnNo := c.GetString("psn_no")
156
-//	mdtrtId := c.GetString("mdtrt_id")
157
-//	doctor := c.GetString("doctor")
158
-//	department := c.GetString("department")
159
-//	diag := c.GetString("diag")
160
-//	org_name := c.GetString("org_name")
161
-//	med_type := c.GetString("med_type")
162
-//	doctor_id, _ := c.GetInt64("doctor_id", 0)
163
-//	fixmedins_code := c.GetString("fixmedins_code")
164
-//	diag_code := c.GetString("diag_code")
165
-//	sick_code := c.GetString("sick_code")
166
-//	sick_name := c.GetString("sick_name")
167
-//	dept := c.GetString("dept")
168
-//
169
-//	insuplc_admdvs := c.GetString("insuplc_admdvs")
170
-//	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
171
-//	secret_key := c.GetString("secret_key")
172
-//
173
-//	var result string
174
-//	if insuplc_admdvs == "440781" { //
175
-//		result = service.Gdyb2203A(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept)
176
-//	} else {
177
-//		result = service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept)
178
-//	}
179
-//	var dat map[string]interface{}
180
-//	if err := json.Unmarshal([]byte(result), &dat); err == nil {
181
-//
182
-//	} else {
183
-//
184
-//	}
185
-//	c.ServeSuccessJSON(map[string]interface{}{
186
-//		"pre": dat,
187
-//	})
188
-//}
222
+func (c *GdybController) PostFour() {
223
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
224
+	var respJSON map[string]interface{}
225
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
226
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
227
+		return
228
+	}
229
+	userJSONBytes, _ := json.Marshal(respJSON["config"])
230
+	var config []*models.HisXtDiagnoseConfig
231
+	if err := json.Unmarshal(userJSONBytes, &config); err != nil {
232
+		utils.ErrorLog("解析失败:%v", err)
233
+		return
234
+	}
235
+	fmt.Println(respJSON["psn_no"].(string))
236
+	fmt.Println(respJSON["mdtrt_id"].(string))
237
+
238
+	psnNo := respJSON["psn_no"].(string)
239
+	mdtrtId := respJSON["mdtrt_id"].(string)
240
+	doctor := respJSON["doctor"].(string)
241
+	department := respJSON["department"].(string)
242
+
243
+	org_name := respJSON["org_name"].(string)
244
+	med_type := respJSON["med_type"].(string)
245
+	doctor_id := respJSON["doctor_id"].(string)
246
+	fixmedins_code := respJSON["fixmedins_code"].(string)
247
+	sick_code := respJSON["sick_code"].(string)
248
+	sick_name := respJSON["sick_name"].(string)
249
+	dept := respJSON["dept"].(string)
250
+
251
+	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
252
+	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
253
+	secret_key := respJSON["secret_key"].(string)
254
+	begin_time := respJSON["begin_time"].(string)
255
+
256
+	new_doctor_name := respJSON["new_doctor_name"].(string)
257
+
258
+
259
+
260
+
261
+
262
+	result, request_log := service.Gdyb2203c(psnNo, mdtrtId, doctor, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, begin_time,new_doctor_name)
263
+	saveLogq(result, request_log, "2203", "上传就诊信息")
264
+
265
+	var dat map[string]interface{}
266
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
267
+
268
+	} else {
269
+
270
+	}
271
+	c.ServeSuccessJSON(map[string]interface{}{
272
+		"pre":         dat,
273
+
274
+	})
275
+}
189 276
 
190 277
 type All struct {
191 278
 	HisPrescription HisPrescription
@@ -211,73 +298,71 @@ type HisPrescription struct {
211 298
 	HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"project"`
212 299
 }
213 300
 
214
-//func (c *GdybController) PostFive() {
215
-//	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
216
-//	var respJSON map[string]interface{}
217
-//	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
218
-//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
219
-//		return
220
-//	}
221
-//	userJSONBytes, _ := json.Marshal(respJSON["pre"])
222
-//	var hp []*models.HisPrescription
223
-//	if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
224
-//		utils.ErrorLog("解析失败:%v", err)
225
-//		return
226
-//	}
227
-//	fmt.Println(respJSON["psn_no"].(string))
228
-//	fmt.Println(respJSON["mdtrt_id"].(string))
229
-//
230
-//	fmt.Println(respJSON["chrg_bchno"].(string))
231
-//	fmt.Println(respJSON["org_name"].(string))
232
-//	fmt.Println(respJSON["doctor"].(string))
233
-//	fmt.Println(respJSON["dept"].(string))
234
-//
235
-//	fmt.Println(respJSON["fixmedins_code"].(string))
236
-//	fmt.Println(respJSON["dept_code"].(string))
237
-//	fmt.Println(respJSON["doctor_id"].(string))
238
-//
239
-//	fmt.Println(respJSON["insuplc_admdvs"].(string))
240
-//	fmt.Println(respJSON["mdtrtarea_admvs"].(string))
241
-//	fmt.Println(respJSON["secret_key"].(string))
242
-//
243
-//	result, requestLog := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
244
-//		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string))
245
-//
246
-//	var dat map[string]interface{}
247
-//	if err := json.Unmarshal([]byte(result), &dat); err == nil {
248
-//		fmt.Println(dat)
249
-//	} else {
250
-//		fmt.Println(err)
251
-//	}
252
-//
253
-//	var dat2 map[string]interface{}
254
-//	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
255
-//		fmt.Println(dat2)
256
-//	} else {
257
-//		fmt.Println(err)
258
-//	}
259
-//
260
-//	c.ServeSuccessJSON(map[string]interface{}{
261
-//		"pre":         dat,
262
-//		"request_log": requestLog,
263
-//	})
264
-//}
301
+func (c *GdybController) PostFive() {
302
+	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
303
+	var respJSON map[string]interface{}
304
+	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
305
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
306
+		return
307
+	}
308
+	userJSONBytes, _ := json.Marshal(respJSON["pre"])
309
+	var hp []*models.HisPrescription
310
+	if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
311
+		utils.ErrorLog("解析失败:%v", err)
312
+		return
313
+	}
314
+	fmt.Println(respJSON["psn_no"].(string))
315
+	fmt.Println(respJSON["mdtrt_id"].(string))
316
+
317
+	fmt.Println(respJSON["chrg_bchno"].(string))
318
+	fmt.Println(respJSON["org_name"].(string))
319
+	fmt.Println(respJSON["doctor"].(string))
320
+	fmt.Println(respJSON["dept"].(string))
321
+
322
+	fmt.Println(respJSON["fixmedins_code"].(string))
323
+	fmt.Println(respJSON["dept_code"].(string))
324
+	fmt.Println(respJSON["doctor_id"].(string))
325
+
326
+	fmt.Println(respJSON["insuplc_admdvs"].(string))
327
+	fmt.Println(respJSON["mdtrtarea_admvs"].(string))
328
+	fmt.Println(respJSON["secret_key"].(string))
329
+
330
+	result, requestLog := service.Gdyb2204For441799(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
331
+		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["new_doctor_name"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["doctor_id"].(string), respJSON["diag_code"].(string))
332
+	saveLogq(result, requestLog, "2204", "上传明细")
333
+
334
+	var dat map[string]interface{}
335
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
336
+		fmt.Println(dat)
337
+	} else {
338
+		fmt.Println(err)
339
+	}
340
+
341
+	c.ServeSuccessJSON(map[string]interface{}{
342
+		"pre":         dat,
343
+
344
+	})
345
+}
265 346
 
266 347
 func (c *GdybController) PostSix() {
267 348
 	psnNo := c.GetString("psn_no")
268 349
 	mdtrtId := c.GetString("mdtrt_id")
269 350
 	chrgBchno := c.GetString("chrg_bchno")
270 351
 	org_name := c.GetString("org_name")
271
-	doctor := c.GetString("doctor")
352
+	operator := c.GetString("doctor")
272 353
 
273 354
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
274 355
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
275 356
 
276 357
 	secret_key := c.GetString("secret_key")
277 358
 	fixmedins_code := c.GetString("fixmedins_code")
359
+	//fixmedins_code := c.Get("fixmedins_code")
360
+	admin_user_id, _ := c.GetInt64("admin_user_id")
361
+
362
+
363
+	result, requestlog := service.Gdyb2205(psnNo, mdtrtId, chrgBchno, org_name, operator, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code,admin_user_id)
364
+	saveLogq(result, requestlog, "2205", "上传就诊信息")
278 365
 
279
-	result, requestlog := service.Gdyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
280
-	fmt.Println(requestlog)
281 366
 	var dat map[string]interface{}
282 367
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
283 368
 		fmt.Println(dat)
@@ -285,40 +370,40 @@ func (c *GdybController) PostSix() {
285 370
 		fmt.Println(err)
286 371
 	}
287 372
 	c.ServeSuccessJSON(map[string]interface{}{
288
-		"pre": result,
373
+		"pre": dat,
289 374
 	})
290 375
 }
291 376
 
292
-//func (c *GdybController) PostSeven() {
293
-//	psnNo := c.GetString("psn_no")
294
-//	mdtrtId := c.GetString("mdtrt_id")
295
-//	chrgBchno := c.GetString("chrg_bchno")
296
-//	certNo := c.GetString("cert_no")
297
-//	insutype := c.GetString("insutype")
298
-//	total := c.GetString("total")
299
-//	org_name := c.GetString("org_name")
300
-//	doctor := c.GetString("doctor")
301
-//	fixmedins_code := c.GetString("fixmedins_code")
302
-//	insuplc_admdvs := c.GetString("insuplc_admdvs")
303
-//	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
304
-//	secret_key := c.GetString("secret_key")
305
-//	med_type := c.GetString("med_type")
306
-//	id_card_type, _ := c.GetInt64("id_card_type")
307
-//
308
-//	//result := service.Gdyb2206(psnNo/**/, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, secret_key)
309
-//
310
-//	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type)
311
-//
312
-//	var dat map[string]interface{}
313
-//	if err := json.Unmarshal([]byte(result), &dat); err == nil {
314
-//		fmt.Println(dat)
315
-//	} else {
316
-//		fmt.Println(err)
317
-//	}
318
-//	c.ServeSuccessJSON(map[string]interface{}{
319
-//		"pre": dat,
320
-//	})
321
-//}
377
+func (c *GdybController) PostSeven() {
378
+	psnNo := c.GetString("psn_no")
379
+	mdtrtId := c.GetString("mdtrt_id")
380
+	chrgBchno := c.GetString("chrg_bchno")
381
+	certNo := c.GetString("cert_no")
382
+	insutype := c.GetString("insutype")
383
+	total := c.GetString("total")
384
+	org_name := c.GetString("org_name")
385
+	operator := c.GetString("operator")
386
+	fixmedins_code := c.GetString("fixmedins_code")
387
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
388
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
389
+	secret_key := c.GetString("secret_key")
390
+	med_type := c.GetString("med_type")
391
+	id_card_type, _ := c.GetInt64("id_card_type")
392
+
393
+	certificates, _ := c.GetInt64("certificates")
394
+	result, log := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates,0)
395
+	saveLogq(result, log, "2206", "预结算")
396
+
397
+	var dat map[string]interface{}
398
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
399
+		fmt.Println(dat)
400
+	} else {
401
+		fmt.Println(err)
402
+	}
403
+	c.ServeSuccessJSON(map[string]interface{}{
404
+		"pre": dat,
405
+	})
406
+}
322 407
 
323 408
 func (c *GdybController) PostEight() {
324 409
 	psnNo := c.GetString("psn_no")
@@ -328,20 +413,23 @@ func (c *GdybController) PostEight() {
328 413
 	insutype := c.GetString("insutype")
329 414
 	total := c.GetString("total")
330 415
 	org_name := c.GetString("org_name")
331
-	doctor := c.GetString("doctor")
416
+	operator := c.GetString("operator")
332 417
 	fixmedins_code := c.GetString("fixmedins_code")
333 418
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
334 419
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
335 420
 	secret_key := c.GetString("secret_key")
336 421
 	med_type := c.GetString("med_type")
337 422
 	id_card_type, _ := c.GetInt64("id_card_type")
423
+	verify_number := c.GetString("verify_number")
424
+	acct_used_flag := c.GetString("acct_used_flag")
338 425
 
339 426
 	fulamt_ownpay_amt, _ := c.GetFloat("fulamt_ownpay_amt")
340 427
 	overlmt_selfpay, _ := c.GetFloat("overlmt_selfpay")
341 428
 	preselfpay_amt, _ := c.GetFloat("preselfpay_amt")
342 429
 	inscp_scp_amt, _ := c.GetFloat("inscp_scp_amt")
343 430
 
344
-	result, srcRequest := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, 1, "0", "")
431
+	result, srcRequest := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, 1, acct_used_flag, verify_number,0)
432
+	saveLogq(result, srcRequest, "2207", "结算")
345 433
 	var dat map[string]interface{}
346 434
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
347 435
 		fmt.Println(dat)
@@ -349,36 +437,37 @@ func (c *GdybController) PostEight() {
349 437
 		fmt.Println(err)
350 438
 	}
351 439
 
352
-	var dat2 map[string]interface{}
353
-	if err := json.Unmarshal([]byte(srcRequest), &dat2); err == nil {
354
-		fmt.Println(dat2)
440
+	c.ServeSuccessJSON(map[string]interface{}{
441
+		"pre":  dat,
442
+	})
443
+}
444
+
445
+func (c *GdybController) PostNine() {
446
+	psnNo := c.GetString("psn_no")
447
+	mdtrtId := c.GetString("mdtrt_id")
448
+	setlId := c.GetString("setl_id")
449
+	org_name := c.GetString("org_name")
450
+	operator := c.GetString("operator")
451
+	secret_key := c.GetString("secret_key")
452
+	fixmedins_code := c.GetString("fixmedins_code")
453
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
454
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
455
+	result, srcRequest := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, operator, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,0)
456
+	saveLogq(result, srcRequest, "2208", "退费")
457
+
458
+	var dat map[string]interface{}
459
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
460
+		fmt.Println(dat)
355 461
 	} else {
356 462
 		fmt.Println(err)
357 463
 	}
358 464
 
359 465
 	c.ServeSuccessJSON(map[string]interface{}{
360 466
 		"pre":  dat,
361
-		"pre2": dat2,
362 467
 	})
363 468
 }
364 469
 
365
-//func (c *GdybController) PostNine() {
366
-//	psnNo := c.GetString("psn_no")
367
-//	mdtrtId := c.GetString("mdtrt_id")
368
-//	setlId := c.GetString("setl_id")
369
-//	org_name := c.GetString("org_name")
370
-//	doctor := c.GetString("doctor")
371
-//	secret_key := c.GetString("secret_key")
372
-//	fixmedins_code := c.GetString("fixmedins_code")
373
-//	insuplc_admdvs := c.GetString("insuplc_admdvs")
374
-//	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
375
-//	//result, src_request := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
376
-//
377
-//}
378
-
379 470
 func (c *GdybController) PostTen() {
380
-	fmt.Println("11222333-----")
381
-
382 471
 	insutype := c.GetString("insutype")
383 472
 	clrType := c.GetString("clr_type")
384 473
 	setlOptins := c.GetString("setl_optins")
@@ -394,6 +483,10 @@ func (c *GdybController) PostTen() {
394 483
 	secret_key := c.GetString("secret_key")
395 484
 	org_name := c.GetString("org_name")
396 485
 	doctor := c.GetString("doctor")
486
+	//doctor := c.Get("doctor")
487
+	admin_user_id, _ := c.GetInt64("admin_user_id")
488
+
489
+
397 490
 
398 491
 	fmt.Println(insutype)
399 492
 	fmt.Println(clrType)
@@ -424,7 +517,7 @@ func (c *GdybController) PostTen() {
424 517
 	fmt.Println(baseParams)
425 518
 	fmt.Println(businessParams)
426 519
 
427
-	result := service.Gdyb3201(baseParams, businessParams)
520
+	result := service.Gdyb3201(baseParams, businessParams,admin_user_id)
428 521
 	var dat map[string]interface{}
429 522
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
430 523
 		fmt.Println(dat)
@@ -521,45 +614,38 @@ func (c *GdybController) PostTwelve() {
521 614
 	})
522 615
 }
523 616
 
524
-func (c *GdybController) PostZHFive() {
525
-	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
526
-	var respJSON map[string]interface{}
527
-	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
528
-		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
529
-		return
617
+func (c *GdybController) Post5203() {
618
+	org_name := c.GetString("org_name")
619
+	operator := c.GetString("doctor")
620
+	fixmedins_code := c.GetString("fixmedins_code")
621
+	insuplc_admdvs := c.GetString("insuplc_admdvs")
622
+	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
623
+	secret_key := c.GetString("secret_key")
624
+	psn_no := c.GetString("psn_no")
625
+	mdtrt_id := c.GetString("mdtrt_id")
626
+	setl_id := c.GetString("setl_id")
627
+	bp := models.BaseParams{
628
+		SecretKey:      secret_key,
629
+		FixmedinsCode:  fixmedins_code,
630
+		InsuplcAdmdvs:  insuplc_admdvs,
631
+		MdtrtareaAdmvs: mdtrtarea_admvs,
632
+		OrgName:        org_name,
633
+		Doctor:         operator,
530 634
 	}
531
-	userJSONBytes, _ := json.Marshal(respJSON["pre"])
532
-	var hp []*models.NewCustom
533
-	if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
534
-		utils.ErrorLog("解析失败:%v", err)
535
-		return
635
+	bps := models.BusinessParams{
636
+		PsnNo:   psn_no,
637
+		MdtrtId: mdtrt_id,
638
+		SetlId:  setl_id,
536 639
 	}
537
-	fmt.Println(respJSON["psn_no"].(string))
538
-	fmt.Println(respJSON["mdtrt_id"].(string))
539
-
540
-	fmt.Println(respJSON["chrg_bchno"].(string))
541
-	fmt.Println(respJSON["org_name"].(string))
542
-	fmt.Println(respJSON["doctor"].(string))
543
-	fmt.Println(respJSON["dept"].(string))
544
-
545
-	fmt.Println(respJSON["fixmedins_code"].(string))
546
-	fmt.Println(respJSON["dept_code"].(string))
547
-	fmt.Println(respJSON["doctor_id"].(string))
548
-
549
-	fmt.Println(respJSON["insuplc_admdvs"].(string))
550
-	fmt.Println(respJSON["mdtrtarea_admvs"].(string))
551
-	fmt.Println(respJSON["secret_key"].(string))
640
+	result := service.Gdyb5203(bp, bps)
641
+	saveLogq(result, "", "5203", "结算单")
642
+	var dat map[string]interface{}
643
+	if err := json.Unmarshal([]byte(result), &dat); err == nil {
552 644
 
553
-	//result := service.ZHGdyb2301(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
554
-	//	respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["med_type"].(string))
645
+	} else {
555 646
 
556
-	//var dat map[string]interface{}
557
-	//if err := json.Unmarshal([]byte(result), &dat); err == nil {
558
-	//	fmt.Println(dat)
559
-	//} else {
560
-	//	fmt.Println(err)
561
-	//}
647
+	}
562 648
 	c.ServeSuccessJSON(map[string]interface{}{
563
-		"pre": "",
649
+		"pre": dat,
564 650
 	})
565 651
 }

File diff suppressed because it is too large
+ 28071 - 16845
controllers/sg/his_api_controller.go


File diff suppressed because it is too large
+ 2887 - 170
controllers/zh/zh_his_api_controller.go


+ 4 - 0
enums/error_code.go View File

@@ -262,6 +262,8 @@ const ( // ErrorCode
262 262
 
263 263
 	ErrorCodeHisPatientNoRegException = 4000000
264 264
 	ErrorCodeCreateOrderExceptionT    = 200680000
265
+
266
+	ErrorPsnNoEmpty = 310000
265 267
 )
266 268
 
267 269
 var ErrCodeMsgs = map[int]string{
@@ -504,6 +506,8 @@ var ErrCodeMsgs = map[int]string{
504 506
 	ErrorCodeHisPatientNoRegException: "该患者尚未挂号,请先挂号",
505 507
 
506 508
 	ErrorCodeCreateOrderExceptionT: "记账失败",
509
+
510
+	ErrorPsnNoEmpty: "人员编码不能为空",
507 511
 }
508 512
 
509 513
 type SGJError struct {

BIN
gdyb View File


File diff suppressed because it is too large
+ 3613 - 3346
main.go


+ 26 - 0
models/cfyljg.go View File

@@ -163,6 +163,8 @@ type CFYLJG003 struct {
163 163
 	PharChkTime     string `json:"phar_chk_time"`
164 164
 	RxFile          string `json:"rx_file"`
165 165
 	SignDigest      string `json:"sign_digest"`
166
+	EcToken      string `json:"ec_token"`
167
+
166 168
 }
167 169
 
168 170
 type CFYLJG004 struct {
@@ -202,8 +204,28 @@ type CFYLJG007 struct {
202 204
 	PsnNo         string `json:"psn_no"`
203 205
 	PsnCertType   string `json:"psn_cert_type"`
204 206
 	Certno        string `json:"certno"`
207
+	PsnName       string `json:"psn_name"`
208
+
209
+
210
+}
211
+
212
+type MedinsProdInvChgDDTO struct {
213
+	MedListCodg  string  `json:"medListCodg"`
214
+	Cnt          float64 `json:"cnt"`
205 215
 }
206 216
 
217
+type CFYLJG008 struct {
218
+	PageNum      int                  `json:"pageNum"`
219
+	PageSize     int                  `json:"pageSize"`
220
+	OrderType    string               `json:"orderType"`
221
+	PoolareaNo   string               `json:"poolareaNo"`
222
+	FixmedinsName string              `json:"fixmedinsName"`
223
+	Lng          string               `json:"lng"`
224
+	Lat          string               `json:"lat"`
225
+	MedList      []MedinsProdInvChgDDTO `json:"medinsProdInvChgDDTOList"`
226
+}
227
+
228
+
207 229
 type HisPrescriptionFlow struct {
208 230
 	ID             int64  `gorm:"column:id" json:"id" form:"id"`
209 231
 	RxTraceCode    string `gorm:"column:rx_trace_code" json:"rx_trace_code" form:"rx_trace_code"`
@@ -221,6 +243,10 @@ type HisPrescriptionFlow struct {
221 243
 	SignCertSn     string `gorm:"column:sign_cert_sn" json:"sign_cert_sn" form:"sign_cert_sn"`
222 244
 	SignCertDn     string `gorm:"column:sign_cert_dn" json:"sign_cert_dn" form:"sign_cert_dn"`
223 245
 	MID            string `gorm:"column:m_id" json:"m_id" form:"m_id"`
246
+	DCode            string `gorm:"column:m_id" json:"m_id" form:"m_id"`
247
+	DID           int64 `gorm:"column:d_id" json:"d_id" form:"d_id"`
248
+
249
+
224 250
 }
225 251
 
226 252
 func (HisPrescriptionFlow) TableName() string {

+ 2 - 0
models/doctor_advice_models.go View File

@@ -28,6 +28,8 @@ type DrugwayDic struct {
28 28
 	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
29 29
 	OrgId       int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
30 30
 	Creator     int64  `gorm:"column:creator" json:"creator" form:"creator"`
31
+	Bby01     string  `gorm:"column:bby01" json:"bby01" form:"bby01"`
32
+
31 33
 }
32 34
 
33 35
 func (DrugwayDic) TableName() string {

+ 5 - 0
models/drug.go View File

@@ -69,6 +69,11 @@ type BaseDrugLib struct {
69 69
 	DrugDay   string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
70 70
 	MinPrice  float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
71 71
 	IsUser    int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
72
+	ZuobiaoId             string    `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
73
+	Bck01b             string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
74
+	Bby01             string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
75
+
76
+
72 77
 
73 78
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
74 79
 }

+ 8 - 0
models/good_models.go View File

@@ -73,6 +73,14 @@ type GoodInfo struct {
73 73
 	IsUser             int64     `gorm:"column:is_user" json:"is_user" form:"is_user"`
74 74
 	PackingUnit        string    `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
75 75
 	Number             string    `gorm:"column:number" json:"number" form:"number"`
76
+	ZuobiaoId             string    `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
77
+	Bck01b             string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
78
+	Bby01             string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
79
+
80
+
81
+
82
+
83
+
76 84
 }
77 85
 
78 86
 func (GoodInfo) TableName() string {

+ 291 - 8
models/his_models.go View File

@@ -1,6 +1,10 @@
1 1
 package models
2 2
 
3
-import "time"
3
+import (
4
+	"encoding/xml"
5
+	"fmt"
6
+	"time"
7
+)
4 8
 
5 9
 type XtHisProject struct {
6 10
 	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
@@ -36,6 +40,8 @@ type XtHisProject struct {
36 40
 	DeliveryWay               string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
37 41
 	NumberDays                string  `gorm:"column:number_days" json:"number_days" form:"number_days"`
38 42
 	Total                     string  `gorm:"column:total" json:"total" form:"total"`
43
+	Vaf14             string    `gorm:"column:vaf14" json:"vaf14" form:"vaf14"`
44
+
39 45
 }
40 46
 
41 47
 func (XtHisProject) TableName() string {
@@ -228,6 +234,11 @@ type HisDoctorAdviceInfo struct {
228 234
 	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
229 235
 	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
230 236
 	HospApprFlag          int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
237
+	DrugWayCount               string  `gorm:"column:drug_way_count" json:"drug_way_count" form:"drug_way_count"`
238
+
239
+	NewGroupno               string   `gorm:"column:-" json:"new_groupno" form:"new_groupno"`
240
+	Newfn               string   `gorm:"column:-" json:"newfn" form:"newfn"`
241
+
231 242
 
232 243
 	BaseDrugLib BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
233 244
 }
@@ -302,6 +313,9 @@ type HisPrescriptionInfo struct {
302 313
 	DoctorId           int64           `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
303 314
 	XtHisDepartment    XtHisDepartment `gorm:"ForeignKey:ID;AssociationForeignKey:Departments" json:"department"`
304 315
 	SickType           int64           `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
316
+
317
+
318
+
305 319
 }
306 320
 
307 321
 func (HisPrescriptionInfo) TableName() string {
@@ -328,11 +342,16 @@ type HisPrescription struct {
328 342
 	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
329 343
 	Patients               Patients                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
330 344
 	HisPatient             VMHisPatient              `gorm:"ForeignKey:PatientId;AssociationForeignKey:patient_id" json:"hisPatient"`
331
-	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
332
-	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
333
-	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
334
-	VMHisPrescriptionInfo  HisPrescriptionInfo       `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"info"`
345
+	HisDoctorAdviceInfo    []HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
346
+	HisPrescriptionProject []HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
347
+	HisAdditionalCharge    []HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
348
+	VMHisPrescriptionInfo  HisPrescriptionInfo       `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,RecordDate" json:"info"`
335 349
 	MedType                string                    `gorm:"column:med_type" json:"med_type" form:"med_type"`
350
+	Cbm01                string                    `gorm:"column:cbm01" json:"cbm01" form:"cbm01"`
351
+	Cbm07                string                    `gorm:"column:cbm07" json:"cbm07" form:"cbm07"`
352
+
353
+
354
+
336 355
 }
337 356
 
338 357
 func (HisPrescription) TableName() string {
@@ -368,6 +387,12 @@ type HisProject struct {
368 387
 	Status                    int64   `gorm:"column:status" json:"status" form:"status"`
369 388
 	CreatedTime               int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
370 389
 	UpdatedTime               int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
390
+	ZuobiaoId             string    `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
391
+	Bck01b	 string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
392
+	Bby01             string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
393
+	Vaf14             string    `gorm:"column:vaf14" json:"vaf14" form:"vaf14"`
394
+
395
+
371 396
 }
372 397
 
373 398
 func (HisProject) TableName() string {
@@ -507,6 +532,9 @@ type HisPrescriptionProject struct {
507 532
 	DeliveryWay        string           `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
508 533
 	ExecutionFrequency string           `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
509 534
 	Day                string           `gorm:"column:day" json:"day" form:"day"`
535
+	StartTime                int64           `gorm:"column:start_time" json:"start_time" form:"start_time"`
536
+
537
+
510 538
 	HisProject         HisProject       `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
511 539
 	GoodInfo           GoodInfo         `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
512 540
 	Type               int64            `gorm:"column:type" json:"type" form:"type"`
@@ -877,7 +905,7 @@ type MedicalInsuranceOrgConfig struct {
877 905
 	MdtrtareaAdmvs string `gorm:"column:mdtrtarea_admvs" json:"mdtrtarea_admvs" form:"mdtrtarea_admvs"`
878 906
 	InsuplcAdmdvs  string `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
879 907
 	SecretKey      string `gorm:"column:secret_key" json:"secret_key" form:"secret_key"`
880
-	Url            string `gorm:"column:url" json:"url" form:"url"`
908
+Url            string `gorm:"column:url" json:"url" form:"url"`
881 909
 	AccessKey      string `gorm:"column:access_key" json:"access_key" form:"access_key"`
882 910
 	Cainfo         string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
883 911
 	AppSecret      string `gorm:"column:app_secret" json:"app_secret" form:"app_secret"`
@@ -1049,6 +1077,7 @@ type BusinessParams struct {
1049 1077
 	MdtrtId          string
1050 1078
 	SetlId           string
1051 1079
 	StasType         string
1080
+
1052 1081
 }
1053 1082
 
1054 1083
 type BusinessParamsTwo struct {
@@ -1069,6 +1098,20 @@ type BusinessParamsTwo struct {
1069 1098
 	SetlId           string
1070 1099
 }
1071 1100
 
1101
+
1102
+type BusinessParams5262 struct {
1103
+	RefdSetlFlag         string
1104
+	QBegntime         	 string
1105
+	QEndtime      		 string
1106
+	MedType   			 string
1107
+	PageNum     		 string
1108
+	PageSize      		 string
1109
+	Certno     			 string
1110
+	Psnno    			 string
1111
+
1112
+}
1113
+
1114
+
1072 1115
 type Custom struct {
1073 1116
 	DetItemFeeSumamt string
1074 1117
 	Cut              string
@@ -1182,6 +1225,8 @@ type MyHisProject struct {
1182 1225
 	SpecailProject              int64   `gorm:"column:specail_project" json:"specail_project" form:"specail_project"`
1183 1226
 	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
1184 1227
 	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1228
+	Vaf14             string    `gorm:"column:vaf14" json:"vaf14" form:"vaf14"`
1229
+
1185 1230
 }
1186 1231
 
1187 1232
 func (MyHisProject) TableName() string {
@@ -1350,6 +1395,10 @@ type HisPsn struct {
1350 1395
 	RecordDate    int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1351 1396
 	InsuplcAdmdvs string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
1352 1397
 	IdCardType    int64   `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
1398
+	AuthInfo    string   `gorm:"column:auth_info" json:"auth_info" form:"auth_info"`
1399
+
1400
+
1401
+
1353 1402
 }
1354 1403
 
1355 1404
 func (HisPsn) TableName() string {
@@ -1438,6 +1487,8 @@ type HisDoctorAdviceInfoTen struct {
1438 1487
 	HospApprFlag          int64        `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
1439 1488
 	BaseDrugLib           BaseDrugLib  `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
1440 1489
 	HisOrderInfo          HisOrderInfo `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"order_info"`
1490
+	DrugWayCount               string  `gorm:"column:drug_way_count" json:"drug_way_count" form:"drug_way_count"`
1491
+
1441 1492
 }
1442 1493
 
1443 1494
 func (HisDoctorAdviceInfoTen) TableName() string {
@@ -1661,17 +1712,49 @@ type NewCustomTwo struct {
1661 1712
 	Type             int64
1662 1713
 	AdviceId         int64
1663 1714
 	ProjectId        int64
1664
-	ItemId           int64
1715
+	ItemId           string
1716
+	StartTime        string
1717
+	Content string
1718
+	Bby01             string
1719
+
1720
+}
1721
+
1722
+type ChargeList struct {
1723
+	Bby01 			string
1724
+	Vaj25              string
1725
+	Bbx01              string
1726
+	Vaf21              string
1727
+	Vaf22              string
1728
+	Vaf42              string
1729
+
1730
+
1665 1731
 }
1666 1732
 
1733
+
1734
+type ChargeListtwo struct {
1735
+	Bby01 			int64  `json:"bby01"`
1736
+	Vaj25              float64 `json:"vaj25"`
1737
+
1738
+}
1667 1739
 type UploadInfo struct {
1668 1740
 	Bce02a   string `json:"bce02a"`
1741
+	Acf01   int64 `json:"acf01"`
1742
+	Bce01   string `json:"bce01"`
1743
+	Bck01   string `json:"bck01"`
1744
+	ChargeListtwo []*ChargeListtwo `json:"chargeList"`
1745
+	Bce01a   string `json:"bce01a"`
1746
+
1669 1747
 	Bck01c   string `json:"bck01c"`
1748
+	Bck01a   string `json:"bck01a"`
1749
+
1670 1750
 	Diag     []*Diag
1671 1751
 	Fasong   string `json:"fasong"`
1672 1752
 	PresInfo []*PresInfo
1673
-	Vaa01    int64 `json:"vaa01"`
1753
+	Vaa01    int64 `json:"bby01"`
1674 1754
 	Vaa07    int64 `json:"vaa07"`
1755
+	Vaa05    string `json:"vaa05"`
1756
+
1757
+
1675 1758
 }
1676 1759
 
1677 1760
 type Diag struct {
@@ -1830,3 +1913,203 @@ type NewHisOrder111 struct {
1830 1913
 func (NewHisOrder111) TableName() string {
1831 1914
 	return "his_order"
1832 1915
 }
1916
+
1917
+
1918
+type Root2 struct {
1919
+	XMLName    xml.Name   `xml:"Root"`
1920
+	TradeInfo  TradeInfo  `xml:"tradeinfo"`
1921
+
1922
+	VAF1       VAF10       `xml:"VAF1"`
1923
+
1924
+}
1925
+
1926
+
1927
+type Root struct {
1928
+	XMLName    xml.Name   `xml:"Root"`
1929
+	TradeInfo  TradeInfo  `xml:"tradeinfo"`
1930
+	CBM1       CBM1       `xml:"CBM1"`
1931
+	VAF1       VAF1       `xml:"VAF1"`
1932
+	VAO1       VAO1       `xml:"VAO1"`
1933
+	VBQ1       VBQ1       `xml:"VBQ1"`
1934
+}
1935
+
1936
+type TradeInfo struct {
1937
+	Type      int    `xml:"type"`
1938
+	PatSource int    `xml:"pat_source"`
1939
+	Detpid    string `xml:"detpid"`
1940
+	Empid     string `xml:"empid"`
1941
+	Empno     string `xml:"empno"`
1942
+	Empname   string `xml:"empname"`
1943
+}
1944
+
1945
+type CBM1 struct {
1946
+	Ie []IEone `xml:"Ie"`
1947
+}
1948
+
1949
+type VAF1 struct {
1950
+	Ie []IEtwo `xml:"Ie"`
1951
+}
1952
+
1953
+type VAO1 struct {
1954
+	Ie []IEthree `xml:"Ie"`
1955
+}
1956
+
1957
+type VBQ1 struct {
1958
+	Ie []IEfour `xml:"Ie"`
1959
+}
1960
+
1961
+type VAF10 struct {
1962
+	Ie []IEfive `xml:"Ie"`
1963
+}
1964
+
1965
+type IEone struct {
1966
+	CBMID  string `xml:"CBMID,attr"`
1967
+	VAA01  string `xml:"VAA01,attr"`
1968
+	VAA07  string `xml:"VAA07,attr"`
1969
+	ACF01  string `xml:"ACF01,attr"`
1970
+	CBM06  string `xml:"CBM06,attr"`
1971
+	CBM07  string `xml:"CBM07,attr"`
1972
+	BCK01A string `xml:"BCK01A,attr"`
1973
+	BCK01B string `xml:"BCK01B,attr"`
1974
+	BCK01C string `xml:"BCK01C,attr"`
1975
+	CBM19  string `xml:"CBM19,attr"`
1976
+
1977
+}
1978
+type IEtwo struct {
1979
+	CBMID  string `xml:"CBMID,attr"`
1980
+	VAF04  string `xml:"VAF04,attr"`
1981
+	VAA01  string `xml:"VAA01,attr"`
1982
+	VAF06  string `xml:"VAF06,attr"`
1983
+	BCK01A string `xml:"BCK01A,attr"`
1984
+	ROWNR  string `xml:"ROWNR,attr"`
1985
+	VAF10  string `xml:"VAF10,attr"`
1986
+	VAF11  string `xml:"VAF11,attr"`
1987
+	BDA01  string `xml:"BDA01,attr"`
1988
+	BBX01  string `xml:"BBX01,attr"`
1989
+	VAF14  string `xml:"VAF14,attr"`
1990
+	VAF15  string `xml:"VAF15,attr"`
1991
+	BBY01  string `xml:"BBY01,attr"`
1992
+	VAF17  string `xml:"VAF17,attr"`
1993
+	VAF18  string `xml:"VAF18,attr"`
1994
+	VAF19  string `xml:"VAF19,attr"`
1995
+	VAF20  string `xml:"VAF20,attr"`
1996
+	VAF21  string `xml:"VAF21,attr"`
1997
+	VAF22  string `xml:"VAF22,attr"`
1998
+	Crypt  string `xml:"Crypt,attr"`
1999
+	VAF23  string `xml:"VAF23,attr"`
2000
+	BCK01B string `xml:"BCK01B,attr"`
2001
+	VAF26  string `xml:"VAF26,attr"`
2002
+	VAF27  string `xml:"VAF27,attr"`
2003
+	VAF28  string `xml:"VAF28,attr"`
2004
+	VAF29  string `xml:"VAF29,attr"`
2005
+	VAF30  string `xml:"VAF30,attr"`
2006
+	VAF31  string `xml:"VAF31,attr"`
2007
+	VAF32  string `xml:"VAF32,attr"`
2008
+	VAF33  string `xml:"VAF33,attr"`
2009
+	VAF34  string `xml:"VAF34,attr"`
2010
+	VAF35  string `xml:"VAF35,attr"`
2011
+	VAF36  string `xml:"VAF36,attr"`
2012
+	VAF37  string `xml:"VAF37,attr"`
2013
+	BCE02A  string `xml:"BCE02A,attr"`
2014
+	BCE03A  string `xml:"BCE03A,attr"`
2015
+	BCE03B  string `xml:"BCE03B,attr"`
2016
+	VAF53  string `xml:"VAF53,attr"`
2017
+	VAF55  string `xml:"VAF55,attr"`
2018
+	BCK01D  string `xml:"BCK01D,attr"`
2019
+	VAF58  string `xml:"VAF58,attr"`
2020
+	VAF59  string `xml:"VAF59,attr"`
2021
+	VAF60  string `xml:"VAF60,attr"`
2022
+	VAF61  string `xml:"VAF61,attr"`
2023
+	VAF62  string `xml:"VAF62,attr"`
2024
+	LSign  string `xml:"lSign,attr"`
2025
+	BDA01A  string `xml:"BDA01A,attr"`
2026
+	LRoute  string `xml:"lRoute,attr"`
2027
+	BCE01A  string `xml:"BCE01A,attr"`
2028
+	BCE01B  string `xml:"BCE01B,attr"`
2029
+	VAF01B  string `xml:"VAF01B,attr"`
2030
+	VCO01  string `xml:"VCO01,attr"`
2031
+	BCE01H  string `xml:"BCE01H,attr"`
2032
+	BCE03H  string `xml:"BCE03H,attr"`
2033
+	BIW02  string `xml:"BIW02,attr"`
2034
+	RCurrent  string `xml:"rCurrent,attr"`
2035
+	FCheck  string `xml:"FCheck,attr"`
2036
+	UnameA  string `xml:"UnameA,attr"`
2037
+	VEH02  string `xml:"VEH02,attr"`
2038
+	BCK01C  string `xml:"BCK01C,attr"`
2039
+	VAF07  string `xml:"VAF07,attr"`
2040
+
2041
+
2042
+
2043
+
2044
+
2045
+
2046
+}
2047
+type IEthree struct {
2048
+	CBMID  string `xml:"CBMID,attr"`
2049
+	VAA01  string `xml:"VAA01,attr"`
2050
+	VAA07  string `xml:"VAA07,attr"`
2051
+	ACF01  string `xml:"ACF01,attr"`
2052
+
2053
+	VAO06  string `xml:"VAO06,attr"`
2054
+	VAO07  string `xml:"VAO07,attr"`
2055
+	VAO10  string `xml:"VAO10,attr"`
2056
+	VAO11  string `xml:"VAO11,attr"`
2057
+	BAK01A  string `xml:"BAK01A,attr"`
2058
+	CAM01  string `xml:"CAM01,attr"`
2059
+	VAO15  string `xml:"VAO15,attr"`
2060
+	VAO18  string `xml:"VAO18,attr"`
2061
+	VAO22  string `xml:"VAO22,attr"`
2062
+	IAA01  string `xml:"IAA01,attr"`
2063
+	IAD03  string `xml:"IAD03,attr"`
2064
+	BAK01B  string `xml:"BAK01B,attr"`
2065
+	VAO26  string `xml:"VAO26,attr"`
2066
+	IAD04  string `xml:"IAD04,attr"`
2067
+	IAD01  string `xml:"IAD01,attr"`
2068
+	VAO25  string `xml:"VAO25,attr"`
2069
+	VAO35  string `xml:"VAO35,attr"`
2070
+
2071
+
2072
+}
2073
+type IEfour struct {
2074
+	VBQ01  string `xml:"VBQ01,attr"`
2075
+	VAA01  string `xml:"VAA01,attr"`
2076
+	VAA07  string `xml:"VAA07,attr"`
2077
+	ACF01  string `xml:"ACF01,attr"`
2078
+	VAP01  string `xml:"VAP01,attr"`
2079
+	VBQ07  string `xml:"VBQ07,attr"`
2080
+	BCK01A string `xml:"BCK01A,attr"`
2081
+	BCK01B string `xml:"BCK01B,attr"`
2082
+	BCE03A  string `xml:"BCE03A,attr"`
2083
+	BCE01A  string `xml:"BCE01A,attr"`
2084
+	VBQ27  string `xml:"VBQ27,attr"`
2085
+	VBQ28  string `xml:"VBQ28,attr"`
2086
+	VBQ29  string `xml:"VBQ29,attr"`
2087
+	VBQ30  string `xml:"VBQ30,attr"`
2088
+
2089
+
2090
+}
2091
+type IEfive struct {
2092
+	VAF01  string `xml:"VAF01,attr"`
2093
+
2094
+}
2095
+
2096
+
2097
+func main() {
2098
+	data := `YOUR_XML_CONTENT_HERE`
2099
+
2100
+	var root Root
2101
+	err := xml.Unmarshal([]byte(data), &root)
2102
+	if err != nil {
2103
+		fmt.Println("错误:", err)
2104
+		return
2105
+	}
2106
+
2107
+	fmt.Printf("%+v\n", root)
2108
+}
2109
+
2110
+
2111
+
2112
+
2113
+
2114
+
2115
+

+ 2 - 0
models/stock_models.go View File

@@ -1358,6 +1358,8 @@ type BloodHisDoctorAdviceInfo struct {
1358 1358
 	HospApprFlag          int64                       `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
1359 1359
 	LmtUsedFlag           int64                       `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
1360 1360
 	ExecutionFrequencyId  int64                       `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1361
+	DrugWayCount               string  `gorm:"column:drug_way_count" json:"drug_way_count" form:"drug_way_count"`
1362
+
1361 1363
 }
1362 1364
 
1363 1365
 func (BloodHisDoctorAdviceInfo) TableName() string {

+ 17 - 0
models/yb_models.go View File

@@ -58,3 +58,20 @@ type Result9001 struct {
58 58
 	Signtype    interface{} `json:"signtype"`
59 59
 	WarnInfo    interface{} `json:"warn_info"`
60 60
 }
61
+
62
+
63
+type Result9001Two struct {
64
+	ErrMsg      string `json:"err_msg"`
65
+	InfRefmsgid string `json:"inf_refmsgid"`
66
+	Infcode     int64  `json:"infcode"`
67
+	Output      struct {
68
+		Signinoutb struct {
69
+			SignNo   string `json:"sign_no"`
70
+
71
+		} `json:"signinoutb"`
72
+	} `json:"output"`
73
+	RefmsgTime  string      `json:"refmsg_time"`
74
+	RespondTime string      `json:"respond_time"`
75
+	Signtype    interface{} `json:"signtype"`
76
+	WarnInfo    interface{} `json:"warn_info"`
77
+}

+ 1 - 0
models/zb_his_models.go View File

@@ -9,4 +9,5 @@ type Reg struct {
9 9
 	RegFee      string
10 10
 	TreatFee    string
11 11
 	OperatorId  string
12
+	IdCardNo    string
12 13
 }

+ 62 - 0
models/zuobiao_models.go View File

@@ -0,0 +1,62 @@
1
+package models
2
+
3
+
4
+
5
+
6
+type HisZuobiaoAdvice struct {
7
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
8
+	AdviceRequestLog string `gorm:"column:advice_request_log" json:"advice_request_log" form:"advice_request_log"`
9
+	AdviceResultLog string `gorm:"column:advice_result_log" json:"advice_result_log" form:"advice_result_log"`
10
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
11
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
12
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
13
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
14
+	PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
15
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
16
+	SettleRequestLog string `gorm:"column:settle_request_log" json:"settle_request_log" form:"settle_request_log"`
17
+	SettleResultLog string `gorm:"column:settle_result_log" json:"settle_result_log" form:"settle_result_log"`
18
+	Cbm01 string `gorm:"column:cbm01" json:"cbm01" form:"cbm01"`
19
+	AdiviceIds string `gorm:"column:adivice_ids" json:"adivice_ids" form:"adivice_ids"`
20
+	Oid int64 `gorm:"column:oid" json:"oid" form:"oid"`
21
+	StartTime           int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
22
+	EndTime             int64   `gorm:"column:end_time" json:"end_time" form:"end_time"`
23
+	Vaa01 string `gorm:"column:vaa01" json:"vaa01" form:"vaa01"`
24
+	Vaa07 string `gorm:"column:vaa07" json:"vaa07" form:"vaa07"`
25
+
26
+
27
+
28
+}
29
+
30
+
31
+func (HisZuobiaoAdvice) TableName() string {
32
+	return "his_zuobiao_advice"
33
+}
34
+
35
+
36
+type CmResult struct {
37
+	HisUserID     int       `gorm:"column:his_user_id;primaryKey"`
38
+	PatientName   string    `gorm:"column:patient_name"`
39
+	ProjectID     int       `gorm:"column:project_id"`
40
+	ProjectName   string    `gorm:"column:project_name"`
41
+	InspectDate   string       `gorm:"column:inspect_date"`
42
+	ItemID        int       `gorm:"column:item_id"`
43
+	ItemName      string    `gorm:"column:item_name"`
44
+	ItemType      int       `gorm:"column:item_type"`
45
+	ItemValue     string    `gorm:"column:item_value"`
46
+	RangeMin      string    `gorm:"column:range_min"`
47
+	RangeMax      string    `gorm:"column:range_max"`
48
+	RangeValue    string    `gorm:"column:range_value"`
49
+
50
+
51
+	RangeOptions  string    `gorm:"column:range_options"`
52
+	Unit          string    `gorm:"column:unit"`
53
+	State         string       `gorm:"column:state"`
54
+	CTime         string       `gorm:"column:c_time"`
55
+	UTime         string       `gorm:"column:u_time"`
56
+}
57
+
58
+// TableName sets the table name for the MedicalRecord model.
59
+func (CmResult) TableName() string {
60
+	return "xk_jy"
61
+}
62
+

+ 4 - 1
routers/router.go View File

@@ -1,6 +1,7 @@
1 1
 package routers
2 2
 
3 3
 import (
4
+	"gdyb/controllers/ah"
4 5
 	"gdyb/controllers/coordinate"
5 6
 	"gdyb/controllers/hb"
6 7
 	"gdyb/controllers/js"
@@ -32,6 +33,8 @@ func init() {
32 33
 	zh.ZHHisManagerApiRegistRouters()
33 34
 	js.JSybRegistRouters()
34 35
 	nm.NmybRegistRouters()
35
-	coordinate.CoordinateRegistRouters()
36
+	ah.AHybRegistRouters()
37
+	coordinate.CoordinateRcegistRouters()
38
+	coordinate.CoordinatenetRcegistRouters()
36 39
 
37 40
 }

File diff suppressed because it is too large
+ 3439 - 0
service/ahyb_service.go


+ 32 - 29
service/auto_create_week_schedules_service.go View File

@@ -70,21 +70,20 @@ func AutoCreateStock() {
70 70
 	var NewDrugCancelStock []*models.NewDrugCancelStockInfo
71 71
 
72 72
 	var XtDrugInventorys []*models.XtDrugInventory
73
-
74 73
 	var NewDrugWarehouseOutTwo []*models.NewDrugWarehouseOutInfo
75 74
 
76 75
 	//var XtDrugInventorys2 []*models.XtDrugInventory
77 76
 
78
-	//readDb.Model(&models.XtDrugInventory{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND stock_max_number > 0", org_id).Preload("BaseDrugLib", "status = 1").Find(&XtDrugInventorys)
77
+	readDb.Model(&models.XtDrugInventory{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND stock_max_number > 0", org_id).Preload("BaseDrugLib", "status = 1").Find(&XtDrugInventorys)
79 78
 
80
-	//readDb.Model(&models.NewWarehousingInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).First(&NewWarehousing)
81
-	//readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
82
-	//readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
79
+	readDb.Model(&models.NewWarehousingInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).First(&NewWarehousing)
80
+	readDb.Model(&models.NewWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
81
+	readDb.Model(&models.NewCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
83 82
 
84 83
 	////大丰
85
-	//readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 4778", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
86
-	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 360136", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
87
-	//readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
84
+	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 ", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
85
+	readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
86
+	readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
88 87
 
89 88
 	//响水
90 89
 	//readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 5720", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
@@ -122,10 +121,10 @@ func AutoCreateStock() {
122 121
 
123 122
 	}
124 123
 
125
-	for _, item := range NewWarehousing {
126
-		res := Post3503ForGoodInfo(org_id, item)
124
+	for _, item := range NewDrugWarehouse {
125
+		res := Post3503ForDrug(org_id, item)
127 126
 		if res.Infcode == 0 {
128
-			writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
127
+			writeDb.Model(&models.NewDrugWarehouseInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
129 128
 				"is_upload": 1,
130 129
 			})
131 130
 		} else {
@@ -134,22 +133,19 @@ func AutoCreateStock() {
134 133
 		}
135 134
 	}
136 135
 
137
-	for _, item := range NewWarehouseOut {
138
-		res := Post3505ForGoodInfo(org_id, item)
136
+	for _, item := range NewDrugWarehouseOut {
137
+		res := Post3505ForDrug(org_id, item)
139 138
 		if res.Infcode == 0 {
140
-			writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
139
+			writeDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
141 140
 				"is_upload": 1,
142 141
 			})
143
-		} else {
144
-
145
-			continue
146 142
 		}
147 143
 	}
148 144
 
149
-	for _, item := range NewCancelStock {
150
-		res := Post3506ForGoodInfo(org_id, item)
145
+	for _, item := range NewDrugCancelStock {
146
+		res := Post3506ForDrug(org_id, item)
151 147
 		if res.Infcode == 0 {
152
-			writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
148
+			writeDb.Model(&models.NewDrugCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
153 149
 				"is_upload": 1,
154 150
 			})
155 151
 		} else {
@@ -158,10 +154,12 @@ func AutoCreateStock() {
158 154
 		}
159 155
 	}
160 156
 
161
-	for _, item := range NewDrugWarehouse {
162
-		res := Post3503ForDrug(org_id, item)
157
+
158
+
159
+	for _, item := range NewWarehousing {
160
+		res := Post3503ForGoodInfo(org_id, item)
163 161
 		if res.Infcode == 0 {
164
-			writeDb.Model(&models.NewDrugWarehouseInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
162
+			writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
165 163
 				"is_upload": 1,
166 164
 			})
167 165
 		} else {
@@ -170,19 +168,22 @@ func AutoCreateStock() {
170 168
 		}
171 169
 	}
172 170
 
173
-	for _, item := range NewDrugWarehouseOut {
174
-		res := Post3505ForDrug(org_id, item)
171
+	for _, item := range NewWarehouseOut {
172
+		res := Post3505ForGoodInfo(org_id, item)
175 173
 		if res.Infcode == 0 {
176
-			writeDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
174
+			writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
177 175
 				"is_upload": 1,
178 176
 			})
177
+		} else {
178
+
179
+			continue
179 180
 		}
180 181
 	}
181 182
 
182
-	for _, item := range NewDrugCancelStock {
183
-		res := Post3506ForDrug(org_id, item)
183
+	for _, item := range NewCancelStock {
184
+		res := Post3506ForGoodInfo(org_id, item)
184 185
 		if res.Infcode == 0 {
185
-			writeDb.Model(&models.NewDrugCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
186
+			writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
186 187
 				"is_upload": 1,
187 188
 			})
188 189
 		} else {
@@ -191,6 +192,8 @@ func AutoCreateStock() {
191 192
 		}
192 193
 	}
193 194
 
195
+
196
+
194 197
 }
195 198
 
196 199
 func AutoGdybCreateStock() {

File diff suppressed because it is too large
+ 1238 - 152
service/coordinate_service.go


+ 21 - 161
service/db.go View File

@@ -18,7 +18,6 @@ package service
18 18
 
19 19
 import (
20 20
 	"fmt"
21
-
22 21
 	"github.com/astaxie/beego"
23 22
 	"github.com/jinzhu/gorm"
24 23
 	_ "github.com/jinzhu/gorm/dialects/mysql" // mysql
@@ -29,92 +28,44 @@ var writeDb *gorm.DB
29 28
 var readUserDb *gorm.DB
30 29
 var writeUserDb *gorm.DB
31 30
 
32
-var readMiddleDb *gorm.DB
33
-var writeMiddleDb *gorm.DB
34 31
 
35
-var readPatientDb *gorm.DB
36
-var writePatientDb *gorm.DB
37 32
 
38
-var readSgjPatientDb *gorm.DB
39
-var writeSgjPatientDb *gorm.DB
40 33
 
41
-var readUserDbT *gorm.DB
42
-var writeUserDbT *gorm.DB
43 34
 
44 35
 var err error
45 36
 
46 37
 func ConnectDB() {
47
-	readHost := beego.AppConfig.String("readmysqlhost")
38
+	readHost := "kuyicloud2024lt.mysql.rds.aliyuncs.com"
48 39
 	readPort := beego.AppConfig.String("readmysqlport")
49
-	readUser := beego.AppConfig.String("readmysqluser")
50
-	readPass := beego.AppConfig.String("readmysqlpass")
40
+	readUser := "kuyicloud"
41
+	readPass := "yHXAcb7dTJyvMiX3vK2iOvTAHeaowy5P"
51 42
 	readName := beego.AppConfig.String("readmysqlname")
52 43
 
53
-	writeHost := beego.AppConfig.String("writemysqlhost")
44
+
45
+
46
+	writeHost := "kuyicloud2024lt.mysql.rds.aliyuncs.com"
54 47
 	writePort := beego.AppConfig.String("writemysqlport")
55
-	writeUser := beego.AppConfig.String("writemysqluser")
56
-	writePass := beego.AppConfig.String("writemysqlpass")
48
+	writeUser := "kuyicloud"
49
+	writePass := "yHXAcb7dTJyvMiX3vK2iOvTAHeaowy5P"
57 50
 	writeName := beego.AppConfig.String("writemysqlname")
58 51
 
59
-	readUserHost := beego.AppConfig.String("readuserhost")
52
+
53
+
54
+	readUserHost := "kuyicloud2024lt.mysql.rds.aliyuncs.com"
60 55
 	readUserPort := beego.AppConfig.String("readuserport")
61
-	readUserUser := beego.AppConfig.String("readuseruser")
62
-	readUserPass := beego.AppConfig.String("readuserpass")
56
+	readUserUser := "kuyicloud"
57
+	readUserPass :=  "yHXAcb7dTJyvMiX3vK2iOvTAHeaowy5P"
63 58
 	readUserName := beego.AppConfig.String("readusername")
64 59
 
65
-	writeUserHost := beego.AppConfig.String("writeuserhost")
60
+
61
+	writeUserHost := "kuyicloud2024lt.mysql.rds.aliyuncs.com"
66 62
 	writeUserPort := beego.AppConfig.String("writeuserport")
67
-	writeUserUser := beego.AppConfig.String("writeuseruser")
68
-	writeUserPass := beego.AppConfig.String("writeuserpass")
69
-	writeUserName := beego.AppConfig.String("writeusername")
70
-
71
-	readMiddleHost := beego.AppConfig.String("readmiddlehost")
72
-	readMiddlePort := beego.AppConfig.String("readmiddleport")
73
-	readMiddleUser := beego.AppConfig.String("readmiddleuser")
74
-	readMiddlePass := beego.AppConfig.String("readmiddlepass")
75
-	readMiddleName := beego.AppConfig.String("readmiddlename")
76
-
77
-	writeMiddleHost := beego.AppConfig.String("writemiddlehost")
78
-	writeMiddlePort := beego.AppConfig.String("writemiddleport")
79
-	writeMiddleUser := beego.AppConfig.String("writemiddleuser")
80
-	writeMiddlePass := beego.AppConfig.String("writemiddlepass")
81
-	writeMiddleName := beego.AppConfig.String("writemiddlename")
82
-
83
-	readPatientHost := beego.AppConfig.String("readpatienthost")
84
-	readPatientPort := beego.AppConfig.String("readpatientport")
85
-	readPatientUser := beego.AppConfig.String("readpatientuser")
86
-	readPatientPass := beego.AppConfig.String("readpatientpass")
87
-	readPatientName := beego.AppConfig.String("readpatientname")
88
-
89
-	writePatientHost := beego.AppConfig.String("writepatienthost")
90
-	writePatientPort := beego.AppConfig.String("writepatientport")
91
-	writePatientUser := beego.AppConfig.String("writepatientuser")
92
-	writePatientPass := beego.AppConfig.String("writepatientpass")
93
-	writePatientName := beego.AppConfig.String("writepatientname")
94
-
95
-	readSgjPatientHost := beego.AppConfig.String("readsgjpatientmysqlhost")
96
-	readSgjPatientPort := beego.AppConfig.String("readsgjpatientmysqlport")
97
-	readSgjPatientUser := beego.AppConfig.String("readsgjpatientmysqluser")
98
-	readSgjPatientPass := beego.AppConfig.String("readsgjpatientmysqlpass")
99
-	readSgjPatientName := beego.AppConfig.String("readsgjpatientmysqlname")
100
-
101
-	writeSgjPatientHost := beego.AppConfig.String("writesgjpatientmysqlhost")
102
-	writeSgjPatientPort := beego.AppConfig.String("writesgjpatientmysqlport")
103
-	writeSgjPatientUser := beego.AppConfig.String("writesgjpatientmysqluser")
104
-	writeSgjPatientPass := beego.AppConfig.String("writesgjpatientmysqlpass")
105
-	writeSgjPatientName := beego.AppConfig.String("writesgjpatientmysqlname")
106
-
107
-	readUserHostT := beego.AppConfig.String("readuserhostTest")
108
-	readUserPortT := beego.AppConfig.String("readuserportTest")
109
-	readUserUserT := beego.AppConfig.String("readuseruserTest")
110
-	readUserPassT := beego.AppConfig.String("readuserpassTest")
111
-	readUserNameT := beego.AppConfig.String("readusernameTest")
112
-
113
-	writeUserHostT := beego.AppConfig.String("writeuserhostTest")
114
-	writeUserPortT := beego.AppConfig.String("writeuserportTest")
115
-	writeUserUserT := beego.AppConfig.String("writeuseruserTest")
116
-	writeUserPassT := beego.AppConfig.String("writeuserpassTest")
117
-	writeUserNameT := beego.AppConfig.String("writeusernameTest")
63
+	writeUserUser :=  "kuyicloud"
64
+	writeUserPass := "yHXAcb7dTJyvMiX3vK2iOvTAHeaowy5P"
65
+	writeUserName :=  beego.AppConfig.String("readusername")
66
+
67
+
68
+
118 69
 
119 70
 	rdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser, readPass, readHost, readPort, readName)
120 71
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
@@ -122,17 +73,6 @@ func ConnectDB() {
122 73
 	rudsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUser, readUserPass, readUserHost, readUserPort, readUserName)
123 74
 	wudsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUserUser, writeUserPass, writeUserHost, writeUserPort, writeUserName)
124 75
 
125
-	rmdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readMiddleUser, readMiddlePass, readMiddleHost, readMiddlePort, readMiddleName)
126
-	wmdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeMiddleUser, writeMiddlePass, writeMiddleHost, writeMiddlePort, writeMiddleName)
127
-
128
-	rpdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readPatientUser, readPatientPass, readPatientHost, readPatientPort, readPatientName)
129
-	wpdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writePatientUser, writePatientPass, writePatientHost, writePatientPort, writePatientName)
130
-
131
-	rspdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readSgjPatientUser, readSgjPatientPass, readSgjPatientHost, readSgjPatientPort, readSgjPatientName)
132
-	wspdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeSgjPatientUser, writeSgjPatientPass, writeSgjPatientHost, writeSgjPatientPort, writeSgjPatientName)
133
-
134
-	rudsnT := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUserT, readUserPassT, readUserHostT, readUserPortT, readUserNameT)
135
-	wudsnT := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUserUserT, writeUserPassT, writeUserHostT, writeUserPortT, writeUserNameT)
136 76
 
137 77
 	readDb, err = gorm.Open("mysql", rdsn)
138 78
 	if err != nil {
@@ -150,21 +90,7 @@ func ConnectDB() {
150 90
 	writeDb.DB().SetMaxOpenConns(100)
151 91
 	writeDb.LogMode(true)
152 92
 
153
-	readUserDbT, err = gorm.Open("mysql", rudsnT)
154
-	if err != nil {
155
-		//beego.Error(err)
156
-	}
157
-	readUserDbT.DB().SetMaxIdleConns(10)
158
-	readUserDbT.DB().SetMaxOpenConns(100)
159
-	readUserDbT.LogMode(true)
160 93
 
161
-	writeUserDbT, err = gorm.Open("mysql", wudsnT)
162
-	if err != nil {
163
-		//beego.Error(err)
164
-	}
165
-	writeUserDbT.DB().SetMaxIdleConns(10)
166
-	writeUserDbT.DB().SetMaxOpenConns(100)
167
-	writeUserDbT.LogMode(true)
168 94
 
169 95
 	readUserDb, err = gorm.Open("mysql", rudsn)
170 96
 	if err != nil {
@@ -182,53 +108,8 @@ func ConnectDB() {
182 108
 	writeUserDb.DB().SetMaxOpenConns(100)
183 109
 	writeUserDb.LogMode(true)
184 110
 
185
-	readMiddleDb, err = gorm.Open("mysql", rmdsn)
186
-	if err != nil {
187
-		//beego.Error(err)
188
-	}
189
-	readMiddleDb.DB().SetMaxIdleConns(10)
190
-	readMiddleDb.DB().SetMaxOpenConns(100)
191
-	readMiddleDb.LogMode(true)
192
-
193
-	writeMiddleDb, err = gorm.Open("mysql", wmdsn)
194
-	if err != nil {
195
-		//beego.Error(err)
196
-	}
197
-	writeMiddleDb.DB().SetMaxIdleConns(10)
198
-	writeMiddleDb.DB().SetMaxOpenConns(100)
199
-	writeMiddleDb.LogMode(true)
200
-
201
-	readPatientDb, err = gorm.Open("mysql", rpdsn)
202
-	if err != nil {
203
-		beego.Error(err)
204
-	}
205
-	readPatientDb.DB().SetMaxIdleConns(10)
206
-	readPatientDb.DB().SetMaxOpenConns(100)
207
-	readPatientDb.LogMode(true)
208 111
 
209
-	writePatientDb, err = gorm.Open("mysql", wpdsn)
210
-	if err != nil {
211
-		beego.Error(err)
212
-	}
213
-	writePatientDb.DB().SetMaxIdleConns(10)
214
-	writePatientDb.DB().SetMaxOpenConns(100)
215
-	writePatientDb.LogMode(true)
216
-
217
-	readSgjPatientDb, err = gorm.Open("mysql", rspdsn)
218
-	if err != nil {
219
-		beego.Error(err)
220
-	}
221
-	readSgjPatientDb.DB().SetMaxIdleConns(10)
222
-	readSgjPatientDb.DB().SetMaxOpenConns(100)
223
-	readSgjPatientDb.LogMode(true)
224 112
 
225
-	writeSgjPatientDb, err = gorm.Open("mysql", wspdsn)
226
-	if err != nil {
227
-		beego.Error(err)
228
-	}
229
-	writeSgjPatientDb.DB().SetMaxIdleConns(10)
230
-	writeSgjPatientDb.DB().SetMaxOpenConns(100)
231
-	writeSgjPatientDb.LogMode(true)
232 113
 }
233 114
 
234 115
 //func DisconnectDB() {
@@ -250,25 +131,4 @@ func UserWriteDB() *gorm.DB {
250 131
 	return writeUserDb
251 132
 }
252 133
 
253
-func MiddleReadDB() *gorm.DB {
254
-	return readMiddleDb
255
-}
256
-func MiddleWriteDB() *gorm.DB {
257
-	return writeMiddleDb
258
-}
259
-
260
-func PatientReadDB() *gorm.DB {
261
-	return readPatientDb
262
-}
263 134
 
264
-func PatientWriteDB() *gorm.DB {
265
-	return writePatientDb
266
-}
267
-
268
-func SgjPatientReadDB() *gorm.DB {
269
-	return readSgjPatientDb
270
-}
271
-
272
-func SgjPatientWriteDB() *gorm.DB {
273
-	return writeSgjPatientDb
274
-}

+ 110 - 19
service/dianzichufang.go View File

@@ -12,7 +12,7 @@ import (
12 12
 	"time"
13 13
 )
14 14
 
15
-func GetCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG001 models.CFYLJG001) (string, string) {
15
+func GetCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG001 models.CFYLJG001,isu string) (string, string) {
16 16
 	//生成签名
17 17
 	nonce := GetRandomString(32)
18 18
 	timestamp := time.Now().Unix()
@@ -94,7 +94,7 @@ func GetCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc
94 94
 
95 95
 		rxdrug["drug_totlcnt_emp"] = item.DrugTotlcntEmp
96 96
 		rxdrug["hosp_appr_flag"] = item.HospApprFlag
97
-		rxdrug["extras"] = item.Extras
97
+		//rxdrug["extras"] = ""
98 98
 		rxdrugdetail = append(rxdrugdetail, rxdrug)
99 99
 	}
100 100
 	inputData["rxdrugdetail"] = rxdrugdetail
@@ -145,7 +145,14 @@ func GetCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc
145 145
 	mdtrtinfo["rgst_fee"] = cFYLJG001.Mdtrtinfo.RgstFee
146 146
 	mdtrtinfo["medfee_sumamt"] = cFYLJG001.Mdtrtinfo.MedfeeSumamt
147 147
 	mdtrtinfo["fstdiag_flag"] = cFYLJG001.Mdtrtinfo.FstdiagFlag
148
-	mdtrtinfo["extras"] = cFYLJG001.Mdtrtinfo.Extras
148
+	type MyData struct {
149
+		Insutype string `json:"insutype"`
150
+	}
151
+	data := MyData{
152
+		Insutype: isu,
153
+	}
154
+
155
+	mdtrtinfo["extras"] = data
149 156
 	inputData["mdtrtinfo"] = mdtrtinfo
150 157
 
151 158
 	diseinfos := make([]map[string]interface{}, 0)
@@ -228,14 +235,15 @@ func GetCFYLJG002(org_name string, doctor string, fixmedins_code string, insuplc
228 235
 	//生成输入报文
229 236
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
230 237
 	inputData := make(map[string]interface{})
231
-	//inputData := makemap[string]interface{})
238
+	inputDatas := make(map[string]interface{})
232 239
 
233 240
 	inputMessage["infno"] = "CFYLJG002"
234 241
 	inputData["fixmedins_code"] = fixmedins_code
235 242
 	inputData["original_value"] = original_value
236 243
 	inputData["original_rx_file"] = original_rx_file
237 244
 	inputData["extras"] = extras
238
-	inputMessage["rx_sign_info"] = inputData
245
+	inputDatas["rx_sign_info"] = inputData
246
+	inputMessage["input"] = inputDatas
239 247
 
240 248
 	var inputLog string
241 249
 	bytesData, err := json.Marshal(inputMessage)
@@ -295,6 +303,7 @@ func GetCFYLJG003(org_name string, doctor string, fixmedins_code string, insuplc
295 303
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
296 304
 	//input := make(map[string]interface{})
297 305
 	inputData := make(map[string]interface{})
306
+	inputData2 := make(map[string]interface{})
298 307
 
299 308
 	inputMessage["infno"] = "CFYLJG003"
300 309
 
@@ -321,7 +330,8 @@ func GetCFYLJG003(org_name string, doctor string, fixmedins_code string, insuplc
321 330
 	inputData["phar_chk_time"] = cFYLJG003.PharChkTime
322 331
 	inputData["rx_file"] = cFYLJG003.RxFile
323 332
 	inputData["sign_digest"] = cFYLJG003.SignDigest
324
-	inputMessage["rx_upload_info"] = inputData
333
+	inputData2["rx_upload_info"] = inputData
334
+	inputMessage["input"] = inputData2
325 335
 	var inputLog string
326 336
 	bytesData, err := json.Marshal(inputMessage)
327 337
 	inputLog = string(bytesData)
@@ -379,10 +389,10 @@ func GetCFYLJG004(org_name string, doctor string, fixmedins_code string, insuplc
379 389
 	//生成输入报文
380 390
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
381 391
 	inputData := make(map[string]interface{})
382
-	//inputDatas := make([]map[string]interface{}, 0)
392
+	inputData1 := make(map[string]interface{})
383 393
 
394
+	//inputDatas := make([]map[string]interface{}, 0)
384 395
 	inputMessage["infno"] = "CFYLJG004"
385
-
386 396
 	inputData["hi_rxno"] = cFYLJG004.HiRxno
387 397
 	inputData["undo_dr_code"] = cFYLJG004.UndoDrCode
388 398
 	inputData["undo_dr_name"] = cFYLJG004.UndoDrName
@@ -391,8 +401,8 @@ func GetCFYLJG004(org_name string, doctor string, fixmedins_code string, insuplc
391 401
 	inputData["undo_rea"] = cFYLJG004.UndoRea
392 402
 	inputData["undo_time"] = cFYLJG004.UndoTime
393 403
 	inputData["fixmedins_code"] = cFYLJG004.FixmedinsCode
394
-
395
-	inputMessage["rx_cancel_info"] = inputData
404
+	inputData1["rx_cancel_info"] = inputData
405
+	inputMessage["input"] = inputData1
396 406
 	var inputLog string
397 407
 	bytesData, err := json.Marshal(inputMessage)
398 408
 	inputLog = string(bytesData)
@@ -449,12 +459,16 @@ func GetCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc
449 459
 	signature := setSignature(timestamp, nonce, secret_key)
450 460
 	//生成输入报文
451 461
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
462
+
463
+
452 464
 	inputData := make(map[string]interface{})
465
+
466
+	inputData2 := make(map[string]interface{})
453 467
 	//inputDatas := make([]map[string]interface{}, 0)
454 468
 
455 469
 	inputMessage["infno"] = "CFYLJG005"
456 470
 
457
-	inputData["fixmedins_code"] = cFYLJG005.FixmedinsCode
471
+	inputData["fixmedins_code"] = fixmedins_code
458 472
 
459 473
 	inputData["hi_rxno"] = cFYLJG005.HiRxno
460 474
 	inputData["mdtrt_id"] = cFYLJG005.MdtrtID
@@ -462,8 +476,8 @@ func GetCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc
462 476
 	inputData["psn_name"] = cFYLJG005.PsnName
463 477
 	inputData["psn_cert_type"] = cFYLJG005.PsnCertType
464 478
 	inputData["certno"] = cFYLJG005.Certno
465
-
466
-	inputMessage["rx_detl_query"] = inputData
479
+	inputData2["rx_detl_query"]  = inputData
480
+	inputMessage["input"] = inputData2
467 481
 	var inputLog string
468 482
 	bytesData, err := json.Marshal(inputMessage)
469 483
 	inputLog = string(bytesData)
@@ -512,7 +526,6 @@ func GetCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc
512 526
 	return str, inputLog
513 527
 
514 528
 }
515
-
516 529
 func GetCFYLJG006(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG006 models.CFYLJG006) (string, string) {
517 530
 	//生成签名
518 531
 	nonce := GetRandomString(32)
@@ -522,17 +535,18 @@ func GetCFYLJG006(org_name string, doctor string, fixmedins_code string, insuplc
522 535
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
523 536
 	inputData := make(map[string]interface{})
524 537
 	//inputDatas := make([]map[string]interface{}, 0)
538
+	inputData2 := make(map[string]interface{})
525 539
 
526 540
 	inputMessage["infno"] = "CFYLJG006"
527 541
 
528
-	inputData["fixmedins_code"] = cFYLJG006.FixmedinsCode
542
+	inputData["fixmedins_code"] = fixmedins_code
529 543
 	inputData["hi_rxno"] = cFYLJG006.HiRxno
530 544
 	inputData["mdtrt_id"] = cFYLJG006.MdtrtID
531 545
 	inputData["psn_cert_type"] = cFYLJG006.PsnCertType
532 546
 	inputData["certno"] = cFYLJG006.Certno
533 547
 	inputData["psn_name"] = cFYLJG006.PsnName
534
-
535
-	inputMessage["rx_chk_info"] = inputData
548
+	inputData2["rx_chk_info"] =inputData
549
+	inputMessage["input"] = inputData2
536 550
 	var inputLog string
537 551
 	bytesData, err := json.Marshal(inputMessage)
538 552
 	inputLog = string(bytesData)
@@ -589,18 +603,95 @@ func GetCFYLJG007(org_name string, doctor string, fixmedins_code string, insuplc
589 603
 	//生成输入报文
590 604
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
591 605
 	inputData := make(map[string]interface{})
606
+	inputData2 := make(map[string]interface{})
607
+
592 608
 	//inputDatas := make([]map[string]interface{}, 0)
593 609
 
594 610
 	inputMessage["infno"] = "CFYLJG007"
595 611
 
596
-	inputData["fixmedins_code"] = cFYLJG007.FixmedinsCode
612
+	inputData["fixmedins_code"] = fixmedins_code
597 613
 	inputData["hi_rxno"] = cFYLJG007.HiRxno
598 614
 	inputData["mdtrt_id"] = cFYLJG007.MdtrtID
599 615
 	inputData["psn_no"] = cFYLJG007.PsnNo
600 616
 	inputData["psn_cert_type"] = cFYLJG007.PsnCertType
601 617
 	inputData["certno"] = cFYLJG007.Certno
618
+	inputData["psn_name"] = cFYLJG007.PsnName
619
+
620
+	inputData2["rx_setl_query"] = inputData
621
+
622
+	inputMessage["input"] = inputData2
623
+	var inputLog string
624
+	bytesData, err := json.Marshal(inputMessage)
625
+	inputLog = string(bytesData)
626
+	fmt.Println(string(bytesData))
627
+	if err != nil {
628
+		fmt.Println(err.Error())
629
+		return err.Error(), ""
630
+	}
631
+	reader := bytes.NewReader(bytesData)
632
+	gdyb_url := beego.AppConfig.String("gdyb_url")
633
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
602 634
 
603
-	inputMessage["rx_setl_query"] = inputData
635
+	var url string
636
+	if fixmedins_code == "H15049901371" {
637
+		url = gdyb_url
638
+	} else {
639
+		url = gdyb_url + "CFYLJG007"
640
+	}
641
+
642
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
643
+	request, err := http.NewRequest("POST", url, reader)
644
+	if err != nil {
645
+		fmt.Println(err.Error())
646
+		return err.Error(), ""
647
+	}
648
+
649
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
650
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
651
+	request.Header.Set("x-tif-signature", signature)
652
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
653
+	request.Header.Set("x-tif-nonce", nonce)
654
+
655
+	client := http.Client{}
656
+	resp, err := client.Do(request)
657
+	if err != nil {
658
+		fmt.Println(err.Error())
659
+		return err.Error(), ""
660
+	}
661
+	respBytes, err := ioutil.ReadAll(resp.Body)
662
+	if err != nil {
663
+		fmt.Println(err.Error())
664
+		return err.Error(), ""
665
+	}
666
+	fmt.Println(string(respBytes))
667
+	str := string(respBytes)
668
+	return str, inputLog
669
+
670
+}
671
+func GetCFYLJG008(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG008 models.CFYLJG008) (string, string) {
672
+	//生成签名
673
+	nonce := GetRandomString(32)
674
+	timestamp := time.Now().Unix()
675
+	signature := setSignature(timestamp, nonce, secret_key)
676
+	//生成输入报文
677
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
678
+	inputData := make(map[string]interface{})
679
+	//inputData2 := make(map[string]interface{})
680
+
681
+	//inputDatas := make([]map[string]interface{}, 0)
682
+
683
+	inputMessage["infno"] = "CFYLJG008"
684
+
685
+	inputData["pageNum"] = cFYLJG008.PageNum
686
+	inputData["pageSize"] = cFYLJG008.PageSize
687
+	inputData["orderType"] = cFYLJG008.OrderType
688
+	inputData["poolareaNo"] = cFYLJG008.PoolareaNo
689
+	inputData["fixmedinsName"] = cFYLJG008.FixmedinsName
690
+	inputData["lng"] = cFYLJG008.Lng
691
+	inputData["lat"] = cFYLJG008.Lat
692
+	inputData["medinsProdInvChgDDTOList"] = cFYLJG008.MedList
693
+
694
+	inputMessage["input"] = inputData
604 695
 	var inputLog string
605 696
 	bytesData, err := json.Marshal(inputMessage)
606 697
 	inputLog = string(bytesData)

+ 209 - 0
service/fj_service.go View File

@@ -1842,6 +1842,215 @@ func FJyb5301(psnNo string, insutype string, org_name string, doctor string, fix
1842 1842
 	return str
1843 1843
 }
1844 1844
 
1845
+func Fjyb4101(struct4101 Struct4101, params models.PublicParams) (string, string, string) {
1846
+	timestamp := time.Now().Unix()
1847
+	inputMessage := SetHnInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
1848
+	// 生成输入报文
1849
+	input := make(map[string]interface{})
1850
+	inputData := make(map[string]interface{})
1851
+	inputMessage["infno"] = "4101A" // 交易编码
1852
+	year := time.Now().Format("2006")
1853
+	month := time.Now().Format("01")
1854
+	day := time.Now().Format("02")
1855
+
1856
+	inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID  必填(来自2201接口返回)
1857
+	inputData["setl_id"] = struct4101.SetlId   // 结算 ID  必填
1858
+	inputData["psn_no"] = struct4101.PsnNo     // 结算 ID  必填
1859
+
1860
+	inputData["fixmedins_name"] = params.FixmedinsName      // 定点医药机构名称  必填
1861
+	inputData["fixmedins_code"] = params.FixmedinsCode      // 定点医药机构编码  必填
1862
+	inputData["hi_setl_lv"] = ""                            // 医保结算等级
1863
+	inputData["hi_no"] = struct4101.PsnNo                   // 医保编号
1864
+	inputData["medcasno"] = struct4101.PsnNo                // 病案号  必填
1865
+	inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间  必填
1866
+	inputData["psn_name"] = struct4101.PsnName              // 人员姓名  必填
1867
+	inputData["gend"] = struct4101.Gend                     // 性别  必填
1868
+	inputData["brdy"] = struct4101.Brdy                     // 出生日期  必填
1869
+	inputData["age"] = struct4101.Age                       // 年龄  必填
1870
+	inputData["ntly"] = struct4101.Ntly                     // 国籍  必填
1871
+
1872
+
1873
+	inputData["nwb_age"] = ""                                 // 年龄  必填
1874
+	inputData["naty"] = struct4101.Naty                       // 民族  必填
1875
+	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
1876
+	inputData["certno"] = struct4101.Certno                   // 证件号码  必填
1877
+	inputData["prfs"] = struct4101.Prfs                       // 职业  必填
1878
+	inputData["curr_addr"] = ""                               // 现住址  必填
1879
+	inputData["emp_name"] = ""                                // 单位名称  必填
1880
+	inputData["emp_addr"] = ""                                // 单位地址  必填
1881
+	inputData["emp_tel"] = ""                                 // 单位电话  必填
1882
+	inputData["poscode"] = ""                                 // 邮编  必填
1883
+	inputData["coner_name"] = ""           // 联系人姓名  必填
1884
+	inputData["patn_rlts"] = ""              // 与患者关系  必填
1885
+	inputData["coner_addr"] = ""            // 联系人地址  必填
1886
+	inputData["coner_tel"] = ""              // 联系人电话  必填
1887
+	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
1888
+	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
1889
+	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
1890
+	inputData["nwb_adm_type"] = ""                            // 新生儿入院类型  必填
1891
+	inputData["nwb_bir_wt"] = ""                              // 新生儿出生体重  必填
1892
+	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
1893
+	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
1894
+	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
1895
+	inputData["ipt_med_type"] = struct4101.IptMedType         // 住院医疗类型  必填
1896
+	inputData["adm_way"] = ""                                 // 入院途径  必填
1897
+	inputData["trt_type"] = ""                                // 治疗类别  必填
1898
+	inputData["adm_time"] = struct4101.AdmTime                // 入院时间  必填
1899
+	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
1900
+	inputData["refldept_dept"] = ""                           // 转科科别  必填
1901
+	inputData["dscg_time"] = struct4101.AdmEndTime            // 出院时间  必填
1902
+	inputData["dscg_caty"] = struct4101.AdmCaty               // 出院科别  必填
1903
+	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
1904
+	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
1905
+	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
1906
+	inputData["otp_tcm_dise"] = ""                            // 西医诊断疾病代码  必填
1907
+	inputData["tcm_dise_code"] = ""                           // 中医诊断代码  必填
1908
+	inputData["oprn_oprt_code_cnt"] = ""                      // 手术操作代码计数  必填
1909
+	inputData["vent_used_dura"] = ""                          // 呼吸机使用时长  必填
1910
+	inputData["pwcry_bfadm_coma_dura"] = ""                   // 颅脑损伤患者入院前昏迷时长  必填
1911
+	inputData["pwcry_afadm_coma_dura"] = ""                   // 颅脑损伤患者入院后昏迷时长  必填
1912
+	inputData["bld_cat"] = ""                                 // 输血品种  必填
1913
+	inputData["bld_amt"] = ""                                 // 输血量  必填
1914
+	inputData["bld_unt"] = ""                                 // 输血计量单位  必填
1915
+	inputData["spga_nurscare_days"] = ""                      // 特级护理天数  必填
1916
+	inputData["lv1_nurscare_days"] = ""                       // 一级护理天数  必填
1917
+	inputData["scd_nurscare_days"] = ""                       // 二级护理天数  必填
1918
+	inputData["lv3_nurscare_days"] = ""                       // 三级护理天数  必填
1919
+	inputData["acp_medins_name"] = ""                         // 拟接收机构名称  必填
1920
+	inputData["acp_optins_code"] = ""                         // 拟接收机构代码  必填
1921
+	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
1922
+	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
1923
+	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
1924
+	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
1925
+	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
1926
+	inputData["chfpdr_name"] = struct4101.DoctorName          // 主诊医师姓名  必填
1927
+	inputData["chfpdr_code"] = struct4101.DoctorCode          // 主诊医师代码  必填
1928
+	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
1929
+	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
1930
+	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填
1931
+	inputData["psn_ownpay"] = struct4101.PsnOwnPay            // 个人自费  必填
1932
+	inputData["acct_pay"] = struct4101.AcctPay                // 个人账户支出  必填
1933
+	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
1934
+	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
1935
+	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
1936
+	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
1937
+	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
1938
+	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
1939
+
1940
+	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
1941
+	for _, item := range struct4101.CustomStruct {
1942
+		payinfotemp := make(map[string]interface{})
1943
+		if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
1944
+			payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型  必填
1945
+			payinfotemp["fund_payamt"] = item.FundPayamt    // 基金支付金额
1946
+			payinfo = append(payinfo, payinfotemp)
1947
+		}
1948
+	}
1949
+	opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
1950
+
1951
+	opspdiseinfotemp := make(map[string]interface{})
1952
+	opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName      // 诊断名称  必填
1953
+	opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode      // 诊断代码 必填
1954
+	opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
1955
+	opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
1956
+	opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
1957
+
1958
+	diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
1959
+	for _, item := range struct4101.Diseinfo {
1960
+		diseinfotemp := make(map[string]interface{})
1961
+		diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
1962
+		diseinfotemp["diag_type"] = item.DiagType         // 诊断类别  必填
1963
+		diseinfotemp["diag_code"] = item.DiagCode         // 诊断代码 必填
1964
+		diseinfotemp["diag_name"] = item.DiagName         // 诊断名称 必填
1965
+		diseinfotemp["adm_cond_type"] = "3"               // 入院病情类型 必填
1966
+		diseinfo = append(diseinfo, diseinfotemp)
1967
+	}
1968
+
1969
+	iteminfo := make([]map[string]interface{}, 0)
1970
+	for _, item := range struct4101.IteminfoStruct {
1971
+		iteminfotemp := make(map[string]interface{})
1972
+		iteminfotemp["med_chrgitm"] = item.MedChrgitm            // 医疗收费项目  必填
1973
+		iteminfotemp["amt"] = item.Amt                           // 金额 必填
1974
+		iteminfotemp["claa_sumfee"] = item.ClaaSumfee            // 甲类费用合计 必填
1975
+		iteminfotemp["clab_amt"] = item.ClabAmt                  // 乙类金额 必填
1976
+		iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
1977
+		iteminfotemp["oth_amt"] = item.OthAmt                    // 其他金额 必填
1978
+		iteminfo = append(iteminfo, iteminfotemp)
1979
+	}
1980
+
1981
+	oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
1982
+	oprninfotemp := make(map[string]interface{})
1983
+	oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别  必填
1984
+	oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
1985
+	oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
1986
+	oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
1987
+	oprninfotemp["anst_way"] = ""       // 麻醉方式 必填
1988
+	oprninfotemp["oper_dr_name"] = ""   // 术者医师姓名 必填
1989
+	oprninfotemp["oper_dr_code"] = ""   // 术者医师代码 必填
1990
+	oprninfotemp["anst_dr_name"] = ""   // 麻醉医师姓名 必填
1991
+	oprninfotemp["anst_dr_code"] = ""   // 麻醉医师代码 必填
1992
+	oprninfo = append(oprninfo, oprninfotemp)
1993
+
1994
+	icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
1995
+	icuinfotemp := make(map[string]interface{})
1996
+	icuinfotemp["scs_cutd_ward_type"] = ""   // 重症监护病房类型  必填
1997
+	icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
1998
+	icuinfotemp["scs_cutd_exit_time"] = ""   // 重症监护退出时间 必填
1999
+	icuinfotemp["scs_cutd_sum_dura"] = ""    // 重症监护合计时长 必填
2000
+	icuinfo = append(icuinfo, icuinfotemp)
2001
+	input["setlinfo"] = inputData
2002
+	input["payinfo"] = payinfo
2003
+	input["opspdiseinfo"] = opspdiseinfo
2004
+	input["diseinfo"] = diseinfo
2005
+	input["iteminfo"] = iteminfo
2006
+
2007
+	inputMessage["input"] = input //交易输入
2008
+	bytesData, _ := json.Marshal(inputMessage)
2009
+	fmt.Println(string(bytesData))
2010
+	if err != nil {
2011
+		fmt.Println(err.Error())
2012
+		return err.Error(), "", ""
2013
+	}
2014
+
2015
+	var requestLog string
2016
+	requestLog = string(bytesData)
2017
+	enc := mahonia.NewEncoder("gbk")
2018
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
2019
+	return output, requestLog, err_msg
2020
+}
2021
+
2022
+func Fjyb4102(psn_no string,SetlId string, params models.PublicParams,stas_type string) (string, string, string) {
2023
+	timestamp := time.Now().Unix()
2024
+	inputMessage := SetHnInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
2025
+	// 生成输入报文
2026
+	input := make(map[string]interface{})
2027
+	input2 := make(map[string]interface{})
2028
+
2029
+	inputData := make(map[string]interface{})
2030
+	inputMessage["infno"] = "4102" // 交易编码
2031
+
2032
+
2033
+	inputData["setl_id"] = SetlId   // 结算 ID  必填
2034
+	inputData["psn_no"] = psn_no     // 结算 ID  必填
2035
+	inputData["stas_type"] = stas_type     // 结算 ID  必填
2036
+	input2["stastinfo"] = inputData
2037
+	input["data"] = input2
2038
+	inputMessage["input"] = input //交易输入
2039
+	bytesData, _ := json.Marshal(inputMessage)
2040
+	fmt.Println(string(bytesData))
2041
+	if err != nil {
2042
+		fmt.Println(err.Error())
2043
+		return err.Error(), "", ""
2044
+	}
2045
+
2046
+	var requestLog string
2047
+	requestLog = string(bytesData)
2048
+	enc := mahonia.NewEncoder("gbk")
2049
+	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
2050
+	return output, requestLog, err_msg
2051
+}
2052
+
2053
+
1845 2054
 //
1846 2055
 //func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1847 2056
 //	// 生成签名

File diff suppressed because it is too large
+ 2176 - 415
service/gdyb_service.go


+ 331 - 0
service/gxyb_service.go View File

@@ -0,0 +1,331 @@
1
+package service
2
+
3
+import (
4
+
5
+	//"crypto/md5"
6
+
7
+	//"strings"
8
+	//"gdyb/utils"
9
+
10
+
11
+	"time"
12
+	"fmt"
13
+	"encoding/json"
14
+	"github.com/astaxie/beego"
15
+	"net/http"
16
+	"strconv"
17
+	"io/ioutil"
18
+
19
+	"bytes"
20
+	"github.com/go-ole/go-ole"
21
+	"github.com/go-ole/go-ole/oleutil"
22
+)
23
+
24
+func Gxyb9001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, admin_user_id int64,setlId string,mdtrtId string,psn_no string,medinsSetlId string){
25
+
26
+	ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED)
27
+	defer ole.CoUninitialize()
28
+
29
+	// Replace with the ProgID or CLSID of your COM object
30
+	progID := "YinHai.XJ.Actual.Interface.New"
31
+
32
+	// Create COM object
33
+	unknown, err := oleutil.CreateObject(progID)
34
+	if err != nil {
35
+		fmt.Println("Unable to create COM object:", err)
36
+	}
37
+	defer unknown.Release()
38
+
39
+	// Query for the IDispatch interface
40
+	dispatch, err := unknown.QueryInterface(ole.IID_IDispatch)
41
+	if err != nil {
42
+		fmt.Println("Unable to get IDispatch interface:", err)
43
+	}
44
+	defer dispatch.Release()
45
+
46
+	nonce := GetRandomString(32)
47
+	timestamp := time.Now().Unix()
48
+	inputMessage := make(map[string]interface{})
49
+	inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
50
+	input := make(map[string]interface{})
51
+	inputData := make(map[string]interface{})
52
+	inputMessage["infno"] = "P0001" // 交易编码
53
+	inputData["setlId"] = setlId
54
+	inputData["mdtrtId"] = mdtrtId
55
+	inputData["psn_no"] = psn_no
56
+	inputData["medinsSetlId"] = medinsSetlId
57
+	input["data"] = inputData
58
+	inputMessage["input"] = input //交易输入
59
+
60
+	jsonData, err := json.Marshal(inputMessage)
61
+	if err != nil {
62
+		fmt.Println("转换为JSON失败:", err)
63
+
64
+	}
65
+	//data := fmt.Sprintf(`{"transNo":"%s","transType":"%s","timestamp":"%s","data":{"fixmedinsCode":"%s","psnNo":"%s"}}`, transNo, transType, timestamp, fixmedinsCode, psnNo)
66
+	result2 := ""
67
+	// Call COM object's method using the IDispatch interface
68
+	resulr, err := oleutil.CallMethod(dispatch, "gxyb_call", "P0001", string(jsonData),&result2)
69
+	fmt.Println(resulr)
70
+
71
+
72
+}
73
+
74
+
75
+func Gxyb5302(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string,admin_user_id int64) string {
76
+	// 生成签名
77
+	nonce := GetRandomString(32)
78
+	//timestamp := time.Now().Unix()
79
+	timestamp := time.Now().UnixNano() / 1e6
80
+
81
+	signature := setSignature(timestamp, nonce, secret_key)
82
+
83
+	inputMessage := SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
84
+
85
+	// 生成输入报文
86
+	//inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
87
+	input := make(map[string]interface{})
88
+	inputData := make(map[string]interface{})
89
+	inputMessage["infno"] = "5302"    // 交易编码
90
+	inputData["psn_no"] = psnNo       // 人员编号 (来自1101接口返回)
91
+	inputData["biz_appy_type"] = "03" // 人员编号 (来自1101接口返回)
92
+
93
+	input["data"] = inputData
94
+	inputMessage["input"] = input //交易输入
95
+	bytesData, err := json.Marshal(inputMessage)
96
+	fmt.Println(string(bytesData))
97
+	if err != nil {
98
+		fmt.Println(err.Error())
99
+		return err.Error()
100
+	}
101
+	reader := bytes.NewReader(bytesData)
102
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
103
+	gdyb_url := beego.AppConfig.String("gdyb_url")
104
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
105
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
106
+	url := gdyb_url
107
+	request, err := http.NewRequest("POST", url, reader)
108
+	if err != nil {
109
+		fmt.Println(err.Error())
110
+		return err.Error()
111
+	}
112
+
113
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
114
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
115
+	request.Header.Set("x-tif-signature", signature)
116
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
117
+	request.Header.Set("x-tif-nonce", nonce)
118
+
119
+	client := http.Client{}
120
+	resp, err := client.Do(request)
121
+	if err != nil {
122
+		fmt.Println(err.Error())
123
+		return err.Error()
124
+	}
125
+	respBytes, err := ioutil.ReadAll(resp.Body)
126
+	if err != nil {
127
+		fmt.Println(err.Error())
128
+		return err.Error()
129
+	}
130
+	str := string(respBytes)
131
+	fmt.Println(str)
132
+	return str
133
+}
134
+
135
+
136
+func Gxyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, token string,admin_user_id int64) (string, string) {
137
+	// 生成签名
138
+	nonce := GetRandomString(32)
139
+	timestamp := time.Now().Unix()
140
+	signature := setSignature(timestamp, nonce, secret_key)
141
+
142
+	// 生成输入报文
143
+	inputMessage := make(map[string]interface{})
144
+
145
+	if  mdtrtarea_admvs == "450721"  ||  mdtrtarea_admvs == "450127"{
146
+
147
+		inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
148
+	} else {
149
+		inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
150
+	}
151
+	//inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
152
+	input := make(map[string]interface{})
153
+	inputData := make(map[string]interface{})
154
+	inputMessage["infno"] = "2207" // 交易编码
155
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
156
+	if certificates == 3 {
157
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
158
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
159
+	} else {
160
+		if id_card_type == 1 {
161
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
162
+			inputData["mdtrt_cert_no"] = token // 就诊凭证编号
163
+		} else if id_card_type == 4 {
164
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
165
+			inputData["mdtrt_cert_no"] = token  // 就诊凭证编号
166
+		} else {
167
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
168
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
169
+
170
+		}
171
+	}
172
+	if med_type == "1111" || med_type == "1112" {
173
+		med_type = "11"
174
+	}
175
+	if insuplc_admdvs == "421300" {
176
+		if med_type == "11" {
177
+			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
178
+		} else if med_type == "14" {
179
+			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
180
+		}
181
+	} else {
182
+		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
183
+	}
184
+	inputData["medfee_sumamt"] = total           // 医疗费总额
185
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
186
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
187
+	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
188
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
189
+	inputData["insutype"] = insutype             // 险种类型
190
+	inputData["invono"] = ""                     // 发票号
191
+
192
+	inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
193
+	inputData["overlmt_selfpay"] = overlmt_selfpay     //
194
+	inputData["preselfpay_amt"] = preselfpay_amt       //
195
+	inputData["inscp_scp_amt"] = inscp_scp_amt         //
196
+
197
+	input["data"] = inputData
198
+	inputMessage["input"] = input //交易输入
199
+
200
+	bytesData, err := json.Marshal(inputMessage)
201
+	fmt.Println(string(bytesData))
202
+	if err != nil {
203
+		fmt.Println(err.Error())
204
+		return err.Error(), ""
205
+	}
206
+	reader := bytes.NewReader(bytesData)
207
+	gdyb_url := beego.AppConfig.String("gdyb_url")
208
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
209
+
210
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
211
+	//url := gdyb_url + "2207"
212
+
213
+	var url string
214
+	if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" ||  mdtrtarea_admvs == "450721" {
215
+		url = gdyb_url
216
+	} else {
217
+		url = gdyb_url + "2207"
218
+	}
219
+
220
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2207"
221
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
222
+
223
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
224
+
225
+
226
+		request, err := http.NewRequest("POST", url, reader)
227
+		if err != nil {
228
+			fmt.Println(err.Error())
229
+			return err.Error(), ""
230
+		}
231
+
232
+		request.Header.Set("Content-Type", "application/json;charset=UTF-8")
233
+		request.Header.Set("x-tif-paasid", gdyb_paasid)
234
+		request.Header.Set("x-tif-signature", signature)
235
+		request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
236
+		request.Header.Set("x-tif-nonce", nonce)
237
+
238
+		client := http.Client{}
239
+		resp, err := client.Do(request)
240
+		if err != nil {
241
+			fmt.Println(err.Error())
242
+			return err.Error(), ""
243
+		}
244
+		respBytes, err := ioutil.ReadAll(resp.Body)
245
+		if err != nil {
246
+			fmt.Println(err.Error())
247
+			return err.Error(), ""
248
+		}
249
+		str := string(respBytes)
250
+		fmt.Println(str)
251
+		mjson, _ := json.Marshal(inputMessage)
252
+		str2 := string(mjson)
253
+
254
+		return str, str2
255
+
256
+}
257
+
258
+func Gxyb2503( org_name string, doctor string, fixmedins_code string,insuplc_admdvs string, mdtrtarea_admvs string, secret_key string,admin_user_id int64) string {
259
+	// 生成签名
260
+	nonce := GetRandomString(32)
261
+	timestamp := time.Now().Unix()
262
+	signature := setSignature(timestamp, nonce, secret_key)
263
+
264
+	// 生成输入报文
265
+	inputMessage := SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
266
+
267
+	input := make(map[string]interface{})
268
+	inputData := make(map[string]interface{})
269
+	inputMessage["infno"] = "2503"                  // 交易编码
270
+	inputData["psn_no"] = "45000000000008100150404986"                     // 人员编号 (来自1101接口返回)
271
+	inputData["insutype"] = "390"                // 险种类型(来自1101接口返回)
272
+	inputData["opsp_dise_code"] = "M03900"         // 险种类型(来自1101接口返回)
273
+	inputData["opsp_dise_name"] = "高血压(高危组)"         // 险种类型(来自1101接口返回)
274
+	inputData["insu_optins"] = "450721"       // 险种类型(来自1101接口返回)
275
+	inputData["ide_fixmedins_no"] = "H45072101171"   // 险种类型(来自1101接口返回)
276
+	inputData["ide_fixmedins_name"] = "灵山盛康血液透析中心" // 险种类型(来自1101接口返回)
277
+	inputData["hosp_ide_date"] = "2024-02-01"         // 险种类型(来自1101接口返回)
278
+	inputData["diag_dr_codg"] = "D450721000406"           // 开始时间
279
+	inputData["diag_dr_name"] = "韦秋萍"              // 开始时间
280
+	inputData["begndate"] = "2024-02-01"              // 医师编码
281
+	inputData["tel"] = ""                           // 医师编码
282
+	inputData["addr"] = ""                          // 医师编码
283
+	inputData["enddate"] = "2026-01-30"                 // 医师编码
284
+
285
+	input["data"] = inputData
286
+	inputMessage["input"] = input //交易输入
287
+	bytesData, err := json.Marshal(inputMessage)
288
+	fmt.Println(string(bytesData))
289
+	if err != nil {
290
+		fmt.Println(err.Error())
291
+		return err.Error()
292
+	}
293
+	reader := bytes.NewReader(bytesData)
294
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
295
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
296
+	gdyb_url := beego.AppConfig.String("gdyb_url")
297
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
298
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
299
+	//url := gdyb_url + "2503"
300
+
301
+	var url string
302
+
303
+	url = gdyb_url
304
+
305
+	request, err := http.NewRequest("POST", url, reader)
306
+	if err != nil {
307
+		fmt.Println(err.Error())
308
+		return err.Error()
309
+	}
310
+
311
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
312
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
313
+	request.Header.Set("x-tif-signature", signature)
314
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
315
+	request.Header.Set("x-tif-nonce", nonce)
316
+
317
+	client := http.Client{}
318
+	resp, err := client.Do(request)
319
+	if err != nil {
320
+		fmt.Println(err.Error())
321
+		return err.Error()
322
+	}
323
+	respBytes, err := ioutil.ReadAll(resp.Body)
324
+	if err != nil {
325
+		fmt.Println(err.Error())
326
+		return err.Error()
327
+	}
328
+	str := string(respBytes)
329
+	fmt.Println(str)
330
+	return str
331
+}

+ 3 - 3
service/hb_service.go View File

@@ -1133,7 +1133,7 @@ func HeBeiyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string,
1133 1133
 		if med_type == "11" || med_type == "1112" || med_type == "1111" {
1134 1134
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1135 1135
 		} else if med_type == "14" {
1136
-			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
1136
+			inputData["med_type"] = "14" // 医疗类别 11 普通门诊  12 门诊挂号
1137 1137
 		}
1138 1138
 	} else {
1139 1139
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
@@ -1258,7 +1258,7 @@ func HeBeiyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string,
1258 1258
 		if med_type == "11" {
1259 1259
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1260 1260
 		} else if med_type == "14" {
1261
-			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
1261
+			inputData["med_type"] = "14" // 医疗类别 11 普通门诊  12 门诊挂号
1262 1262
 		}
1263 1263
 	} else {
1264 1264
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
@@ -1383,7 +1383,7 @@ func HeBeiyb2207A(psnNo string, mdtrtId string, chrgBchno string, certNo string,
1383 1383
 		if med_type == "11" {
1384 1384
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1385 1385
 		} else if med_type == "14" {
1386
-			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
1386
+			inputData["med_type"] = "14" // 医疗类别 11 普通门诊  12 门诊挂号
1387 1387
 		}
1388 1388
 	} else {
1389 1389
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号

File diff suppressed because it is too large
+ 899 - 37
service/hbyb_service.go


+ 28 - 0
service/his_project_service.go View File

@@ -715,6 +715,20 @@ func GetBatchDrugList(idss []int64) (drug []*models.BaseDrugList, err error) {
715 715
 
716 716
 	return drug, err
717 717
 }
718
+func GetBatchDrugListtw(org_id int64) (drug []*models.BaseDrugList, err error) {
719
+
720
+	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1")
721
+	table := XTReadDB().Table("xt_manufacturer as m")
722
+	fmt.Print(table)
723
+
724
+		db = db.Where("x.org_id = ?", org_id)
725
+
726
+	err = db.Select("x.id,x.medical_insurance_number,x.code,x.drug_name,x.drug_spec,x.drug_type,x.min_unit,x.last_price,x.retail_price,x.limit_remark,x.drug_dosage_form,x.social_security_directory_code,m.manufacturer_name").Joins("left join xt_manufacturer as m on m.id = x.manufacturer").Scan(&drug).Error
727
+
728
+	return drug, err
729
+}
730
+
731
+
718 732
 
719 733
 func GetBatchGoodInformationList(idss []int64) (good []*models.GoodInformation, err error) {
720 734
 
@@ -729,3 +743,17 @@ func GetBatchGoodInformationList(idss []int64) (good []*models.GoodInformation,
729 743
 	err = db.Select("x.id,x.social_security_directory_code,x.good_name,x.specification_name,x.production_type,x.special_medical,x.good_unit,x.buy_price,x.sell_price,x.remark,m.manufacturer_name").Joins("left join xt_manufacturer as m on m.id = x.manufacturer").Scan(&good).Error
730 744
 	return good, err
731 745
 }
746
+
747
+
748
+func GetBatchGoodInformationListtwo(org_id int64) (good []*models.GoodInformation, err error) {
749
+
750
+	db := XTReadDB().Table("xt_good_information as x").Where("x.status=1")
751
+	table := XTReadDB().Table("xt_manufacturer as m")
752
+	fmt.Println(table)
753
+
754
+		db = db.Where("x.org_id = ?", org_id)
755
+
756
+	err = db.Select("x.id,x.social_security_directory_code,x.good_name,x.specification_name,x.production_type,x.special_medical,x.good_unit,x.buy_price,x.sell_price,x.remark,m.manufacturer_name").Joins("left join xt_manufacturer as m on m.id = x.manufacturer").Scan(&good).Error
757
+	return good, err
758
+}
759
+

+ 125 - 15
service/his_service.go View File

@@ -526,6 +526,16 @@ func FindLastPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_d
526 526
 	return
527 527
 }
528 528
 
529
+func FindLastPatientPrescriptionInfoTwo1(org_id int64, patient_id int64) (info models.HisPrescriptionInfo, err error) {
530
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? and p_type = 1", org_id, patient_id).Last(&info).Error
531
+	return
532
+}
533
+
534
+func FindLastPatientPrescriptionInfoTwo2(org_id int64, patient_id int64,start_time string, end_time string) (info []models.HisPrescriptionInfo, err error) {
535
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? and p_type = 1 and FROM_UNIXTIME(record_date) >= ? and FROM_UNIXTIME(record_date) <= ?", org_id, patient_id,start_time,end_time).Find(&info).Error
536
+	return
537
+}
538
+
529 539
 func SavePatientPrescriptionInfo(info models.HisPrescriptionInfo) (err error) {
530 540
 	err = writeDb.Save(&info).Error
531 541
 	return
@@ -608,6 +618,7 @@ type HisOrder struct {
608 618
 	PrivatePrice            float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
609 619
 	Creator                 int64   `gorm:"column:creator" json:"creator" form:"creator"`
610 620
 	Modify                  int64   `gorm:"column:modify" json:"modify" form:"modify"`
621
+	MedType                  int64   `gorm:"column:med_type" json:"med_type" form:"med_type"`
611 622
 	IsPre                   int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
612 623
 	SzChargeInfo            string  `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
613 624
 	SzProjectInfo           string  `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
@@ -616,6 +627,7 @@ type HisOrder struct {
616 627
 	OrgSetlNumber           string  `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
617 628
 	PayWays                 string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
618 629
 	OthDesc                 string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
630
+	SetlDetail              string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
619 631
 
620 632
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
621 633
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -999,16 +1011,22 @@ func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype str
999 1011
 	}
1000 1012
 	if len(clr_type) > 0 {
1001 1013
 		if mdtrtareaAdmvs == "150499" {
1002
-			if clr_type == "11" {
1014
+			if clr_type == "11"  {
1003 1015
 				db = db.Where("clr_type = ?", clr_type)
1004 1016
 			}
1005 1017
 
1006 1018
 		} else {
1007
-			db = db.Where("clr_type = ?", clr_type)
1008 1019
 
1020
+			db = db.Where("clr_type = ?", clr_type)
1009 1021
 		}
1010 1022
 	} else {
1011
-		db = db.Where("clr_type <> ?", "9903")
1023
+		if len(clr_type) == 0{
1024
+			db = db.Where("clr_type = ?", "")
1025
+
1026
+		}else{
1027
+			db = db.Where("clr_type = ?", "9903")
1028
+
1029
+		}
1012 1030
 
1013 1031
 	}
1014 1032
 	err = db.Find(&orders).Error
@@ -1043,6 +1061,22 @@ func GetOrderByTimeFour(start_time int64, end_time int64, org_id int64) (orders
1043 1061
 	return
1044 1062
 }
1045 1063
 
1064
+
1065
+func GetOrderByTime11222(start_time int64, end_time int64, org_id int64) (orders []*models.HisOrder, err error) {
1066
+	db := readDb.Model(&models.HisOrder{})
1067
+	db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ?", org_id, end_time, start_time)
1068
+	err = db.Find(&orders).Error
1069
+	return
1070
+}
1071
+
1072
+func GetOrderByTimeFourfor11(start_time int64, end_time int64, org_id int64) (orders []*models.HisOrder, err error) {
1073
+	db := readDb.Model(&models.HisOrder{})
1074
+db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ? and med_type = 11", org_id, end_time, start_time)
1075
+	err = db.Find(&orders).Error
1076
+	return
1077
+}
1078
+
1079
+
1046 1080
 func GetOrderByTimeThree(start_time int64, end_time int64, org_id int64, insutype string, clr_type string) (orders []*models.HisOrder, err error) {
1047 1081
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1  AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time) <= ? AND UNIX_TIMESTAMP(setl_time) >= ? AND insutype = ?", org_id, end_time, start_time, insutype).Find(&orders).Error
1048 1082
 	return
@@ -1068,7 +1102,13 @@ func GetPatientByID(orgID int64, patientID int64) (*models.Patients, error) {
1068 1102
 
1069 1103
 func FindDiagnoseById(id int64) (models.HisXtDiagnoseConfig, error) {
1070 1104
 	dealer := models.HisXtDiagnoseConfig{}
1071
-	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ?", id).First(&dealer).Error
1105
+	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ? and status = 1", id).First(&dealer).Error
1106
+	return dealer, err
1107
+}
1108
+
1109
+func FindDiagnoseByIdtwo(id string) (models.HisXtDiagnoseConfig, error) {
1110
+	dealer := models.HisXtDiagnoseConfig{}
1111
+	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ? and status = 1", id).First(&dealer).Error
1072 1112
 	return dealer, err
1073 1113
 }
1074 1114
 
@@ -1136,7 +1176,7 @@ func GetPatientByNumber(number string, user_org_id int64) (patient Patients, err
1136 1176
 }
1137 1177
 
1138 1178
 func GetPatientByIDCard(id_card_no string, user_org_id int64) (patient Patients, err error) {
1139
-	err = readDb.Model(&Patients{}).Where("id_card_no = ? AND user_org_id = ?", id_card_no, user_org_id).First(&patient).Error
1179
+	err = readDb.Model(&Patients{}).Where("(health_care_no = ? or id_card_no = ?) AND user_org_id = ?", id_card_no, id_card_no, user_org_id).First(&patient).Error
1140 1180
 	return
1141 1181
 }
1142 1182
 
@@ -1289,7 +1329,14 @@ func GetBathchMyPorjecgList(idss []int64) (project []*models.MyHisProject, err e
1289 1329
 
1290 1330
 	return project, err
1291 1331
 }
1332
+func GetBathchMyPorjecgListtwo(org_id int64) (project []*models.MyHisProject, err error) {
1333
+	db := XTReadDB().Table("xt_his_project")
1334
+
1335
+	err = db.Where("status = 1 and user_org_id = ?", org_id).Find(&project).Error
1292 1336
 
1337
+
1338
+	return project, err
1339
+}
1293 1340
 func GetBatchDoctorList(idss []int64) (role []*models.SgjUserAdminRole, err error) {
1294 1341
 
1295 1342
 	db := UserReadDB().Table("sgj_user_admin_role as x").Where("x.status =1")
@@ -1321,6 +1368,12 @@ func UpdateHisPrescriptionHisIDTwo(his_patient_id int64, patient_id int64, recor
1321 1368
 	XTWriteDB().Model(&models.HisPrescriptionInfo{}).Where("record_date = ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0 AND order_status <> 2", record_time, start_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
1322 1369
 	return
1323 1370
 }
1371
+func UpdateHisPrescriptionHisID1111(his_patient_id int64, patient_id int64, record_time int64, org_id int64) {
1372
+	//XTWriteDB().Model(&models.HisPrescription{}).Where("record_date = ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0", record_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
1373
+	//XTWriteDB().Model(&models.HisPrescriptionInfo{}).Where("record_date = ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0", record_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
1374
+	return
1375
+}
1376
+
1324 1377
 
1325 1378
 func GetHisPatientInfoList(org_id int64, patient_id int64, record_date int64) (info []*models.HisPatient, err error) {
1326 1379
 	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ?", org_id, record_date, patient_id).Find(&info).Error
@@ -1343,7 +1396,7 @@ func CreateUploadRecord(result *models.HisFundSettleListResult) (err error) {
1343 1396
 }
1344 1397
 
1345 1398
 func GetUploadRecord(order_id int64) (result models.HisFundSettleListResult, err error) {
1346
-	err = readDb.Model(&models.HisFundSettleListResult{}).Where("order_id = ? AND status = 1", order_id).First(result).Error
1399
+	err = readDb.Model(&models.HisFundSettleListResult{}).Where("order_id = ? AND status = 1", order_id).First(&result).Error
1347 1400
 	return
1348 1401
 }
1349 1402
 func UpdateRecord(result *models.HisFundSettleListResult) (err error) {
@@ -1485,27 +1538,34 @@ func GetAllHisOrderTwo(org_id int64) (his []*models.HisOrder, err error) {
1485 1538
 }
1486 1539
 
1487 1540
 func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1488
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10106  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2023-06-01 00:00:00' AND setl_time <= '2023-06-30 23:59:00'").Order("setl_time asc").Find(&his).Error
1541
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10106  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2023-08-01 00:00:00' AND setl_time <= '2023-08-31 23:59:00'").Order("setl_time asc").Find(&his).Error
1489 1542
 	fmt.Println(err)
1490 1543
 	return
1491 1544
 }
1492
-
1493 1545
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1494
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> ''  AND setl_time >= '2023-06-01 00:00:00' AND setl_time <= '2023-06-30 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1546
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138  AND status = 1  AND  order_status = 2 AND  setl_id <> ''  AND setl_time >= '2024-04-01 00:00:00' AND setl_time <= '2024-04-30 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1495 1547
 	fmt.Println(err)
1496 1548
 	return
1497 1549
 }
1498
-func GetOrderError10138(org_id int64) (order []*models.HisOrderError, err error) {
1499
-	err = readDb.Model(&models.HisOrderError{}).Where("user_org_id = ? AND status = 1 AND stage = 10139000", org_id).Find(&order).Error
1550
+func GetOrderError10138() (order []*models.HisOrderError, err error) {
1551
+	err = readDb.Model(&models.HisOrderError{}).Where("status = 1 AND stage = 10138500").Find(&order).Error
1500 1552
 	return
1501 1553
 }
1502 1554
 
1503 1555
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1504
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2023-06-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1556
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2024-01-01 00:00:00' AND setl_time <= '2024-03-31 23:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
1505 1557
 	fmt.Println(err)
1506 1558
 	return
1507 1559
 }
1508 1560
 
1561
+
1562
+func GetAllHisOrder10265() (his []*models.HisOrder, err error) {
1563
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2023-09-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1564
+	fmt.Println(err)
1565
+	return
1566
+}
1567
+
1568
+
1509 1569
 //	func GetAllHisOrder2(org_id int64) (his []models.HisOrder, err error) {
1510 1570
 //		err = readDb.Model(&models.HisOrder{}).Where("id = 180753").Order("setl_time asc").First(&his).Error
1511 1571
 //		return
@@ -1592,14 +1652,64 @@ func GetHisPrescriptionForMedType(org_id int64, patient_id int64, record_date in
1592 1652
 	return
1593 1653
 }
1594 1654
 
1595
-func GetOrderByTimeTen(start_time string, end_time string, org_id int64) (orders []models.FixMonRecDetailFileIn, err error) {
1596
-	err = readDb.Raw("SELECT CONCAT(insutype, '99', med_type, '555555') AS fund_key, insutype, '99' as `psn_type` , `med_type`, COUNT(DISTINCT `certno`) AS psn_cnt, count(*) as psn_time, sum(medfee_sumamt) as sumamt, sum(inscp_scp_amt) as amt, sum(fund_pay_sumamt) as fund FROM his_order where user_org_id = ? and status = 1 and order_status = 2 and setl_time >= ? and setl_time <= ? GROUP BY fund_key", org_id, start_time+" 00:00:00", end_time+" 23:00:00").Scan(&orders).Error
1655
+func GetOrderByTimeTen(start_time string, end_time string, org_id int64) (orders []*models.FixMonRecDetailFileIn, err error) {
1656
+	err = readDb.Raw("select CASE WHEN p.`insuplc_admdvs` LIKE '%3209%' THEN CONCAT(his_order.insutype, '99', his_order.med_type, '555555')  ELSE CONCAT(his_order.insutype, '99', his_order.med_type, '888888') END AS fund_key, his_order.insutype, '99' as `psn_type` , his_order.`med_type`, COUNT(DISTINCT his_order.`certno`) AS psn_cnt, count(*) as psn_time, sum(his_order.medfee_sumamt) as sumamt, sum(his_order.inscp_scp_amt) as amt, sum(his_order.fund_pay_sumamt) + sum(his_order.acct_pay)  as fund FROM his_order join his_patient p on p.number =  his_order.mdtrt_id where his_order.user_org_id = ? and his_order.status = 1 and his_order.order_status = 2 and his_order.setl_time >= ? and his_order.setl_time <= ? and his_order.setl_id <> '' GROUP BY fund_key", org_id, start_time+" 00:00:00", end_time+" 23:00:00").Scan(&orders).Error
1657
+	return
1658
+}
1659
+
1660
+func GetOrderByTimeTentwo(start_time string, end_time string, org_id int64) (orders []*models.FixMonRecDetailFileIn, err error) {
1661
+	err = readDb.Raw("select CASE WHEN p.`insuplc_admdvs` LIKE '%3209%' THEN CONCAT(his_order.insutype, '99', his_order.med_type, '555555')  ELSE CONCAT(his_order.insutype, '99', his_order.med_type, '888888') END AS fund_key, his_order.insutype, '99' as `psn_type` , his_order.`med_type`, COUNT(DISTINCT his_order.`certno`) AS psn_cnt, count(*) as psn_time, sum(his_order.medfee_sumamt) as sumamt, sum(his_order.inscp_scp_amt) as amt, sum(his_order.fund_pay_sumamt) + sum(his_order.acct_pay)  as fund FROM his_order join his_patient p on p.number =  his_order.mdtrt_id where his_order.user_org_id = ? and his_order.status = 0 and his_order.order_status = 3 and his_order.setl_time >= ? and his_order.setl_time <= ? and his_order.setl_id <> '' GROUP BY fund_key", org_id, start_time+" 00:00:00", end_time+" 23:00:00").Scan(&orders).Error
1597 1662
 	return
1598 1663
 }
1599 1664
 
1600 1665
 func GetOrderDetailByTimeTen(start_time string, end_time string, org_id int64, fund_key string) (fund []models.FundDetail, err error) {
1601
-	err = readDb.Raw("SELECT CONCAT(insutype, '99', med_type, '555555') as fund_key,  `setl_detail`  FROM his_order where user_org_id = ? and status = 1 and order_status = 2 and setl_time >= ? and setl_time <= ?  and CONCAT(insutype, '99', med_type, '555555')  = ?", org_id, start_time+" 00:00:00", end_time+" 23:59:00", fund_key).Scan(&fund).Error
1666
+	err = readDb.Raw("SELECT CASE WHEN p.`insuplc_admdvs` LIKE '%3209%' THEN CONCAT(his_order.insutype, '99', his_order.med_type, '555555')  ELSE CONCAT(his_order.insutype, '99', his_order.med_type, '888888') end AS fund_key, his_order.`setl_detail`  FROM his_order  join his_patient p on p.number =  his_order.mdtrt_id   where his_order.user_org_id = ? and his_order.status = 1 and his_order.order_status = 2 and his_order.setl_time >= ? and his_order.setl_time <= ?  and CONCAT(his_order.insutype, '99', his_order.med_type, '555555')  = ?", org_id, start_time+" 00:00:00", end_time+" 23:59:00", fund_key).Scan(&fund).Error
1602 1667
 	return
1603 1668
 }
1604 1669
 
1605 1670
 //
1671
+func Saveflow(flow models.HisPrescriptionFlow){
1672
+	writeDb.Save(&flow)
1673
+}
1674
+
1675
+
1676
+
1677
+func GetNewHisPrescriptionTenone(org_id int64,number string) (prescription []*models.HisPrescriptionTen, err error) {
1678
+	err = readDb.Model(&models.HisPrescriptionTen{}).
1679
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1680
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("BaseDrugLib", "status=1")
1681
+		}).
1682
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1683
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject", "status=1").Preload("GoodInfo", "status=1")
1684
+		}).
1685
+		Where("user_org_id = ? AND status = 1 AND batch_number = ? and order_status = 4 ", org_id, number).
1686
+		Find(&prescription).Error
1687
+	return
1688
+}
1689
+
1690
+func GetHisOrderByIDThree(start_time string) (his []*models.HisOrder, err error) {
1691
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= ?",start_time).Order("setl_time asc").Find(&his).Error
1692
+	fmt.Println(err)
1693
+	return
1694
+}
1695
+
1696
+
1697
+
1698
+func UpDatePrescriptionNumber111(user_org_id int64, start_time int64, end_time int64, number string,patient_id int64) (err error) {
1699
+	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? and record_date <= ? and patient_id = ? and order_status = 1", user_org_id, start_time,end_time,patient_id).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1700
+	return
1701
+}
1702
+func UpDatePrescriptionNumber222(user_org_id int64,id int64, number string,patient_id int64) (err error) {
1703
+	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id = ? and patient_id = ?", user_org_id, id,patient_id).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1704
+	return
1705
+}
1706
+
1707
+
1708
+
1709
+
1710
+
1711
+func GetAllHisOrderTwo10485() (his []*models.HisOrder, err error) {
1712
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10485  AND status = 1  AND  order_status = 2 AND setl_id <> '' AND  setl_time >= '2024-01-01 00:00:00' ").Order("setl_time asc").Find(&his).Error
1713
+	fmt.Println(err)
1714
+	return
1715
+}

+ 84 - 1
service/hn_service.go View File

@@ -532,7 +532,7 @@ func Hnyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
532 532
 		feedetailInfo["rx_circ_flag"] = "0"                          // 外购处方标志
533 533
 		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
534 534
 		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
535
-		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
535
+		feedetailInfo["medins_list_codg"] =  item.MedListCodg          // 医药机构目录编码
536 536
 		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
537 537
 		feedetailInfo["cnt"] = item.Cut                              // 数量
538 538
 		feedetailInfo["pric"] = item.Price                           // 单价
@@ -2036,3 +2036,86 @@ func Hnyb3507(struct3507 models.Struct3507) (string, string) {
2036 2036
 	return HNHttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData), "3507"), string(bytesData)
2037 2037
 
2038 2038
 }
2039
+
2040
+
2041
+
2042
+func Hnyb3301(org_name string,opera string,fixmedins_code string,insuplc_admdvs string,mdtrtarea_admvs string,cainfo string, name string, codg string, list_type string,start_time string, ent_time string, request_url string,access_key string,secret_key string) (string,string) {
2043
+	// 生成签名
2044
+	//nonce := GetRandomString(32)
2045
+	// 生成签名
2046
+	timestamp := time.Now().Unix()
2047
+	//tempTime := time.Unix(timestamp, 0)
2048
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2049
+	inputMessage := SetHnInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2050
+
2051
+	// 生成输入报文
2052
+	//inputMessage := SetHnInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
2053
+
2054
+	//inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
2055
+	input := make(map[string]interface{})
2056
+	inputData := make(map[string]interface{})
2057
+	inputMessage["infno"] = "3301" // 交易编码
2058
+	inputData["fixmedins_hilist_id"] = codg
2059
+	inputData["fixmedins_hilist_name"] = name
2060
+	inputData["list_type"] = list_type
2061
+	inputData["med_list_codg"] = codg
2062
+	inputData["begndate"] = start_time
2063
+	inputData["enddate"] = ent_time
2064
+
2065
+	inputData["aprvno"] = ""
2066
+	inputData["dosform"] = ""
2067
+	inputData["exct_cont"] = ""
2068
+	inputData["item_cont"] = ""
2069
+	inputData["prcunt"] = ""
2070
+	inputData["spec"] = ""
2071
+	inputData["pacspec"] = ""
2072
+	inputData["memo"] = ""
2073
+
2074
+	input["data"] = inputData
2075
+	inputMessage["input"] = input //交易输入
2076
+	bytesData, err := json.Marshal(inputMessage)
2077
+	fmt.Println(string(bytesData))
2078
+	if err != nil {
2079
+		fmt.Println(err.Error())
2080
+		return err.Error(),""
2081
+	}
2082
+
2083
+	request_url = request_url + "3301"
2084
+	timestamp2 := time.Now().UnixNano() / int64(time.Millisecond)
2085
+	return HNHttpRequest(request_url, access_key, secret_key, timestamp2, string(bytesData), "3301"), string(bytesData)
2086
+
2087
+}
2088
+func Hnyb3302(org_name string,opera string,fixmedins_code string,insuplc_admdvs string,mdtrtarea_admvs string,cainfo string, name string, codg string, list_type string,start_time string, ent_time string, request_url string,access_key string,secret_key string) (string,string) {
2089
+	// 生成签名
2090
+	//nonce := GetRandomString(32)
2091
+	// 生成签名
2092
+	timestamp := time.Now().Unix()
2093
+	//tempTime := time.Unix(timestamp, 0)
2094
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2095
+	inputMessage := SetHnInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2096
+
2097
+	// 生成输入报文
2098
+	//inputMessage := SetHnInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
2099
+
2100
+	//inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
2101
+	input := make(map[string]interface{})
2102
+	inputData := make(map[string]interface{})
2103
+	inputMessage["infno"] = "3302" // 交易编码
2104
+	inputData["fixmedins_code"] = fixmedins_code
2105
+	inputData["fixmedins_hilist_id"] = codg
2106
+	inputData["list_type"] = list_type
2107
+	inputData["med_list_codg"] = codg
2108
+	input["data"] = inputData
2109
+	inputMessage["input"] = input //交易输入
2110
+	bytesData, err := json.Marshal(inputMessage)
2111
+	fmt.Println(string(bytesData))
2112
+	if err != nil {
2113
+		fmt.Println(err.Error())
2114
+		return err.Error(),""
2115
+	}
2116
+
2117
+	request_url = request_url + "3302"
2118
+	timestamp2 := time.Now().UnixNano() / int64(time.Millisecond)
2119
+	return HNHttpRequest(request_url, access_key, secret_key, timestamp2, string(bytesData), "3302"), string(bytesData)
2120
+
2121
+}

+ 47 - 22
service/jsyb_service.go View File

@@ -294,7 +294,7 @@ func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, ope
294 294
 
295 295
 	}
296 296
 
297
-	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
297
+	inputData["ipt_otp_no"] = "11223333" // 住院/门诊号
298 298
 	inputData["atddr_no"] = doctor_id    // 医师编码
299 299
 	inputData["dr_name"] = doctor_name   // 医师姓名
300 300
 	inputData["dept_code"] = dept_code   // 科室编码
@@ -613,23 +613,15 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
613 613
 		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
614 614
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
615 615
 
616
-		if fixmedins_code == "H32092103007" {
617
-			feedetailInfo["bilg_dr_codg"] = "D320923012139"   // 开单医生编码
618
-			feedetailInfo["bilg_dr_name"] = "王曙光"             // 开单医师姓名
619
-			feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
620
-			feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
621
-			feedetailInfo["orders_dr_code"] = "D320923012139" // 受单医生编码
622
-			feedetailInfo["orders_dr_name"] = "王曙光"           // 受单医生姓名
623 616
 
624
-		} else {
625
-			feedetailInfo["bilg_dr_codg"] = "D371621008686"   // 开单医生编码
626
-			feedetailInfo["bilg_dr_name"] = "王云刚"             // 开单医师姓名
617
+			feedetailInfo["bilg_dr_codg"] = item.DoctorNumber   // 开单医生编码
618
+			feedetailInfo["bilg_dr_name"] = item.DoctorName             // 开单医师姓名
627 619
 			feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
628 620
 			feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
629
-			feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
630
-			feedetailInfo["orders_dr_name"] = "王云刚"           // 受单医生姓名
621
+			feedetailInfo["orders_dr_code"] = item.DoctorNumber  // 受单医生编码
622
+			feedetailInfo["orders_dr_name"] = item.DoctorName            // 受单医生姓名
623
+
631 624
 
632
-		}
633 625
 
634 626
 		if balance_accounts_type == "8" {
635 627
 			feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
@@ -1048,11 +1040,11 @@ func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedin
1048 1040
 	inputMessage["infver"] = "1.0.0"                                                            // 接收方系统代码
1049 1041
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
1050 1042
 	if fixmedins_code == "H32090403023" {
1051
-		inputMessage["opter"] = "晁海燕"      // 经办人
1052
-		inputMessage["opter_name"] = "晁海燕" // 经办人姓名
1043
+		inputMessage["opter"] = doctor      // 经办人
1044
+		inputMessage["opter_name"] = doctor // 经办人姓名
1053 1045
 	} else {
1054
-		inputMessage["opter"] = "孙欣欣"      // 经办人
1055
-		inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
1046
+		inputMessage["opter"] = doctor      // 经办人
1047
+		inputMessage["opter_name"] = doctor // 经办人姓名
1056 1048
 	}
1057 1049
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1058 1050
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
@@ -2079,8 +2071,8 @@ func Jxyb3262(setl_mon, org_name string, doctor string, fixmedins_code string, i
2079 2071
 		fixMonRecDetailFileIn["insutype"] = item.Insutype
2080 2072
 		fixMonRecDetailFileIn["psn_type"] = item.PsnType
2081 2073
 		fixMonRecDetailFileIn["med_type"] = item.MedType
2082
-		fixMonRecDetailFileIn["fix_blng_admdvs"] = mdtrtarea_admvs
2083
-		fixMonRecDetailFileIn["insu_admdvs"] = insuplc_admdvs
2074
+		fixMonRecDetailFileIn["fix_blng_admdvs"] = item.FixBlngAdmdvs
2075
+		fixMonRecDetailFileIn["insu_admdvs"] = item.InsuAdmdvs
2084 2076
 		fixMonRecDetailFileIn["psn_time"] = item.PsnTime
2085 2077
 		fixMonRecDetailFileIn["psn_cnt"] = item.PsnCnt
2086 2078
 		fixMonRecDetailFileIn["medfee_sumamt"] = item.MedfeeSumAmt
@@ -2094,8 +2086,6 @@ func Jxyb3262(setl_mon, org_name string, doctor string, fixmedins_code string, i
2094 2086
 		fund["fund_key"] = item.FundKey
2095 2087
 		fund["fix_blng_admdvs"] = item.FixBlngAdmdvs
2096 2088
 		fund["insu_admdvs"] = item.InsuAdmdvs
2097
-		fund["fix_blng_admdvs"] = item.FixBlngAdmdvs
2098
-		fund["insu_admdvs"] = item.InsuAdmdvs
2099 2089
 		fund["fund_code"] = item.FundCode
2100 2090
 		fund["fund_name"] = item.FundName
2101 2091
 		fund["fund_amt"] = item.FundAmt
@@ -2592,3 +2582,38 @@ func Jxyb3277(stmt_mon string, org_name string, doctor string, fixmedins_code st
2592 2582
 	request_url = request_url + "3277"
2593 2583
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3277"), string(bytesData)
2594 2584
 }
2585
+
2586
+
2587
+func Jsyb1318(code string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, cainfo string) (string, string) {
2588
+	// 生成签名
2589
+	timestamp := time.Now().Unix()
2590
+	// 生成输入报文
2591
+	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
2592
+	input := make(map[string]interface{})
2593
+	inputData := make(map[string]interface{})
2594
+	inputMessage["infno"] = "1318" // 交易编码
2595
+	inputData["query_date"] =  ""
2596
+	inputData["hilist_code"] =  code
2597
+	inputData["hilist_lmtpric_type"] =  ""
2598
+	inputData["overlmt_dspo_way"] =  ""
2599
+	inputData["insu_admdvs"] =  ""
2600
+	inputData["begndate"] =  ""
2601
+	inputData["enddate"] =  ""
2602
+	inputData["vali_flag"] =  ""
2603
+	inputData["rid"] =  ""
2604
+	inputData["tabname"] =  ""
2605
+	inputData["poolarea_no"] =  ""
2606
+	inputData["updt_time"] =  "2024-03-11"
2607
+	inputData["page_num"] =  "1"
2608
+	inputData["page_size"] =  "100"
2609
+	input["data"] = inputData
2610
+	inputMessage["input"] = input //交易输入
2611
+	bytesData, err := json.Marshal(inputMessage)
2612
+	fmt.Println(string(bytesData))
2613
+	if err != nil {
2614
+		fmt.Println(err.Error())
2615
+		return err.Error(), ""
2616
+	}
2617
+	request_url = request_url + "1318"
2618
+	return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
2619
+}

+ 380 - 102
service/jx_service.go View File

@@ -14,10 +14,10 @@ import (
14 14
 )
15 15
 
16 16
 // 人员基本信息
17
-func Jxyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, cainfo string) (string, string) {
17
+func Jxyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, name string) (string, string) {
18 18
 	timestamp := time.Now().Unix()
19 19
 	//生成输入报文
20
-	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
20
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, "")
21 21
 
22 22
 	input := make(map[string]interface{})
23 23
 	inputData := make(map[string]interface{})
@@ -34,8 +34,17 @@ func Jxyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
34 34
 			inputData["card_sn"] = card_sn      // 卡识别码
35 35
 			inputData["certno"] = certNo        // 证件号码
36 36
 			inputData["psn_cert_type"] = "01"   // 人员证件类型
37
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
37 38
 
38
-		} else {
39
+
40
+		} else if id_card_type == 4 {
41
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
42
+			inputData["card_sn"] = ""      // 卡识别码
43
+			inputData["certno"] = certNo        // 证件号码
44
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
45
+			inputData["mdtrt_cert_no"] = card_sn // 就诊凭证编号
46
+
47
+		}else {
39 48
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
40 49
 			inputData["card_sn"] = ""           // 卡识别码
41 50
 			inputData["certno"] = certNo        // 证件号码
@@ -43,9 +52,8 @@ func Jxyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
43 52
 		}
44 53
 	}
45 54
 
46
-	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
47 55
 	inputData["begntime"] = ""          // 开始时间
48
-	inputData["psn_name"] = ""          // 人员姓名
56
+	inputData["psn_name"] = name          // 人员姓名
49 57
 	input["data"] = inputData
50 58
 	inputMessage["input"] = input //交易输入
51 59
 
@@ -173,7 +181,7 @@ func Jxyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, i
173 181
 }
174 182
 
175 183
 // 门诊挂号
176
-func Jxyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
184
+func Jxyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string, card_sn string,psn_cert_type string,certno string,psn_type string,psn_name string) (string, string) {
177 185
 	fmt.Println(opera)
178 186
 
179 187
 	// 生成签名
@@ -208,6 +216,15 @@ func Jxyb2201(psnNo string, insutype string, certNo string, org_name string, ope
208 216
 
209 217
 	}
210 218
 
219
+
220
+
221
+	inputData["card_sn"] = card_sn          // 发票号
222
+	inputData["psn_cert_type"] = psn_cert_type          // 发票号
223
+	inputData["certno"] = certno          // 发票号
224
+	inputData["psn_type"] = psn_type          // 发票号
225
+	inputData["psn_name"] = psn_name          // 发票号
226
+
227
+
211 228
 	inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
212 229
 	inputData["atddr_no"] = doctor_id    // 医师编码
213 230
 	inputData["dr_name"] = doctor_name   // 医师姓名
@@ -383,7 +400,7 @@ func Jxyb2203A(psnNo string, mdtrtId string, doctor string, department string, o
383 400
 		fmt.Println(err.Error())
384 401
 		return err.Error(), ""
385 402
 	}
386
-	request_url = request_url + "2203A"
403
+	request_url = request_url + "2203"
387 404
 	//fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
388 405
 
389 406
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2203"), requestLog
@@ -401,8 +418,7 @@ func Jxyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
401 418
 	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
402 419
 	var customs []*Custom
403 420
 	for _, item := range hisPrescription {
404
-		tm := time.Unix(item.PreTime, 0)
405
-
421
+		tm := time.Now()
406 422
 		if item.Type == 1 { //药品
407 423
 			for _, subItem := range item.HisDoctorAdviceInfo {
408 424
 				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
@@ -690,7 +706,7 @@ func Jxyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
690 706
 }
691 707
 
692 708
 //  门诊预结算
693
-func Jxyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
709
+func Jxyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, card_sn string,psn_cert_type string,certno string,psn_type string,psn_name string) (string, string) {
694 710
 
695 711
 	// 生成签名
696 712
 	timestamp := time.Now().Unix() //		inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
@@ -739,6 +755,14 @@ func Jxyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string,
739 755
 	inputData["invono"] = ""            // 发票号
740 756
 	inputData["exp_content"] = ""       // 人员编号 (来自1101接口返回)
741 757
 
758
+
759
+	inputData["card_sn"] = card_sn          // 发票号
760
+	inputData["psn_cert_type"] = psn_cert_type          // 发票号
761
+	inputData["certno"] = certno          // 发票号
762
+	inputData["psn_type"] = psn_type          // 发票号
763
+	inputData["psn_name"] = psn_name          // 发票号
764
+
765
+
742 766
 	input["data"] = inputData
743 767
 	inputMessage["input"] = input //交易输入
744 768
 
@@ -760,7 +784,7 @@ func Jxyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string,
760 784
 }
761 785
 
762 786
 //  门诊结算
763
-func Jxyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
787
+func Jxyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string,card_sn string,psn_cert_type string,certno string,psn_type string,psn_name string) (string, string) {
764 788
 	// 生成签名
765 789
 	timestamp := time.Now().Unix()
766 790
 	// 生成输入报文
@@ -809,6 +833,17 @@ func Jxyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
809 833
 	inputData["preselfpay_amt"] = preselfpay_amt       //
810 834
 	inputData["inscp_scp_amt"] = inscp_scp_amt         //
811 835
 
836
+
837
+
838
+	inputData["card_sn"] = card_sn          // 发票号
839
+	inputData["psn_cert_type"] = psn_cert_type          // 发票号
840
+	inputData["certno"] = certno          // 发票号
841
+	inputData["psn_type"] = psn_type          // 发票号
842
+	inputData["psn_name"] = psn_name          // 发票号
843
+
844
+
845
+
846
+
812 847
 	inputData2 := make(map[string]interface{})
813 848
 	inputData2["trum_flag"] = ""
814 849
 	inputData2["rel_ttp_flag"] = ""
@@ -1012,6 +1047,53 @@ func Jxyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
1012 1047
 
1013 1048
 	return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5203"), string(bytesData)
1014 1049
 }
1050
+func Jxyb5202(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
1051
+	timestamp := time.Now().Unix()
1052
+	// 生成输入报文
1053
+	inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
1054
+	input := make(map[string]interface{})
1055
+	inputData := make(map[string]interface{})
1056
+	inputMessage["infno"] = "5202" // 交易编码
1057
+	inputData["psn_no"] = businessParams.PsnNo
1058
+	inputData["mdtrt_id"] = businessParams.MdtrtId
1059
+	input["data"] = inputData
1060
+	inputMessage["input"] = input //交易输入
1061
+	bytesData, err := json.Marshal(inputMessage)
1062
+	fmt.Println(string(bytesData))
1063
+	if err != nil {
1064
+		fmt.Println(err.Error())
1065
+		return err.Error(), ""
1066
+	}
1067
+	baseParams.RequestUrl = baseParams.RequestUrl + "5202"
1068
+	//fmt.Println(JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
1069
+
1070
+	return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5202"), string(bytesData)
1071
+}
1072
+func Jxyb5201(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
1073
+	timestamp := time.Now().Unix()
1074
+	// 生成输入报文
1075
+	inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
1076
+	input := make(map[string]interface{})
1077
+	inputData := make(map[string]interface{})
1078
+	inputMessage["infno"] = "5201" // 交易编码
1079
+	inputData["psn_no"] = businessParams.PsnNo
1080
+	inputData["begntime"] = "2023-06-01"
1081
+	inputData["endtime"] = "2023-07-30"
1082
+	inputData["med_type"] = "21"
1083
+	inputData["mdtrt_id"] = businessParams.MdtrtId
1084
+	input["data"] = inputData
1085
+	inputMessage["input"] = input //交易输入
1086
+	bytesData, err := json.Marshal(inputMessage)
1087
+	fmt.Println(string(bytesData))
1088
+	if err != nil {
1089
+		fmt.Println(err.Error())
1090
+		return err.Error(), ""
1091
+	}
1092
+	baseParams.RequestUrl = baseParams.RequestUrl + "5201"
1093
+	//fmt.Println(JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
1094
+
1095
+	return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5201"), string(bytesData)
1096
+}
1015 1097
 
1016 1098
 func JxybZY1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
1017 1099
 	timestamp := time.Now().Unix()
@@ -1111,6 +1193,14 @@ func Jxyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedi
1111 1193
 	inputData["insuplc_admdvs"] = insuplc_admdvs
1112 1194
 	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
1113 1195
 
1196
+	inputData["card_sn"] = struct2401.Cardsn
1197
+	inputData["psn_cert_type"] = struct2401.PsnCertType
1198
+	inputData["certno"] = struct2401.Certno
1199
+	inputData["psn_type"] = struct2401.PsnType
1200
+	inputData["psn_name"] = struct2401.PsnName
1201
+
1202
+
1203
+
1114 1204
 	inputDataArr := make([]map[string]interface{}, 0)
1115 1205
 	for _, item := range struct2401.Diseinfo {
1116 1206
 		inputDataTwo := make(map[string]interface{})
@@ -1142,6 +1232,89 @@ func Jxyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedi
1142 1232
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2401"), requestLog
1143 1233
 
1144 1234
 }
1235
+
1236
+func Jxyb2403(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1237
+	// 生成签名
1238
+	timestamp := time.Now().Unix()
1239
+	//tempTime := time.Unix(timestamp, 0)
1240
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
1241
+
1242
+	// 生成输入报文
1243
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1244
+	//inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1245
+	input := make(map[string]interface{})
1246
+	inputData := make(map[string]interface{})
1247
+	inputMessage["infno"] = "2403"           // 交易编码
1248
+	inputData["mdtrt_id"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
1249
+	inputData["psn_no"] = struct2401.PsnNo   // 人员编号 (来自1101接口返回)
1250
+	inputData["coner_name"] = struct2401
1251
+	inputData["tel"] = ""
1252
+	inputData["begntime"] = struct2401.Begntime             // 开始时间
1253
+	inputData["endtime"] = struct2401.Begntime              // 开始时间
1254
+	inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
1255
+	inputData["med_type"] = struct2401.MedType              // 就诊凭证编号
1256
+	inputData["ipt_opt_no"] = struct2401.IptNo              // 住院/门诊号
1257
+
1258
+	inputData["medrcdno"] = ""
1259
+	inputData["atddr_no"] = struct2401.AtddrNo
1260
+	inputData["chfpdr_name"] = struct2401.ChfpdrName
1261
+	inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
1262
+	inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
1263
+	inputData["adm_dept_name"] = struct2401.AdmDeptName
1264
+	inputData["adm_bed"] = struct2401.AdmBed
1265
+	inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
1266
+	inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
1267
+	inputData["main_cond_dscr"] = ""
1268
+	inputData["dise_codg"] = struct2401.DiseCodg
1269
+	inputData["dise_name"] = struct2401.DiseName
1270
+	inputData["oprn_oprt_code"] = ""
1271
+	inputData["oprn_oprt_name"] = ""
1272
+	inputData["fpsc_no"] = ""
1273
+	inputData["matn_type"] = ""
1274
+	inputData["birctrl_type"] = ""
1275
+	inputData["latechb_flag"] = ""
1276
+	inputData["geso_val"] = ""
1277
+	inputData["fetts"] = ""
1278
+	inputData["fetus_cnt"] = ""
1279
+	inputData["pret_flag"] = ""
1280
+	inputData["birctrl_matn_date"] = ""
1281
+	inputData["dise_type_code"] = ""
1282
+	inputData["expContent"] = ""
1283
+
1284
+	inputDataArr := make([]map[string]interface{}, 0)
1285
+	for _, item := range struct2401.Diseinfo {
1286
+		inputDataTwo := make(map[string]interface{})
1287
+		inputDataTwo["mdtrt_id"] = item.PsnNo
1288
+
1289
+		inputDataTwo["psn_no"] = item.PsnNo
1290
+		inputDataTwo["diag_type"] = item.DiagType
1291
+		inputDataTwo["maindiag_flag"] = item.MaindiagFlag
1292
+		inputDataTwo["diag_srt_no"] = item.DiagSrtNo
1293
+		inputDataTwo["diag_code"] = item.DiagCode
1294
+		inputDataTwo["diag_name"] = item.DiagName
1295
+		inputDataTwo["adm_cond"] = ""
1296
+		inputDataTwo["diag_dept"] = item.DiagDept
1297
+		inputDataTwo["dise_dor_no"] = item.DiseDorNo
1298
+		inputDataTwo["dise_dor_name"] = item.DiseDorName
1299
+		inputDataTwo["diag_time"] = item.DiagTime
1300
+		inputDataArr = append(inputDataArr, inputDataTwo)
1301
+	}
1302
+	input["adminfo"] = inputData
1303
+	input["diseinfo"] = inputDataArr
1304
+	inputMessage["input"] = input //交易输入
1305
+
1306
+	bytesData, err := json.Marshal(inputMessage)
1307
+	fmt.Println(string(bytesData))
1308
+	requestLog := string(bytesData)
1309
+	if err != nil {
1310
+		fmt.Println(err.Error())
1311
+		return err.Error(), ""
1312
+	}
1313
+	request_url = request_url + "2403"
1314
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2403"), requestLog
1315
+
1316
+}
1317
+
1145 1318
 func Jxyb2404(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1146 1319
 	// 生成签名
1147 1320
 	timestamp := time.Now().Unix()
@@ -1378,7 +1551,7 @@ func Jxyb2302(psnNo string, mdtrtId string, refund_type int64, number string, se
1378 1551
 
1379 1552
 }
1380 1553
 
1381
-func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1554
+func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string,card_sn string,psn_type int64,psn_cert_type string,certno string,psn_name string) (string, string) {
1382 1555
 	// 生成签名
1383 1556
 	nonce := GetRandomString(32)
1384 1557
 	timestamp := time.Now().Unix()
@@ -1411,6 +1584,16 @@ func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, tota
1411 1584
 	inputData["invono"] = ""                   // 发票号
1412 1585
 	inputData["dise_codg"] = "M07803"          // 发票号
1413 1586
 
1587
+	inputData["card_sn"] = card_sn          // 发票号
1588
+	inputData["psn_cert_type"] = psn_cert_type          // 发票号
1589
+	inputData["certno"] = certno          // 发票号
1590
+	inputData["psn_type"] = psn_type          // 发票号
1591
+	inputData["psn_name"] = psn_name          // 发票号
1592
+
1593
+
1594
+
1595
+
1596
+
1414 1597
 	inputData["insuplc_admdvs"] = insuplc_admdvs   // 发票号
1415 1598
 	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs // 发票号
1416 1599
 
@@ -1429,7 +1612,7 @@ func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, tota
1429 1612
 
1430 1613
 }
1431 1614
 
1432
-func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, fapiao_number string, acct_used_flag string) (string, string) {
1615
+func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, fapiao_number string, acct_used_flag string,card_sn string,psn_type string,psn_cert_type string,certno string,psn_name string) (string, string) {
1433 1616
 	// 生成签名
1434 1617
 	nonce := GetRandomString(32)
1435 1618
 	timestamp := time.Now().Unix()
@@ -1468,6 +1651,13 @@ func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, tota
1468 1651
 	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
1469 1652
 	inputData["insutype"] = insutype             // 险种类型
1470 1653
 
1654
+	inputData["card_sn"] = card_sn          // 发票号
1655
+	inputData["psn_cert_type"] = psn_cert_type          // 发票号
1656
+	inputData["certno"] = certno          // 发票号
1657
+	inputData["psn_type"] = psn_type          // 发票号
1658
+	inputData["psn_name"] = psn_name          // 发票号
1659
+
1660
+
1471 1661
 	input["data"] = inputData
1472 1662
 	inputMessage["input"] = input //交易输入
1473 1663
 
@@ -1483,6 +1673,69 @@ func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, tota
1483 1673
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
1484 1674
 
1485 1675
 }
1676
+func Jxyb2304a(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, fapiao_number string, acct_used_flag string,card_sn string,psn_type int64,psn_cert_type string,certno string,psn_name string) (string, string) {
1677
+	// 生成签名
1678
+	nonce := GetRandomString(32)
1679
+	timestamp := time.Now().Unix()
1680
+
1681
+	// 生成输入报文
1682
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
1683
+	input := make(map[string]interface{})
1684
+	inputData := make(map[string]interface{})
1685
+	inputMessage["infno"] = "2304" // 交易编码
1686
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
1687
+	if certificates == 3 {
1688
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
1689
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1690
+	} else {
1691
+		if id_card_type == 1 {
1692
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
1693
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1694
+		} else if id_card_type == 4 {
1695
+
1696
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
1697
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1698
+
1699
+		} else {
1700
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
1701
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1702
+		}
1703
+	}
1704
+	inputData["insuplc_admdvs"] = insuplc_admdvs
1705
+	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
1706
+
1707
+	inputData["mdtrt_cert_sn"] = ""
1708
+	inputData["mid_setl_flag"] = mid_setl_flag   // 中途退费标志
1709
+	inputData["medfee_sumamt"] = total           // 医疗费总额
1710
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
1711
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
1712
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
1713
+	inputData["insutype"] = insutype             // 险种类型
1714
+
1715
+	inputData["card_sn"] = card_sn          // 发票号
1716
+	inputData["psn_cert_type"] = psn_cert_type          // 发票号
1717
+	inputData["certno"] = certno          // 发票号
1718
+	inputData["psn_type"] = psn_type          // 发票号
1719
+	inputData["psn_name"] = psn_name          // 发票号
1720
+
1721
+
1722
+	input["data"] = inputData
1723
+	inputMessage["input"] = input //交易输入
1724
+
1725
+	bytesData, err := json.Marshal(inputMessage)
1726
+	fmt.Println(string(bytesData))
1727
+	requestLog := string(bytesData)
1728
+	if err != nil {
1729
+		fmt.Println(err.Error())
1730
+		return err.Error(), ""
1731
+	}
1732
+
1733
+	request_url = request_url + "2304"
1734
+	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
1735
+
1736
+}
1737
+
1738
+
1486 1739
 func Jxyb2305(psnNo string, mdtrtId string, setlId string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
1487 1740
 	// 生成签名
1488 1741
 	timestamp := time.Now().Unix()
@@ -1585,14 +1838,10 @@ func SetJXInputMessage(timestamp int64, org_name string, doctor string, fixmedin
1585 1838
 	inputMessage["signtype"] = "SM3"                                                            // 签名类型
1586 1839
 	inputMessage["infver"] = "V1.0"                                                             // 接收方系统代码
1587 1840
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
1588
-	if fixmedins_code == "H32090403023" {
1589 1841
 
1590
-		inputMessage["opter"] = "晁海燕"      // 经办人
1591
-		inputMessage["opter_name"] = "晁海燕" // 经办人姓名
1592
-	} else {
1593
-		inputMessage["opter"] = doctor      // 经办人
1594
-		inputMessage["opter_name"] = doctor // 经办人姓名
1595
-	}
1842
+	inputMessage["opter"] = doctor      // 经办人
1843
+	inputMessage["opter_name"] = doctor // 经办人姓名
1844
+
1596 1845
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1597 1846
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
1598 1847
 	inputMessage["fixmedins_name"] = org_name
@@ -1666,17 +1915,17 @@ func Jxyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1666 1915
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2503"), string(bytesData)
1667 1916
 }
1668 1917
 
1669
-func Jxyb3201(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
1918
+func Jxyb3201(fixmedins_setl_cnt int64,  stmt_begndate string, stmt_enddate string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string,medfee_sumamt string,fund_pay_sumamt string,acct_pay string) (string, string) {
1670 1919
 	// 生成签名
1671 1920
 	timestamp := time.Now().Unix()
1672 1921
 	// 生成输入报文
1673
-	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1922
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, "360399", "360399", "")
1674 1923
 	input := make(map[string]interface{})
1675 1924
 	inputData := make(map[string]interface{})
1676 1925
 	inputMessage["infno"] = "3201"                       // 交易编码
1677 1926
 	inputData["insutype"] = insutype                     // 险种
1678 1927
 	inputData["clr_type"] = clr_type                     // 就诊 ID(来自2201接口返回)
1679
-	inputData["setl_optins"] = setl_optins               // 结算经办机构
1928
+	inputData["setl_optins"] = "360302"               // 结算经办机构
1680 1929
 	inputData["stmt_begndate"] = stmt_begndate           // 对帐开始时间
1681 1930
 	inputData["stmt_enddate"] = stmt_enddate             //对帐结束时间
1682 1931
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
@@ -2075,83 +2324,83 @@ func Jxyb4101(struct4101 Struct4101, params models.PublicParams) (string, string
2075 2324
 	inputData["setl_id"] = struct4101.SetlId   // 结算 ID  必填
2076 2325
 	inputData["psn_no"] = struct4101.PsnNo     // 结算 ID  必填
2077 2326
 
2078
-	inputData["fixmedins_name"] = params.FixmedinsName        // 定点医药机构名称  必填
2079
-	inputData["fixmedins_code"] = params.FixmedinsCode        // 定点医药机构编码  必填
2080
-	inputData["hi_setl_lv"] = ""                              // 医保结算等级
2081
-	inputData["hi_no"] = struct4101.PsnNo                     // 医保编号
2082
-	inputData["medcasno"] = struct4101.PsnNo                  // 病案号  必填
2083
-	inputData["dcla_time"] = year + "-" + month + "-" + day   // 申报时间  必填
2084
-	inputData["psn_name"] = struct4101.PsnName                // 人员姓名  必填
2085
-	inputData["gend"] = struct4101.Gend                       // 性别  必填
2086
-	inputData["brdy"] = struct4101.Brdy                       // 出生日期  必填
2087
-	inputData["age"] = struct4101.Age                         // 年龄  必填
2088
-	inputData["ntly"] = struct4101.Ntly                       // 国籍  必填
2089
-	inputData["nwb_age"] = ""                                 // 年龄  必填
2090
-	inputData["naty"] = struct4101.Naty                       // 民族  必填
2091
-	inputData["patn_cert_type"] = struct4101.PatnCertType     // 患者证件类别  必填
2092
-	inputData["certno"] = struct4101.Certno                   // 证件号码  必填
2093
-	inputData["prfs"] = struct4101.Prfs                       // 职业  必填
2094
-	inputData["curr_addr"] = ""                               // 现住址  必填
2095
-	inputData["emp_name"] = ""                                // 单位名称  必填
2096
-	inputData["emp_addr"] = ""                                // 单位地址  必填
2097
-	inputData["emp_tel"] = ""                                 // 单位电话  必填
2098
-	inputData["poscode"] = ""                                 // 邮编  必填
2099
-	inputData["coner_name"] = struct4101.ConerName            // 联系人姓名  必填
2100
-	inputData["patn_rlts"] = struct4101.PatnRlts              // 与患者关系  必填
2101
-	inputData["coner_addr"] = struct4101.ConerAddr            // 联系人地址  必填
2102
-	inputData["coner_tel"] = struct4101.ConerTel              // 联系人电话  必填
2103
-	inputData["hi_type"] = struct4101.HiType                  // 医保类型  必填
2104
-	inputData["insuplc"] = struct4101.Insuplc                 // 参保地  必填
2105
-	inputData["sp_psn_type"] = ""                             // 特殊人员类型  必填
2106
-	inputData["nwb_adm_type"] = ""                            // 新生儿入院类型  必填
2107
-	inputData["nwb_bir_wt"] = ""                              // 新生儿出生体重  必填
2108
-	inputData["nwb_adm_wt"] = ""                              // 新生儿入院体重  必填
2109
-	inputData["opsp_diag_caty"] = ""                          // 门诊慢特病诊断  必填
2110
-	inputData["opsp_mdtrt_date"] = ""                         // 门诊慢特病就诊日期  必填
2111
-	inputData["ipt_med_type"] = struct4101.IptMedType         // 住院医疗类型  必填
2112
-	inputData["adm_way"] = ""                                 // 入院途径  必填
2113
-	inputData["trt_type"] = ""                                // 治疗类别  必填
2114
-	inputData["adm_time"] = struct4101.AdmTime                // 入院时间  必填
2115
-	inputData["adm_caty"] = struct4101.AdmCaty                // 入院科别  必填
2116
-	inputData["refldept_dept"] = ""                           // 转科科别  必填
2117
-	inputData["dscg_time"] = struct4101.AdmEndTime            // 出院时间  必填
2118
-	inputData["dscg_caty"] = struct4101.AdmCaty               // 出院科别  必填
2119
-	inputData["act_ipt_days"] = ""                            // 实际住院天数  必填
2120
-	inputData["otp_wm_dise"] = ""                             // 门(急) 诊西医诊断  必填
2121
-	inputData["wm_dise_code"] = ""                            // 门(急) 诊中医诊断  必填
2122
-	inputData["otp_tcm_dise"] = ""                            // 西医诊断疾病代码  必填
2123
-	inputData["tcm_dise_code"] = ""                           // 中医诊断代码  必填
2124
-	inputData["oprn_oprt_code_cnt"] = ""                      // 手术操作代码计数  必填
2125
-	inputData["vent_used_dura"] = ""                          // 呼吸机使用时长  必填
2126
-	inputData["pwcry_bfadm_coma_dura"] = ""                   // 颅脑损伤患者入院前昏迷时长  必填
2127
-	inputData["pwcry_afadm_coma_dura"] = ""                   // 颅脑损伤患者入院后昏迷时长  必填
2128
-	inputData["bld_cat"] = ""                                 // 输血品种  必填
2129
-	inputData["bld_amt"] = ""                                 // 输血量  必填
2130
-	inputData["bld_unt"] = ""                                 // 输血计量单位  必填
2131
-	inputData["spga_nurscare_days"] = ""                      // 特级护理天数  必填
2132
-	inputData["lv1_nurscare_days"] = ""                       // 一级护理天数  必填
2133
-	inputData["scd_nurscare_days"] = ""                       // 二级护理天数  必填
2134
-	inputData["lv3_nurscare_days"] = ""                       // 三级护理天数  必填
2135
-	inputData["acp_medins_name"] = ""                         // 拟接收机构名称  必填
2136
-	inputData["acp_optins_code"] = ""                         // 拟接收机构代码  必填
2137
-	inputData["bill_code"] = struct4101.BillCode              // 票据代码  必填
2138
-	inputData["bill_no"] = struct4101.BillNo                  // 票据号码  必填
2139
-	inputData["biz_sn"] = struct4101.BizSn                    // 业务流水号  必填
2140
-	inputData["days_rinp_flag_31"] = ""                       // 出院 31 天内再住院计划标志  必填
2141
-	inputData["days_rinp_pup_31"] = ""                        // 出院 31 天内再住院目的  必填
2142
-	inputData["chfpdr_name"] = ""                             // 主诊医师姓名  必填
2143
-	inputData["chfpdr_code"] = ""                             // 主诊医师代码  必填
2144
-	inputData["setl_begn_date"] = struct4101.SetlBegnDate     // 结算开始日期  必填
2145
-	inputData["setl_end_date"] = struct4101.SetlEndDate       // 结算结束日期  必填
2146
-	inputData["psn_selfpay"] = struct4101.PsnSelfPay          // 个人自付  必填
2147
-	inputData["psn_ownpay"] = struct4101.PsnOwnPay            // 个人自费  必填
2148
-	inputData["acct_pay"] = struct4101.AcctPay                // 个人账户支出  必填
2149
-	inputData["hi_paymtd"] = struct4101.HiPaymtd              // 医保支付方式  必填
2150
-	inputData["hsorg"] = struct4101.Hsorg                     // 医保机构  必填
2151
-	inputData["hsorg_opter"] = struct4101.HsorgOpter          // 医保机构经办人  必填
2152
-	inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门  必填
2153
-	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn   // 医疗机构填报人  必填
2154
-	inputData["psn_cashpay"] = struct4101.PsnCashpay          // 医疗机构填报人  必填
2327
+	inputData["fixmedins_name"] = params.FixmedinsName      // 定点医药机构名称  必填
2328
+	inputData["fixmedins_code"] = params.FixmedinsCode      // 定点医药机构编码  必填
2329
+	inputData["hi_setl_lv"] = ""                            // 医保结算等级
2330
+	inputData["hi_no"] = struct4101.PsnNo                   // 医保编号
2331
+	inputData["medcasno"] = struct4101.PsnNo                // 病案号  必填
2332
+	inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间  必填
2333
+	inputData["psn_name"] = struct4101.PsnName              // 人员姓名  必填
2334
+	inputData["gend"] = struct4101.Gend                     // 性别  必填
2335
+	inputData["brdy"] = struct4101.Brdy                     // 出生日期  必填
2336
+	inputData["age"] = struct4101.Age                       // 年龄  必填
2337
+	inputData["ntly"] = struct4101.Ntly                     // 国籍  必填
2338
+	inputData["nwb_age"] = ""                               // 年龄  必填
2339
+	inputData["naty"] = struct4101.Naty                     // 民族  必填
2340
+	inputData["patn_cert_type"] = struct4101.PatnCertType   // 患者证件类别  必填
2341
+	inputData["certno"] = struct4101.Certno                 // 证件号码  必填
2342
+	inputData["prfs"] = struct4101.Prfs                     // 职业  必填
2343
+	inputData["curr_addr"] = ""                             // 现住址  必填
2344
+	inputData["emp_name"] = ""                              // 单位名称  必填
2345
+	inputData["emp_addr"] = ""                              // 单位地址  必填
2346
+	inputData["emp_tel"] = ""                               // 单位电话  必填
2347
+	inputData["poscode"] = ""                               // 邮编  必填
2348
+	inputData["coner_name"] = struct4101.ConerName          // 联系人姓名  必填
2349
+	inputData["patn_rlts"] = struct4101.PatnRlts            // 与患者关系  必填
2350
+	inputData["coner_addr"] = struct4101.ConerAddr          // 联系人地址  必填
2351
+	inputData["coner_tel"] = struct4101.ConerTel            // 联系人电话  必填
2352
+	inputData["hi_type"] = struct4101.HiType                // 医保类型  必填
2353
+	inputData["insuplc"] = struct4101.Insuplc               // 参保地  必填
2354
+	inputData["sp_psn_type"] = ""                           // 特殊人员类型  必填
2355
+	inputData["nwb_adm_type"] = ""                          // 新生儿入院类型  必填
2356
+	inputData["nwb_bir_wt"] = ""                            // 新生儿出生体重  必填
2357
+	inputData["nwb_adm_wt"] = ""                            // 新生儿入院体重  必填
2358
+	inputData["opsp_diag_caty"] = ""                        // 门诊慢特病诊断  必填
2359
+	inputData["opsp_mdtrt_date"] = ""                       // 门诊慢特病就诊日期  必填
2360
+	inputData["ipt_med_type"] = struct4101.IptMedType       // 住院医疗类型  必填
2361
+	inputData["adm_way"] = ""                               // 入院途径  必填
2362
+	inputData["trt_type"] = ""                              // 治疗类别  必填
2363
+	inputData["adm_time"] = struct4101.AdmTime              // 入院时间  必填
2364
+	inputData["adm_caty"] = struct4101.AdmCaty              // 入院科别  必填
2365
+	inputData["refldept_dept"] = ""                         // 转科科别  必填
2366
+	inputData["dscg_time"] = struct4101.AdmEndTime          // 出院时间  必填
2367
+	inputData["dscg_caty"] = struct4101.AdmCaty             // 出院科别  必填
2368
+	inputData["act_ipt_days"] = ""                          // 实际住院天数  必填
2369
+	inputData["otp_wm_dise"] = ""                           // 门(急) 诊西医诊断  必填
2370
+	inputData["wm_dise_code"] = ""                          // 门(急) 诊中医诊断  必填
2371
+	inputData["otp_tcm_dise"] = ""                          // 西医诊断疾病代码  必填
2372
+	inputData["tcm_dise_code"] = ""                         // 中医诊断代码  必填
2373
+	inputData["oprn_oprt_code_cnt"] = ""                    // 手术操作代码计数  必填
2374
+	inputData["vent_used_dura"] = ""                        // 呼吸机使用时长  必填
2375
+	inputData["pwcry_bfadm_coma_dura"] = ""                 // 颅脑损伤患者入院前昏迷时长  必填
2376
+	inputData["pwcry_afadm_coma_dura"] = ""                 // 颅脑损伤患者入院后昏迷时长  必填
2377
+	inputData["bld_cat"] = ""                               // 输血品种  必填
2378
+	inputData["bld_amt"] = ""                               // 输血量  必填
2379
+	inputData["bld_unt"] = ""                               // 输血计量单位  必填
2380
+	inputData["spga_nurscare_days"] = ""                    // 特级护理天数  必填
2381
+	inputData["lv1_nurscare_days"] = ""                     // 一级护理天数  必填
2382
+	inputData["scd_nurscare_days"] = ""                     // 二级护理天数  必填
2383
+	inputData["lv3_nurscare_days"] = ""                     // 三级护理天数  必填
2384
+	inputData["acp_medins_name"] = ""                       // 拟接收机构名称  必填
2385
+	inputData["acp_optins_code"] = ""                       // 拟接收机构代码  必填
2386
+	inputData["bill_code"] = struct4101.BillCode            // 票据代码  必填
2387
+	inputData["bill_no"] = struct4101.BillNo                // 票据号码  必填
2388
+	inputData["biz_sn"] = struct4101.BizSn                  // 业务流水号  必填
2389
+	inputData["days_rinp_flag_31"] = ""                     // 出院 31 天内再住院计划标志  必填
2390
+	inputData["days_rinp_pup_31"] = ""                      // 出院 31 天内再住院目的  必填
2391
+	inputData["chfpdr_name"] = ""                           // 主诊医师姓名  必填
2392
+	inputData["chfpdr_code"] = ""                           // 主诊医师代码  必填
2393
+	inputData["setl_begn_date"] = struct4101.SetlBegnDate   // 结算开始日期  必填
2394
+	inputData["setl_end_date"] = struct4101.SetlEndDate     // 结算结束日期  必填
2395
+	inputData["psn_selfpay"] = struct4101.PsnSelfPay        // 个人自付  必填
2396
+	inputData["psn_ownpay"] = struct4101.PsnOwnPay          // 个人自费  必填
2397
+	inputData["acct_pay"] = struct4101.AcctPay              // 个人账户支出  必填
2398
+	inputData["hi_paymtd"] = struct4101.HiPaymtd            // 医保支付方式  必填
2399
+	inputData["hsorg"] = params.FixmedinsName               // 医保机构  必填
2400
+	inputData["hsorg_opter"] = struct4101.HsorgOpter        // 医保机构经办人  必填
2401
+	inputData["medins_fill_dept"] = params.FixmedinsName    // 医疗机构填报部门  必填
2402
+	inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人  必填
2403
+	inputData["psn_cashpay"] = struct4101.PsnCashpay        // 医疗机构填报人  必填
2155 2404
 
2156 2405
 	payinfo := make([]map[string]interface{}, 0) // 基金支付信息
2157 2406
 	for _, item := range struct4101.CustomStruct {
@@ -2235,13 +2484,15 @@ func Jxyb4102(psn_no string, setl_id string, params models.PublicParams, stas_ty
2235 2484
 	// 生成输入报文
2236 2485
 	input := make(map[string]interface{})
2237 2486
 	inputData := make(map[string]interface{})
2487
+	inputData2 := make(map[string]interface{})
2488
+
2238 2489
 	inputMessage["infno"] = "4102" // 交易编码
2239 2490
 
2240 2491
 	inputData["setl_id"] = setl_id     // 结算 ID  必填
2241 2492
 	inputData["psn_no"] = psn_no       // 结算 ID  必填
2242 2493
 	inputData["stas_type"] = stas_type // 结算 ID  必填
2243
-
2244
-	input["data"] = inputData
2494
+	inputData2["stastinfo"]  = inputData
2495
+	input["data"] = inputData2
2245 2496
 	inputMessage["input"] = input //交易输入
2246 2497
 	bytesData, _ := json.Marshal(inputMessage)
2247 2498
 	fmt.Println(string(bytesData))
@@ -2272,6 +2523,33 @@ func Jxyb4103(psn_no string, setl_id string, params models.PublicParams) (string
2272 2523
 
2273 2524
 }
2274 2525
 
2526
+
2527
+func Jxyb4105( params models.PublicParams) (string, string) {
2528
+	var meds []string
2529
+	meds = append(meds,"21")
2530
+
2531
+	timestamp := time.Now().Unix()
2532
+	inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
2533
+	// 生成输入报文
2534
+	input := make(map[string]interface{})
2535
+	inputData := make(map[string]interface{})
2536
+	inputMessage["infno"] = "4105" // 交易编码
2537
+
2538
+	inputData["fixmedins_code"] = params.FixmedinsCode // 结算 ID  必填
2539
+	inputData["medtype_list"] = meds // 结算 ID  必填
2540
+	inputData["stt_begntime"] = "2023-11-01"// 结算 ID  必填
2541
+	inputData["stt_endtime"] = "2023-11-31"// 结算 ID  必填
2542
+
2543
+	input["data"] = inputData
2544
+	inputMessage["input"] = input //交易输入
2545
+	bytesData, _ := json.Marshal(inputMessage)
2546
+	fmt.Println(string(bytesData))
2547
+
2548
+	params.RequestUrl = params.RequestUrl + "4105"
2549
+	return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4105"), string(bytesData)
2550
+
2551
+}
2552
+
2275 2553
 func Jxyb3501(struct3501 models.Struct3501) (string, string) {
2276 2554
 	timestamp := time.Now().Unix()
2277 2555
 	// 生成输入报文

+ 218 - 38
service/nm_service.go View File

@@ -5,14 +5,16 @@ import (
5 5
 	"encoding/json"
6 6
 	"fmt"
7 7
 	"gdyb/models"
8
+	"github.com/astaxie/beego"
8 9
 	"io/ioutil"
9 10
 	"net/http"
10 11
 	"strconv"
12
+	"strings"
11 13
 	"time"
12 14
 )
13 15
 
14 16
 // 门诊挂号
15
-func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, verify_number string, cainfo string) (string, string) {
17
+func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, verify_number string, cainfo string) (string, string) {
16 18
 	// 生成签名
17 19
 	// 生成签名
18 20
 	nonce := GetRandomString(32)
@@ -20,9 +22,9 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
20 22
 	signature := setSignature(timestamp, nonce, secret_key)
21 23
 	tempTime := time.Unix(timestamp, 0)
22 24
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
23
-
25
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
24 26
 	// 生成输入报文
25
-	inputMessage := SetJSInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
27
+	//inputMessage := SetInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
26 28
 	input := make(map[string]interface{})
27 29
 	inputData := make(map[string]interface{})
28 30
 	inputMessage["infno"] = "2201"        // 交易编码
@@ -31,8 +33,8 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
31 33
 	inputData["begntime"] = timeFormatOne // 开始时间
32 34
 
33 35
 	if id_card_type == 1 {
34
-		inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
35
-		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
36
+		inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
37
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
36 38
 	} else if id_card_type == 3 {
37 39
 		inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
38 40
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
@@ -40,8 +42,8 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
40 42
 		inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
41 43
 		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
42 44
 	} else {
43
-		inputData["mdtrt_cert_type"] = "02"        // 就诊凭证类型
44
-		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
45
+		inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
46
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
45 47
 
46 48
 	}
47 49
 
@@ -68,9 +70,8 @@ func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, ope
68 70
 
69 71
 	gdyb_url := beego.AppConfig.String("gdyb_url")
70 72
 	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
71
-	request_url = gdyb_url
72 73
 
73
-	request, err := http.NewRequest("POST", request_url, reader)
74
+	request, err := http.NewRequest("POST", gdyb_url, reader)
74 75
 	if err != nil {
75 76
 		fmt.Println(err.Error())
76 77
 		return err.Error(), ""
@@ -108,7 +109,9 @@ func Nmyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
108 109
 	signature := setSignature(timestamp, nonce, secret_key)
109 110
 
110 111
 	// 生成输入报文
111
-	inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
112
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
113
+
114
+	//inputMessage := SetInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
112 115
 	input := make(map[string]interface{})
113 116
 	inputData := make(map[string]interface{})
114 117
 	inputMessage["infno"] = "2202"       // 交易编码
@@ -255,10 +258,104 @@ func Nmyb2203(psnNo string, mdtrtId string, doctor string, department string, or
255 258
 	fmt.Println(str)
256 259
 	return str, requestLog
257 260
 
261
+}
262
+func Nmyb2203C(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, cainfo string) (string, string) {
263
+	// 生成签名
264
+	// 生成签名
265
+	nonce := GetRandomString(32)
266
+	timestamp := time.Now().Unix()
267
+	signature := setSignature(timestamp, nonce, secret_key)
268
+	//tempTime := time.Unix(timestamp, 0)
269
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
270
+	// 生成输入报文
271
+
272
+	tempTime := time.Unix(timestamp, 0)
273
+	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
274
+	// 生成输入报文
275
+	inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
276
+	input := make(map[string]interface{})
277
+	inputData := make(map[string]interface{})
278
+	diseinfo := make([]map[string]interface{}, 0)
279
+
280
+	if med_type == "1111" || med_type == "1112" {
281
+		med_type = "11"
282
+	}
283
+
284
+	inputMessage["infno"] = "2203A"     // 交易编码
285
+	inputData["mdtrt_id"] = mdtrtId     // 就诊 ID(来自2201接口返回)
286
+	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
287
+	inputData["med_type"] = med_type    // 医疗类别 16门诊特殊病
288
+	inputData["begntime"] = begin_time  // 开始时间
289
+	inputData["main_cond_dscr"] = ""    // 主要病情描述
290
+	inputData["dise_codg"] = sick_code  // 病种编码
291
+	inputData["dise_name"] = sick_name  // 病种名称
292
+	inputData["birctrl_type"] = ""      // 计划生育手术类别
293
+	inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
294
+
295
+	for index, item := range config {
296
+		diseinfo_sun := make(map[string]interface{})
297
+		diseinfo_sun["diag_type"] = "1"              // 诊断类别
298
+		diseinfo_sun["diag_srt_no"] = index          // 诊断排序号
299
+		diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
300
+		diseinfo_sun["diag_name"] = item.ClassName   // 诊断名称
301
+		diseinfo_sun["diag_dept"] = department       // 诊断科室
302
+		diseinfo_sun["dise_dor_no"] = doctor_id      // 诊断医生编码
303
+		diseinfo_sun["dise_dor_name"] = doctor       // 诊断医生姓名
304
+		diseinfo_sun["diag_time"] = timeFormatOne    // 诊断时间
305
+		diseinfo_sun["vali_flag"] = "0"              // 有效标志
306
+		diseinfo = append(diseinfo, diseinfo_sun)
307
+	}
308
+	//inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
309
+	inputData["exp_content"] = "" //
310
+
311
+	input["diseinfo"] = diseinfo
312
+	input["mdtrtinfo"] = inputData
313
+	inputMessage["input"] = input //交易输入
314
+	var requestLog string
315
+	bytesData, err := json.Marshal(inputMessage)
316
+	fmt.Println(string(bytesData))
317
+	requestLog = string(bytesData)
318
+	if err != nil {
319
+		fmt.Println(err.Error())
320
+		return err.Error(), ""
321
+	}
322
+	reader := bytes.NewReader(bytesData)
323
+
324
+	gdyb_url := beego.AppConfig.String("gdyb_url")
325
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
326
+
327
+	request, err := http.NewRequest("POST", gdyb_url, reader)
328
+	if err != nil {
329
+		fmt.Println(err.Error())
330
+		return err.Error(), ""
331
+	}
332
+
333
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
334
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
335
+	request.Header.Set("x-tif-signature", signature)
336
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
337
+	request.Header.Set("x-tif-nonce", nonce)
338
+
339
+	client := http.Client{}
340
+	resp, err := client.Do(request)
341
+	if err != nil {
342
+		fmt.Println(err.Error())
343
+		return err.Error(), ""
344
+	}
345
+	respBytes, err := ioutil.ReadAll(resp.Body)
346
+	if err != nil {
347
+		fmt.Println(err.Error())
348
+		return err.Error(), ""
349
+	}
350
+	str := string(respBytes)
351
+	fmt.Println(str)
352
+	return str, requestLog
353
+
258 354
 }
259 355
 
260 356
 // 门诊费用明细信息上传
261 357
 func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, diag_code string, request_url string, access_key string, new_doctor_name string, time_stamp_2203 string, cainfo string) (string, string) {
358
+
262 359
 	// 生成签名
263 360
 	timestamp := time.Now().Unix()
264 361
 	// 生成签名
@@ -267,7 +364,7 @@ func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
267 364
 
268 365
 	var customs []*Custom
269 366
 	for _, item := range hisPrescription {
270
-		tm := time.Unix(item.PreTime, 0)
367
+		tm := time.Now()
271 368
 
272 369
 		if item.Type == 1 { //药品
273 370
 			for _, subItem := range item.HisDoctorAdviceInfo {
@@ -394,23 +491,12 @@ func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
394 491
 		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
395 492
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
396 493
 
397
-		if fixmedins_code == "H32092103007" {
398
-			feedetailInfo["bilg_dr_codg"] = "D320923012139"   // 开单医生编码
399
-			feedetailInfo["bilg_dr_name"] = "王曙光"             // 开单医师姓名
400
-			feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
401
-			feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
402
-			feedetailInfo["orders_dr_code"] = "D320923012139" // 受单医生编码
403
-			feedetailInfo["orders_dr_name"] = "王曙光"           // 受单医生姓名
404
-
405
-		} else {
406
-			feedetailInfo["bilg_dr_codg"] = "D371621008686"   // 开单医生编码
407
-			feedetailInfo["bilg_dr_name"] = "王云刚"             // 开单医师姓名
408
-			feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
409
-			feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
410
-			feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
411
-			feedetailInfo["orders_dr_name"] = "王云刚"           // 受单医生姓名
412
-
413
-		}
494
+		feedetailInfo["bilg_dr_codg"] = doctor_id         // 开单医生编码
495
+		feedetailInfo["bilg_dr_name"] = new_doctor_name   // 开单医师姓名
496
+		feedetailInfo["acord_dept_codg"] = dept_code      // 受单科室编码
497
+		feedetailInfo["acord_dept_name"] = dept           // 受单科室名称
498
+		feedetailInfo["orders_dr_code"] = doctor_id       // 受单医生编码
499
+		feedetailInfo["orders_dr_name"] = new_doctor_name // 受单医生姓名
414 500
 
415 501
 		if balance_accounts_type == "8" {
416 502
 			feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
@@ -553,7 +639,10 @@ func Nmyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
553 639
 
554 640
 // 门诊预结算
555 641
 func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, mdtrt_grp_type string) (string, string) {
642
+	if !strings.Contains(insuplc_admdvs, "150") {
556 643
 
644
+		chrgBchno = "0000"
645
+	}
557 646
 	// 生成签名
558 647
 	nonce := GetRandomString(32)
559 648
 	timestamp := time.Now().Unix()
@@ -571,8 +660,8 @@ func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
571 660
 		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
572 661
 	} else {
573 662
 		if id_card_type == 1 {
574
-			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
575
-			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
663
+			inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
664
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
576 665
 		} else if id_card_type == 3 {
577 666
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
578 667
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
@@ -580,8 +669,8 @@ func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
580 669
 			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
581 670
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
582 671
 		} else {
583
-			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
584
-			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
672
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
673
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
585 674
 		}
586 675
 	}
587 676
 	if insuplc_admdvs == "421300" {
@@ -654,6 +743,10 @@ func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
654 743
 
655 744
 // 门诊结算
656 745
 func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string, mdtrt_grp_type string) (string, string) {
746
+	if !strings.Contains(insuplc_admdvs, "150") {
747
+
748
+		chrgBchno = "0000"
749
+	}
657 750
 	// 生成签名
658 751
 	nonce := GetRandomString(32)
659 752
 	timestamp := time.Now().Unix()
@@ -665,12 +758,12 @@ func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
665 758
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
666 759
 
667 760
 	if certificates == 3 {
668
-		inputData["mdtrt_cert_type"] = "99"                       // 就诊凭证类型
669
-		inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
761
+		inputData["mdtrt_cert_type"] = "99"        // 就诊凭证类型
762
+		inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
670 763
 	} else {
671 764
 		if id_card_type == 1 {
672
-			inputData["mdtrt_cert_type"] = "03"                       // 就诊凭证类型
673
-			inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
765
+			inputData["mdtrt_cert_type"] = "03"        // 就诊凭证类型
766
+			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
674 767
 		} else if id_card_type == 3 {
675 768
 			inputData["mdtrt_cert_type"] = "04"        // 就诊凭证类型
676 769
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
@@ -678,7 +771,8 @@ func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
678 771
 			inputData["mdtrt_cert_type"] = "01"        // 就诊凭证类型
679 772
 			inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
680 773
 		} else {
681
-
774
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
775
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
682 776
 		}
683 777
 	}
684 778
 	if med_type == "1111" || med_type == "1112" {
@@ -699,7 +793,7 @@ func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
699 793
 	inputData["chrg_bchno"] = chrgBchno          // 收费批次号(来自2204生成的)
700 794
 	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
701 795
 	inputData["insutype"] = insutype             // 险种类型
702
-	inputData["invono"] = ""                     // 发票号
796
+	inputData["invono"] = "12345"                // 发票号
703 797
 
704 798
 	inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
705 799
 	inputData["overlmt_selfpay"] = overlmt_selfpay     //
@@ -816,3 +910,89 @@ func Nmyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
816 910
 	str2 := string(mjson)
817 911
 	return str, str2
818 912
 }
913
+
914
+func Nmyb2503(psnNo string, insutype string, org_name string, op string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string, start_time string, end_time string, check_time string, hospital_code string, hospital_name string) string {
915
+	// 生成签名
916
+	nonce := GetRandomString(32)
917
+	timestamp := time.Now().Unix()
918
+	signature := setSignature(timestamp, nonce, secret_key)
919
+	//tempTime := time.Unix(timestamp, 0)
920
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
921
+
922
+	//timeFormatTwo := tempTime.Format("2006-01-02")
923
+
924
+	//t := time.Now()
925
+	//last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
926
+	//tm := time.Unix(last.Unix(), 0)
927
+
928
+	// 生成输入报文
929
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, op, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
930
+	input := make(map[string]interface{})
931
+	inputData := make(map[string]interface{})
932
+	inputMessage["infno"] = "2503"                  // 交易编码
933
+	inputData["psn_no"] = psnNo                     // 人员编号 (来自1101接口返回)
934
+	inputData["insutype"] = insutype                // 险种类型(来自1101接口返回)
935
+	inputData["opsp_dise_code"] = sick_code         // 险种类型(来自1101接口返回)
936
+	inputData["opsp_dise_name"] = sick_name         // 险种类型(来自1101接口返回)
937
+	inputData["insu_optins"] = insuplc_admdvs       // 险种类型(来自1101接口返回)
938
+	inputData["ide_fixmedins_no"] = hospital_code   // 险种类型(来自1101接口返回)
939
+	inputData["ide_fixmedins_name"] = hospital_name // 险种类型(来自1101接口返回)
940
+	inputData["hosp_ide_date"] = check_time         // 险种类型(来自1101接口返回)
941
+	inputData["diag_dr_codg"] = doctor_id           // 开始时间
942
+	inputData["diag_dr_name"] = doctor              // 开始时间
943
+	inputData["begndate"] = start_time              // 医师编码
944
+	inputData["tel"] = ""                           // 医师编码
945
+	inputData["addr"] = ""                          // 医师编码
946
+	inputData["enddate"] = end_time                 // 医师编码
947
+
948
+	input["data"] = inputData
949
+	inputMessage["input"] = input //交易输入
950
+	bytesData, err := json.Marshal(inputMessage)
951
+	fmt.Println(string(bytesData))
952
+	if err != nil {
953
+		fmt.Println(err.Error())
954
+		return err.Error()
955
+	}
956
+	reader := bytes.NewReader(bytesData)
957
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
958
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
959
+	gdyb_url := beego.AppConfig.String("gdyb_url")
960
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
961
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
962
+	//url := gdyb_url + "2503"
963
+
964
+	var url string
965
+	if fixmedins_code == "H15049901371" {
966
+		url = gdyb_url
967
+	} else {
968
+		url = gdyb_url + "2503"
969
+	}
970
+
971
+	request, err := http.NewRequest("POST", url, reader)
972
+	if err != nil {
973
+		fmt.Println(err.Error())
974
+		return err.Error()
975
+	}
976
+
977
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
978
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
979
+	request.Header.Set("x-tif-signature", signature)
980
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
981
+	request.Header.Set("x-tif-nonce", nonce)
982
+
983
+	client := http.Client{}
984
+	resp, err := client.Do(request)
985
+	if err != nil {
986
+		fmt.Println(err.Error())
987
+		return err.Error()
988
+	}
989
+	respBytes, err := ioutil.ReadAll(resp.Body)
990
+	if err != nil {
991
+		fmt.Println(err.Error())
992
+		return err.Error()
993
+	}
994
+	str := string(respBytes)
995
+	fmt.Println(str)
996
+	return str
997
+}
998
+

+ 201 - 2
service/zh_his_service.go View File

@@ -15,15 +15,27 @@ import (
15 15
 )
16 16
 
17 17
 // 人员基本信息
18
-func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, name string) (string, string, string) {
18
+func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, name string,admin_user_id int64) (string, string, string) {
19 19
 	//生成签名
20 20
 	var requestLog string
21 21
 	var resultLog string
22
+	//nonce := GetRandomString(32)
23
+	//timestamp := time.Now().UnixNano() / 1e6
24
+	//signature := setSignature(timestamp, nonce, secret_key)
22 25
 	nonce := GetRandomString(32)
23 26
 	timestamp := time.Now().Unix()
24 27
 	signature := setSignature(timestamp, nonce, secret_key)
28
+	inputMessage := make(map[string]interface{})
29
+
25 30
 	//生成输入报文
26
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
31
+	if   mdtrtarea_admvs == "450721"  ||  mdtrtarea_admvs == "450127"{
32
+
33
+		inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
34
+	} else {
35
+		inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
36
+	}
37
+
38
+	//inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
27 39
 	input := make(map[string]interface{})
28 40
 	inputData := make(map[string]interface{})
29 41
 	inputMessage["infno"] = "1101" // 交易编码
@@ -75,6 +87,119 @@ func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code st
75 87
 	if mdtrtarea_admvs == "150499" {
76 88
 		url = gdyb_url
77 89
 	}
90
+	if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
91
+		url = gdyb_url
92
+	}
93
+
94
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
95
+	request, err := http.NewRequest("POST", url, reader)
96
+	if err != nil {
97
+		fmt.Println(err.Error())
98
+		return err.Error(), "", ""
99
+	}
100
+
101
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
102
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
103
+	request.Header.Set("x-tif-signature", signature)
104
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
105
+	request.Header.Set("x-tif-nonce", nonce)
106
+
107
+	client := http.Client{}
108
+	resp, err := client.Do(request)
109
+	if err != nil {
110
+		fmt.Println(err.Error())
111
+		return err.Error(), "", ""
112
+	}
113
+	respBytes, err := ioutil.ReadAll(resp.Body)
114
+	if err != nil {
115
+		fmt.Println(err.Error())
116
+		return err.Error(), "", ""
117
+	}
118
+	fmt.Println(string(respBytes))
119
+	str := string(respBytes)
120
+	resultLog = str
121
+	return str, requestLog, resultLog
122
+}
123
+
124
+func ZHGdyb1101d(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, name string,admin_user_id int64,token string) (string, string, string) {
125
+	//生成签名
126
+	var requestLog string
127
+	var resultLog string
128
+	//nonce := GetRandomString(32)
129
+	//timestamp := time.Now().UnixNano() / 1e6
130
+	//signature := setSignature(timestamp, nonce, secret_key)
131
+	nonce := GetRandomString(32)
132
+	timestamp := time.Now().Unix()
133
+	signature := setSignature(timestamp, nonce, secret_key)
134
+	inputMessage := make(map[string]interface{})
135
+
136
+	//生成输入报文
137
+	if   mdtrtarea_admvs == "450721"  ||  mdtrtarea_admvs == "450127"{
138
+
139
+		inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
140
+	} else {
141
+		inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
142
+	}
143
+
144
+	//inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
145
+	input := make(map[string]interface{})
146
+	inputData := make(map[string]interface{})
147
+	inputMessage["infno"] = "1101" // 交易编码
148
+
149
+	if certificates == 3 {
150
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
151
+		inputData["certno"] = certNo        // 证件号码
152
+		inputData["psn_cert_type"] = "99"   // 人员证件类型
153
+
154
+	} else {
155
+		if id_card_type == 1 {
156
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
157
+			inputData["card_sn"] = card_sn      // 卡识别码
158
+			inputData["certno"] = certNo        // 证件号码
159
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
160
+			inputData["mdtrt_cert_no"] = token // 就诊凭证编号
161
+
162
+
163
+		} else if id_card_type == 4 {
164
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
165
+			inputData["card_sn"] = ""           // 卡识别码
166
+			inputData["certno"] = certNo        // 证件号码
167
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
168
+			inputData["mdtrt_cert_no"] = token // 就诊凭证编号
169
+
170
+		} else {
171
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
172
+			inputData["card_sn"] = ""           // 卡识别码
173
+			inputData["certno"] = certNo        // 证件号码
174
+			inputData["psn_cert_type"] = "01"   // 人员证件类型
175
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
176
+
177
+		}
178
+	}
179
+
180
+	inputData["begntime"] = ""          // 开始时间
181
+	inputData["psn_name"] = name        // 人员姓名
182
+	input["data"] = inputData
183
+	inputMessage["input"] = input //交易输入
184
+
185
+	bytesData, err := json.Marshal(inputMessage)
186
+	fmt.Println(string(bytesData))
187
+	requestLog = string(bytesData)
188
+	if err != nil {
189
+		fmt.Println(err.Error())
190
+		return err.Error(), "", ""
191
+	}
192
+	reader := bytes.NewReader(bytesData)
193
+	gdyb_url := beego.AppConfig.String("gdyb_url")
194
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
195
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
196
+	url := gdyb_url + "1101"
197
+	if mdtrtarea_admvs == "150499" {
198
+		url = gdyb_url
199
+	}
200
+	if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
201
+		url = gdyb_url
202
+	}
78 203
 
79 204
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
80 205
 	request, err := http.NewRequest("POST", url, reader)
@@ -105,6 +230,9 @@ func ZHGdyb1101(certNo string, org_name string, doctor string, fixmedins_code st
105 230
 	resultLog = str
106 231
 	return str, requestLog, resultLog
107 232
 }
233
+
234
+
235
+
108 236
 func ZHGdyb1101C(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, name string) (string, string, string) {
109 237
 	//生成签名
110 238
 	var requestLog string
@@ -304,6 +432,11 @@ type Struct2401 struct {
304 432
 	Begntime         string
305 433
 	DiseCodg         string
306 434
 	DiseName         string
435
+	Cardsn string
436
+	PsnCertType string
437
+	Certno string
438
+	PsnType int64
439
+	PsnName string
307 440
 }
308 441
 
309 442
 // 住院登记
@@ -1225,6 +1358,7 @@ func ZHGdyb2304(psnNo string, mdtrtId string, chrgBchno string, certNo string, i
1225 1358
 
1226 1359
 	return str, str2
1227 1360
 }
1361
+
1228 1362
 func Gdyb26011(psnNo string, omsgid string, oinfno string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
1229 1363
 	// 生成签名
1230 1364
 	nonce := GetRandomString(32)
@@ -1735,3 +1869,68 @@ func ZHyb4103(baseParams models.BaseParams, businessParams models.BusinessParams
1735 1869
 	fmt.Println(str)
1736 1870
 	return str
1737 1871
 }
1872
+func ZHyb4104(baseParams models.BaseParams, businessParams models.BusinessParams) string {
1873
+	// 生成签名
1874
+	nonce := GetRandomString(32)
1875
+	timestamp := time.Now().Unix()
1876
+	signature := setSignature(timestamp, nonce, baseParams.SecretKey)
1877
+
1878
+	// 生成输入报文
1879
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1880
+	input := make(map[string]interface{})
1881
+	inputData := make(map[string]interface{})
1882
+	inputMessage["infno"] = "4104" // 交易编码
1883
+	inputData["setl_ym"] = "202306"
1884
+	inputData["page_num"] = "1"
1885
+	inputData["page_size"] = "100"
1886
+	input["data"] = inputData
1887
+	inputMessage["input"] = input //交易输入
1888
+	bytesData, err := json.Marshal(inputMessage)
1889
+	fmt.Println(string(bytesData))
1890
+	fmt.Println(string(bytesData))
1891
+	if err != nil {
1892
+		fmt.Println(err.Error())
1893
+		return err.Error()
1894
+	}
1895
+	reader := bytes.NewReader(bytesData)
1896
+	gdyb_url := beego.AppConfig.String("gdyb_url")
1897
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1898
+
1899
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
1900
+	//url := gdyb_url + "5203"
1901
+	var url string
1902
+	if baseParams.FixmedinsCode == "H15049901371" {
1903
+		url = gdyb_url
1904
+	} else {
1905
+		url = gdyb_url + "4103"
1906
+	}
1907
+
1908
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5203"
1909
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1910
+
1911
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
1912
+	request, err := http.NewRequest("POST", url, reader)
1913
+	if err != nil {
1914
+		fmt.Println(err.Error())
1915
+		return err.Error()
1916
+	}
1917
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1918
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
1919
+	request.Header.Set("x-tif-signature", signature)
1920
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1921
+	request.Header.Set("x-tif-nonce", nonce)
1922
+	client := http.Client{}
1923
+	resp, err := client.Do(request)
1924
+	if err != nil {
1925
+		fmt.Println(err.Error())
1926
+		return err.Error()
1927
+	}
1928
+	respBytes, err := ioutil.ReadAll(resp.Body)
1929
+	if err != nil {
1930
+		fmt.Println(err.Error())
1931
+		return err.Error()
1932
+	}
1933
+	str := string(respBytes)
1934
+	fmt.Println(str)
1935
+	return str
1936
+}

BIN
simkai.ttf View File