|
@@ -1489,45 +1489,110 @@ func SyncInfection(rdb *gorm.DB, org_id int64, hospital_id string) {
|
1489
|
1489
|
}
|
1490
|
1490
|
|
1491
|
1491
|
|
1492
|
|
- patients, _ := service.FindOrgPatientInfectious(org_id, sync_time, time.Now().Unix())
|
|
1492
|
+ patients, _ := service.FindOrgPatientDataOne(org_id)
|
1493
|
1493
|
var infectionList []*sz.TempHdInfection
|
1494
|
1494
|
for _, patient := range patients {
|
1495
|
|
- if len(patient.InfectiousDiseases) > 0 {
|
1496
|
|
- infection := &sz.TempHdInfection{
|
1497
|
|
- Sn : strconv.FormatInt(patient.ID,10),
|
1498
|
|
- HospitalId: hospital_id,
|
1499
|
|
- PatientNk: strconv.FormatInt(patient.ID, 10),
|
1500
|
|
- Hbv: 0,
|
1501
|
|
- Hcv: 0,
|
1502
|
|
- Rpr: 0,
|
1503
|
|
- Hiv: 0,
|
1504
|
|
- Hbsag: 9,
|
1505
|
|
- Hbsab: 9,
|
1506
|
|
- Hbeag: 9,
|
1507
|
|
- Hbeab: 9,
|
1508
|
|
- Hbcab: 9,
|
1509
|
|
- CheckDate: time.Unix(patient.CreatedTime, 0),
|
1510
|
|
- DoctorId: strconv.FormatInt(patient.RegistrarsId,10),
|
1511
|
|
- CreateTime: time.Now(),
|
1512
|
|
- Sjscsj: time.Now(),
|
1513
|
|
- Xgbz: 0,
|
1514
|
|
- }
|
1515
|
|
-
|
1516
|
|
- for _ , infectionDiseases := range patient.InfectiousDiseases{
|
1517
|
|
- if infectionDiseases.DiseaseId == 2 {
|
1518
|
|
- infection.Hbv = 1
|
1519
|
|
- }
|
1520
|
|
- if infectionDiseases.DiseaseId == 3 {
|
1521
|
|
- infection.Hcv = 1
|
1522
|
|
- }
|
1523
|
|
- if infectionDiseases.DiseaseId == 4 {
|
1524
|
|
- infection.Hiv = 1
|
1525
|
|
- }
|
1526
|
|
- if infectionDiseases.DiseaseId == 6 {
|
1527
|
|
- infection.Rpr = 1
|
|
1495
|
+
|
|
1496
|
+ inspections, _ := service.FindOrgInspectionGroupOne(org_id, sync_time, time.Now().Unix(),patient.ID)
|
|
1497
|
+ if len(inspections) > 0 {
|
|
1498
|
+ for _, insp := range inspections {
|
|
1499
|
+ inspection_arr ,_:= service.FindOrgInspectionGroupTwo(org_id,insp.InspectDate,patient.ID)
|
|
1500
|
+ if len(inspection_arr) > 0 {
|
|
1501
|
+ infection := &sz.TempHdInfection{
|
|
1502
|
+ Sn : strconv.FormatInt(patient.ID,10),
|
|
1503
|
+ HospitalId: hospital_id,
|
|
1504
|
+ PatientNk: strconv.FormatInt(patient.ID, 10),
|
|
1505
|
+ Hbv: 0,
|
|
1506
|
+ Hcv: 0,
|
|
1507
|
+ Rpr: 0,
|
|
1508
|
+ Hiv: 0,
|
|
1509
|
+ Hbsag: 9,
|
|
1510
|
+ Hbsab: 9,
|
|
1511
|
+ Hbeag: 9,
|
|
1512
|
+ Hbeab: 9,
|
|
1513
|
+ Hbcab: 9,
|
|
1514
|
+ CheckDate: time.Unix(patient.CreatedTime, 0),
|
|
1515
|
+ DoctorId: strconv.FormatInt(patient.RegistrarsId,10),
|
|
1516
|
+ CreateTime: time.Now(),
|
|
1517
|
+ Sjscsj: time.Now(),
|
|
1518
|
+ Xgbz: 0,
|
|
1519
|
+ }
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+ for _ , infectionDiseases := range inspection_arr{
|
|
1523
|
+ if infectionDiseases.ItemId == 60 {
|
|
1524
|
+ infection.Hcv = 0
|
|
1525
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1526
|
+ infection.Hcv = 1
|
|
1527
|
+ }
|
|
1528
|
+ }
|
|
1529
|
+ if infectionDiseases.ItemId == 62 {
|
|
1530
|
+ infection.Hbsag = 0
|
|
1531
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1532
|
+ infection.Hbsag = 1
|
|
1533
|
+ }
|
|
1534
|
+ }
|
|
1535
|
+
|
|
1536
|
+ if infectionDiseases.ItemId == 63 {
|
|
1537
|
+ infection.Hbsab = 0
|
|
1538
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1539
|
+ infection.Hbsab = 1
|
|
1540
|
+ }
|
|
1541
|
+ }
|
|
1542
|
+
|
|
1543
|
+ if infectionDiseases.ItemId == 64 {
|
|
1544
|
+ infection.Hbeag = 0
|
|
1545
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1546
|
+ infection.Hbeag = 1
|
|
1547
|
+ }
|
|
1548
|
+ }
|
|
1549
|
+
|
|
1550
|
+ if infectionDiseases.ItemId == 65 {
|
|
1551
|
+ infection.Hbeab = 0
|
|
1552
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1553
|
+ infection.Hbeab = 1
|
|
1554
|
+ }
|
|
1555
|
+ }
|
|
1556
|
+
|
|
1557
|
+ if infectionDiseases.ItemId == 66 {
|
|
1558
|
+ infection.Hbcab = 0
|
|
1559
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1560
|
+ infection.Hbcab = 1
|
|
1561
|
+ }
|
|
1562
|
+ }
|
|
1563
|
+
|
|
1564
|
+ if infectionDiseases.ItemId == 111 {
|
|
1565
|
+ infection.Hiv = 0
|
|
1566
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1567
|
+ infection.Hiv = 1
|
|
1568
|
+ }
|
|
1569
|
+ }
|
|
1570
|
+
|
|
1571
|
+ if infectionDiseases.ItemId == 112 {
|
|
1572
|
+ infection.Rpr = 0
|
|
1573
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1574
|
+ infection.Rpr = 1
|
|
1575
|
+ }
|
|
1576
|
+ }
|
|
1577
|
+
|
|
1578
|
+ if infectionDiseases.ItemId == 178 {
|
|
1579
|
+ infection.Hbv = 0
|
|
1580
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1581
|
+ infection.Hbv = 1
|
|
1582
|
+ }
|
|
1583
|
+ }
|
|
1584
|
+
|
|
1585
|
+ if infectionDiseases.ItemId == 179 {
|
|
1586
|
+ infection.Hcv = 0
|
|
1587
|
+ if infectionDiseases.InspectValue == "阳性" {
|
|
1588
|
+ infection.Hcv = 1
|
|
1589
|
+ }
|
|
1590
|
+ }
|
|
1591
|
+
|
|
1592
|
+ }
|
|
1593
|
+ infectionList = append(infectionList,infection)
|
1528
|
1594
|
}
|
1529
|
1595
|
}
|
1530
|
|
- infectionList = append(infectionList,infection)
|
1531
|
1596
|
}
|
1532
|
1597
|
}
|
1533
|
1598
|
|