test_user 5 miesięcy temu
rodzic
commit
522d08da61

+ 12 - 172
conf/app.conf Wyświetl plik

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

Plik diff jest za duży
+ 1746 - 0
controllers/ah/ahyb_controller.go


Plik diff jest za duży
+ 5876 - 1186
controllers/coordinate/coordinate_controller.go


+ 888 - 0
controllers/coordinate/coordinate_net_controller.go Wyświetl plik

@@ -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 Wyświetl plik

@@ -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()

+ 470 - 1
controllers/hb/hbyb_controller.go Wyświetl plik

@@ -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,11 +32,347 @@ 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
 
33 43
 	beego.Router("/hbyb/5262", &HBybController{}, "post:Post5262")
34 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")
35 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
+	})
36 376
 
37 377
 }
38 378
 func (c *HBybController)Post5262(){
@@ -143,6 +483,82 @@ func (c *HBybController) Post3202a() {
143 483
 	})
144 484
 }
145 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
+
146 562
 func (c *HBybController) Post4101() {
147 563
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
148 564
 	var respJSON map[string]interface{}
@@ -575,8 +991,18 @@ func (c *HBybController) PostTen() {
575 991
 		MdtrtId: mdtrtId,
576 992
 		SetlId:  setlId,
577 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
+	}
578 1005
 
579
-	result := service.Hbyb5203(baseParams, businessParams, med_type)
580 1006
 	var dat map[string]interface{}
581 1007
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
582 1008
 		fmt.Println(dat)
@@ -587,3 +1013,46 @@ func (c *HBybController) PostTen() {
587 1013
 		"pre": dat,
588 1014
 	})
589 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
+}

+ 299 - 1
controllers/js/jsyb_controller.go Wyświetl plik

@@ -56,6 +56,8 @@ func JSybRegistRouters() {
56 56
 
57 57
 	beego.Router("/jsyb/readcardcharge", &JSybController{}, "get:Readcardcharge")
58 58
 	beego.Router("/jsyb/readcardchargeother", &JSybController{}, "get:Readcardchargeother")
59
+	beego.Router("/jsyb/readcardface", &JSybController{}, "get:Readcardface")
60
+
59 61
 
60 62
 	beego.Router("/jsyb/3260", &JSybController{}, "get:Get3260")
61 63
 	beego.Router("/jsyb/3261", &JSybController{}, "get:Get3261")
@@ -73,11 +75,57 @@ func JSybRegistRouters() {
73 75
 	beego.Router("/jsyb/3273", &JSybController{}, "post:Get3273")
74 76
 	beego.Router("/jsyb/3274", &JSybController{}, "post:Get3274")
75 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
+
76 96
 	//beego.Router("/jsyb/3276", &JSybController{}, "post:Get3276")
77 97
 	//beego.Router("/jsyb/3277", &JSybController{}, "post:Get3277")
78 98
 
79 99
 }
80 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
+
81 129
 func (c *JSybController) Get3260() {
82 130
 	org_name := c.GetString("org_name")
83 131
 	doctor := c.GetString("doctor")
@@ -1330,9 +1378,12 @@ func (c *JSybController) PostFive() {
1330 1378
 		utils.ErrorLog("解析失败:%v", err)
1331 1379
 		return
1332 1380
 	}
1381
+
1382
+
1383
+
1333 1384
 	//fmt.Println("2203A的time_stamp=" + respJSON["time_stamp"].(string))
1334 1385
 	result, request_log := service.Jsyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
1335
-		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))
1336 1387
 
1337 1388
 	saveJsLog(result, request_log, "2204", "上传明细", respJSON["org_name"].(string))
1338 1389
 	var dat map[string]interface{}
@@ -1689,6 +1740,100 @@ type ELeCertData struct {
1689 1740
 	Message string `json:"message"`
1690 1741
 }
1691 1742
 
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
+
1692 1837
 func (c *JSybController) Readcardcharge() {
1693 1838
 	fixmedins_code := c.GetString("fixmedins_code")
1694 1839
 	secret_key := c.GetString("secret_key")
@@ -2098,6 +2243,59 @@ func (c *JSybController) ReadCard() {
2098 2243
 
2099 2244
 		}
2100 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
+
2101 2299
 
2102 2300
 	}
2103 2301
 
@@ -2293,6 +2491,104 @@ func (c *JSybController) GetELeCertInfoFour2223(code string, operator_id string,
2293 2491
 	return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030)
2294 2492
 }
2295 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
+
2296 2592
 func (c *JSybController) GetELeCertInfoTwo(code string, operator_id string, operator_name string) (string, string) {
2297 2593
 	// WebSocket服务器地址
2298 2594
 	serverURL := "ws://127.0.0.1:8899"
@@ -2388,6 +2684,8 @@ func (c *JSybController) GetELeCertInfoThree(code string, operator_id string, op
2388 2684
 	return "", string(receivedMessage)
2389 2685
 }
2390 2686
 
2687
+
2688
+
2391 2689
 func GetELeCertInfoSettle(code string, operator_id string, operator_name string) (string, string) {
2392 2690
 	DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
2393 2691
 	readCard := DllDef.MustFindProc("GetPersonInfo")

+ 63 - 67
controllers/nm/nm_controller.go Wyświetl plik

@@ -47,7 +47,7 @@ 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
 
@@ -495,56 +495,56 @@ func (c *NmController) Post2503() {
495 495
 	})
496 496
 }
497 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
-}
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
+//}
548 548
 func (c *NmController) GetToken() {
549 549
 	token := c.GetString("token")
550 550
 	results := strings.Split(token, "-")
@@ -733,7 +733,7 @@ func (c *NmController) Post4101() {
733 733
 		utils.ErrorLog("解析失败:%v", err)
734 734
 		return
735 735
 	}
736
-	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)
737 737
 	var dat map[string]interface{}
738 738
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
739 739
 		fmt.Println(dat)
@@ -911,7 +911,7 @@ func (c *NmController) Post1101() {
911 911
 	certificates := c.GetString("certificates")
912 912
 	name := c.GetString("name")
913 913
 	certificate, _ := strconv.ParseInt(certificates, 10, 64)
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)
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)
915 915
 
916 916
 	saveJsLog(result_log, request_log, "1101", "查询个人信息", org_name)
917 917
 	var dat map[string]interface{}
@@ -953,7 +953,7 @@ func (c *NmController) Post2401() {
953 953
 	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
954 954
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
955 955
 	secret_key := respJSON["secret_key"].(string)
956
-	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)
957 957
 	saveJsLog(result, request_log, "2401", "入院登记", org_name)
958 958
 	var dat2 map[string]interface{}
959 959
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
@@ -980,7 +980,7 @@ func (c *NmController) Post2404() {
980 980
 	secret_key := c.GetString("secret_key")
981 981
 	org_name := c.GetString("org_name")
982 982
 
983
-	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)
984 984
 	saveJsLog(result, requestLog, "2404", "入院登记撤销", org_name)
985 985
 	var dat map[string]interface{}
986 986
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -996,7 +996,6 @@ func (c *NmController) Post2404() {
996 996
 	})
997 997
 
998 998
 }
999
-
1000 999
 func (c *NmController) Post2405() {
1001 1000
 	mdtrt_id := c.GetString("mdtrt_id")
1002 1001
 	psn_no := c.GetString("psn_no")
@@ -1007,7 +1006,7 @@ func (c *NmController) Post2405() {
1007 1006
 	secret_key := c.GetString("secret_key")
1008 1007
 	org_name := c.GetString("org_name")
1009 1008
 
1010
-	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)
1011 1010
 	saveJsLog(result, requestLog, "2405", "出院登记撤销", org_name)
1012 1011
 	var dat map[string]interface{}
1013 1012
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
@@ -1023,7 +1022,6 @@ func (c *NmController) Post2405() {
1023 1022
 	})
1024 1023
 
1025 1024
 }
1026
-
1027 1025
 func (c *NmController) Post2402() {
1028 1026
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
1029 1027
 	var respJSON map[string]interface{}
@@ -1043,7 +1041,7 @@ func (c *NmController) Post2402() {
1043 1041
 	insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
1044 1042
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
1045 1043
 	secret_key := respJSON["secret_key"].(string)
1046
-	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)
1047 1045
 	saveJsLog(result, request_log, "2402", "出院", org_name)
1048 1046
 	var dat2 map[string]interface{}
1049 1047
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
@@ -1058,7 +1056,6 @@ func (c *NmController) Post2402() {
1058 1056
 		"request_log": dat2,
1059 1057
 	})
1060 1058
 }
1061
-
1062 1059
 func (c *NmController) Post2301() {
1063 1060
 
1064 1061
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
@@ -1093,7 +1090,7 @@ func (c *NmController) Post2301() {
1093 1090
 	//med_type := strconv.FormatInt(int64(respJSON["med_type"].(float64)), 10)
1094 1091
 	psn_no := respJSON["psn_no"].(string)
1095 1092
 
1096
-	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)
1097 1094
 	saveJsLog(result, requestLog, "2301", "上传明细", org_name)
1098 1095
 
1099 1096
 	var dat2 map[string]interface{}
@@ -1121,7 +1118,7 @@ func (c *NmController) Post2302() {
1121 1118
 	org_name := c.GetString("org_name")
1122 1119
 	refund_type, _ := c.GetInt64("refund_type")
1123 1120
 
1124
-	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)
1125 1122
 	saveJsLog(result, requestLog, "2302", "退明细", org_name)
1126 1123
 	var dat2 map[string]interface{}
1127 1124
 	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
@@ -1136,7 +1133,6 @@ func (c *NmController) Post2302() {
1136 1133
 		"request_log": dat2,
1137 1134
 	})
1138 1135
 }
