|
@@ -268,6 +268,7 @@ func (c *HisApiController) ReadCard() {
|
268
|
268
|
api := "http://192.168.124.4:9532/" + "hbyb/1101?cert_no=" + "" +
|
269
|
269
|
"&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
|
270
|
270
|
"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10)
|
|
271
|
+
|
271
|
272
|
resp, requestErr := http.Get(api)
|
272
|
273
|
if requestErr != nil {
|
273
|
274
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -340,11 +341,9 @@ func (c *HisApiController) ReadCard() {
|
340
|
341
|
}
|
341
|
342
|
|
342
|
343
|
} else if miConfig.MdtrtareaAdmvs == "320921" {
|
343
|
|
- DllDef := syscall.MustLoadDLL("HeaSecReadInfo.dll")
|
344
|
|
- Iinit := DllDef.MustFindProc("Init")
|
345
|
|
- fmt.Println(Iinit)
|
346
|
|
- var res ResultTwo
|
347
|
|
- api := "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.ChannelNumber
|
|
344
|
+
|
|
345
|
+ api := "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.ChannelNumber + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
|
|
346
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url
|
348
|
347
|
|
349
|
348
|
resp, requestErr := http.Get(api)
|
350
|
349
|
if requestErr != nil {
|
|
@@ -364,57 +363,87 @@ func (c *HisApiController) ReadCard() {
|
364
|
363
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
365
|
364
|
return
|
366
|
365
|
}
|
367
|
|
-
|
368
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
366
|
+ var status string
|
|
367
|
+ respJSON = respJSON["data"].(map[string]interface{})["status"].(map[string]interface{})
|
369
|
368
|
result, _ := json.Marshal(respJSON)
|
370
|
|
- fmt.Println("log")
|
371
|
|
- fmt.Println(string(result))
|
372
|
|
-
|
373
|
|
- if err := json.Unmarshal([]byte(result), &res); err != nil {
|
|
369
|
+ if err := json.Unmarshal([]byte(result), &status); err != nil {
|
374
|
370
|
utils.ErrorLog("解析失败:%v", err)
|
375
|
371
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
376
|
372
|
return
|
377
|
373
|
}
|
|
374
|
+ if status == "0" { //读卡成功
|
|
375
|
+ var card_info string //卡信息
|
|
376
|
+ var busi_card_info string
|
|
377
|
+ var res ResultTwo //1101结果
|
378
|
378
|
|
379
|
|
- if res.Infcode == 0 {
|
380
|
|
- patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
381
|
|
- if err == gorm.ErrRecordNotFound {
|
382
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
379
|
+ respJSON = respJSON["data"].(map[string]interface{})["card_info"].(map[string]interface{})
|
|
380
|
+ card_info_result, _ := json.Marshal(respJSON)
|
|
381
|
+
|
|
382
|
+ respJSON = respJSON["data"].(map[string]interface{})["busi_card_info"].(map[string]interface{})
|
|
383
|
+ busi_card_info_result, _ := json.Marshal(respJSON)
|
|
384
|
+
|
|
385
|
+ respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
|
|
386
|
+ result, _ := json.Marshal(respJSON)
|
|
387
|
+
|
|
388
|
+ if err := json.Unmarshal([]byte(result), &res); err != nil {
|
|
389
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
390
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
383
|
391
|
return
|
384
|
|
- } else if err != nil {
|
385
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
392
|
+ }
|
|
393
|
+ if err := json.Unmarshal([]byte(card_info_result), &card_info); err != nil {
|
|
394
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
395
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
386
|
396
|
return
|
|
397
|
+ }
|
|
398
|
+ if err := json.Unmarshal([]byte(busi_card_info_result), &busi_card_info); err != nil {
|
|
399
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
400
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
401
|
+ return
|
|
402
|
+ }
|
387
|
403
|
|
388
|
|
- } else {
|
|
404
|
+ if res.Infcode == 0 {
|
|
405
|
+ patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
|
406
|
+ if err == gorm.ErrRecordNotFound {
|
|
407
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
408
|
+ return
|
|
409
|
+ } else if err != nil {
|
|
410
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
411
|
+ return
|
389
|
412
|
|
390
|
|
- Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
391
|
|
- Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
392
|
|
- infoStr := string(Iinfos)
|
393
|
|
- idetinfoStr := string(Idetinfos)
|
394
|
|
- psn := &models.HisPsn{
|
395
|
|
- PsnNo: res.Output.Baseinfo.PsnNo,
|
396
|
|
- Age: res.Output.Baseinfo.Age,
|
397
|
|
- PatientId: patient.ID,
|
398
|
|
- Certno: res.Output.Baseinfo.Certno,
|
399
|
|
- Brdy: res.Output.Baseinfo.Brdy,
|
400
|
|
- Gend: res.Output.Baseinfo.Gend,
|
401
|
|
- Naty: res.Output.Baseinfo.Naty,
|
402
|
|
- PsnCertType: res.Output.Baseinfo.PsnCertType,
|
403
|
|
- PsnName: res.Output.Baseinfo.PsnName,
|
404
|
|
- Idetinfo: idetinfoStr,
|
405
|
|
- Insuinfo: infoStr,
|
406
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
407
|
|
- }
|
408
|
|
- service.CreateHisPsn(psn)
|
|
413
|
+ } else {
|
409
|
414
|
|
410
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
411
|
|
- "patient": patient,
|
412
|
|
- "number": res.Output.Baseinfo.Certno,
|
413
|
|
- })
|
|
415
|
+ Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
|
416
|
+ Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
|
417
|
+ infoStr := string(Iinfos)
|
|
418
|
+ idetinfoStr := string(Idetinfos)
|
|
419
|
+ psn := &models.HisPsn{
|
|
420
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
421
|
+ Age: res.Output.Baseinfo.Age,
|
|
422
|
+ PatientId: patient.ID,
|
|
423
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
424
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
425
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
426
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
427
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
428
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
429
|
+ Idetinfo: idetinfoStr,
|
|
430
|
+ Insuinfo: infoStr,
|
|
431
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
432
|
+ }
|
|
433
|
+ service.CreateHisPsn(psn)
|
|
434
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
435
|
+ "patient": patient,
|
|
436
|
+ "number": res.Output.Baseinfo.Certno,
|
|
437
|
+ })
|
|
438
|
+ }
|
|
439
|
+ } else {
|
|
440
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
441
|
+ return
|
414
|
442
|
}
|
415
|
|
- } else {
|
|
443
|
+ } else { //读卡失败
|
416
|
444
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
417
|
445
|
return
|
|
446
|
+
|
418
|
447
|
}
|
419
|
448
|
|
420
|
449
|
} else {
|