function_service.go 7.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package service
  2. import (
  3. "XT_Admin_Api/models/function_models"
  4. )
  5. func GetTodayInfo(to int64,ctime int64,page int64,limit int64)(patients []function_models.XtPatients,total int64,err error) {
  6. db := readDb.Table("xt_patients as p").Where("p.status = 1")
  7. offset := (page - 1) * limit
  8. err = db.Where("status <> 0 AND created_time >= ? AND created_time <= ?", to, ctime).
  9. Count(&total).Order("p.created_time desc").Offset(offset).Limit(limit).
  10. Select("p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").
  11. Find(&patients).Error
  12. return patients,total,err
  13. }
  14. func GetTodayDialysisPatientsInfo(to int64,ctime int64,page int64,limit int64)(patients []function_models.XtPatients,total int64,err error) {
  15. db := readDb.Table("xt_patients as p").Where("p.status = 1")
  16. offset := (page - 1) * limit
  17. err = db.Select("p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").
  18. Joins("join xt_dialysis_prescription as x On x.patient_id = p.id").Where("x.created_time >= ? AND x.created_time <= ?", to, ctime).Count(&total).Order("p.created_time desc").Offset(offset).Limit(limit).Find(&patients).Error
  19. return patients,total,err
  20. }
  21. func GetTodayReceivePatientsInfo(to int64,ctime int64,page int64,limit int64)(patients []function_models.XtPatients,total int64,err error) {
  22. db := readDb.Table("xt_patients as p").Where("p.status = 1")
  23. offset := (page - 1) * limit
  24. err = db.Select("p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").
  25. Joins("join xt_receive_treatment_asses as x On x.patient_id = p.id").Where("x.created_time >= ? AND x.created_time <= ?", to, ctime).Count(&total).Order("p.created_time desc").Offset(offset).Limit(limit).Find(&patients).Error
  26. return patients,total,err
  27. }
  28. func GetTodayDoctorsOrderInfo(to int64,ctime int64,page int64,limit int64)(patients []function_models.XtPatients,total int64,err error) {
  29. db := readDb.Table("xt_patients as p").Where("p.status = 1")
  30. offset := (page - 1) * limit
  31. err = db.Select("p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").
  32. Joins("join xt_doctor_advice as x On x.patient_id = p.id").Where("x.created_time >= ? AND x.created_time <= ?", to, ctime).Count(&total).Order("p.created_time desc").Offset(offset).Limit(limit).Find(&patients).Error
  33. return patients,total,err
  34. }
  35. func GetTodayDoubleCheckInfo(to int64,ctime int64,page int64,limit int64)(patients []function_models.XtPatients,total int64,err error) {
  36. db := readDb.Table("xt_patients as p").Where("p.status = 1")
  37. offset := (page - 1) * limit
  38. err = db.Select("p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").
  39. Joins("join xt_double_check as x On x.patient_id = p.id").Where("x.created_time >= ? AND x.created_time <= ?", to, ctime).Count(&total).Order("p.created_time desc").Offset(offset).Limit(limit).Find(&patients).Error
  40. return patients,total,err
  41. }
  42. func GetTodayDialysisMachinek(to int64,ctime int64,page int64,limit int64)(patients []function_models.XtPatients,total int64,err error) {
  43. db := readDb.Table("xt_patients as p").Where("p.status = 1")
  44. offset := (page - 1) * limit
  45. err = db.Select("p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time").
  46. Joins("join xt_double_check as x On x.patient_id = p.id").Where("x.created_time >= ? AND x.created_time <= ?", to, ctime).Count(&total).Order("p.created_time desc").Offset(offset).Limit(limit).Find(&patients).Error
  47. return patients,total,err
  48. }