1139
-
1140 1136
 func (c *NmController) Post2303() {
1141 1137
 	mdtrt_id := c.GetString("mdtrt_id")
1142 1138
 	psn_no := c.GetString("psn_no")
@@ -1156,7 +1152,7 @@ func (c *NmController) Post2303() {
1156 1152
 	secret_key := c.GetString("secret_key")
1157 1153
 	org_name := c.GetString("org_name")
1158 1154
 
1159
-	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)
1160 1156
 	saveJsLog(result, src_resquest, "2303", "预结算", org_name)
1161 1157
 	var dat2 map[string]interface{}
1162 1158
 	if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
@@ -1192,7 +1188,7 @@ func (c *NmController) Post2304() {
1192 1188
 	fapiao_number := c.GetString("fapiao_number")
1193 1189
 	acct_used_flag := c.GetString("acct_used_flag")
1194 1190
 
1195
-	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)
1196 1192
 	saveJsLog(result, src_resquest, "2304", "住院结算", org_name)
1197 1193
 	var dat2 map[string]interface{}
1198 1194
 	if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
@@ -1219,7 +1215,7 @@ func (c *NmController) Post2305() {
1219 1215
 	secret_key := c.GetString("secret_key")
1220 1216
 	org_name := c.GetString("org_name")
1221 1217
 
1222
-	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)
1223 1219
 	saveJsLog(result, requestLog, "2305", "退费", org_name)
1224 1220
 	var dat2 map[string]interface{}
1225 1221
 	if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
@@ -1789,7 +1785,7 @@ func (c *NmController) Get3201() {
1789 1785
 		AcctPay:          acctPay,
1790 1786
 		FixmedinsSetlCnt: fixmedinsSetlCnt,
1791 1787
 	}
1792
-	result := service.Gdyb3201(baseParams, businessParams)
1788
+	result := service.Gdyb3201(baseParams, businessParams,0)
1793 1789
 	saveJsLog(result, "", "3201", "对总账", org_name)
1794 1790
 	var dat map[string]interface{}
1795 1791
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {

+ 279 - 193
controllers/sg/gdyb_controller.go Wyświetl plik

@@ -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
 }

Plik diff jest za duży
+ 12862 - 4787
controllers/sg/his_api_controller.go


Plik diff jest za duży
+ 1605 - 355
controllers/zh/zh_his_api_controller.go


Plik diff jest za duży
+ 648 - 955
main.go


+ 2 - 0
models/doctor_advice_models.go Wyświetl plik

@@ -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 {

+ 30 - 9
models/his_models.go Wyświetl plik

@@ -40,6 +40,8 @@ type XtHisProject struct {
40 40
 	DeliveryWay               string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
41 41
 	NumberDays                string  `gorm:"column:number_days" json:"number_days" form:"number_days"`
42 42
 	Total                     string  `gorm:"column:total" json:"total" form:"total"`
43
+	Vaf14             string    `gorm:"column:vaf14" json:"vaf14" form:"vaf14"`
44
+
43 45
 }
44 46
 
45 47
 func (XtHisProject) TableName() string {
@@ -232,6 +234,11 @@ type HisDoctorAdviceInfo struct {
232 234
 	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
233 235
 	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
234 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
+
235 242
 
236 243
 	BaseDrugLib BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
237 244
 }
@@ -306,6 +313,9 @@ type HisPrescriptionInfo struct {
306 313
 	DoctorId           int64           `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
307 314
 	XtHisDepartment    XtHisDepartment `gorm:"ForeignKey:ID;AssociationForeignKey:Departments" json:"department"`
308 315
 	SickType           int64           `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
316
+
317
+
318
+
309 319
 }
310 320
 
311 321
 func (HisPrescriptionInfo) TableName() string {
@@ -332,10 +342,10 @@ type HisPrescription struct {
332 342
 	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
333 343
 	Patients               Patients                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
334 344
 	HisPatient             VMHisPatient              `gorm:"ForeignKey:PatientId;AssociationForeignKey:patient_id" json:"hisPatient"`
335
-	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
336
-	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
337
-	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
338
-	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"`
339 349
 	MedType                string                    `gorm:"column:med_type" json:"med_type" form:"med_type"`
340 350
 	Cbm01                string                    `gorm:"column:cbm01" json:"cbm01" form:"cbm01"`
341 351
 	Cbm07                string                    `gorm:"column:cbm07" json:"cbm07" form:"cbm07"`
@@ -380,6 +390,8 @@ type HisProject struct {
380 390
 	ZuobiaoId             string    `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
381 391
 	Bck01b	 string    `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
382 392
 	Bby01             string    `gorm:"column:bby01" json:"bby01" form:"bby01"`
393
+	Vaf14             string    `gorm:"column:vaf14" json:"vaf14" form:"vaf14"`
394
+
383 395
 
384 396
 }
385 397
 
@@ -1213,6 +1225,8 @@ type MyHisProject struct {
1213 1225
 	SpecailProject              int64   `gorm:"column:specail_project" json:"specail_project" form:"specail_project"`
1214 1226
 	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
1215 1227
 	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1228
+	Vaf14             string    `gorm:"column:vaf14" json:"vaf14" form:"vaf14"`
1229
+
1216 1230
 }
1217 1231
 
1218 1232
 func (MyHisProject) TableName() string {
@@ -1381,6 +1395,10 @@ type HisPsn struct {
1381 1395
 	RecordDate    int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1382 1396
 	InsuplcAdmdvs string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
1383 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
+
1384 1402
 }
1385 1403
 
1386 1404
 func (HisPsn) TableName() string {
@@ -1469,6 +1487,8 @@ type HisDoctorAdviceInfoTen struct {
1469 1487
 	HospApprFlag          int64        `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
1470 1488
 	BaseDrugLib           BaseDrugLib  `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
1471 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
+
1472 1492
 }
1473 1493
 
1474 1494
 func (HisDoctorAdviceInfoTen) TableName() string {
@@ -1712,8 +1732,8 @@ type ChargeList struct {
1712 1732
 
1713 1733
 
1714 1734
 type ChargeListtwo struct {
1715
-	Bby01 			string
1716
-	Vaj25              string
1735
+	Bby01 			int64  `json:"bby01"`
1736
+	Vaj25              float64 `json:"vaj25"`
1717 1737
 
1718 1738
 }
1719 1739
 type UploadInfo struct {
@@ -1721,9 +1741,7 @@ type UploadInfo struct {
1721 1741
 	Acf01   int64 `json:"acf01"`
1722 1742
 	Bce01   string `json:"bce01"`
1723 1743
 	Bck01   string `json:"bck01"`
1724
-	ChargeList []ChargeList `json:"chargeList"`
1725
-	ChargeListtwo []ChargeListtwo `json:"chargeList"`
1726
-
1744
+	ChargeListtwo []*ChargeListtwo `json:"chargeList"`
1727 1745
 	Bce01a   string `json:"bce01a"`
1728 1746
 
1729 1747
 	Bck01c   string `json:"bck01c"`
@@ -2018,6 +2036,9 @@ type IEtwo struct {
2018 2036
 	UnameA  string `xml:"UnameA,attr"`
2019 2037
 	VEH02  string `xml:"VEH02,attr"`
2020 2038
 	BCK01C  string `xml:"BCK01C,attr"`
2039
+	VAF07  string `xml:"VAF07,attr"`
2040
+
2041
+
2021 2042
 
2022 2043
 
2023 2044
 

+ 2 - 0
models/stock_models.go Wyświetl plik

@@ -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 Wyświetl plik

@@ -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
+}

+ 37 - 0
models/zuobiao_models.go Wyświetl plik

@@ -17,9 +17,46 @@ type HisZuobiaoAdvice struct {
17 17
 	SettleResultLog string `gorm:"column:settle_result_log" json:"settle_result_log" form:"settle_result_log"`
18 18
 	Cbm01 string `gorm:"column:cbm01" json:"cbm01" form:"cbm01"`
19 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
+
20 28
 }
21 29
 
22 30
 
23 31
 func (HisZuobiaoAdvice) TableName() string {
24 32
 	return "his_zuobiao_advice"
25 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
+

+ 3 - 0
routers/router.go Wyświetl plik

@@ -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()
36
+	ah.AHybRegistRouters()
35 37
 	coordinate.CoordinateRcegistRouters()
38
+	coordinate.CoordinatenetRcegistRouters()
36 39
 
37 40
 }

Plik diff jest za duży
+ 3439 - 0
service/ahyb_service.go


+ 32 - 29
service/auto_create_week_schedules_service.go Wyświetl plik

@@ -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() {

+ 114 - 97
service/coordinate_service.go Wyświetl plik

@@ -290,10 +290,11 @@ func UpdateHisPatientStatusten(his *models.VMHisPatient) {
290 290
 	writeDb.Save(&his)
291 291
 }
292 292
 
293
-func GetUnSettleHisPrescriptionFive(org_id int64, patient_id int64, record_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
293
+func GetUnSettleHisPrescriptionFive(org_id int64, patient_id int64, record_date int64, p_type int64) (prescription []models.HisPrescription, err error) {
294 294
 	err = readDb.Model(&models.HisPrescription{}).
295
+		Preload("VMHisPrescriptionInfo","status = 1").
295 296
 		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
296
-			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
297
+			return db.Where("status = 1 AND user_org_id = ? and is_self_drug <> 1", org_id).Preload("BaseDrugLib", "status=1")
297 298
 		}).
298 299
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
299 300
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
@@ -302,14 +303,30 @@ func GetUnSettleHisPrescriptionFive(org_id int64, patient_id int64, record_date
302 303
 		Find(&prescription).Error
303 304
 	return
304 305
 }
306
+func GetUnSettleHisPrescriptionFiveone(id int64) (prescription []models.HisPrescription, err error) {
307
+	err = readDb.Model(&models.HisPrescription{}).
308
+		Preload("VMHisPrescriptionInfo","status = 1").
309
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
310
+			return db.Where("status = 1  and is_self_drug <> 1").Preload("BaseDrugLib", "status=1")
311
+		}).
312
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
313
+			return db.Where("status = 1").Preload("HisProject").Preload("GoodInfo", "status=1")
314
+		}).
315
+		Where("id = ?", id).
316
+		Find(&prescription).Error
317
+	return
318
+}
319
+
320
+
305 321
 
306
-func GetUnSettleMonthHisPrescription(org_id int64, patient_id int64, start_date int64, end_date int64) (prescription []*models.HisPrescription, err error) {
322
+func GetUnSettleMonthHisPrescription(org_id int64, patient_id int64, start_date int64, end_date int64) (prescription []models.HisPrescription, err error) {
307 323
 	err = readDb.Model(&models.HisPrescription{}).
324
+		Preload("VMHisPrescriptionInfo","status = 1").
308 325
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
309 326
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
310 327
 		}).
311 328
 		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
312
-			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
329
+			return db.Where("status = 1 AND user_org_id = ? and is_self_drug <> 1 ", org_id).Preload("BaseDrugLib", "status=1")
313 330
 		}).
314 331
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
315 332
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
@@ -634,8 +651,8 @@ func GetDrugs() (string, string) {
634 651
 	request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
635 652
 	request.Header.Set("Accept", "*/*")
636 653
 
637
-	fmt.Println(request)
638
-	fmt.Println(request.Header)
654
+	//fmt.Println(request)
655
+	//fmt.Println(request.Header)
639 656
 	client := http.Client{}
640 657
 	resp, err := client.Do(request)
641 658
 	if err != nil {
@@ -643,19 +660,13 @@ func GetDrugs() (string, string) {
643 660
 		return err.Error(), ""
644 661
 	}
645 662
 	defer resp.Body.Close()
646
-	fmt.Println(resp)
647
-	fmt.Println("resp.Status")
648
-	fmt.Println(resp.Status)
649
-	fmt.Println("resp.Body")
650 663
 
651
-	fmt.Println(resp.Body)
652 664
 
653 665
 	respBytes, err := ioutil.ReadAll(resp.Body)
654 666
 	if err != nil {
655 667
 		fmt.Println(err.Error())
656 668
 		return err.Error(), ""
657 669
 	}
658
-	fmt.Println(string(respBytes))
659 670
 	str := string(respBytes)
660 671
 	return str, inputLog
661 672
 
@@ -667,8 +678,8 @@ func GetProject() (string, string) {
667 678
 
668 679
 	var inputLog string
669 680
 	bytesData, err := json.Marshal(inputData)
670
-	inputLog = string(bytesData)
671
-	fmt.Println(string(bytesData))
681
+	//inputLog = string(bytesData)
682
+
672 683
 	if err != nil {
673 684
 		fmt.Println(err.Error())
674 685
 		return err.Error(), ""
@@ -689,8 +700,7 @@ func GetProject() (string, string) {
689 700
 	request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
690 701
 	request.Header.Set("Accept", "*/*")
691 702
 
692
-	fmt.Println(request)
693
-	fmt.Println(request.Header)
703
+
694 704
 	client := http.Client{}
695 705
 	resp, err := client.Do(request)
696 706
 	if err != nil {
@@ -698,19 +708,12 @@ func GetProject() (string, string) {
698 708
 		return err.Error(), ""
699 709
 	}
700 710
 	defer resp.Body.Close()
701
-	fmt.Println(resp)
702
-	fmt.Println("resp.Status")
703
-	fmt.Println(resp.Status)
704
-	fmt.Println("resp.Body")
705
-
706
-	fmt.Println(resp.Body)
707 711
 
708 712
 	respBytes, err := ioutil.ReadAll(resp.Body)
709 713
 	if err != nil {
710 714
 		fmt.Println(err.Error())
711 715
 		return err.Error(), ""
712 716
 	}
713
-	fmt.Println(string(respBytes))
714 717
 	str := string(respBytes)
715 718
 	return str, inputLog
716 719
 
@@ -718,76 +721,73 @@ func GetProject() (string, string) {
718 721
 
719 722
 
720 723
 
721
-
722
-
723
-
724 724
 //开医嘱版本1
725
-func UploadNMGPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
726
-
727
-
728
-	inputData := make(map[string]interface{})
729
-
730
-
731
-	presInfos := make([]map[string]interface{}, 0)
732
-
733
-
734
-	for _, item := range info.ChargeList {
735
-		inputDataPresInfo := make(map[string]interface{})
736
-		inputDataPresInfo["bbx01"] = item.Bbx01
737
-		inputDataPresInfo["vaf21"] = item.Vaf21
738
-		inputDataPresInfo["vaf22"] = item.Vaf22
739
-		inputDataPresInfo["vaf42"] = item.Vaf42
740
-		presInfos = append(presInfos, inputDataPresInfo)
741
-	}
742
-	inputData["vaa01"] = info.Vaa01   // 就诊凭证编号
743
-	inputData["vaa07"] = info.Vaa07   // 就诊凭证编号
744
-	inputData["acf01"] = info.Acf01   // 就诊凭证编号
745
-	inputData["vaa05"] = info.Vaa05   // 就诊凭证编号
746
-	inputData["bck01"] = info.Bck01   // 就诊凭证编号
747
-	inputData["bce01a"] = info.Bce01a   // 就诊凭证编号
748
-	inputData["bck01a"] = info.Bck01a   // 就诊凭证编号
749
-	inputData["vafReqList"] = presInfos // 就诊凭证编号
750
-	var inputLog string
751
-	bytesData, err := json.Marshal(inputData)
752
-	inputLog = string(bytesData)
753
-	fmt.Println(string(bytesData))
754
-	if err != nil {
755
-		fmt.Println(err.Error())
756
-		return err.Error(), ""
757
-	}
758
-	reader := bytes.NewReader(bytesData)
759
-	var url string
760
-	gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_New"
761
-
762
-	//gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
763
-	url = gdyb_url
764
-
765
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
766
-	request, err := http.NewRequest("POST", url, reader)
767
-	if err != nil {
768
-		fmt.Println(err.Error())
769
-		return err.Error(), ""
770
-	}
771
-
772
-	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
773
-	request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
774
-	request.Header.Set("Accept", "*/*")
775
-	client := http.Client{}
776
-	resp, err := client.Do(request)
777
-	if err != nil {
778
-		fmt.Println(err.Error())
779
-		return err.Error(), ""
780
-	}
781
-	respBytes, err := ioutil.ReadAll(resp.Body)
782
-	if err != nil {
783
-		fmt.Println(err.Error())
784
-		return err.Error(), ""
785
-	}
786
-	fmt.Println(string(respBytes))
787
-	str := string(respBytes)
788
-	return str, inputLog
789
-
790
-}
725
+//func UploadNMGPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
726
+//
727
+//
728
+//	inputData := make(map[string]interface{})
729
+//
730
+//
731
+//	presInfos := make([]map[string]interface{}, 0)
732
+//
733
+//
734
+//	for _, item := range info.ChargeList {
735
+//		inputDataPresInfo := make(map[string]interface{})
736
+//		inputDataPresInfo["bbx01"] = item.Bbx01
737
+//		inputDataPresInfo["vaf21"] = item.Vaf21
738
+//		inputDataPresInfo["vaf22"] = item.Vaf22
739
+//		inputDataPresInfo["vaf42"] = item.Vaf42
740
+//		presInfos = append(presInfos, inputDataPresInfo)
741
+//	}
742
+//	inputData["vaa01"] = info.Vaa01   // 就诊凭证编号
743
+//	inputData["vaa07"] = info.Vaa07   // 就诊凭证编号
744
+//	inputData["acf01"] = info.Acf01   // 就诊凭证编号
745
+//	inputData["vaa05"] = info.Vaa05   // 就诊凭证编号
746
+//	inputData["bck01"] = info.Bck01   // 就诊凭证编号
747
+//	inputData["bce01a"] = info.Bce01a   // 就诊凭证编号
748
+//	inputData["bck01a"] = info.Bck01a   // 就诊凭证编号
749
+//	inputData["vafReqList"] = presInfos // 就诊凭证编号
750
+//	var inputLog string
751
+//	bytesData, err := json.Marshal(inputData)
752
+//	inputLog = string(bytesData)
753
+//	fmt.Println(string(bytesData))
754
+//	if err != nil {
755
+//		fmt.Println(err.Error())
756
+//		return err.Error(), ""
757
+//	}
758
+//	reader := bytes.NewReader(bytesData)
759
+//	var url string
760
+//	gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_New"
761
+//
762
+//	//gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
763
+//	url = gdyb_url
764
+//
765
+//	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
766
+//	request, err := http.NewRequest("POST", url, reader)
767
+//	if err != nil {
768
+//		fmt.Println(err.Error())
769
+//		return err.Error(), ""
770
+//	}
771
+//
772
+//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
773
+//	request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
774
+//	request.Header.Set("Accept", "*/*")
775
+//	client := http.Client{}
776
+//	resp, err := client.Do(request)
777
+//	if err != nil {
778
+//		fmt.Println(err.Error())
779
+//		return err.Error(), ""
780
+//	}
781
+//	respBytes, err := ioutil.ReadAll(resp.Body)
782
+//	if err != nil {
783
+//		fmt.Println(err.Error())
784
+//		return err.Error(), ""
785
+//	}
786
+//	fmt.Println(string(respBytes))
787
+//	str := string(respBytes)
788
+//	return str, inputLog
789
+//
790
+//}
791 791
 
792 792
 //开医嘱版本2
793 793
 func UploadNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
@@ -808,9 +808,12 @@ func UploadNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (strin
808 808
 	values.Set("cmdid", cmdid)
809 809
 	values.Set("data", xml_date)
810 810
 	dataStr := values.Encode()
811
+	fmt.Println(xml_date)
812
+	fmt.Println(dataStr)
811 813
 
812 814
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
813
-	request, err := http.NewRequest("POST", urls, strings.NewReader(dataStr))
815
+
816
+	request, err := http.NewRequest("POST", urls, bytes.NewBufferString(string(dataStr)))
814 817
 	if err != nil {
815 818
 		fmt.Println(err.Error())
816 819
 		return err.Error(), ""
@@ -890,7 +893,7 @@ func QueryNMGPrescriptionForCoordinate(ACF01 int64, vaf01List []string, cbm01 st
890 893
 }
891 894
 
892 895
 //删除医嘱
893
-func CancleNMGPrescriptionForCoordinate(ACF01 int64,  cbm01 string,vaf01List []string) (string, string) {
896
+func CancleNMGPrescriptionForCoordinate(ACF01 int64,  cbm01 string) (string, string) {
894 897
 
895 898
 	inputData := make(map[string]interface{})
896 899
 	//
@@ -1059,12 +1062,19 @@ func Createzuobiao(zuobiao *models.HisZuobiaoAdvice){
1059 1062
 
1060 1063
 }
1061 1064
 
1062
-func Getzuobiao(user_org_id int64,patient_id int64,record_date int64)(zuobiao models.HisZuobiaoAdvice,err error){
1063
-	err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("user_org_id = ? and patient_id = ? and record_date = ?",user_org_id,patient_id,record_date).First(&zuobiao).Error
1065
+func Getzuobiao(user_org_id int64,patient_id int64,start_time int64,end_time int64, ids string,vaa01 string, vaa07 string)(zuobiao models.HisZuobiaoAdvice,err error){
1066
+	err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("user_org_id = ? and patient_id = ? and start_time = ? and end_time = ? and status = 1 and cbm01 = ? and vaa01 = ? and vaa07 = ?",user_org_id,patient_id,start_time,end_time,ids,vaa01,vaa07).Last(&zuobiao).Error
1067
+	return
1068
+}
1069
+
1070
+
1071
+func Getzuobiaobyid(id int64)(zuobiao models.HisZuobiaoAdvice,err error){
1072
+	err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("id = ?",id).Last(&zuobiao).Error
1064 1073
 	return
1065 1074
 }
1066 1075
 
1067 1076
 
1077
+
1068 1078
 //查询诊断
1069 1079
 func QueryNMGDiagnoseForCoordinate(ACF01 int64, vaa01 string, vaa07 string) (string, string) {
1070 1080
 
@@ -1168,6 +1178,7 @@ func QueryNMGChenckForCoordinate(ACF01 int64, vaa01 string, vaa07 string,bfc03s
1168 1178
 
1169 1179
 //血库记账接口
1170 1180
 func NMGSettleForCoordinate(info models.UploadInfo) (string, string) {
1181
+	fmt.Println(info)
1171 1182
 
1172 1183
 	inputData := make(map[string]interface{})
1173 1184
 	inputData["acf01"] = info.Acf01   // 就诊凭证编号
@@ -1178,7 +1189,6 @@ func NMGSettleForCoordinate(info models.UploadInfo) (string, string) {
1178 1189
 	var inputLog string
1179 1190
 	bytesData, err := json.Marshal(inputData)
1180 1191
 	inputLog = string(bytesData)
1181
-	fmt.Println(string(bytesData))
1182 1192
 	if err != nil {
1183 1193
 		fmt.Println(err.Error())
1184 1194
 		return err.Error(), ""
@@ -1527,6 +1537,7 @@ func UpdataOrderStatusThreef(number string, user_org_id int64) (err error) {
1527 1537
 
1528 1538
 func UpdataOrderStatustwo(id int64, number string, user_org_id int64) (err error) {
1529 1539
 	err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix(), "status": 0}).Error
1540
+	//err = writeDb.Model(&models.HisPatient{}).Where("status = 1 AND number = ?", number).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
1530 1541
 	err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 1, "mtime": time.Now().Unix()}).Error
1531 1542
 	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 1, "mtime": time.Now().Unix()}).Error
1532 1543
 	return
@@ -1543,3 +1554,9 @@ func GetDrugwayDicByName(name string, org_id int64) (ef models.DrugwayDic, err e
1543 1554
 	err = readDb.Model(&models.DrugwayDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
1544 1555
 	return
1545 1556
 }
1557
+
1558
+
1559
+func GetResultRecord(date string) (record []models.CmResult, err error) {
1560
+	err = nmDataBase.Model(&models.CmResult{}).Where("inspect_date >= ?",date).Find(&record).Error
1561
+	return
1562
+}

+ 21 - 161
service/db.go Wyświetl plik

@@ -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
-}

Plik diff jest za duży
+ 1803 - 436
service/gdyb_service.go


+ 331 - 0
service/gxyb_service.go Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 门诊挂号

+ 816 - 37
service/hbyb_service.go Wyświetl plik

@@ -13,6 +13,9 @@ import (
13 13
 	"strconv"
14 14
 	"strings"
15 15
 	"time"
16
+	"encoding/xml"
17
+
18
+
16 19
 )
17 20
 
18 21
 type Charset string
@@ -225,7 +228,7 @@ func Hbyb2203(psnNo string, mdtrtId string, doctor string, department string, or
225 228
 		if med_type == "11" || med_type == "1111" || med_type == "1112" {
226 229
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
227 230
 		} else if med_type == "14" {
228
-			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
231
+			inputData["med_type"] = "14" // 医疗类别 11 普通门诊  12 门诊挂号
229 232
 		}
230 233
 	} else {
231 234
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
@@ -522,7 +525,7 @@ func Hbyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
522 525
 		if med_type == "11" || med_type == "1111" || med_type == "1112" {
523 526
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
524 527
 		} else if med_type == "14" {
525
-			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
528
+			inputData["med_type"] = "14" // 医疗类别 11 普通门诊  12 门诊挂号
526 529
 		}
527 530
 	} else {
528 531
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
@@ -593,7 +596,7 @@ func Hbyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
593 596
 		if med_type == "11" || med_type == "1111" || med_type == "1112" {
594 597
 			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
595 598
 		} else if med_type == "14" {
596
-			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
599
+			inputData["med_type"] = "14" // 医疗类别 11 普通门诊  12 门诊挂号
597 600
 		}
598 601
 	} else {
599 602
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
@@ -684,11 +687,11 @@ func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
684 687
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
685 688
 	input := make(map[string]interface{})
686 689
 	inputData := make(map[string]interface{})
687
-	inputMessage["infno"] = "5203" // 交易编码
690
+	inputMessage["infno"] = "YH03" // 交易编码
688 691
 	inputData["psn_no"] = businessParams.PsnNo
689 692
 	inputData["setl_id"] = businessParams.SetlId
690 693
 	inputData["mdtrt_id"] = businessParams.MdtrtId
691
-	//inputData["med_type"] = med_type
694
+	inputData["med_type"] = med_type
692 695
 	fmt.Println(med_type)
693 696
 	input["data"] = inputData
694 697
 	inputMessage["input"] = input //交易输入
@@ -700,7 +703,41 @@ func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
700 703
 	}
701 704
 
702 705
 	var json2 string
703
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
706
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "YH03", string(bytesData), json2)
707
+	out, err := cmd.Output()
708
+	if err != nil {
709
+		fmt.Println("error:", err.Error())
710
+	}
711
+	//mjson, _ := json.Marshal(inputMessage)
712
+	//str2 := string(mjson)
713
+	fmt.Println(string(out))
714
+
715
+	return ConvertToString(string(out), "gbk", "utf-8")
716
+}
717
+
718
+func Hbyb5203aa(baseParams models.BaseParams, businessParams models.BusinessParams) string {
719
+	// 生成签名
720
+	nonce := GetRandomString(32)
721
+	timestamp := time.Now().Unix()
722
+	// 生成输入报文
723
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
724
+	input := make(map[string]interface{})
725
+	inputData := make(map[string]interface{})
726
+	inputMessage["infno"] = "5203" // 交易编码
727
+	inputData["psn_no"] = businessParams.PsnNo
728
+	inputData["setl_id"] = businessParams.SetlId
729
+	inputData["mdtrt_id"] = businessParams.MdtrtId
730
+	input["data"] = inputData
731
+	inputMessage["input"] = input //交易输入
732
+	bytesData, err := json.Marshal(inputMessage)
733
+	fmt.Println(string(bytesData))
734
+	if err != nil {
735
+		fmt.Println(err.Error())
736
+		return err.Error()
737
+	}
738
+
739
+	var json2 string
740
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "5203", string(bytesData), json2)
704 741
 	out, err := cmd.Output()
705 742
 	if err != nil {
706 743
 		fmt.Println("error:", err.Error())
@@ -875,6 +912,78 @@ func Hbyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
875 912
 	return str
876 913
 }
877 914
 
915
+type Input struct {
916
+	MonSetlAppyID   string `xml:"MON_SETL_APPY_ID"`
917
+	FixmedinsNo     string `xml:"FIXMEDINS_NO"`
918
+	ClrCnt          string    `xml:"CLR_CNT"`
919
+	MedfeeSumAmt    string    `xml:"MEDFEE_SUMAMT"`
920
+	OptinsPaySumAmt string    `xml:"OPTINS_PAY_SUMAMT"`
921
+	Begndate        string `xml:"BEGNDATE"`
922
+	Enddate         string `xml:"ENDDATE"`
923
+	OpterName       string `xml:"OPTER_NAME"`
924
+}
925
+
926
+type Inputs struct {
927
+	XMLName xml.Name `xml:"INPUTS"`
928
+	Input   Input    `xml:"INPUT"`
929
+}
930
+
931
+type Data struct {
932
+	XMLName xml.Name `xml:"DATA"`
933
+	Inputs  Inputs   `xml:"INPUTS"`
934
+}
935
+
936
+
937
+func Hbyb1608(baseParams models.BaseParams,cnt string,medfee_sumamt string,start_time string,end_time string,func_t string) string {
938
+
939
+	// 生成签名
940
+	nonce := GetRandomString(32)
941
+	timestamp := time.Now().Unix()
942
+
943
+	// 生成输入报文
944
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
945
+	//input := make(map[string]interface{})
946
+	//inputDatas := []make(map[string]interface{})
947
+	//inputDatas := make([]map[string]interface{}, 0)
948
+	data := Data{
949
+		Inputs: Inputs{
950
+			Input: Input{
951
+				MonSetlAppyID:  strconv.FormatInt(timestamp, 10)  ,
952
+				FixmedinsNo:     baseParams.FixmedinsCode,
953
+				ClrCnt:          cnt,
954
+				MedfeeSumAmt:    medfee_sumamt,
955
+				OptinsPaySumAmt: func_t,
956
+				Begndate:        start_time,
957
+				Enddate:         end_time,
958
+				OpterName:       baseParams.Doctor,
959
+			},
960
+		},
961
+	}
962
+	// 将结构体变量转换为 XML 字符串
963
+	xmlData, err := xml.MarshalIndent(data, "", "  ")
964
+	if err != nil {
965
+		fmt.Println("转换为XML失败:", err)
966
+	}
967
+
968
+	inputMessage["infno"] = "1608" // 交易编码
969
+	inputMessage["input"] = string(xmlData) //交易输入
970
+	bytesData, err := json.Marshal(inputMessage)
971
+	fmt.Println(string(bytesData))
972
+	if err != nil {
973
+		fmt.Println(err.Error())
974
+		return err.Error()
975
+	}
976
+	var json2 string
977
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1608", string(bytesData), json2)
978
+	out, err := cmd.Output()
979
+	if err != nil {
980
+		fmt.Println("error:", err.Error())
981
+	}
982
+	fmt.Println(string(out))
983
+	return ConvertToString(string(out), "gbk", "utf-8")
984
+}
985
+
986
+
878 987
 func Hbyb3202a(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
879 988
 
880 989
 	fmt.Println(baseParams)
@@ -889,6 +998,52 @@ func Hbyb3202a(baseParams models.BaseParams, businessParams []*models.BusinessPa
889 998
 	//inputDatas := []make(map[string]interface{})
890 999
 	inputDatas := make([]map[string]interface{}, 0)
891 1000
 
1001
+	inputMessage["infno"] = "3202a" // 交易编码
1002
+	for _, item := range businessParams {
1003
+		inputData := make(map[string]interface{})
1004
+		inputData["insutype"] = ""                        // 险种
1005
+		inputData["clr_type"] = ""                        // 就诊 ID(来自2201接口返回)
1006
+		inputData["setl_optins"] = item.SetlOptins                     // 结算经办机构
1007
+		inputData["stmt_begndate"] = item.StmtBegndate    // 对帐开始时间
1008
+		inputData["stmt_enddate"] = item.StmtEnddate      //对帐结束时间
1009
+		inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
1010
+		inputData["acct_pay"] = item.AcctPay              //个人账户支付金额
1011
+		inputData["med_type"] = "14"                        //个人账户支付金额
1012
+		inputDatas = append(inputDatas, inputData)
1013
+	}
1014
+	input["clrdata"] = inputDatas
1015
+	inputMessage["input"] = input //交易输入
1016
+
1017
+	bytesData, err := json.Marshal(inputMessage)
1018
+	fmt.Println(string(bytesData))
1019
+	if err != nil {
1020
+		fmt.Println(err.Error())
1021
+		return err.Error()
1022
+	}
1023
+	var json2 string
1024
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "3202a", string(bytesData), json2)
1025
+	out, err := cmd.Output()
1026
+	if err != nil {
1027
+		fmt.Println("error:", err.Error())
1028
+	}
1029
+	fmt.Println(string(out))
1030
+	return ConvertToString(string(out), "gbk", "utf-8")
1031
+
1032
+}
1033
+func Hbyb3202b(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
1034
+
1035
+	fmt.Println(baseParams)
1036
+	fmt.Println(businessParams)
1037
+	// 生成签名
1038
+	nonce := GetRandomString(32)
1039
+	timestamp := time.Now().Unix()
1040
+
1041
+	// 生成输入报文
1042
+	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
1043
+	input := make(map[string]interface{})
1044
+	//inputDatas := []make(map[string]interface{})
1045
+	inputDatas := make([]map[string]interface{}, 0)
1046
+
892 1047
 	inputMessage["infno"] = "3202a" // 交易编码
893 1048
 	for _, item := range businessParams {
894 1049
 		inputData := make(map[string]interface{})
@@ -899,7 +1054,7 @@ func Hbyb3202a(baseParams models.BaseParams, businessParams []*models.BusinessPa
899 1054
 		inputData["stmt_enddate"] = item.StmtEnddate      //对帐结束时间
900 1055
 		inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
901 1056
 		inputData["acct_pay"] = item.AcctPay              //个人账户支付金额
902
-		inputData["med_type"] = ""                        //个人账户支付金额
1057
+		inputData["med_type"] = "110104"                        //个人账户支付金额
903 1058
 		inputDatas = append(inputDatas, inputData)
904 1059
 	}
905 1060
 	input["clrdata"] = inputDatas
@@ -1731,7 +1886,7 @@ func Hbyb5301(psnNo string, insutype string, org_name string, doctor string, fix
1731 1886
 	// 生成签名
1732 1887
 	nonce := GetRandomString(32)
1733 1888
 	timestamp := time.Now().Unix()
1734
-	signature := setSignature(timestamp, nonce, secret_key)
1889
+
1735 1890
 	//tempTime := time.Unix(timestamp, 0)
1736 1891
 	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
1737 1892
 
@@ -1745,44 +1900,25 @@ func Hbyb5301(psnNo string, insutype string, org_name string, doctor string, fix
1745 1900
 	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
1746 1901
 	input["data"] = inputData
1747 1902
 	inputMessage["input"] = input //交易输入
1903
+
1904
+
1748 1905
 	bytesData, err := json.Marshal(inputMessage)
1906
+	//inputLog = string(bytesData)
1749 1907
 	fmt.Println(string(bytesData))
1750 1908
 	if err != nil {
1751 1909
 		fmt.Println(err.Error())
1752 1910
 		return err.Error()
1753 1911
 	}
1754
-	reader := bytes.NewReader(bytesData)
1755
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
1756
-	gdyb_url := beego.AppConfig.String("gdyb_url")
1757
-	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
1758
-	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
1759
-	url := gdyb_url + "5301"
1760
-	request, err := http.NewRequest("POST", url, reader)
1761
-	if err != nil {
1762
-		fmt.Println(err.Error())
1763
-		return err.Error()
1764
-	}
1765
-
1766
-	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
1767
-	request.Header.Set("x-tif-paasid", gdyb_paasid)
1768
-	request.Header.Set("x-tif-signature", signature)
1769
-	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
1770
-	request.Header.Set("x-tif-nonce", nonce)
1771 1912
 
1772
-	client := http.Client{}
1773
-	resp, err := client.Do(request)
1774
-	if err != nil {
1775
-		fmt.Println(err.Error())
1776
-		return err.Error()
1777
-	}
1778
-	respBytes, err := ioutil.ReadAll(resp.Body)
1913
+	var json2 string
1914
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "5301", string(bytesData), json2)
1915
+	out, err := cmd.Output()
1779 1916
 	if err != nil {
1780
-		fmt.Println(err.Error())
1781
-		return err.Error()
1917
+		fmt.Println("error:", err.Error())
1782 1918
 	}
1783
-	str := string(respBytes)
1784
-	fmt.Println(str)
1785
-	return str
1919
+	fmt.Println(string(out))
1920
+	return ConvertToString(string(out), "gbk", "utf-8")
1921
+
1786 1922
 }
1787 1923
 
1788 1924
 //
@@ -2420,3 +2556,646 @@ func Hbyb2001(secret_key string, org_name string, doctor_name string, code strin
2420 2556
 
2421 2557
 	return string(out), string(bytesData)
2422 2558
 }
2559
+
2560
+
2561
+// 住院登记
2562
+func Hbyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
2563
+	// 生成签名
2564
+	nonce := GetRandomString(32)
2565
+	timestamp := time.Now().Unix()
2566
+	//signature := setSignature(timestamp, nonce, secret_key)
2567
+	//tempTime := time.Unix(timestamp, 0)
2568
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2569
+
2570
+	// 生成输入报文
2571
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2572
+	input := make(map[string]interface{})
2573
+	inputData := make(map[string]interface{})
2574
+	inputMessage["infno"] = "2401"              // 交易编码
2575
+	inputData["psn_no"] = struct2401.PsnNo      // 人员编号 (来自1101接口返回)
2576
+	inputData["insutype"] = struct2401.Insutype // 险种类型(来自1101接口返回)
2577
+	inputData["tel"] = ""
2578
+	inputData["coner_name"] = ""
2579
+	inputData["begntime"] = struct2401.Begntime             // 开始时间
2580
+	inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
2581
+	inputData["mdtrt_cert_no"] = struct2401.MdtrtCertNo     // 就诊凭证编号
2582
+	inputData["med_type"] = struct2401.MedType              // 就诊凭证编号
2583
+	inputData["ipt_no"] = struct2401.IptNo                  // 住院/门诊号
2584
+	inputData["medrcdno"] = ""
2585
+	inputData["atddr_no"] = struct2401.AtddrNo
2586
+	inputData["chfpdr_name"] = struct2401.ChfpdrName
2587
+	inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
2588
+	inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
2589
+	inputData["adm_dept_name"] = struct2401.AdmDeptName
2590
+	inputData["adm_bed"] = struct2401.AdmBed
2591
+	inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
2592
+	inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
2593
+	inputData["main_cond_dscr"] = ""
2594
+	inputData["dise_codg"] = struct2401.DiseCodg
2595
+	inputData["dise_name"] = struct2401.DiseName
2596
+	inputData["oprn_oprt_code"] = ""
2597
+	inputData["oprn_oprt_name"] = ""
2598
+	inputData["fpsc_no"] = ""
2599
+	inputData["matn_type"] = ""
2600
+	inputData["birctrl_type"] = ""
2601
+	inputData["latechb_flag"] = ""
2602
+	inputData["geso_val"] = ""
2603
+	inputData["fetts"] = ""
2604
+	inputData["fetus_cnt"] = ""
2605
+	inputData["pret_flag"] = ""
2606
+	inputData["birctrl_matn_date"] = ""
2607
+	inputData["dise_type_code"] = ""
2608
+
2609
+	inputDataArr := make([]map[string]interface{}, 0)
2610
+	for _, item := range struct2401.Diseinfo {
2611
+		inputDataTwo := make(map[string]interface{})
2612
+		inputDataTwo["psn_no"] = item.PsnNo
2613
+		inputDataTwo["diag_type"] = item.DiagType
2614
+		inputDataTwo["maindiag_flag"] = item.MaindiagFlag
2615
+		inputDataTwo["diag_srt_no"] = item.DiagSrtNo
2616
+		inputDataTwo["diag_code"] = item.DiagCode
2617
+		inputDataTwo["diag_name"] = item.DiagName
2618
+		inputDataTwo["adm_cond"] = ""
2619
+		inputDataTwo["diag_dept"] = item.DiagDept
2620
+		inputDataTwo["dise_dor_no"] = item.DiseDorNo
2621
+		inputDataTwo["dise_dor_name"] = item.DiseDorName
2622
+		inputDataTwo["diag_time"] = item.DiagTime
2623
+		inputDataArr = append(inputDataArr, inputDataTwo)
2624
+	}
2625
+	input["mdtrtinfo"] = inputData
2626
+	input["diseinfo"] = inputDataArr
2627
+	inputMessage["input"] = input //交易输入
2628
+
2629
+	bytesData, err := json.Marshal(inputMessage)
2630
+	fmt.Println(string(bytesData))
2631
+	if err != nil {
2632
+		fmt.Println(err.Error())
2633
+		return err.Error(), ""
2634
+	}
2635
+	var json2 string
2636
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2401",  string(bytesData), json2)
2637
+	out, err := cmd.Output()
2638
+
2639
+	//decoder := simplifiedchinese.GBK.NewDecoder()
2640
+	//utf8Bytes, _ := decoder.Bytes([]byte(string(out)))
2641
+	//fmt.Println(string(utf8Bytes)) // 输出:中文
2642
+
2643
+	if err != nil {
2644
+		fmt.Println("error:", err.Error())
2645
+	}
2646
+
2647
+	return   ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
2648
+}
2649
+
2650
+
2651
+//住院撤销
2652
+func Hbyb2404(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
2653
+	// 生成签名
2654
+	nonce := GetRandomString(32)
2655
+	timestamp := time.Now().Unix()
2656
+
2657
+	// 生成输入报文
2658
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2659
+	input := make(map[string]interface{})
2660
+	inputData := make(map[string]interface{})
2661
+	inputMessage["infno"] = "2404"   // 交易编码
2662
+	inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
2663
+	inputData["psn_no"] = psn_no     // 人员编号 (来自1101接口返回)
2664
+	input["data"] = inputData
2665
+	inputMessage["input"] = input //交易输入
2666
+	bytesData, err := json.Marshal(inputMessage)
2667
+	fmt.Println(string(bytesData))
2668
+	if err != nil {
2669
+		fmt.Println(err.Error())
2670
+		return err.Error(), ""
2671
+	}
2672
+	var json2 string
2673
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2404", string(bytesData), json2)
2674
+	out, err := cmd.Output()
2675
+	if err != nil {
2676
+		fmt.Println("error:", err.Error())
2677
+	}
2678
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
2679
+
2680
+	//return string(out), string(bytesData)
2681
+}
2682
+
2683
+//出院撤销
2684
+func Hb2405(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
2685
+	// 生成签名
2686
+	nonce := GetRandomString(32)
2687
+	timestamp := time.Now().Unix()
2688
+
2689
+
2690
+	// 生成输入报文
2691
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2692
+	input := make(map[string]interface{})
2693
+	inputData := make(map[string]interface{})
2694
+	inputMessage["infno"] = "2405"   // 交易编码
2695
+	inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
2696
+	inputData["psn_no"] = psn_no     // 人员编号 (来自1101接口返回)
2697
+	input["data"] = inputData
2698
+	inputMessage["input"] = input //交易输入
2699
+	bytesData, err := json.Marshal(inputMessage)
2700
+	fmt.Println(string(bytesData))
2701
+	if err != nil {
2702
+		fmt.Println(err.Error())
2703
+		return err.Error(), ""
2704
+	}
2705
+	var json2 string
2706
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2405", string(bytesData), json2)
2707
+	out, err := cmd.Output()
2708
+	if err != nil {
2709
+		fmt.Println("error:", err.Error())
2710
+	}
2711
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
2712
+
2713
+	//return string(out), string(bytesData)
2714
+}
2715
+
2716
+// 出院
2717
+func Hb2402(struct2402 Struct2402, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) (string, string) {
2718
+
2719
+	// 生成签名
2720
+	nonce := GetRandomString(32)
2721
+	timestamp := time.Now().Unix()
2722
+	//tempTime := time.Unix(timestamp, 0)
2723
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2724
+
2725
+	// 生成输入报文
2726
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2727
+	input := make(map[string]interface{})
2728
+	inputData := make(map[string]interface{})
2729
+	inputMessage["infno"] = "2402"               // 交易编码
2730
+	inputData["mdtrt_id"] = struct2402.MdtrtId   // 人员编号 (来自1101接口返回)
2731
+	inputData["psn_no"] = struct2402.PsnNo       // 人员编号 (来自1101接口返回)
2732
+	inputData["insutype"] = struct2402.Insutype  // 险种类型(来自1101接口返回)
2733
+	inputData["endtime"] = struct2402.Endtime    // 结束时间
2734
+	inputData["dise_codg"] = struct2402.DiseCode // 就诊凭证类型
2735
+
2736
+	inputData["dise_name"] = struct2402.DiseName // 就诊凭证类型
2737
+	inputData["oprn_oprt_code"] = ""             // 就诊凭证类型
2738
+	inputData["oprn_oprt_name"] = ""             // 就诊凭证类型
2739
+	inputData["fpsc_no"] = ""                    // 就诊凭证类型
2740
+
2741
+	inputData["matn_type"] = ""    // 就诊凭证类型
2742
+	inputData["birctrl_type"] = "" // 就诊凭证类型
2743
+	inputData["latechb_flag"] = "" // 就诊凭证类型
2744
+	inputData["geso_val"] = ""
2745
+	inputData["fetts"] = ""
2746
+	inputData["fetus_cnt"] = ""
2747
+	inputData["pret_flag"] = ""
2748
+	inputData["birctrl_matn_date"] = ""
2749
+	inputData["cop_flag"] = ""
2750
+
2751
+	inputData["dscg_dept_codg"] = struct2402.DscgDeptCodg
2752
+	inputData["dscg_dept_name"] = struct2402.DscgDeptName
2753
+	inputData["dscg_bed"] = "待定"
2754
+	inputData["dscg_way"] = struct2402.DscgWay
2755
+	inputData["die_date"] = ""
2756
+
2757
+	inputDataArr := make([]map[string]interface{}, 0)
2758
+	for _, item := range struct2402.Diseinfo {
2759
+		inputDataTwo := make(map[string]interface{})
2760
+		inputDataTwo["psn_no"] = item.PsnNo
2761
+		inputDataTwo["mdtrt_id"] = item.MdtrtId
2762
+		inputDataTwo["diag_type"] = item.DiagType
2763
+		inputDataTwo["maindiag_flag"] = item.MaindiagFlag
2764
+		inputDataTwo["diag_srt_no"] = item.DiagSrtNo
2765
+		inputDataTwo["diag_code"] = item.DiagCode
2766
+		inputDataTwo["diag_name"] = item.DiagName
2767
+		inputDataTwo["diag_dept"] = item.DiagDept
2768
+		inputDataTwo["dise_dor_no"] = item.DiseDorNo
2769
+		inputDataTwo["dise_dor_name"] = item.DiseDorName
2770
+		inputDataTwo["diag_time"] = item.DiagTime
2771
+		inputDataArr = append(inputDataArr, inputDataTwo)
2772
+	}
2773
+
2774
+	input["dscginfo"] = inputData
2775
+	input["diseinfo"] = inputDataArr
2776
+
2777
+	inputMessage["input"] = input //交易输入
2778
+
2779
+	bytesData, err := json.Marshal(inputMessage)
2780
+	fmt.Println(string(bytesData))
2781
+	if err != nil {
2782
+		fmt.Println(err.Error())
2783
+		return err.Error(), ""
2784
+	}
2785
+	var json2 string
2786
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2402", string(bytesData), json2)
2787
+	out, err := cmd.Output()
2788
+	if err != nil {
2789
+		fmt.Println("error:", err.Error())
2790
+	}
2791
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
2792
+
2793
+	//return string(out), string(bytesData)
2794
+}
2795
+
2796
+
2797
+//  住院费用明细信息上传
2798
+func Hb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, 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, med_type string, doctor_name string, doctor_number string) (string, string) {
2799
+	// 生成签名
2800
+	nonce := GetRandomString(32)
2801
+	timestamp := time.Now().Unix()
2802
+	signature := setSignature(timestamp, nonce, secret_key)
2803
+	//tempTime := time.Unix(timestamp, 0)
2804
+	//timeFormat := tempTime.Format("20060102150405")
2805
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2806
+	//chrgBchno := rand.Intn(100000) + 10000
2807
+
2808
+	var customs []*models.NewCustom
2809
+
2810
+	customs = hisPrescription
2811
+	// 生成输入报文
2812
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2813
+	input := make(map[string]interface{})
2814
+	feedetail := make([]map[string]interface{}, 0)
2815
+	inputMessage["infno"] = "2301" // 交易编码
2816
+
2817
+	//chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
2818
+	for _, item := range customs {
2819
+		org_id, _ := beego.AppConfig.Int64("org_id")
2820
+		doctor_info, _ := GetAdminUserInfoByID(org_id, item.DoctorId)
2821
+
2822
+		feedetailInfo := make(map[string]interface{})
2823
+		feedetailInfo["feedetl_sn"] = item.FeedetlSn
2824
+		feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
2825
+		feedetailInfo["psn_no"] = psnNo     // 人员编号 (来自1101接口返回)
2826
+		feedetailInfo["med_type"] = med_type
2827
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
2828
+		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
2829
+		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
2830
+		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
2831
+		feedetailInfo["cnt"] = item.Cut                              // 数量
2832
+		feedetailInfo["pric"] = item.Price                           // 单价
2833
+		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
2834
+		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
2835
+		feedetailInfo["bilg_dr_codg"] = doctor_info.DoctorNumber     // 开单医生编码
2836
+		feedetailInfo["bilg_dr_name"] = doctor_info.UserName
2837
+		feedetailInfo["acord_dept_codg"] = dept_code               // 受单科室编码
2838
+		feedetailInfo["acord_dept_name"] = dept                    // 受单科室名称
2839
+		feedetailInfo["orders_dr_code"] = doctor_info.DoctorNumber // 受单医生编码
2840
+		feedetailInfo["orders_dr_name"] = doctor_info.UserName     // 受单医生姓名
2841
+		feedetailInfo["chrg_bchno"] = chrg_bchno                   // 收费批次号
2842
+		feedetailInfo["dise_codg"] = ""                            // 病种编码
2843
+		feedetailInfo["rxno"] = ""                                 // 处方号
2844
+		feedetailInfo["rx_circ_flag"] = "0"                        // 外购处方标志
2845
+		feedetailInfo["sin_dos_dscr"] = ""                         // 单次剂量描述
2846
+		feedetailInfo["used_frqu_dscr"] = ""                       // 使用频次描述
2847
+		feedetailInfo["prd_days"] = "0"                            // 周期天数
2848
+		feedetailInfo["medc_way_dscr"] = ""                        // 用药途径描述
2849
+		// 开单医师姓名
2850
+
2851
+		if item.HospApprFlag != -1 {
2852
+			if item.HospApprFlag == 1 {
2853
+				feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
2854
+			} else if item.HospApprFlag == 2 {
2855
+				feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
2856
+			} else if item.HospApprFlag == 3 {
2857
+				feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
2858
+			} else {
2859
+				feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
2860
+			}
2861
+		} else {
2862
+			feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
2863
+		}
2864
+
2865
+		//feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
2866
+		feedetailInfo["etip_flag"] = ""        // 外检标志
2867
+		feedetailInfo["etip_hosp_code"] = ""   // 外检医院编码
2868
+		feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
2869
+		feedetailInfo["matn_fee_flag"] = ""    // 生育费用标志
2870
+		feedetail = append(feedetail, feedetailInfo)
2871
+	}
2872
+	input["feedetail"] = feedetail
2873
+	inputMessage["input"] = input //交易输入
2874
+
2875
+	bytesData, err := json.Marshal(inputMessage)
2876
+	fmt.Println("----------")
2877
+	fmt.Println(string(bytesData))
2878
+	fmt.Println("----------")
2879
+	requestLog := string(bytesData)
2880
+
2881
+	if err != nil {
2882
+		fmt.Println(err.Error())
2883
+		return "", ""
2884
+	}
2885
+	reader := bytes.NewReader(bytesData)
2886
+
2887
+	gdyb_url := beego.AppConfig.String("gdyb_url")
2888
+	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
2889
+	url := gdyb_url + "2301"
2890
+	if mdtrtarea_admvs == "150499" {
2891
+		url = gdyb_url
2892
+	}
2893
+	request, err := http.NewRequest("POST", url, reader)
2894
+	if err != nil {
2895
+		fmt.Println(err.Error())
2896
+		return "", ""
2897
+	}
2898
+
2899
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
2900
+	request.Header.Set("x-tif-paasid", gdyb_paasid)
2901
+	request.Header.Set("x-tif-signature", signature)
2902
+	request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
2903
+	request.Header.Set("x-tif-nonce", nonce)
2904
+
2905
+	client := http.Client{}
2906
+	resp, err := client.Do(request)
2907
+	if err != nil {
2908
+		fmt.Println(err.Error())
2909
+		return "", ""
2910
+	}
2911
+	respBytes, err := ioutil.ReadAll(resp.Body)
2912
+	if err != nil {
2913
+		fmt.Println(err.Error())
2914
+		return "", ""
2915
+	}
2916
+	return string(respBytes), requestLog
2917
+
2918
+}
2919
+func Hb2301A(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, 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, med_type string, opertor string) (string, string) {
2920
+	// 生成签名
2921
+	nonce := GetRandomString(32)
2922
+	timestamp := time.Now().Unix()
2923
+
2924
+	//tempTime := time.Unix(timestamp, 0)
2925
+	//timeFormat := tempTime.Format("20060102150405")
2926
+	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
2927
+	//chrgBchno := rand.Intn(100000) + 10000
2928
+
2929
+	var customs []*models.NewCustom
2930
+
2931
+	customs = hisPrescription
2932
+	// 生成输入报文
2933
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, opertor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
2934
+	input := make(map[string]interface{})
2935
+	feedetail := make([]map[string]interface{}, 0)
2936
+	inputMessage["infno"] = "2301" // 交易编码
2937
+
2938
+	//chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
2939
+	for _, item := range customs {
2940
+		feedetailInfo := make(map[string]interface{})
2941
+		feedetailInfo["feedetl_sn"] = item.FeedetlSn
2942
+		feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
2943
+		feedetailInfo["psn_no"] = psnNo     // 人员编号 (来自1101接口返回)
2944
+		feedetailInfo["med_type"] = med_type
2945
+
2946
+		feedetailInfo["fee_ocur_time"] = item.FeeOcurTime            // 费用发生时间
2947
+		feedetailInfo["med_list_codg"] = item.MedListCodg            // 医疗目录编码
2948
+		feedetailInfo["medins_list_codg"] = fixmedins_code           // 医药机构目录编码
2949
+		feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
2950
+		feedetailInfo["cnt"] = item.Cut                              // 数量
2951
+		feedetailInfo["pric"] = item.Price                           // 单价
2952
+		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
2953
+		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
2954
+		feedetailInfo["bilg_dr_codg"] = doctor_id                    // 开单医生编码
2955
+		feedetailInfo["bilg_dr_name"] = doctor
2956
+		feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码
2957
+		feedetailInfo["acord_dept_name"] = dept      // 受单科室名称
2958
+		feedetailInfo["orders_dr_code"] = doctor_id  // 受单医生编码
2959
+		feedetailInfo["orders_dr_name"] = doctor     // 受单医生姓名
2960
+		feedetailInfo["chrg_bchno"] = chrg_bchno     // 收费批次号
2961
+		feedetailInfo["dise_codg"] = ""              // 病种编码
2962
+		feedetailInfo["rxno"] = ""                   // 处方号
2963
+		feedetailInfo["rx_circ_flag"] = "0"          // 外购处方标志
2964
+		feedetailInfo["sin_dos_dscr"] = ""           // 单次剂量描述
2965
+		feedetailInfo["used_frqu_dscr"] = ""         // 使用频次描述
2966
+		feedetailInfo["prd_days"] = "0"              // 周期天数
2967
+		feedetailInfo["medc_way_dscr"] = ""          // 用药途径描述
2968
+		// 开单医师姓名
2969
+
2970
+		if item.HospApprFlag != -1 {
2971
+			if item.HospApprFlag == 1 {
2972
+				feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
2973
+			} else if item.HospApprFlag == 2 {
2974
+				feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
2975
+			} else if item.HospApprFlag == 3 {
2976
+				feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
2977
+			} else {
2978
+				feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
2979
+			}
2980
+		} else {
2981
+			feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
2982
+		}
2983
+
2984
+		feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
2985
+		feedetailInfo["etip_flag"] = ""        // 外检标志
2986
+		feedetailInfo["etip_hosp_code"] = ""   // 外检医院编码
2987
+		feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
2988
+		feedetailInfo["matn_fee_flag"] = ""    // 生育费用标志
2989
+		feedetail = append(feedetail, feedetailInfo)
2990
+	}
2991
+	input["feedetail"] = feedetail
2992
+	inputMessage["input"] = input //交易输入
2993
+
2994
+	bytesData, err := json.Marshal(inputMessage)
2995
+	fmt.Println(string(bytesData))
2996
+	if err != nil {
2997
+		fmt.Println(err.Error())
2998
+		return err.Error(), ""
2999
+	}
3000
+	var json2 string
3001
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2301", string(bytesData), json2)
3002
+	out, err := cmd.Output()
3003
+	if err != nil {
3004
+		fmt.Println("error:", err.Error())
3005
+	}
3006
+	fmt.Println(string(out))
3007
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3008
+
3009
+	//return string(out), string(bytesData)
3010
+
3011
+}
3012
+//  住院费用明细信息撤销
3013
+func Hb2302(psnNo string, mdtrtId string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, number string, refund_type int64) (string, string) {
3014
+	// 生成签名
3015
+	nonce := GetRandomString(32)
3016
+	timestamp := time.Now().Unix()
3017
+
3018
+
3019
+	// 生成输入报文
3020
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3021
+	input := make(map[string]interface{})
3022
+	inputData := make(map[string]interface{})
3023
+
3024
+	//inputData := make(map[string]interface{})
3025
+	feedetail := make([]map[string]interface{}, 0)
3026
+
3027
+	inputMessage["infno"] = "2302" // 交易编码
3028
+	if refund_type == 1 {
3029
+		inputData["feedetl_sn"] = number //
3030
+
3031
+	} else {
3032
+		inputData["feedetl_sn"] = "0000" //
3033
+	}
3034
+
3035
+	inputData["mdtrt_id"] = mdtrtId // 就诊 ID
3036
+	inputData["psn_no"] = psnNo     // 人员编号
3037
+	feedetail = append(feedetail,inputData)
3038
+	input["data"] = feedetail
3039
+	inputMessage["input"] = input //交易输入
3040
+
3041
+	bytesData, err := json.Marshal(inputMessage)
3042
+	fmt.Println(string(bytesData))
3043
+	if err != nil {
3044
+		fmt.Println(err.Error())
3045
+		return err.Error(), ""
3046
+	}
3047
+	var json2 string
3048
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2302", string(bytesData), json2)
3049
+	out, err := cmd.Output()
3050
+	if err != nil {
3051
+		fmt.Println("error:", err.Error())
3052
+	}
3053
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3054
+
3055
+	//return string(out), string(bytesData)
3056
+}
3057
+func Hb2303(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, mid_setl_flag string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64) (string, string) {
3058
+	// 生成签名
3059
+	nonce := GetRandomString(32)
3060
+	timestamp := time.Now().Unix()
3061
+
3062
+	// 生成输入报文
3063
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3064
+	input := make(map[string]interface{})
3065
+	inputData := make(map[string]interface{})
3066
+	inputMessage["infno"] = "2303" // 交易编码
3067
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
3068
+	if certificates == 3 {
3069
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
3070
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3071
+	} else {
3072
+		if id_card_type == 1 {
3073
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
3074
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3075
+		} else {
3076
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
3077
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3078
+		}
3079
+	}
3080
+	inputData["mdtrt_cert_sn"] = ""
3081
+	inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
3082
+	inputData["medfee_sumamt"] = total         // 医疗费总额
3083
+	inputData["psn_setlway"] = "02"            // 个人结算方式 01 按项目结 02 按定额结算
3084
+	inputData["mdtrt_id"] = mdtrtId            // 就诊 ID(来自2201接口返回)
3085
+	inputData["acct_used_flag"] = "1"          // 个人账户使用标志 0否 1是
3086
+	inputData["insutype"] = insutype           // 险种类型
3087
+	inputData["invono"] = ""                   // 发票号
3088
+	inputData["dise_codg"] = "M07803"          // 发票号
3089
+
3090
+	input["data"] = inputData
3091
+	inputMessage["input"] = input //交易输入
3092
+
3093
+	bytesData, err := json.Marshal(inputMessage)
3094
+	fmt.Println(string(bytesData))
3095
+	if err != nil {
3096
+		fmt.Println(err.Error())
3097
+		return err.Error(), ""
3098
+	}
3099
+	var json2 string
3100
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2303", string(bytesData), json2)
3101
+	out, err := cmd.Output()
3102
+	if err != nil {
3103
+		fmt.Println("error:", err.Error())
3104
+	}
3105
+
3106
+	return string(out), string(bytesData)
3107
+}
3108
+//  住院结算
3109
+func Hb2304(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, mid_setl_flag string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, fapiao_number string, acct_used_flag string) (string, string) {
3110
+	// 生成签名
3111
+	nonce := GetRandomString(32)
3112
+	timestamp := time.Now().Unix()
3113
+
3114
+	// 生成输入报文
3115
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3116
+	input := make(map[string]interface{})
3117
+	inputData := make(map[string]interface{})
3118
+	inputMessage["infno"] = "2304" // 交易编码
3119
+	inputData["psn_no"] = psnNo    // 人员编号 (来自1101接口返回)
3120
+	if certificates == 3 {
3121
+		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
3122
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3123
+	} else {
3124
+		if id_card_type == 1 {
3125
+			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
3126
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3127
+		} else if id_card_type == 4 {
3128
+
3129
+			inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
3130
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3131
+
3132
+		} else {
3133
+			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
3134
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3135
+		}
3136
+	}
3137
+	inputData["mdtrt_cert_sn"] = ""
3138
+	inputData["mid_setl_flag"] = mid_setl_flag   // 中途退费标志
3139
+	inputData["medfee_sumamt"] = total           // 医疗费总额
3140
+	inputData["psn_setlway"] = "01"              // 个人结算方式 01 按项目结 02 按定额结算
3141
+	inputData["mdtrt_id"] = mdtrtId              // 就诊 ID(来自2201接口返回)
3142
+	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
3143
+	inputData["insutype"] = insutype             // 险种类型
3144
+	inputData["invono"] = fapiao_number          // 发票号
3145
+
3146
+	input["data"] = inputData
3147
+	inputMessage["input"] = input //交易输入
3148
+
3149
+	bytesData, err := json.Marshal(inputMessage)
3150
+	fmt.Println(string(bytesData))
3151
+	if err != nil {
3152
+		fmt.Println(err.Error())
3153
+		return err.Error(), ""
3154
+	}
3155
+	var json2 string
3156
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2304", string(bytesData), json2)
3157
+	out, err := cmd.Output()
3158
+	if err != nil {
3159
+		fmt.Println("error:", err.Error())
3160
+	}
3161
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3162
+
3163
+	//return string(out), string(bytesData)
3164
+}
3165
+
3166
+//  住院结算撤销
3167
+func Hb2305(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
3168
+	// 生成签名
3169
+	nonce := GetRandomString(32)
3170
+	timestamp := time.Now().Unix()
3171
+	//signature := setSignature(timestamp, nonce, secret_key)
3172
+
3173
+	// 生成输入报文
3174
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
3175
+	input := make(map[string]interface{})
3176
+	inputData := make(map[string]interface{})
3177
+	inputMessage["infno"] = "2305" // 交易编码
3178
+
3179
+	inputData["psn_no"] = psnNo     // 人员编号 (来自1101接口返回)
3180
+	inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
3181
+	inputData["setl_id"] = setlId   // 结算 ID
3182
+
3183
+	input["data"] = inputData
3184
+	inputMessage["input"] = input //交易输入
3185
+
3186
+	bytesData, err := json.Marshal(inputMessage)
3187
+	fmt.Println(string(bytesData))
3188
+	if err != nil {
3189
+		fmt.Println(err.Error())
3190
+		return err.Error(), ""
3191
+	}
3192
+	var json2 string
3193
+	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2305", string(bytesData), json2)
3194
+	out, err := cmd.Output()
3195
+	if err != nil {
3196
+		fmt.Println("error:", err.Error())
3197
+	}
3198
+	return  ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
3199
+
3200
+	//return string(out), string(bytesData)
3201
+}

+ 67 - 12
service/his_service.go Wyświetl plik

@@ -618,6 +618,7 @@ type HisOrder struct {
618 618
 	PrivatePrice            float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
619 619
 	Creator                 int64   `gorm:"column:creator" json:"creator" form:"creator"`
620 620
 	Modify                  int64   `gorm:"column:modify" json:"modify" form:"modify"`
621
+	MedType                  int64   `gorm:"column:med_type" json:"med_type" form:"med_type"`
621 622
 	IsPre                   int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
622 623
 	SzChargeInfo            string  `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
623 624
 	SzProjectInfo           string  `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
@@ -626,6 +627,7 @@ type HisOrder struct {
626 627
 	OrgSetlNumber           string  `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
627 628
 	PayWays                 string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
628 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"`
629 631
 
630 632
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
631 633
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -1009,16 +1011,22 @@ func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype str
1009 1011
 	}
1010 1012
 	if len(clr_type) > 0 {
1011 1013
 		if mdtrtareaAdmvs == "150499" {
1012
-			if clr_type == "11" {
1014
+			if clr_type == "11"  {
1013 1015
 				db = db.Where("clr_type = ?", clr_type)
1014 1016
 			}
1015 1017
 
1016 1018
 		} else {
1017
-			db = db.Where("clr_type = ?", clr_type)
1018 1019
 
1020
+			db = db.Where("clr_type = ?", clr_type)
1019 1021
 		}
1020 1022
 	} else {
1021
-		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
+		}
1022 1030
 
1023 1031
 	}
1024 1032
 	err = db.Find(&orders).Error
@@ -1053,6 +1061,22 @@ func GetOrderByTimeFour(start_time int64, end_time int64, org_id int64) (orders
1053 1061
 	return
1054 1062
 }
1055 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
+
1056 1080
 func GetOrderByTimeThree(start_time int64, end_time int64, org_id int64, insutype string, clr_type string) (orders []*models.HisOrder, err error) {
1057 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
1058 1082
 	return
@@ -1078,13 +1102,13 @@ func GetPatientByID(orgID int64, patientID int64) (*models.Patients, error) {
1078 1102
 
1079 1103
 func FindDiagnoseById(id int64) (models.HisXtDiagnoseConfig, error) {
1080 1104
 	dealer := models.HisXtDiagnoseConfig{}
1081
-	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
1082 1106
 	return dealer, err
1083 1107
 }
1084 1108
 
1085 1109
 func FindDiagnoseByIdtwo(id string) (models.HisXtDiagnoseConfig, error) {
1086 1110
 	dealer := models.HisXtDiagnoseConfig{}
1087
-	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ?", id).First(&dealer).Error
1111
+	err := readDb.Model(&models.HisXtDiagnoseConfig{}).Where("id = ? and status = 1", id).First(&dealer).Error
1088 1112
 	return dealer, err
1089 1113
 }
1090 1114
 
@@ -1152,7 +1176,7 @@ func GetPatientByNumber(number string, user_org_id int64) (patient Patients, err
1152 1176
 }
1153 1177
 
1154 1178
 func GetPatientByIDCard(id_card_no string, user_org_id int64) (patient Patients, err error) {
1155
-	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
1156 1180
 	return
1157 1181
 }
1158 1182
 
@@ -1344,6 +1368,12 @@ func UpdateHisPrescriptionHisIDTwo(his_patient_id int64, patient_id int64, recor
1344 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})
1345 1369
 	return
1346 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
+
1347 1377
 
1348 1378
 func GetHisPatientInfoList(org_id int64, patient_id int64, record_date int64) (info []*models.HisPatient, err error) {
1349 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
@@ -1366,7 +1396,7 @@ func CreateUploadRecord(result *models.HisFundSettleListResult) (err error) {
1366 1396
 }
1367 1397
 
1368 1398
 func GetUploadRecord(order_id int64) (result models.HisFundSettleListResult, err error) {
1369
-	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
1370 1400
 	return
1371 1401
 }
1372 1402
 func UpdateRecord(result *models.HisFundSettleListResult) (err error) {
@@ -1512,19 +1542,18 @@ func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
1512 1542
 	fmt.Println(err)
1513 1543
 	return
1514 1544
 }
1515
-
1516 1545
 func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
1517
-	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
1518 1547
 	fmt.Println(err)
1519 1548
 	return
1520 1549
 }
1521
-func GetOrderError10138(org_id int64) (order []*models.HisOrderError, err error) {
1522
-	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
1523 1552
 	return
1524 1553
 }
1525 1554
 
1526 1555
 func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1527
-	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
1528 1557
 	fmt.Println(err)
1529 1558
 	return
1530 1559
 }
@@ -1658,3 +1687,29 @@ func GetNewHisPrescriptionTenone(org_id int64,number string) (prescription []*mo
1658 1687
 	return
1659 1688
 }
1660 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
+}

+ 40 - 5
service/jsyb_service.go Wyświetl plik

@@ -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   // 科室编码
@@ -1040,11 +1040,11 @@ func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedin
1040 1040
 	inputMessage["infver"] = "1.0.0"                                                            // 接收方系统代码
1041 1041
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
1042 1042
 	if fixmedins_code == "H32090403023" {
1043
-		inputMessage["opter"] = "晁海燕"      // 经办人
1044
-		inputMessage["opter_name"] = "晁海燕" // 经办人姓名
1043
+		inputMessage["opter"] = doctor      // 经办人
1044
+		inputMessage["opter_name"] = doctor // 经办人姓名
1045 1045
 	} else {
1046
-		inputMessage["opter"] = "孙欣欣"      // 经办人
1047
-		inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
1046
+		inputMessage["opter"] = doctor      // 经办人
1047
+		inputMessage["opter_name"] = doctor // 经办人姓名
1048 1048
 	}
1049 1049
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1050 1050
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
@@ -2582,3 +2582,38 @@ func Jxyb3277(stmt_mon string, org_name string, doctor string, fixmedins_code st
2582 2582
 	request_url = request_url + "3277"
2583 2583
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3277"), string(bytesData)
2584 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
+}

+ 173 - 25
service/jx_service.go Wyświetl plik

@@ -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"] = ""
@@ -1158,6 +1193,14 @@ func Jxyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedi
1158 1193
 	inputData["insuplc_admdvs"] = insuplc_admdvs
1159 1194
 	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
1160 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
+
1161 1204
 	inputDataArr := make([]map[string]interface{}, 0)
1162 1205
 	for _, item := range struct2401.Diseinfo {
1163 1206
 		inputDataTwo := make(map[string]interface{})
@@ -1508,7 +1551,7 @@ func Jxyb2302(psnNo string, mdtrtId string, refund_type int64, number string, se
1508 1551
 
1509 1552
 }
1510 1553
 
1511
-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) {
1512 1555
 	// 生成签名
1513 1556
 	nonce := GetRandomString(32)
1514 1557
 	timestamp := time.Now().Unix()
@@ -1541,6 +1584,16 @@ func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, tota
1541 1584
 	inputData["invono"] = ""                   // 发票号
1542 1585
 	inputData["dise_codg"] = "M07803"          // 发票号
1543 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
+
1544 1597
 	inputData["insuplc_admdvs"] = insuplc_admdvs   // 发票号
1545 1598
 	inputData["mdtrtarea_admvs"] = mdtrtarea_admvs // 发票号
1546 1599
 
@@ -1559,7 +1612,7 @@ func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, tota
1559 1612
 
1560 1613
 }
1561 1614
 
1562
-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) {
1563 1616
 	// 生成签名
1564 1617
 	nonce := GetRandomString(32)
1565 1618
 	timestamp := time.Now().Unix()
@@ -1598,6 +1651,13 @@ func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, tota
1598 1651
 	inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
1599 1652
 	inputData["insutype"] = insutype             // 险种类型
1600 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
+
1601 1661
 	input["data"] = inputData
1602 1662
 	inputMessage["input"] = input //交易输入
1603 1663
 
@@ -1613,6 +1673,69 @@ func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, tota
1613 1673
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
1614 1674
 
1615 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
+
1616 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) {
1617 1740
 	// 生成签名
1618 1741
 	timestamp := time.Now().Unix()
@@ -1715,14 +1838,10 @@ func SetJXInputMessage(timestamp int64, org_name string, doctor string, fixmedin
1715 1838
 	inputMessage["signtype"] = "SM3"                                                            // 签名类型
1716 1839
 	inputMessage["infver"] = "V1.0"                                                             // 接收方系统代码
1717 1840
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
1718
-	if fixmedins_code == "H32090403023" {
1719 1841
 
1720
-		inputMessage["opter"] = "晁海燕"      // 经办人
1721
-		inputMessage["opter_name"] = "晁海燕" // 经办人姓名
1722
-	} else {
1723
-		inputMessage["opter"] = doctor      // 经办人
1724
-		inputMessage["opter_name"] = doctor // 经办人姓名
1725
-	}
1842
+	inputMessage["opter"] = doctor      // 经办人
1843
+	inputMessage["opter_name"] = doctor // 经办人姓名
1844
+
1726 1845
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1727 1846
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
1728 1847
 	inputMessage["fixmedins_name"] = org_name
@@ -1796,17 +1915,17 @@ func Jxyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1796 1915
 	return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2503"), string(bytesData)
1797 1916
 }
1798 1917
 
1799
-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) {
1800 1919
 	// 生成签名
1801 1920
 	timestamp := time.Now().Unix()
1802 1921
 	// 生成输入报文
1803
-	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
1922
+	inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, "360399", "360399", "")
1804 1923
 	input := make(map[string]interface{})
1805 1924
 	inputData := make(map[string]interface{})
1806 1925
 	inputMessage["infno"] = "3201"                       // 交易编码
1807 1926
 	inputData["insutype"] = insutype                     // 险种
1808 1927
 	inputData["clr_type"] = clr_type                     // 就诊 ID(来自2201接口返回)
1809
-	inputData["setl_optins"] = setl_optins               // 结算经办机构
1928
+	inputData["setl_optins"] = "360302"               // 结算经办机构
1810 1929
 	inputData["stmt_begndate"] = stmt_begndate           // 对帐开始时间
1811 1930
 	inputData["stmt_enddate"] = stmt_enddate             //对帐结束时间
1812 1931
 	inputData["medfee_sumamt"] = medfee_sumamt           //医疗费总额
@@ -2365,13 +2484,15 @@ func Jxyb4102(psn_no string, setl_id string, params models.PublicParams, stas_ty
2365 2484
 	// 生成输入报文
2366 2485
 	input := make(map[string]interface{})
2367 2486
 	inputData := make(map[string]interface{})
2487
+	inputData2 := make(map[string]interface{})
2488
+
2368 2489
 	inputMessage["infno"] = "4102" // 交易编码
2369 2490
 
2370 2491
 	inputData["setl_id"] = setl_id     // 结算 ID  必填
2371 2492
 	inputData["psn_no"] = psn_no       // 结算 ID  必填
2372 2493
 	inputData["stas_type"] = stas_type // 结算 ID  必填
2373
-
2374
-	input["data"] = inputData
2494
+	inputData2["stastinfo"]  = inputData
2495
+	input["data"] = inputData2
2375 2496
 	inputMessage["input"] = input //交易输入
2376 2497
 	bytesData, _ := json.Marshal(inputMessage)
2377 2498
 	fmt.Println(string(bytesData))
@@ -2402,6 +2523,33 @@ func Jxyb4103(psn_no string, setl_id string, params models.PublicParams) (string
2402 2523
 
2403 2524
 }
2404 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
+
2405 2553
 func Jxyb3501(struct3501 models.Struct3501) (string, string) {
2406 2554
 	timestamp := time.Now().Unix()
2407 2555
 	// 生成输入报文

+ 1 - 1
service/nm_service.go Wyświetl plik

@@ -364,7 +364,7 @@ func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
364 364
 
365 365
 	var customs []*Custom
366 366
 	for _, item := range hisPrescription {
367
-		tm := time.Unix(item.PreTime, 0)
367
+		tm := time.Now()
368 368
 
369 369
 		if item.Type == 1 { //药品
370 370
 			for _, subItem := range item.HisDoctorAdviceInfo {

+ 137 - 3
service/zh_his_service.go Wyświetl plik

@@ -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)
@@ -1746,7 +1880,7 @@ func ZHyb4104(baseParams models.BaseParams, businessParams models.BusinessParams
1746 1880
 	input := make(map[string]interface{})
1747 1881
 	inputData := make(map[string]interface{})
1748 1882
 	inputMessage["infno"] = "4104" // 交易编码
1749
-	inputData["setl_ym"] = "202309"
1883
+	inputData["setl_ym"] = "202306"
1750 1884
 	inputData["page_num"] = "1"
1751 1885
 	inputData["page_size"] = "100"
1752 1886
 	input["data"] = inputData