Bläddra i källkod

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 1 år sedan
förälder
incheckning
db6d5a1a65
1 ändrade filer med 43 tillägg och 2 borttagningar
  1. 43 2
      controllers/sg/his_api_controller.go

+ 43 - 2
controllers/sg/his_api_controller.go Visa fil

@@ -1456,9 +1456,50 @@ func (c *HisApiController) ReadCard() {
1456 1456
 					}
1457 1457
 					service.CreateHisPsn(psn)
1458 1458
 
1459
+					var rf []*ResultFive
1460
+					json.Unmarshal([]byte(infoStr), &rf)
1461
+
1462
+					var insutypes []*ResultFive
1463
+					var insutype string
1464
+					var is390 int = 0
1465
+					var is310 int = 0
1466
+
1467
+					for _, item := range rf {
1468
+						if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
1469
+							insutypes = append(insutypes, item)
1470
+						}
1471
+					}
1472
+
1473
+					if len(insutypes) == 1 {
1474
+						insutype = insutypes[0].Insutype
1475
+						//insuplc_admdvs = insutypes[0].InsuplcAdmdvs
1476
+					} else {
1477
+						for _, i := range insutypes {
1478
+							if i.Insutype == "390" {
1479
+								is390 = 1
1480
+							}
1481
+
1482
+							if i.Insutype == "310" {
1483
+								is310 = 1
1484
+							}
1485
+						}
1486
+					}
1487
+					if is390 == 1 {
1488
+						insutype = "390"
1489
+					}
1490
+
1491
+					if is310 == 1 {
1492
+						insutype = "310"
1493
+					}
1494
+
1495
+					if len(insutypes) == 0 {
1496
+						insutype = "310"
1497
+					}
1498
+
1459 1499
 					c.ServeSuccessJSON(map[string]interface{}{
1460
-						"patient": patient,
1461
-						"number":  cardnum,
1500
+						"patient":  patient,
1501
+						"number":   cardnum,
1502
+						"insutype": insutype,
1462 1503
 					})
1463 1504
 				}
1464 1505
 			} else {