|
@@ -60,25 +60,30 @@ func GetConfigurationlist(orgid int64, limit int64, page int64) (standard []*mod
|
60
|
60
|
|
61
|
61
|
db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
|
62
|
62
|
if orgid > 0 {
|
63
|
|
- db = db.Where("x.user_org_id = ?", orgid)
|
|
63
|
+ db = db.Where("x.user_org_id = ? and x.is_status = 1", orgid)
|
64
|
64
|
}
|
65
|
65
|
table := XTReadDB().Table("xt_inspection_reference as s")
|
66
|
66
|
fmt.Println(table)
|
67
|
67
|
offset := (page - 1) * limit
|
68
|
|
- err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name").Count(&total).
|
|
68
|
+ err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name,x.is_status").Count(&total).
|
69
|
69
|
Joins("left join xt_inspection_reference as s on s.id = x.inspection_minor").Offset(offset).Limit(limit).Scan(&standard).Error
|
70
|
70
|
return standard, total, err
|
71
|
71
|
}
|
72
|
72
|
|
|
73
|
+func GetDefaultBloodPressure(orgid int64) (standard []models.XtQualityControlStandard, err error) {
|
|
74
|
+ err = XTReadDB().Model(&standard).Where("user_org_id = ? and status = 1 and is_status = 0", orgid).Find(&standard).Error
|
|
75
|
+ return standard, err
|
|
76
|
+}
|
|
77
|
+
|
73
|
78
|
func GetConfigurationListTwo(orgid int64, limit int64, page int64) (standard []*models.QualityControlStandard, total int64, err error) {
|
74
|
79
|
db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
|
75
|
80
|
if orgid > 0 {
|
76
|
|
- db = db.Where("x.user_org_id = ?", orgid)
|
|
81
|
+ db = db.Where("x.user_org_id = ? and x.is_status =1", orgid)
|
77
|
82
|
}
|
78
|
83
|
table := XTReadDB().Table("xt_inspection_reference as s")
|
79
|
84
|
fmt.Println(table)
|
80
|
85
|
offset := (page - 1) * limit
|
81
|
|
- err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name").Count(&total).
|
|
86
|
+ err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name,x.is_status").Count(&total).
|
82
|
87
|
Joins("left join xt_inspection_reference as s on s.item_id = x.inspection_minor and s.project_id = x.inspection_major").Where("s.org_id = ? and s.status = 1", orgid).Offset(offset).Limit(limit).Scan(&standard).Error
|
83
|
88
|
return standard, total, err
|
84
|
89
|
}
|
|
@@ -2704,3 +2709,16 @@ func GetLastPatientsControlTwo(orgid int64, patientid int64, startime int64, end
|
2704
|
2709
|
|
2705
|
2710
|
return inspection, err
|
2706
|
2711
|
}
|
|
2712
|
+
|
|
2713
|
+func GetBloodPressureDetail(id int64) (models.XtQualityControlStandard, error) {
|
|
2714
|
+ standard := models.XtQualityControlStandard{}
|
|
2715
|
+ err := XTReadDB().Model(&standard).Where("id=? and status = 1", id).Find(&standard).Error
|
|
2716
|
+ return standard, err
|
|
2717
|
+}
|
|
2718
|
+
|
|
2719
|
+func UpdateBloodPressure(st *models.XtQualityControlStandard, id int64) error {
|
|
2720
|
+
|
|
2721
|
+ err := XTWriteDB().Model(&st).Where("id=?", id).Update(map[string]interface{}{"inspection_major": st.InspectionMajor, "inspection_minor": st.InspectionMinor, "min_range": st.MinRange, "large_range": st.LargeRange, "sort": st.Sort, "updated_time": st.UpdatedTime}).Error
|
|
2722
|
+ return err
|
|
2723
|
+
|
|
2724
|
+}
|