|
|
|
|
12
|
func GetOrgFirstPatientInfo(user_org_id int64) (patient *models.Patients, err error) {
|
12
|
func GetOrgFirstPatientInfo(user_org_id int64) (patient *models.Patients, err error) {
|
13
|
db := service.XTReadDB()
|
13
|
db := service.XTReadDB()
|
14
|
var tempPatient models.Patients
|
14
|
var tempPatient models.Patients
|
15
|
- findErr := db.Model(&models.Patients{}).Where("user_org_id = ? AND status = 1 AND lapseto = 1", user_org_id).First(&tempPatient).Error
|
|
|
|
|
15
|
+ findErr := db.Model(&models.Patients{}).Where("user_org_id = ? AND status = 1 AND lapseto = 1", user_org_id).Last(&tempPatient).Error
|
16
|
if findErr == gorm.ErrRecordNotFound {
|
16
|
if findErr == gorm.ErrRecordNotFound {
|
17
|
return nil, nil
|
17
|
return nil, nil
|
18
|
}
|
18
|
}
|
|
|
|
|
487
|
weightAdd = append(weightAdd, weights[index].WeightBefore-weights[index+1].WeightAfter)
|
487
|
weightAdd = append(weightAdd, weights[index].WeightBefore-weights[index+1].WeightAfter)
|
488
|
}
|
488
|
}
|
489
|
}
|
489
|
}
|
490
|
- fmt.Println(weightAdd)
|
|
|
491
|
|
490
|
|
492
|
var total_one int64
|
491
|
var total_one int64
|
493
|
var total_two int64
|
492
|
var total_two int64
|
|
|
|
|
668
|
if end != 0 {
|
667
|
if end != 0 {
|
669
|
db = db.Where("assessment_date<=?", end)
|
668
|
db = db.Where("assessment_date<=?", end)
|
670
|
}
|
669
|
}
|
671
|
- db = db.Preload("VMAssessmentAfterDislysis", "status = 1").Preload("VMPatients", "status = 1 AND user_org_id = ?", orgID)
|
|
|
|
|
670
|
+ db = db.Preload("VMAssessmentAfterDislysis", "status = 1 AND user_org_id = ?", orgID).Preload("VMPatients", "status = 1 AND user_org_id = ?", orgID)
|
672
|
err = db.Count(&total).Offset(offset).Limit(limit).Order("assessment_date desc").Select("dry_weight, weight_before, patient_id, assessment_date").Find(&orders).Error
|
671
|
err = db.Count(&total).Offset(offset).Limit(limit).Order("assessment_date desc").Select("dry_weight, weight_before, patient_id, assessment_date").Find(&orders).Error
|
673
|
|
672
|
|
674
|
for _, item := range orders {
|
673
|
for _, item := range orders {
|
|
|
|
|
750
|
db := service.XTReadDB()
|
749
|
db := service.XTReadDB()
|
751
|
var items []*otherItemAmount
|
750
|
var items []*otherItemAmount
|
752
|
var tempErr error
|
751
|
var tempErr error
|
753
|
- //var total int64
|
|
|
|
|
752
|
+ var Total int64
|
754
|
switch statistics_type {
|
753
|
switch statistics_type {
|
755
|
case 1:
|
754
|
case 1:
|
756
|
type bp struct {
|
755
|
type bp struct {
|
|
|
|
|
761
|
|
760
|
|
762
|
if patient_id == 0 {
|
761
|
if patient_id == 0 {
|
763
|
db.Raw("SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_before_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? UNION ALL SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_after_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? ", user_org_id, start_time, end_time, user_org_id, start_time, end_time).Scan(&bps)
|
762
|
db.Raw("SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_before_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? UNION ALL SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_after_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? ", user_org_id, start_time, end_time, user_org_id, start_time, end_time).Scan(&bps)
|
|
|
763
|
+ //db.Raw("SELECT count(id) FROM xt_assessment_before_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? UNION ALL SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_after_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? ", user_org_id, start_time, end_time, user_org_id, start_time, end_time).Count(&Total)
|
|
|
764
|
+
|
764
|
} else {
|
765
|
} else {
|
765
|
db.Raw("SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_before_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? AND patient_id = ? UNION ALL SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_after_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? AND patient_id = ? ", user_org_id, start_time, end_time, patient_id, user_org_id, start_time, end_time, patient_id).Scan(&bps)
|
766
|
db.Raw("SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_before_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? AND patient_id = ? UNION ALL SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_after_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? AND patient_id = ? ", user_org_id, start_time, end_time, patient_id, user_org_id, start_time, end_time, patient_id).Scan(&bps)
|
|
|
767
|
+ //db.Raw("SELECT count(id) FROM xt_assessment_before_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? AND patient_id = ? UNION ALL SELECT systolic_blood_pressure,diastolic_blood_pressure FROM xt_assessment_after_dislysis Where user_org_id = ? AND created_time >= ? AND created_time <= ? AND patient_id = ? ", user_org_id, start_time, end_time, patient_id, user_org_id, start_time, end_time, patient_id).Count(&Total)
|
766
|
|
768
|
|
767
|
}
|
769
|
}
|
768
|
|
770
|
|
|
|
|
|
780
|
} else if item.SystolicBloodPressure >= 100 && item.SystolicBloodPressure <= 160 && item.DiastolicBloodPressure >= 99 && item.DiastolicBloodPressure <= 140 {
|
782
|
} else if item.SystolicBloodPressure >= 100 && item.SystolicBloodPressure <= 160 && item.DiastolicBloodPressure >= 99 && item.DiastolicBloodPressure <= 140 {
|
781
|
total_three++
|
783
|
total_three++
|
782
|
} else {
|
784
|
} else {
|
|
|
785
|
+ fmt.Println(item.SystolicBloodPressure)
|
|
|
786
|
+ fmt.Println(item.DiastolicBloodPressure)
|
|
|
787
|
+
|
783
|
total_four++
|
788
|
total_four++
|
784
|
}
|
789
|
}
|
785
|
}
|
790
|
}
|
|
|
|
|
810
|
items = append(items, newItem2)
|
815
|
items = append(items, newItem2)
|
811
|
items = append(items, newItem3)
|
816
|
items = append(items, newItem3)
|
812
|
|
817
|
|
|
|
818
|
+ //
|
|
|
819
|
+ //for _, item := range items {
|
|
|
820
|
+ // float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(item.Total)/float64(Total)), 64)
|
|
|
821
|
+ // item.Ratio = strconv.FormatInt(int64(float_value*100), 10)
|
|
|
822
|
+ //}
|
|
|
823
|
+
|
813
|
break
|
824
|
break
|
814
|
case 2:
|
825
|
case 2:
|
815
|
if patient_id == 0 {
|
826
|
if patient_id == 0 {
|
|
|
|
|
831
|
|
842
|
|
832
|
}
|
843
|
}
|
833
|
|
844
|
|
|
|
845
|
+ //db.Table("xt_assessment_before_dislysis as before").Where("before.user_org_id=? AND before.status = 1 AND before.created_time >= ? and before.created_time <= ? ", user_org_id, patient_id, start_time, end_time).Count(&total)
|
|
|
846
|
+
|
834
|
var isHasConditionOne bool = false
|
847
|
var isHasConditionOne bool = false
|
835
|
var isHasConditionTwo bool = false
|
848
|
var isHasConditionTwo bool = false
|
836
|
var isHasConditionThree bool = false
|
849
|
var isHasConditionThree bool = false
|
|
|
|
|
960
|
if end != 0 {
|
973
|
if end != 0 {
|
961
|
db = db.Where("sch.created_time<=?", end)
|
974
|
db = db.Where("sch.created_time<=?", end)
|
962
|
}
|
975
|
}
|
963
|
- db = db.Preload("VMPredialysisEvaluation", "status = 1").
|
|
|
964
|
- Preload("VMAssessmentAfterDislysis", "status = 1").
|
|
|
|
|
976
|
+ db = db.Preload("VMPredialysisEvaluation", "status = 1 AND user_org_id = ?", orgID).
|
|
|
977
|
+ Preload("VMAssessmentAfterDislysis", "status = 1 AND user_org_id = ?", orgID).
|
965
|
Preload("VMMinMonitoringRecord", func(db *gorm.DB) *gorm.DB {
|
978
|
Preload("VMMinMonitoringRecord", func(db *gorm.DB) *gorm.DB {
|
966
|
- return db.Where("status = 1").Order("systolic_blood_pressure DESC")
|
|
|
|
|
979
|
+ return db.Where("status = 1 AND user_org_id = ?", orgID).Order("systolic_blood_pressure DESC")
|
967
|
}).
|
980
|
}).
|
968
|
Preload("VMMaxMonitoringRecord", func(db *gorm.DB) *gorm.DB {
|
981
|
Preload("VMMaxMonitoringRecord", func(db *gorm.DB) *gorm.DB {
|
969
|
- return db.Where("status = 1").Order("systolic_blood_pressure ASC")
|
|
|
|
|
982
|
+ return db.Where("status = 1 AND user_org_id = ?", orgID).Order("systolic_blood_pressure ASC")
|
970
|
}).
|
983
|
}).
|
971
|
Preload("VMPatients", "status = 1 AND user_org_id = ?", orgID)
|
984
|
Preload("VMPatients", "status = 1 AND user_org_id = ?", orgID)
|
972
|
err = db.Count(&total).Offset(offset).Limit(limit).Order("sch.schedule_date desc").Select(" sch.schedule_date,sch.patient_id,sch.user_org_id").Find(&orders).Error
|
985
|
err = db.Count(&total).Offset(offset).Limit(limit).Order("sch.schedule_date desc").Select(" sch.schedule_date,sch.patient_id,sch.user_org_id").Find(&orders).Error
|
|
|
|
|
1076
|
case 1:
|
1089
|
case 1:
|
1077
|
for _, item := range datas {
|
1090
|
for _, item := range datas {
|
1078
|
var Total int64
|
1091
|
var Total int64
|
1079
|
- db.Raw("select count(*) as total from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND config.name like '%内瘘%' Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
|
|
|
|
1092
|
+ db.Raw("select count(*) as total from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
1080
|
item.PunctureCount = Total
|
1093
|
item.PunctureCount = Total
|
1081
|
}
|
1094
|
}
|
1082
|
break
|
1095
|
break
|
1083
|
case 2:
|
1096
|
case 2:
|
1084
|
for _, item := range datas {
|
1097
|
for _, item := range datas {
|
1085
|
var Total int64
|
1098
|
var Total int64
|
1086
|
- db.Raw("select count(*) as total from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND config.name like '%导管%' Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
|
|
|
|
1099
|
+ db.Raw("select count(*) as total from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
1087
|
item.ChangemedicineCount = Total
|
1100
|
item.ChangemedicineCount = Total
|
1088
|
}
|
1101
|
}
|
1089
|
|
1102
|
|
|
|
|
|
1127
|
var TotalOne int64
|
1140
|
var TotalOne int64
|
1128
|
var TotalTwo int64
|
1141
|
var TotalTwo int64
|
1129
|
var TotalThree int64
|
1142
|
var TotalThree int64
|
1130
|
- db.Raw("select count(*) as total from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND config.name like '%内瘘%' Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
|
|
1131
|
- db.Raw("select count(*) as total_one from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND config.name like '%导管%' Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
|
|
|
|
|
1143
|
+ db.Raw("select count(*) as total from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
|
|
|
1144
|
+ db.Raw("select count(*) as total_one from (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from xt_assessment_before_dislysis as d JOIN `xt_data_config` config on d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Group by d.id) b JOIN `xt_dialysis_order` on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1 AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.created_time >= ? AND xt_dialysis_order.created_time <= ? ", user_org_id, tempConfig.ID, user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
|
1132
|
db.Table("xt_monitoring_record ").Where("user_org_id = ? AND status = 1 AND monitoring_nurse = ? AND created_time >= ? AND created_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
|
1145
|
db.Table("xt_monitoring_record ").Where("user_org_id = ? AND status = 1 AND monitoring_nurse = ? AND created_time >= ? AND created_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
|
1133
|
db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1 AND creater = ? AND created_time >= ? AND created_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalThree)
|
1146
|
db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1 AND creater = ? AND created_time >= ? AND created_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalThree)
|
1134
|
item.PunctureCount = Total
|
1147
|
item.PunctureCount = Total
|
|
|
|
|
1299
|
db := service.XTReadDB()
|
1312
|
db := service.XTReadDB()
|
1300
|
offset := (page - 1) * limit
|
1313
|
offset := (page - 1) * limit
|
1301
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value < ?", user_org_id, start_time, end_time, project_id, item_id, value).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1314
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value < ?", user_org_id, start_time, end_time, project_id, item_id, value).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1302
|
- return db.Where("status = 1")
|
|
|
|
|
1315
|
+ return db.Where("status = 1 AND user_org_id = ?", user_org_id)
|
1303
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1316
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1304
|
return datas, total, err
|
1317
|
return datas, total, err
|
1305
|
} else if indexTwo != -1 {
|
1318
|
} else if indexTwo != -1 {
|
|
|
|
|
1308
|
db := service.XTReadDB()
|
1321
|
db := service.XTReadDB()
|
1309
|
offset := (page - 1) * limit
|
1322
|
offset := (page - 1) * limit
|
1310
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value > ?", user_org_id, start_time, end_time, project_id, item_id, value).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1323
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value > ?", user_org_id, start_time, end_time, project_id, item_id, value).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1311
|
- return db.Where("status = 1")
|
|
|
|
|
1324
|
+ return db.Where("status = 1 AND user_org_id = ?", user_org_id)
|
1312
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1325
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1313
|
return datas, total, err
|
1326
|
return datas, total, err
|
1314
|
} else if indexThree != -1 {
|
1327
|
} else if indexThree != -1 {
|
|
|
|
|
1325
|
db := service.XTReadDB()
|
1338
|
db := service.XTReadDB()
|
1326
|
offset := (page - 1) * limit
|
1339
|
offset := (page - 1) * limit
|
1327
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value >= ? AND inspect_value <= ?", user_org_id, start_time, end_time, project_id, item_id, float1, float2).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1340
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value >= ? AND inspect_value <= ?", user_org_id, start_time, end_time, project_id, item_id, float1, float2).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1328
|
- return db.Where("status = 1")
|
|
|
|
|
1341
|
+ return db.Where("status = 1 AND user_org_id = ?", user_org_id)
|
1329
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1342
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1330
|
return datas, total, err
|
1343
|
return datas, total, err
|
1331
|
} else {
|
1344
|
} else {
|
1332
|
db := service.XTReadDB()
|
1345
|
db := service.XTReadDB()
|
1333
|
offset := (page - 1) * limit
|
1346
|
offset := (page - 1) * limit
|
1334
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 ", user_org_id, start_time, end_time, project_id, item_id).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1347
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 ", user_org_id, start_time, end_time, project_id, item_id).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1335
|
- return db.Where("status = 1")
|
|
|
|
|
1348
|
+ return db.Where("status = 1 AND user_org_id = ?", user_org_id)
|
1336
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1349
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1337
|
return datas, total, err
|
1350
|
return datas, total, err
|
1338
|
}
|
1351
|
}
|
|
|
|
|
1343
|
db := service.XTReadDB()
|
1356
|
db := service.XTReadDB()
|
1344
|
offset := (page - 1) * limit
|
1357
|
offset := (page - 1) * limit
|
1345
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 ", user_org_id, start_time, end_time, project_id, item_id).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1358
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 ", user_org_id, start_time, end_time, project_id, item_id).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1346
|
- return db.Where("status = 1")
|
|
|
|
|
1359
|
+ return db.Where("status = 1 AND user_org_id = ?", user_org_id)
|
1347
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1360
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1348
|
return datas, total, err
|
1361
|
return datas, total, err
|
1349
|
|
1362
|
|
|
|
|
|
1352
|
db := service.XTReadDB()
|
1365
|
db := service.XTReadDB()
|
1353
|
offset := (page - 1) * limit
|
1366
|
offset := (page - 1) * limit
|
1354
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value = ?", user_org_id, start_time, end_time, project_id, item_id, range_value).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1367
|
err = db.Model(&Inspection{}).Where("org_id = ? AND status = 1 AND created_time >= ? AND created_time <= ? AND project_id = ? AND item_id = ? AND status = 1 AND inspect_value = ?", user_org_id, start_time, end_time, project_id, item_id, range_value).Preload("Patient", func(db *gorm.DB) *gorm.DB {
|
1355
|
- return db.Where("status = 1")
|
|
|
|
|
1368
|
+ return db.Where("status = 1 AND user_org_id = ?", user_org_id)
|
1356
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1369
|
}).Count(&total).Offset(offset).Limit(limit).Find(&datas).Error
|
1357
|
return datas, total, err
|
1370
|
return datas, total, err
|
1358
|
|
1371
|
|