|
@@ -643,14 +643,14 @@ func GetPrescriptionByAnticoagulant(page int64, limit int64, orgid int64, antico
|
643
|
643
|
|
644
|
644
|
func GetPrescriptionByDialyzer(page int64, limit int64, orgid int64, dialyzer string, start_time int64, end_time int64) (solution []*models.DialysisPrescription, total int64, err error) {
|
645
|
645
|
|
646
|
|
- db := XTReadDB().Model(&models.DialysisPrescription{}).Where("status = 1")
|
|
646
|
+ db := XTReadDB().Model(&models.DialysisPrescription{}).Preload("QCPatients", "status = 1 and user_org_id = ?", orgid).Where("status = 1")
|
647
|
647
|
if len(dialyzer) > 0 {
|
648
|
648
|
db = db.Where("dialysis_dialyszers = ?", dialyzer)
|
649
|
649
|
}
|
650
|
650
|
if orgid > 0 {
|
651
|
651
|
db = db.Where("user_org_id = ?", orgid)
|
652
|
652
|
}
|
653
|
|
- db = db.Where("record_date >= ? and record_date <= ?", start_time, end_time)
|
|
653
|
+ db = db.Where("record_date >= ? and record_date <= ? and status = 1", start_time, end_time)
|
654
|
654
|
|
655
|
655
|
offset := (page - 1) * limit
|
656
|
656
|
|
|
@@ -736,7 +736,8 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
|
736
|
736
|
CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
|
737
|
737
|
ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
|
738
|
738
|
p.prescription_doctor as doctor,
|
739
|
|
- o.finish_nurse as nurse
|
|
739
|
+ o.finish_nurse as nurse,
|
|
740
|
+ pp.id_card_no as id_card_no
|
740
|
741
|
FROM
|
741
|
742
|
xt_dialysis_order o
|
742
|
743
|
JOIN
|
|
@@ -765,7 +766,9 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
|
765
|
766
|
CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
|
766
|
767
|
ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
|
767
|
768
|
p.prescription_doctor as doctor,
|
768
|
|
- o.finish_nurse as nurse
|
|
769
|
+ o.finish_nurse as nurse,
|
|
770
|
+ pp.id_card_no as id_card_no
|
|
771
|
+
|
769
|
772
|
FROM
|
770
|
773
|
xt_dialysis_order o
|
771
|
774
|
JOIN
|
|
@@ -793,7 +796,8 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
|
793
|
796
|
CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
|
794
|
797
|
ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
|
795
|
798
|
p.prescription_doctor as doctor,
|
796
|
|
- o.finish_nurse as nurse
|
|
799
|
+ o.finish_nurse as nurse,
|
|
800
|
+ pp.id_card_no as id_card_no
|
797
|
801
|
FROM
|
798
|
802
|
xt_dialysis_order o
|
799
|
803
|
JOIN
|
|
@@ -821,7 +825,8 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
|
821
|
825
|
CONCAT(a.actual_treatment_hour, 'h', a.actual_treatment_minute,'min') as actual_duration,
|
822
|
826
|
ABS(TIMESTAMPDIFF(MINUTE, MAKETIME(p.dialysis_duration_hour, p.dialysis_duration_minute, 0), MAKETIME(a.actual_treatment_hour, a.actual_treatment_minute, 0))) as diff,
|
823
|
827
|
p.prescription_doctor as doctor,
|
824
|
|
- o.finish_nurse as nurse
|
|
828
|
+ o.finish_nurse as nurse,
|
|
829
|
+ pp.id_card_no as id_card_no
|
825
|
830
|
FROM
|
826
|
831
|
xt_dialysis_order o
|
827
|
832
|
JOIN
|
|
@@ -859,6 +864,7 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
|
859
|
864
|
"diff": 0,
|
860
|
865
|
"doctor": "",
|
861
|
866
|
"nurse": "",
|
|
867
|
+ "id_card_no": "",
|
862
|
868
|
}
|
863
|
869
|
|
864
|
870
|
// Create the dynamic struct type
|
|
@@ -882,6 +888,7 @@ func GetDialysisCompletionDetail(org_id int64, start_time int64, end_time int64,
|
882
|
888
|
reflect.ValueOf(result).Elem().FieldByName("Diff").Addr().Interface(),
|
883
|
889
|
reflect.ValueOf(result).Elem().FieldByName("Doctor").Addr().Interface(),
|
884
|
890
|
reflect.ValueOf(result).Elem().FieldByName("Nurse").Addr().Interface(),
|
|
891
|
+ reflect.ValueOf(result).Elem().FieldByName("Id_card_no").Addr().Interface(),
|
885
|
892
|
}
|
886
|
893
|
|
887
|
894
|
// Scan the row into the struct
|