|
@@ -4560,20 +4560,31 @@ func GetAutoDialysisPrescription(patient_id int64, start_time int64, end_time in
|
4560
|
4560
|
return prescription, err
|
4561
|
4561
|
}
|
4562
|
4562
|
|
4563
|
|
-func GetAutoMaxDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.DialysisPrescription, error) {
|
|
4563
|
+func GetDialysisPrescriptionGroup(patient_id int64, start_time int64, end_time int64, org_id int64) (list []*models.XtDialysisPrescriptionList, err error) {
|
4564
|
4564
|
|
4565
|
|
- prescription := models.DialysisPrescription{}
|
4566
|
|
- err := XTReadDB().Raw("select MAX(anticoagulant_zongliang) from xt_dialysis_prescripiton where patient_id = ? and record_date>=? and record_date<=? and org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
|
|
4565
|
+ err = XTReadDB().Where("patient_id = ? and record_date >=? and record_date <=? and user_org_id = ? and status=1", patient_id, start_time, end_time, org_id).Group("anticoagulant").Find(&list).Error
|
|
4566
|
+
|
|
4567
|
+ return list, err
|
|
4568
|
+}
|
|
4569
|
+
|
|
4570
|
+func GetDialysisPrescriptionMaxAnticoagulant() {
|
|
4571
|
+
|
|
4572
|
+}
|
|
4573
|
+
|
|
4574
|
+func GetAutoMaxDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtDialysisPrescriptionListOne, error) {
|
|
4575
|
+
|
|
4576
|
+ prescription := models.XtDialysisPrescriptionListOne{}
|
|
4577
|
+ err := XTReadDB().Raw("select MAX(anticoagulant_zongliang) as anticoagulant_zongliang from xt_dialysis_prescription where patient_id = ? and record_date>=? and record_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
|
4567
|
4578
|
return prescription, err
|
4568
|
4579
|
}
|
4569
|
4580
|
|
4570
|
|
-func GetAutoMinDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.DialysisPrescription, error) {
|
4571
|
|
- prescription := models.DialysisPrescription{}
|
4572
|
|
- err := XTReadDB().Raw("select Min(anticoagulant_zongliang) from xt_dialysis_prescripiton where patient_id = ? and record_date>=? and record_date<=? and org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
|
|
4581
|
+func GetAutoMinDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtDialysisPrescriptionListOne, error) {
|
|
4582
|
+ prescription := models.XtDialysisPrescriptionListOne{}
|
|
4583
|
+ err := XTReadDB().Raw("select Min(anticoagulant_zongliang) as anticoagulant_zongliang from xt_dialysis_prescription where patient_id = ? and record_date>=? and record_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
|
4573
|
4584
|
return prescription, err
|
4574
|
4585
|
}
|
4575
|
4586
|
|
4576
|
|
-func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.XtAssessmentBeforeDislysis, err error) {
|
|
4587
|
+func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.BtAssessmentBeforeDislysis, err error) {
|
4577
|
4588
|
|
4578
|
4589
|
db := XTReadDB().Model(&berfor).Where("status=1")
|
4579
|
4590
|
|
|
@@ -4595,6 +4606,37 @@ func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64,
|
4595
|
4606
|
return berfor, err
|
4596
|
4607
|
}
|
4597
|
4608
|
|
|
4609
|
+func GetAutoAfterWeight(patient_id int64, start_time int64, end_time int64, org_id int64) (after []*models.XtAssessmentAfterDislysis, err error) {
|
|
4610
|
+
|
|
4611
|
+ db := XTReadDB().Model(&after).Where("status=1")
|
|
4612
|
+
|
|
4613
|
+ if patient_id > 0 {
|
|
4614
|
+ db = db.Where("patient_id = ?", patient_id)
|
|
4615
|
+ }
|
|
4616
|
+
|
|
4617
|
+ if start_time > 0 {
|
|
4618
|
+ db = db.Where("assessment_date>=?", start_time)
|
|
4619
|
+ }
|
|
4620
|
+
|
|
4621
|
+ if end_time > 0 {
|
|
4622
|
+ db = db.Where("assessment_date<=?", end_time)
|
|
4623
|
+ }
|
|
4624
|
+ if org_id > 0 {
|
|
4625
|
+ db = db.Where("user_org_id = ?", org_id)
|
|
4626
|
+ }
|
|
4627
|
+ err = db.Find(&after).Error
|
|
4628
|
+ return after, err
|
|
4629
|
+}
|
|
4630
|
+
|
|
4631
|
+func GetLastAfterWeight(patient_id int64, assessment_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {
|
|
4632
|
+
|
|
4633
|
+ afterDislysis := models.XtAssessmentAfterDislysis{}
|
|
4634
|
+
|
|
4635
|
+ err := XTReadDB().Where("patient_id = ? and assessment_date <? and user_org_id =? and status=1", patient_id, assessment_date, user_org_id).Order("assessment_date asc").Last(&afterDislysis).Error
|
|
4636
|
+
|
|
4637
|
+ return afterDislysis, err
|
|
4638
|
+}
|
|
4639
|
+
|
4598
|
4640
|
func GetAutoMonitorList(patient_id int64, start_time int64, end_time int64, org_id int64) (monitor []*models.XTMonitoringRecord, err error) {
|
4599
|
4641
|
|
4600
|
4642
|
db := XTReadDB().Model(&monitor).Where("status=1")
|
|
@@ -4617,6 +4659,13 @@ func GetAutoMonitorList(patient_id int64, start_time int64, end_time int64, org_
|
4617
|
4659
|
return monitor, err
|
4618
|
4660
|
}
|
4619
|
4661
|
|
|
4662
|
+func MaxMonitorByBloodFlow(patient_id int64, start_time int64, end_time int64, org_id int64) (models.MonitoringRecord, error) {
|
|
4663
|
+
|
|
4664
|
+ monitoringRecord := models.MonitoringRecord{}
|
|
4665
|
+ err := XTReadDB().Raw("select MAX(blood_flow_volume) as blood_flow_volume from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitoringRecord).Error
|
|
4666
|
+ return monitoringRecord, err
|
|
4667
|
+}
|
|
4668
|
+
|
4620
|
4669
|
func GetAutoPatientDryWeight(patient_id int64, start_time int64, end_time int64, org_id int64) (dryweight []*models.SgjPatientDryweight, err error) {
|
4621
|
4670
|
|
4622
|
4671
|
db := XTReadDB().Model(&dryweight).Where("status=1")
|
|
@@ -4632,6 +4681,13 @@ func GetAutoPatientDryWeight(patient_id int64, start_time int64, end_time int64,
|
4632
|
4681
|
return dryweight, err
|
4633
|
4682
|
}
|
4634
|
4683
|
|
|
4684
|
+func GetPatientLastDryWeightObj(patient_id int64, start_time int64, end_time int64, org_id int64) (models.SgjPatientDryweight, error) {
|
|
4685
|
+
|
|
4686
|
+ dryweight := models.SgjPatientDryweight{}
|
|
4687
|
+ err := XTReadDB().Where("patient_id =? and user_org_id = ? and status=1", patient_id, org_id).Order("id asc").Last(&dryweight).Error
|
|
4688
|
+ return dryweight, err
|
|
4689
|
+}
|
|
4690
|
+
|
4635
|
4691
|
func GetAutoInspectionList(patient_id int64, start_time int64, end_time int64, org_id int64) (inpection []*models.XtInspection, err error) {
|
4636
|
4692
|
|
4637
|
4693
|
db := XTReadDB().Model(&inpection).Where("status=1")
|
|
@@ -4701,3 +4757,106 @@ func GetAutoDialysisOrder(patient_id int64, start_time int64, end_time int64, us
|
4701
|
4757
|
|
4702
|
4758
|
return order, err
|
4703
|
4759
|
}
|
|
4760
|
+
|
|
4761
|
+func GetMaxAssessmentBforSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
|
|
4762
|
+
|
|
4763
|
+ befor := models.XtAssessmentBeforeDislysis{}
|
|
4764
|
+ err := XTReadDB().Raw("select MAX(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4765
|
+ return befor, err
|
|
4766
|
+}
|
|
4767
|
+
|
|
4768
|
+func GetMminAssessmentBforSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
|
|
4769
|
+
|
|
4770
|
+ befor := models.XtAssessmentBeforeDislysis{}
|
|
4771
|
+ err := XTReadDB().Raw("select Min(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4772
|
+ return befor, err
|
|
4773
|
+}
|
|
4774
|
+
|
|
4775
|
+func GetMaxAssessmentBforDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
|
|
4776
|
+
|
|
4777
|
+ befor := models.XtAssessmentBeforeDislysis{}
|
|
4778
|
+ err := XTReadDB().Raw("select MAX(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4779
|
+ return befor, err
|
|
4780
|
+}
|
|
4781
|
+
|
|
4782
|
+func GetMinAssessmentBforDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
|
|
4783
|
+
|
|
4784
|
+ befor := models.XtAssessmentBeforeDislysis{}
|
|
4785
|
+ err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4786
|
+ return befor, err
|
|
4787
|
+}
|
|
4788
|
+
|
|
4789
|
+func GetMaxAssessmentAfterSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
|
|
4790
|
+
|
|
4791
|
+ befor := models.XtAssessmentAfterDislysis{}
|
|
4792
|
+ err := XTReadDB().Raw("select MAX(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4793
|
+ return befor, err
|
|
4794
|
+}
|
|
4795
|
+
|
|
4796
|
+func GetMinAssessmentAfterSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
|
|
4797
|
+
|
|
4798
|
+ befor := models.XtAssessmentAfterDislysis{}
|
|
4799
|
+ err := XTReadDB().Raw("select Min(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4800
|
+ return befor, err
|
|
4801
|
+}
|
|
4802
|
+
|
|
4803
|
+func GetMaxAssessmentAfterDiastolicBloodPressureList(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
|
|
4804
|
+
|
|
4805
|
+ befor := models.XtAssessmentAfterDislysis{}
|
|
4806
|
+ err := XTReadDB().Raw("select Max(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4807
|
+ return befor, err
|
|
4808
|
+}
|
|
4809
|
+
|
|
4810
|
+func GetMinAssessmentAfterDiastolicBloodPressureList(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
|
|
4811
|
+
|
|
4812
|
+ befor := models.XtAssessmentAfterDislysis{}
|
|
4813
|
+ err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
|
|
4814
|
+ return befor, err
|
|
4815
|
+}
|
|
4816
|
+
|
|
4817
|
+func GetMaxMonitorSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
|
|
4818
|
+
|
|
4819
|
+ monitor := models.XTMonitoringRecord{}
|
|
4820
|
+ err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
|
|
4821
|
+ return monitor, err
|
|
4822
|
+}
|
|
4823
|
+
|
|
4824
|
+func GetMinMonitorSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
|
|
4825
|
+
|
|
4826
|
+ monitor := models.XTMonitoringRecord{}
|
|
4827
|
+ err := XTReadDB().Raw("select Min(systolic_blood_pressure) as systolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
|
|
4828
|
+ return monitor, err
|
|
4829
|
+
|
|
4830
|
+}
|
|
4831
|
+
|
|
4832
|
+func GetMaxMonitorDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
|
|
4833
|
+
|
|
4834
|
+ monitor := models.XTMonitoringRecord{}
|
|
4835
|
+ err := XTReadDB().Raw("select Max(diastolic_blood_pressure) as diastolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
|
|
4836
|
+ return monitor, err
|
|
4837
|
+}
|
|
4838
|
+
|
|
4839
|
+func GetMinMonitorDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
|
|
4840
|
+
|
|
4841
|
+ monitor := models.XTMonitoringRecord{}
|
|
4842
|
+ err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
|
|
4843
|
+ return monitor, err
|
|
4844
|
+}
|
|
4845
|
+
|
|
4846
|
+func GetPatientVascularAccessList(patient_id int64, org_id int64) (models.XtPatientVascularAccess, error) {
|
|
4847
|
+
|
|
4848
|
+ vascularAccess := models.XtPatientVascularAccess{}
|
|
4849
|
+
|
|
4850
|
+ err := XTReadDB().Where("patient_id = ? and user_org_id = ? and status=1", patient_id, org_id).Last(&vascularAccess).Error
|
|
4851
|
+
|
|
4852
|
+ return vascularAccess, err
|
|
4853
|
+}
|
|
4854
|
+
|
|
4855
|
+func GetPatientLastBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
|
|
4856
|
+
|
|
4857
|
+ beforeDislysis := models.XtAssessmentBeforeDislysis{}
|
|
4858
|
+
|
|
4859
|
+ err := XTReadDB().Where("patient_id =? and user_org_id = ? and assessment_date>=? and assessment_date<=? and status=1 and complication!=''", patient_id, org_id, start_time, end_time).Order("id asc").Last(&beforeDislysis).Error
|
|
4860
|
+
|
|
4861
|
+ return beforeDislysis, err
|
|
4862
|
+}
|