123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- package service
-
- import (
- "XT_Admin_Api/models/function_models"
- "fmt"
- )
-
- //病人管理
- func GetTodayInfo(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- fmt.Println("rows是什么",rows)
- if rows.Next() {
- rows.Scan(&total)
- }
- fmt.Println("&total是什么",total)
- return patientinfo,total,err
- }
-
- //透析处方
- func GetTodayDialysisPatientsInfo(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
-
- //接诊评估
- func GetTodayReceivePatientsInfo(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
- // 透前评估
- func GetTodayBeforDislysisInfo(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
- //零食医嘱
- func GetTodayDoctorsOrderInfo(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
- //双人核对
- func GetTodayDoubleCheckInfo(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_double_check as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_double_check as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
- //透析上机
- func GetTodayDialysisMachinek(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
- //透析检测
- func GetTodayDialysisExamination(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
- //透析下机
- func GetTodayBeforOrpenetration(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
-
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
- //透后评估
- func GetTodayPostAssessment(to int64,ctime int64,page int64,limit int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_org_follow as f On f.org_id = u.id JoIN sgj_admin as a On a.id = f.admin_user_id join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id JOIN sgj_xt.xt_patients as p On p.id = x.patient_id where x.created_time >= ? AND x.created_time <= ? GROUP BY x.user_org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
- func GetTodayEntrylist(to int64,ctime int64,limit int64,page int64)(patientinfo []function_models.PatientInfo,total int64, err error) {
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_info as x on x.org_id = u.id LEFT JOIN sgj_users.sgj_org_follow as f ON f.org_id = u.id LEFT JOIN sgj_users.sgj_admin as a on a.id = f.admin_user_id where x.ctime >= ? AND x.ctime<= ? GROUP BY x.org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_info as x on x.org_id = u.id where x.ctime >= ? AND x.ctime <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
-
- return patientinfo,total,err
- }
-
- func GetTodayExitlist(to int64,ctime int64,limit int64,page int64)(patientinfo []function_models.PatientInfo,total int64,err error) {
- offset := (page - 1) * limit
- err = readUserDb.Raw("select * from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_out as x on x.org_id = u.id where x.warehouse_out_time >= ? AND x.warehouse_out_time<= ? GROUP BY x.org_id",to,ctime).Scan(&patientinfo).Error
- rows, err := readUserDb.Offset(offset).Limit(limit).Raw("select Count(1) from sgj_users.sgj_user_org as u join sgj_xt.xt_warehouse_out as x on x.org_id = u.id where x.warehouse_out_time >= ? AND x.warehouse_out_time <= ?", to, ctime).Rows()
- if rows.Next() {
- rows.Scan(&total)
- }
- return patientinfo,total,err
- }
|