|
@@ -364,42 +364,26 @@ func (c *HisApiController) ReadCard() {
|
364
|
364
|
return
|
365
|
365
|
}
|
366
|
366
|
var status string
|
367
|
|
- respJSON = respJSON["data"].(map[string]interface{})["status"].(map[string]interface{})
|
368
|
|
- result, _ := json.Marshal(respJSON)
|
369
|
|
- if err := json.Unmarshal([]byte(result), &status); err != nil {
|
370
|
|
- utils.ErrorLog("解析失败:%v", err)
|
371
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
372
|
|
- return
|
373
|
|
- }
|
|
367
|
+ status = respJSON["data"].(map[string]interface{})["status"].(string)
|
|
368
|
+
|
374
|
369
|
if status == "0" { //读卡成功
|
375
|
370
|
var card_info string //卡信息
|
376
|
371
|
var busi_card_info string
|
377
|
372
|
var res ResultTwo //1101结果
|
378
|
373
|
|
379
|
|
- respJSON = respJSON["data"].(map[string]interface{})["card_info"].(map[string]interface{})
|
380
|
|
- card_info_result, _ := json.Marshal(respJSON)
|
|
374
|
+ card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
|
|
375
|
+ busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
|
381
|
376
|
|
382
|
|
- respJSON = respJSON["data"].(map[string]interface{})["busi_card_info"].(map[string]interface{})
|
383
|
|
- busi_card_info_result, _ := json.Marshal(respJSON)
|
|
377
|
+ fmt.Println(card_info)
|
|
378
|
+ fmt.Println(busi_card_info)
|
384
|
379
|
|
385
|
380
|
respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
|
386
|
381
|
result, _ := json.Marshal(respJSON)
|
387
|
|
-
|
388
|
382
|
if err := json.Unmarshal([]byte(result), &res); err != nil {
|
389
|
383
|
utils.ErrorLog("解析失败:%v", err)
|
390
|
384
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
391
|
385
|
return
|
392
|
386
|
}
|
393
|
|
- if err := json.Unmarshal([]byte(card_info_result), &card_info); err != nil {
|
394
|
|
- utils.ErrorLog("解析失败:%v", err)
|
395
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
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
|
|
- }
|
403
|
387
|
|
404
|
388
|
if res.Infcode == 0 {
|
405
|
389
|
patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
|
|
@@ -412,28 +396,33 @@ func (c *HisApiController) ReadCard() {
|
412
|
396
|
|
413
|
397
|
} else {
|
414
|
398
|
|
|
399
|
+ bas := strings.Split(card_info, "|")
|
|
400
|
+ basNumber := bas[2]
|
|
401
|
+
|
415
|
402
|
Iinfos, _ := json.Marshal(res.Output.Iinfo)
|
416
|
403
|
Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
|
417
|
404
|
infoStr := string(Iinfos)
|
418
|
405
|
idetinfoStr := string(Idetinfos)
|
419
|
406
|
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,
|
|
407
|
+ PsnNo: res.Output.Baseinfo.PsnNo,
|
|
408
|
+ Age: res.Output.Baseinfo.Age,
|
|
409
|
+ PatientId: patient.ID,
|
|
410
|
+ Certno: res.Output.Baseinfo.Certno,
|
|
411
|
+ Brdy: res.Output.Baseinfo.Brdy,
|
|
412
|
+ Gend: res.Output.Baseinfo.Gend,
|
|
413
|
+ Naty: res.Output.Baseinfo.Naty,
|
|
414
|
+ PsnCertType: res.Output.Baseinfo.PsnCertType,
|
|
415
|
+ PsnName: res.Output.Baseinfo.PsnName,
|
|
416
|
+ Idetinfo: idetinfoStr,
|
|
417
|
+ Insuinfo: infoStr,
|
|
418
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
419
|
+ CardInfo: card_info,
|
|
420
|
+ VerifyNumber: busi_card_info,
|
432
|
421
|
}
|
433
|
422
|
service.CreateHisPsn(psn)
|
434
|
423
|
c.ServeSuccessJSON(map[string]interface{}{
|
435
|
424
|
"patient": patient,
|
436
|
|
- "number": res.Output.Baseinfo.Certno,
|
|
425
|
+ "number": basNumber,
|
437
|
426
|
})
|
438
|
427
|
}
|
439
|
428
|
} else {
|