|
@@ -10,7 +10,6 @@ import (
|
10
|
10
|
"gdyb/utils"
|
11
|
11
|
"github.com/astaxie/beego"
|
12
|
12
|
"github.com/axgle/mahonia"
|
13
|
|
- "github.com/jinzhu/gorm"
|
14
|
13
|
"io/ioutil"
|
15
|
14
|
"os"
|
16
|
15
|
"regexp"
|
|
@@ -539,59 +538,18 @@ func (c *NmController) ReadCard() {
|
539
|
538
|
infocode, _ := strconv.ParseInt(res2.Infcode, 10, 64)
|
540
|
539
|
|
541
|
540
|
if infocode == 0 {
|
|
541
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
542
|
+ "status": "0",
|
|
543
|
+ "card_info": res.Output.CardInfo,
|
|
544
|
+ "busi_card_info": pBusiCardInfo,
|
|
545
|
+ "result": res2,
|
|
546
|
+ "type": "1",
|
|
547
|
+ })
|
542
|
548
|
|
543
|
|
- var insutypes []string
|
544
|
|
- var insutype string
|
545
|
|
- var is390 int = 0
|
546
|
|
- var is310 int = 0
|
547
|
|
- for _, item := range res2.Output.Iinfo {
|
548
|
|
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
549
|
|
- insutypes = append(insutypes, item.Insutype)
|
550
|
|
- }
|
551
|
|
- }
|
552
|
|
- if len(insutypes) == 1 {
|
553
|
|
- insutype = insutypes[0]
|
554
|
|
- } else {
|
555
|
|
- for _, i := range insutypes {
|
556
|
|
- if i == "390" {
|
557
|
|
- is390 = 1
|
558
|
|
- }
|
559
|
|
-
|
560
|
|
- if i == "310" {
|
561
|
|
- is310 = 1
|
562
|
|
- }
|
563
|
|
- }
|
564
|
|
- }
|
565
|
|
- if is390 == 1 {
|
566
|
|
- insutype = "390"
|
567
|
|
- }
|
568
|
|
- if is310 == 1 {
|
569
|
|
- insutype = "310"
|
570
|
|
- }
|
571
|
|
- if len(insutypes) == 0 {
|
572
|
|
- insutype = "310"
|
573
|
|
- }
|
574
|
|
-
|
575
|
|
- patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
|
576
|
|
- if err == gorm.ErrRecordNotFound {
|
577
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
578
|
|
- return
|
579
|
|
- } else if err != nil {
|
580
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
581
|
|
- return
|
582
|
|
-
|
583
|
|
- } else {
|
584
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
585
|
|
- "patient": patient,
|
586
|
|
- "number": basNumber,
|
587
|
|
- "info": res,
|
588
|
|
- "insutype": insutype,
|
589
|
|
- "card_number": cardNumber,
|
590
|
|
- })
|
591
|
|
- }
|
592
|
549
|
} else {
|
593
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
594
|
|
- return
|
|
550
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
551
|
+ "status": "-1",
|
|
552
|
+ })
|
595
|
553
|
}
|
596
|
554
|
|
597
|
555
|
break
|
|
@@ -624,24 +582,20 @@ func (c *NmController) ReadCard() {
|
624
|
582
|
infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
|
625
|
583
|
|
626
|
584
|
if infocode == 0 {
|
627
|
|
- patient, err := service.GetPatientByNumber(ele.Data.IdNo, c.GetAdminUserInfo().CurrentOrgId)
|
628
|
|
- if err == gorm.ErrRecordNotFound {
|
629
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
630
|
|
- return
|
631
|
|
- } else if err != nil {
|
632
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
633
|
|
- return
|
634
|
|
-
|
635
|
|
- } else {
|
636
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
637
|
|
- "patient": patient,
|
638
|
|
- "number": token,
|
639
|
|
- "info": res,
|
640
|
|
- })
|
641
|
|
- }
|
|
585
|
+
|
|
586
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
587
|
+ "status": "0",
|
|
588
|
+ "card_info": pBusiCardInfo,
|
|
589
|
+ "busi_card_info": pBusiCardInfo,
|
|
590
|
+ "token": token,
|
|
591
|
+ "result": dat,
|
|
592
|
+ })
|
|
593
|
+
|
642
|
594
|
} else {
|
643
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
644
|
|
- return
|
|
595
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
596
|
+ "status": "-1",
|
|
597
|
+ })
|
|
598
|
+
|
645
|
599
|
}
|
646
|
600
|
} else {
|
647
|
601
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|