|
@@ -799,25 +799,48 @@ func GetAllEquitName(orgid int64) (equiment []*models.DeviceEquimentname, err er
|
799
|
799
|
|
800
|
800
|
func GetUserForm(id int64, orgId int64, limit int64, page int64) (infor []*models.DeviceInformations, total int64, err error) {
|
801
|
801
|
|
802
|
|
- db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
|
803
|
|
- table := XTReadDB().Table("xt_patients as p")
|
804
|
|
- fmt.Println("table", table)
|
805
|
|
- dbs := UserReadDB().Table("sgj_user_admin_role as r")
|
806
|
|
- fmt.Println("dbs", dbs)
|
807
|
|
- offset := (page - 1) * limit
|
|
802
|
+ if orgId == 10060 {
|
|
803
|
+ db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
|
|
804
|
+ table := XTReadDB().Table("xt_patients as p")
|
|
805
|
+ fmt.Println("table", table)
|
|
806
|
+ dbs := UserReadDB().Table("sgj_user_admin_role as r")
|
|
807
|
+ fmt.Println("dbs", dbs)
|
|
808
|
+ offset := (page - 1) * limit
|
|
809
|
+
|
|
810
|
+ if id > 0 {
|
|
811
|
+ db = db.Where("x.equiment_id = ?", id)
|
|
812
|
+ }
|
808
|
813
|
|
809
|
|
- if id > 0 {
|
810
|
|
- db = db.Where("x.equiment_id = ?", id)
|
811
|
|
- }
|
|
814
|
+ if orgId > 0 {
|
|
815
|
+ db = db.Where("x.user_org_id = ?", orgId)
|
|
816
|
+ }
|
|
817
|
+ err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date asc").Scan(&infor).Error
|
|
818
|
+ if err != nil {
|
|
819
|
+ return
|
|
820
|
+ }
|
|
821
|
+ return
|
|
822
|
+ } else {
|
|
823
|
+ db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
|
|
824
|
+ table := XTReadDB().Table("xt_patients as p")
|
|
825
|
+ fmt.Println("table", table)
|
|
826
|
+ dbs := UserReadDB().Table("sgj_user_admin_role as r")
|
|
827
|
+ fmt.Println("dbs", dbs)
|
|
828
|
+ offset := (page - 1) * limit
|
|
829
|
+
|
|
830
|
+ if id > 0 {
|
|
831
|
+ db = db.Where("x.equiment_id = ?", id)
|
|
832
|
+ }
|
812
|
833
|
|
813
|
|
- if orgId > 0 {
|
814
|
|
- db = db.Where("x.user_org_id = ?", orgId)
|
815
|
|
- }
|
816
|
|
- err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date desc").Scan(&infor).Error
|
817
|
|
- if err != nil {
|
|
834
|
+ if orgId > 0 {
|
|
835
|
+ db = db.Where("x.user_org_id = ?", orgId)
|
|
836
|
+ }
|
|
837
|
+ err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Offset(offset).Limit(limit).Order("x.date desc").Scan(&infor).Error
|
|
838
|
+ if err != nil {
|
|
839
|
+ return
|
|
840
|
+ }
|
818
|
841
|
return
|
819
|
842
|
}
|
820
|
|
- return
|
|
843
|
+
|
821
|
844
|
}
|
822
|
845
|
|
823
|
846
|
func GetBedNumber(id int64, orgid int64) (models.DeviceAddmacher, error) {
|