|
@@ -1303,21 +1303,21 @@ func (MScheduleDoctorAdviceVM) TableName() string {
|
1303
|
1303
|
}
|
1304
|
1304
|
|
1305
|
1305
|
type MScheduleDoctorAdviceVMOne struct {
|
1306
|
|
- ID int64 `gorm:"column:id" json:"id"`
|
1307
|
|
- UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id"`
|
1308
|
|
- PartitionId int64 `gorm:"column:partition_id" json:"partition_id"`
|
1309
|
|
- BedId int64 `gorm:"column:bed_id" json:"bed_id"`
|
1310
|
|
- PatientId int64 `gorm:"column:patient_id" json:"patient_id"`
|
1311
|
|
- ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date"`
|
1312
|
|
- ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
|
1313
|
|
- ModeId int64 `gorm:"column:mode_id" json:"mode_id"`
|
1314
|
|
- Status int64 `gorm:"column:status" json:"status"`
|
1315
|
|
- DialysisOrder *MDialysisOrderVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
|
1316
|
|
- SchedualPatient *MSchedualPatientVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
|
1317
|
|
- DeviceNumber *MDeviceNumberVM `gorm:"ForeignKey:BedId" json:"device_number"`
|
1318
|
|
- DoctorAdvices []*MDoctorAdviceVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
|
1319
|
|
- Prescription *models.DialysisPrescriptionTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
|
1320
|
|
- //DialysisAssesmentBefor *models.DialysisAssesmentBefor `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
|
|
1306
|
+ ID int64 `gorm:"column:id" json:"id"`
|
|
1307
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id"`
|
|
1308
|
+ PartitionId int64 `gorm:"column:partition_id" json:"partition_id"`
|
|
1309
|
+ BedId int64 `gorm:"column:bed_id" json:"bed_id"`
|
|
1310
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id"`
|
|
1311
|
+ ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date"`
|
|
1312
|
+ ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
|
|
1313
|
+ ModeId int64 `gorm:"column:mode_id" json:"mode_id"`
|
|
1314
|
+ Status int64 `gorm:"column:status" json:"status"`
|
|
1315
|
+ DialysisOrder *MDialysisOrderVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
|
|
1316
|
+ SchedualPatient *MSchedualPatientVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
|
|
1317
|
+ DeviceNumber *MDeviceNumberVM `gorm:"ForeignKey:BedId" json:"device_number"`
|
|
1318
|
+ DoctorAdvices []*MDoctorAdviceVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
|
|
1319
|
+ Prescription *models.DialysisPrescriptionTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
|
|
1320
|
+ DialysisAssesmentBefor *models.DialysisAssesmentBefor `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
|
1321
|
1321
|
}
|
1322
|
1322
|
|
1323
|
1323
|
func (MScheduleDoctorAdviceVMOne) TableName() string {
|
|
@@ -1487,6 +1487,12 @@ func MobileGetScheduleDoctorAdvicesTwo(orgID int64, scheduleDate int64, adviceTy
|
1487
|
1487
|
} else if patientType == 2 {
|
1488
|
1488
|
adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND execution_staff = 0 AND(advice_type = 3 OR advice_type = 1)"
|
1489
|
1489
|
adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1490
|
+ } else if patientType == 3 {
|
|
1491
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND execution_staff = 0 AND(advice_type = 3 OR advice_type = 1) and is_settle = 1"
|
|
1492
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1493
|
+ } else if patientType == 4 {
|
|
1494
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND execution_staff = 0 AND(advice_type = 3 OR advice_type = 1) and (is_settle = 0 or is_settle = 2)"
|
|
1495
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
1490
|
1496
|
}
|
1491
|
1497
|
|
1492
|
1498
|
} else if adviceType == 1 {
|
|
@@ -1502,6 +1508,12 @@ func MobileGetScheduleDoctorAdvicesTwo(orgID int64, scheduleDate int64, adviceTy
|
1502
|
1508
|
adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND record_date = ? AND execution_staff = 0"
|
1503
|
1509
|
adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
1504
|
1510
|
|
|
1511
|
+ } else if patientType == 3 {
|
|
1512
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND record_date = ? and is_settle = 1"
|
|
1513
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1514
|
+ } else if patientType == 4 {
|
|
1515
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND record_date = ? and (is_settle = 0 or is_settle = 2)"
|
|
1516
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
1505
|
1517
|
}
|
1506
|
1518
|
|
1507
|
1519
|
} else if adviceType == 3 {
|
|
@@ -1515,6 +1527,12 @@ func MobileGetScheduleDoctorAdvicesTwo(orgID int64, scheduleDate int64, adviceTy
|
1515
|
1527
|
} else if patientType == 2 {
|
1516
|
1528
|
adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 3 AND execution_staff = 0"
|
1517
|
1529
|
adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1530
|
+ } else if patientType == 3 {
|
|
1531
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 3 and is_settle = 1"
|
|
1532
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1533
|
+ } else if patientType == 4 {
|
|
1534
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 3 and (is_settle = 0 or is_settle = 2)"
|
|
1535
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
1518
|
1536
|
}
|
1519
|
1537
|
|
1520
|
1538
|
} else if adviceType == 2 && len(deliverWay) > 0 {
|
|
@@ -1528,6 +1546,12 @@ func MobileGetScheduleDoctorAdvicesTwo(orgID int64, scheduleDate int64, adviceTy
|
1528
|
1546
|
} else if patientType == 2 {
|
1529
|
1547
|
adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND execution_staff = 0 and delivery_way = ?"
|
1530
|
1548
|
adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, deliverWay)
|
|
1549
|
+ } else if patientType == 3 {
|
|
1550
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 and delivery_way = ? and is_settle = 1"
|
|
1551
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, deliverWay)
|
|
1552
|
+ } else if patientType == 4 {
|
|
1553
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 and delivery_way = ? and (is_settle = 0 or is_settle =2)"
|
|
1554
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, deliverWay)
|
1531
|
1555
|
}
|
1532
|
1556
|
|
1533
|
1557
|
} else if adviceType == 2 && len(deliverWay) <= 0 {
|
|
@@ -1542,6 +1566,12 @@ func MobileGetScheduleDoctorAdvicesTwo(orgID int64, scheduleDate int64, adviceTy
|
1542
|
1566
|
} else if patientType == 2 {
|
1543
|
1567
|
adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND execution_staff = 0"
|
1544
|
1568
|
adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1569
|
+ } else if patientType == 3 {
|
|
1570
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 and is_settle = 1"
|
|
1571
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
|
1572
|
+ } else if patientType == 4 {
|
|
1573
|
+ adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 and (is_settle = 0 or is_settle = 2)"
|
|
1574
|
+ adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
|
1545
|
1575
|
}
|
1546
|
1576
|
|
1547
|
1577
|
}
|
|
@@ -1554,7 +1584,7 @@ func MobileGetScheduleDoctorAdvicesTwo(orgID int64, scheduleDate int64, adviceTy
|
1554
|
1584
|
//}).
|
1555
|
1585
|
Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
1556
|
1586
|
Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
1557
|
|
- //Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1587
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
1558
|
1588
|
Preload("DoctorAdvices", adviceCondition...).
|
1559
|
1589
|
Where("status = 1 AND user_org_id = ?", orgID)
|
1560
|
1590
|
if scheduleDate != 0 {
|
|
@@ -1661,6 +1691,7 @@ func GetHisDoctorAdvicesTwo(orgID int64, scheduleDate int64, deliverWay string,
|
1661
|
1691
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
1662
|
1692
|
return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
1663
|
1693
|
}).
|
|
1694
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
1664
|
1695
|
Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
1665
|
1696
|
Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
1666
|
1697
|
Where("status = 1 AND user_org_id = ?", orgID)
|
|
@@ -1670,21 +1701,79 @@ func GetHisDoctorAdvicesTwo(orgID int64, scheduleDate int64, deliverWay string,
|
1670
|
1701
|
err = db.Find(&vms).Error
|
1671
|
1702
|
}
|
1672
|
1703
|
if patientType > 0 {
|
1673
|
|
- db := readDb.
|
1674
|
|
- Table("xt_schedule").
|
1675
|
|
- Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
1676
|
|
- Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
1677
|
|
- Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
|
1678
|
|
- Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
1679
|
|
- Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
1680
|
|
- Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
1681
|
|
- Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
1682
|
|
- return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
1683
|
|
- }).Where("status = 1 AND user_org_id = ?", orgID)
|
1684
|
|
- if scheduleDate != 0 {
|
1685
|
|
- db = db.Where("schedule_date = ?", scheduleDate)
|
|
1704
|
+ if patientType == 1 {
|
|
1705
|
+ db := readDb.
|
|
1706
|
+ Table("xt_schedule").
|
|
1707
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1708
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1709
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
|
|
1710
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1711
|
+ Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1712
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1713
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1714
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1715
|
+ }).Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
|
1716
|
+ Where("status = 1 AND user_org_id = ?", orgID)
|
|
1717
|
+ if scheduleDate != 0 {
|
|
1718
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1719
|
+ }
|
|
1720
|
+ err = db.Find(&vms).Error
|
1686
|
1721
|
}
|
1687
|
|
- err = db.Find(&vms).Error
|
|
1722
|
+
|
|
1723
|
+ if patientType == 2 {
|
|
1724
|
+ db := readDb.
|
|
1725
|
+ Table("xt_schedule").
|
|
1726
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1727
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1728
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and (advice_doctor = ? or execution_staff = ?)", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
|
|
1729
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1730
|
+ Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1731
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1732
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1733
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1734
|
+ }).Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).Where("status = 1 AND user_org_id = ?", orgID)
|
|
1735
|
+ if scheduleDate != 0 {
|
|
1736
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1737
|
+ }
|
|
1738
|
+ err = db.Find(&vms).Error
|
|
1739
|
+ }
|
|
1740
|
+
|
|
1741
|
+ if patientType == 3 {
|
|
1742
|
+ db := readDb.
|
|
1743
|
+ Table("xt_schedule").
|
|
1744
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1745
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1746
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and (advice_doctor = ? or execution_staff = ?) and is_settle = 1", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
|
|
1747
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1748
|
+ Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1749
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1750
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1751
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1752
|
+ }).Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).Where("status = 1 AND user_org_id = ?", orgID)
|
|
1753
|
+ if scheduleDate != 0 {
|
|
1754
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1755
|
+ }
|
|
1756
|
+ err = db.Find(&vms).Error
|
|
1757
|
+ }
|
|
1758
|
+
|
|
1759
|
+ if patientType == 4 {
|
|
1760
|
+ db := readDb.
|
|
1761
|
+ Table("xt_schedule").
|
|
1762
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1763
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1764
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and (advice_doctor = ? or execution_staff = ?) and (is_settle = 0 or is_settle = 2)", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
|
|
1765
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1766
|
+ Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1767
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1768
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1769
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1770
|
+ }).Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).Where("status = 1 AND user_org_id = ?", orgID)
|
|
1771
|
+ if scheduleDate != 0 {
|
|
1772
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1773
|
+ }
|
|
1774
|
+ err = db.Find(&vms).Error
|
|
1775
|
+ }
|
|
1776
|
+
|
1688
|
1777
|
}
|
1689
|
1778
|
|
1690
|
1779
|
} else {
|
|
@@ -1700,6 +1789,7 @@ func GetHisDoctorAdvicesTwo(orgID int64, scheduleDate int64, deliverWay string,
|
1700
|
1789
|
Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
1701
|
1790
|
Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
1702
|
1791
|
Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1792
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
1703
|
1793
|
Where("status = 1 AND user_org_id = ?", orgID)
|
1704
|
1794
|
if scheduleDate != 0 {
|
1705
|
1795
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -1707,21 +1797,81 @@ func GetHisDoctorAdvicesTwo(orgID int64, scheduleDate int64, deliverWay string,
|
1707
|
1797
|
err = db.Find(&vms).Error
|
1708
|
1798
|
}
|
1709
|
1799
|
if patientType > 0 {
|
1710
|
|
- db := readDb.
|
1711
|
|
- Table("xt_schedule").
|
1712
|
|
- Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
1713
|
|
- Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
|
1714
|
|
- Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
1715
|
|
- Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
1716
|
|
- Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
1717
|
|
- return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
1718
|
|
- }).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
1719
|
|
- Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
1720
|
|
- Where("status = 1 AND user_org_id = ?", orgID)
|
1721
|
|
- if scheduleDate != 0 {
|
1722
|
|
- db = db.Where("schedule_date = ?", scheduleDate)
|
|
1800
|
+ if patientType == 1 {
|
|
1801
|
+ db := readDb.
|
|
1802
|
+ Table("xt_schedule").
|
|
1803
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1804
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
|
|
1805
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1806
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1807
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1808
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1809
|
+ }).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1810
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1811
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
|
1812
|
+ Where("status = 1 AND user_org_id = ?", orgID)
|
|
1813
|
+ if scheduleDate != 0 {
|
|
1814
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1815
|
+ }
|
|
1816
|
+ err = db.Find(&vms).Error
|
1723
|
1817
|
}
|
1724
|
|
- err = db.Find(&vms).Error
|
|
1818
|
+ if patientType == 2 {
|
|
1819
|
+ db := readDb.
|
|
1820
|
+ Table("xt_schedule").
|
|
1821
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1822
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
|
|
1823
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1824
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1825
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1826
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1827
|
+ }).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1828
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1829
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
|
1830
|
+ Where("status = 1 AND user_org_id = ?", orgID)
|
|
1831
|
+ if scheduleDate != 0 {
|
|
1832
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1833
|
+ }
|
|
1834
|
+ err = db.Find(&vms).Error
|
|
1835
|
+ }
|
|
1836
|
+
|
|
1837
|
+ if patientType == 3 {
|
|
1838
|
+ db := readDb.
|
|
1839
|
+ Table("xt_schedule").
|
|
1840
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1841
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and (advice_doctor = ? or execution_staff = ?) and is_settle = 1", orgID, scheduleDate, adminUserId, adminUserId).
|
|
1842
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1843
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1844
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1845
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1846
|
+ }).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1847
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1848
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
|
1849
|
+ Where("status = 1 AND user_org_id = ?", orgID)
|
|
1850
|
+ if scheduleDate != 0 {
|
|
1851
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1852
|
+ }
|
|
1853
|
+ err = db.Find(&vms).Error
|
|
1854
|
+ }
|
|
1855
|
+
|
|
1856
|
+ if patientType == 4 {
|
|
1857
|
+ db := readDb.
|
|
1858
|
+ Table("xt_schedule").
|
|
1859
|
+ Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1860
|
+ Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and (advice_doctor = ? or execution_staff = ?) and (is_settle = 0 or is_settle =2) ", orgID, scheduleDate, adminUserId, adminUserId).
|
|
1861
|
+ Preload("HisPrescriptionProject", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
|
1862
|
+ Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
|
|
1863
|
+ Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
|
1864
|
+ return db.Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
|
1865
|
+ }).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
|
1866
|
+ Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
|
1867
|
+ Preload("DialysisAssesmentBefor", "status = 1 AND user_org_id = ? AND assessment_date = ?", orgID, scheduleDate).
|
|
1868
|
+ Where("status = 1 AND user_org_id = ?", orgID)
|
|
1869
|
+ if scheduleDate != 0 {
|
|
1870
|
+ db = db.Where("schedule_date = ?", scheduleDate)
|
|
1871
|
+ }
|
|
1872
|
+ err = db.Find(&vms).Error
|
|
1873
|
+ }
|
|
1874
|
+
|
1725
|
1875
|
}
|
1726
|
1876
|
|
1727
|
1877
|
}
|
|
@@ -1813,7 +1963,6 @@ func GetMobileHisPrescriptionProject(orgID int64, scheduleDate int64, deliverWay
|
1813
|
1963
|
Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
|
1814
|
1964
|
Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
|
1815
|
1965
|
Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
|
1816
|
|
- Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
|
1817
|
1966
|
Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
1818
|
1967
|
return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND team_id = 0", orgID, scheduleDate).Preload("HisProject").Preload("GoodInfo", "status=1")
|
1819
|
1968
|
}).
|
|
@@ -2043,7 +2192,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
|
2043
|
2192
|
func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
|
2044
|
2193
|
tx := writeDb.Begin()
|
2045
|
2194
|
updateTime := time.Now().Unix()
|
2046
|
|
- err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate}).Error
|
|
2195
|
+ err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark}).Error
|
2047
|
2196
|
if err != nil {
|
2048
|
2197
|
tx.Rollback()
|
2049
|
2198
|
return err
|
|
@@ -3021,6 +3170,7 @@ type HisMScheduleDoctorAdviceVM struct {
|
3021
|
3170
|
Prescription *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
|
3022
|
3171
|
HisDoctorAdviceInfo []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
|
3023
|
3172
|
HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"project"`
|
|
3173
|
+ DialysisAssesmentBefor *models.DialysisAssesmentBefor `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
|
3024
|
3174
|
}
|
3025
|
3175
|
|
3026
|
3176
|
func (HisMScheduleDoctorAdviceVM) TableName() string {
|
|
@@ -3043,6 +3193,7 @@ type HisMScheduleDoctorAdviceVMOne struct {
|
3043
|
3193
|
Prescription *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
|
3044
|
3194
|
HisDoctorAdviceInfo []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
|
3045
|
3195
|
HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"project"`
|
|
3196
|
+ DialysisAssesmentBefor *models.DialysisAssesmentBefor `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
|
3046
|
3197
|
}
|
3047
|
3198
|
|
3048
|
3199
|
func (HisMScheduleDoctorAdviceVMOne) TableName() string {
|
|
@@ -3544,7 +3695,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3544
|
3695
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and patient_id = ? and is_settle", orgID, scheduleDate, deliverWay, patient_id, cost_type).
|
3545
|
3696
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3546
|
3697
|
return db.Where("status = 1 AND user_org_id = ? and patient_id = ?", orgID, patient_id).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3547
|
|
- }).
|
|
3698
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3548
|
3699
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3549
|
3700
|
if scheduleDate != 0 {
|
3550
|
3701
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3558,7 +3709,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3558
|
3709
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and patient_id = ?", orgID, scheduleDate, deliverWay, patient_id).
|
3559
|
3710
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3560
|
3711
|
return db.Where("status = 1 AND user_org_id = ? and patient_id = ?", orgID, patient_id).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3561
|
|
- }).
|
|
3712
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3562
|
3713
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3563
|
3714
|
if scheduleDate != 0 {
|
3564
|
3715
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3578,7 +3729,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3578
|
3729
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and execution_state = ? and is_settle = ?", orgID, scheduleDate, deliverWay, execution_state, cost_type).
|
3579
|
3730
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3580
|
3731
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3581
|
|
- }).
|
|
3732
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3582
|
3733
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3583
|
3734
|
if scheduleDate != 0 {
|
3584
|
3735
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3592,7 +3743,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3592
|
3743
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and execution_state = ?", orgID, scheduleDate, deliverWay, execution_state).
|
3593
|
3744
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3594
|
3745
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3595
|
|
- }).
|
|
3746
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3596
|
3747
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3597
|
3748
|
if scheduleDate != 0 {
|
3598
|
3749
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3609,7 +3760,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3609
|
3760
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and is_settle = ?", orgID, scheduleDate, deliverWay, cost_type).
|
3610
|
3761
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3611
|
3762
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3612
|
|
- }).
|
|
3763
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3613
|
3764
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3614
|
3765
|
if scheduleDate != 0 {
|
3615
|
3766
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3623,7 +3774,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3623
|
3774
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ?", orgID, scheduleDate, deliverWay).
|
3624
|
3775
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3625
|
3776
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3626
|
|
- }).
|
|
3777
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3627
|
3778
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3628
|
3779
|
if scheduleDate != 0 {
|
3629
|
3780
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3653,7 +3804,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3653
|
3804
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and patient_id = ? and execution_state = ? and is_settle = ?", orgID, scheduleDate, patient_id, execution_state, cost_type).
|
3654
|
3805
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3655
|
3806
|
return db.Where("status = 1 AND user_org_id = ? and patient_id = ?", orgID, patient_id).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3656
|
|
- }).
|
|
3807
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3657
|
3808
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3658
|
3809
|
if scheduleDate != 0 {
|
3659
|
3810
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3667,7 +3818,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3667
|
3818
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and patient_id = ? and execution_state = ?", orgID, scheduleDate, patient_id, execution_state).
|
3668
|
3819
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3669
|
3820
|
return db.Where("status = 1 AND user_org_id = ? and patient_id = ?", orgID, patient_id).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3670
|
|
- }).
|
|
3821
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3671
|
3822
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3672
|
3823
|
if scheduleDate != 0 {
|
3673
|
3824
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3684,7 +3835,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3684
|
3835
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and patient_id = ? and is_settle = ?", orgID, scheduleDate, patient_id, cost_type).
|
3685
|
3836
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3686
|
3837
|
return db.Where("status = 1 AND user_org_id = ? and patient_id = ?", orgID, patient_id).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3687
|
|
- }).
|
|
3838
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3688
|
3839
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3689
|
3840
|
if scheduleDate != 0 {
|
3690
|
3841
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3698,7 +3849,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3698
|
3849
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and patient_id = ?", orgID, scheduleDate, patient_id).
|
3699
|
3850
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3700
|
3851
|
return db.Where("status = 1 AND user_org_id = ? and patient_id = ?", orgID, patient_id).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3701
|
|
- }).
|
|
3852
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3702
|
3853
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3703
|
3854
|
if scheduleDate != 0 {
|
3704
|
3855
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3718,7 +3869,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3718
|
3869
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and execution_state = ? and is_settle = ?", orgID, scheduleDate, execution_state, cost_type).
|
3719
|
3870
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3720
|
3871
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3721
|
|
- }).
|
|
3872
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3722
|
3873
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3723
|
3874
|
if scheduleDate != 0 {
|
3724
|
3875
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3732,7 +3883,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3732
|
3883
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and execution_state = ?", orgID, scheduleDate, execution_state).
|
3733
|
3884
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3734
|
3885
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3735
|
|
- }).
|
|
3886
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3736
|
3887
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3737
|
3888
|
if scheduleDate != 0 {
|
3738
|
3889
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3749,7 +3900,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3749
|
3900
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and is_settle = ?", orgID, scheduleDate, cost_type).
|
3750
|
3901
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3751
|
3902
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3752
|
|
- }).
|
|
3903
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3753
|
3904
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3754
|
3905
|
if scheduleDate != 0 {
|
3755
|
3906
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -3763,7 +3914,7 @@ func GetHisDoctorAdvicesOne(orgID int64, scheduleDate int64, deliverWay string,
|
3763
|
3914
|
Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).
|
3764
|
3915
|
Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
|
3765
|
3916
|
return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
|
3766
|
|
- }).
|
|
3917
|
+ }).Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
|
3767
|
3918
|
Where("status = 1 AND user_org_id = ?", orgID)
|
3768
|
3919
|
if scheduleDate != 0 {
|
3769
|
3920
|
db = db.Where("schedule_date = ?", scheduleDate)
|
|
@@ -5018,3 +5169,19 @@ func MobileGetScheduleDoctorAdvicesOne(orgID int64, scheduleDate int64, adviceTy
|
5018
|
5169
|
err := db.Find(&vms).Error
|
5019
|
5170
|
return vms, err
|
5020
|
5171
|
}
|
|
5172
|
+
|
|
5173
|
+func GetLastPatientOrder(id int64) (models.XtDialysisOrder, error) {
|
|
5174
|
+
|
|
5175
|
+ order := models.XtDialysisOrder{}
|
|
5176
|
+ err := XTReadDB().Where("id = ? and status = 1", id).Find(&order).Error
|
|
5177
|
+ return order, err
|
|
5178
|
+}
|
|
5179
|
+
|
|
5180
|
+func UpdateMobilePatient(org_id int64, patient_id int64, schedule_remark string) error {
|
|
5181
|
+
|
|
5182
|
+ order := models.XtPatients{}
|
|
5183
|
+ err := XTWriteDB().Model(&order).Where("user_org_id = ? and id = ? and status = 1", org_id, patient_id).Updates(map[string]interface{}{"schedule_remark": schedule_remark}).Error
|
|
5184
|
+
|
|
5185
|
+ err = XTWriteDB().Model(models.XtPatientsNew{}).Where("user_org_id = ? and id = ? and status = 1", org_id, patient_id).Updates(map[string]interface{}{"schedule_remark": schedule_remark}).Error
|
|
5186
|
+ return err
|
|
5187
|
+}
|