|
@@ -220,15 +220,51 @@ func (c *HisApiController) ReadCard() {
|
220
|
220
|
|
221
|
221
|
roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
222
|
222
|
miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
223
|
|
- if initFlag == 0 {
|
224
|
|
- c.TestGetBasBaseInit()
|
225
|
|
- }
|
|
223
|
+
|
226
|
224
|
switch id_card_type {
|
227
|
225
|
case 1:
|
228
|
226
|
if miConfig.MdtrtareaAdmvs == "421300" {
|
229
|
|
- result := service.Gdyb1101C("", miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates)
|
230
|
|
- fmt.Println(result)
|
|
227
|
+ result, request_log := service.Gdyb1101C("", miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates)
|
|
228
|
+ fmt.Println(request_log)
|
|
229
|
+ var dat map[string]interface{}
|
|
230
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
231
|
+ fmt.Println(dat)
|
|
232
|
+ } else {
|
|
233
|
+ fmt.Println(err)
|
|
234
|
+ }
|
|
235
|
+
|
|
236
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
237
|
+ var res ResultTwo
|
|
238
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
239
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
240
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
241
|
+ return
|
|
242
|
+ }
|
|
243
|
+
|
|
244
|
+ if res.Infcode == 0 {
|
|
245
|
+ patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
|
246
|
+ if err == gorm.ErrRecordNotFound {
|
|
247
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
248
|
+ return
|
|
249
|
+ } else if err != nil {
|
|
250
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
251
|
+ return
|
|
252
|
+
|
|
253
|
+ } else {
|
|
254
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
255
|
+ "patient": patient,
|
|
256
|
+ "number": res.Output.Baseinfo.Certno,
|
|
257
|
+ })
|
|
258
|
+ }
|
|
259
|
+ } else {
|
|
260
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
261
|
+ return
|
|
262
|
+ }
|
|
263
|
+
|
231
|
264
|
} else {
|
|
265
|
+ if initFlag == 0 {
|
|
266
|
+ c.TestGetBasBaseInit()
|
|
267
|
+ }
|
232
|
268
|
basStr := c.GetBasBaseInfo()
|
233
|
269
|
if len(basStr) == 0 {
|
234
|
270
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
@@ -1759,7 +1795,10 @@ func (c *HisApiController) GetRegisterInfo() {
|
1759
|
1795
|
|
1760
|
1796
|
if config.IsOpen == 1 {
|
1761
|
1797
|
//service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")
|
1762
|
|
- result, requestLog := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10))
|
|
1798
|
+
|
|
1799
|
+ result, requestLog := service.Gdyb1101C(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", certificates)
|
|
1800
|
+
|
|
1801
|
+ //result, requestLog := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10))
|
1763
|
1802
|
saveLog(result, requestLog, "1101")
|
1764
|
1803
|
//register_log = requestLog + "\r\n" + "\r\n" + "\r\n" + result
|
1765
|
1804
|
var res ResultTwo
|