|
@@ -1470,9 +1470,12 @@ func MobileGetDialysisGoods(orgID int64, scheduleDate int64, schedule_type int64
|
1470
|
1470
|
}
|
1471
|
1471
|
|
1472
|
1472
|
func GetLastDialysisGoods(patient_id int64, orgID int64, record_time int64) (goodUser []*AutomaticReduceDetail, err error) {
|
|
1473
|
+
|
1473
|
1474
|
var Id []*DialysisGoodsDetailDate
|
|
1475
|
+
|
1474
|
1476
|
err = readDb.Model(&AutomaticReduceDetail{}).Where("patient_id = ? AND org_id = ? AND status=1 AND record_time < ? AND count > 0", patient_id, orgID, record_time).Select("record_time").Group("record_time").Order("record_time asc").Scan(&Id).Error
|
1475
|
1477
|
if len(Id) > 0 {
|
|
1478
|
+
|
1476
|
1479
|
err = readDb.Model(&AutomaticReduceDetail{}).Where("patient_id = ? AND org_id = ? AND status=1 AND record_time = ? AND count > 0", patient_id, orgID, Id[len(Id)-1].RecordTime).Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0) ", orgID).Find(&goodUser).Error
|
1477
|
1480
|
}
|
1478
|
1481
|
return
|
|
@@ -1543,3 +1546,24 @@ func PCGetDialysisGoods(orgID int64, scheduleDate int64, schedule_type int64, pa
|
1543
|
1546
|
|
1544
|
1547
|
return vms, err, total
|
1545
|
1548
|
}
|
|
1549
|
+
|
|
1550
|
+func GetLastDialysisGoodsTwo(patient_id int64, orgID int64, record_time int64) (goodUser []*AutomaticReduceDetail, err error) {
|
|
1551
|
+
|
|
1552
|
+ var Id []*DialysisGoodsDetailDate
|
|
1553
|
+
|
|
1554
|
+ err = readDb.Model(&AutomaticReduceDetail{}).Where("patient_id = ? AND org_id = ? AND status=1 AND record_time = ? AND count > 0", patient_id, orgID, record_time).Select("record_time").Group("record_time").Order("record_time asc").Scan(&Id).Error
|
|
1555
|
+ if len(Id) > 0 {
|
|
1556
|
+
|
|
1557
|
+ err = readDb.Model(&AutomaticReduceDetail{}).Where("patient_id = ? AND org_id = ? AND status=1 AND record_time = ? AND count > 0", patient_id, orgID, Id[len(Id)-1].RecordTime).Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0) ", orgID).Find(&goodUser).Error
|
|
1558
|
+ }
|
|
1559
|
+ return
|
|
1560
|
+}
|
|
1561
|
+
|
|
1562
|
+func GetLastDialysisBeforePrepareTwo(patient_id int64, orgID int64, record_time int64) (goodUser []*DialysisBeforePrepare, err error) {
|
|
1563
|
+ var Id []*DialysisGoodsDate
|
|
1564
|
+ err = readDb.Model(&models.DialysisBeforePrepare{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? AND count > 0", patient_id, orgID, record_time).Select("record_date").Group("record_date").Order("record_date asc").Scan(&Id).Error
|
|
1565
|
+ if len(Id) > 0 {
|
|
1566
|
+ err = readDb.Model(&models.DialysisBeforePrepare{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ? AND count > 0", patient_id, orgID, Id[len(Id)-1].RecordDate).Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0) ", orgID).Find(&goodUser).Error
|
|
1567
|
+ }
|
|
1568
|
+ return
|
|
1569
|
+}
|