CrmPatientMiDao.java 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package thyyxxk.webserver.dao.his.chronicDisease;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import org.apache.ibatis.annotations.Delete;
  4. import org.apache.ibatis.annotations.Param;
  5. import org.apache.ibatis.annotations.Select;
  6. import thyyxxk.webserver.entity.chronicDisease.CrmPatientMi;
  7. import thyyxxk.webserver.entity.chronicDisease.CrmPatientVo;
  8. import java.util.List;
  9. public interface CrmPatientMiDao extends BaseMapper<CrmPatientMi> {
  10. @Select(" select top 1 mi.*, tz.height, tz.weight, tz.temperature, tz.respiratory_rate, tz.heart_rate, " +
  11. " tz.blood_sugar, tz.blood_pressure_high, tz.blood_pressure_low, tz.blood_oxygen, rtrim(f.name) as userName, " +
  12. " rtrim(p.name) as referPhysicianName " +
  13. " from crm_patient_mi mi" +
  14. " left join crm_patient_tzxx tz on (mi.p_id = tz.p_id collate Chinese_PRC_BIN) and mi.visit_times = tz.visit_times " +
  15. " left join a_employee_mi p on mi.refer_physician = p.code collate Chinese_PRC_BIN " +
  16. " left join a_employee_mi f on mi.creat_id = f.code collate Chinese_PRC_BIN " +
  17. " where mi.social_no = #{keyCode} or mi.his_mz_no = #{keyCode} or mi.his_zy_no = #{keyCode} or mi.his_tj_no = #{keyCode}" +
  18. " or mi.p_name = #{keyCode} or mi.p_id = #{keyCode} ")
  19. CrmPatientMi selectCrmPatientMiByCode(@Param("keyCode") String keyCode);
  20. @Select(" select * from crm_patient_mi where social_no = #{socialNo} ")
  21. CrmPatientMi selectCrmPatientMiBySocialNo(@Param("socialNo") String socialNo);
  22. @Select(" select * from crm_patient_mi where p_id = #{pId} ")
  23. CrmPatientMi selectCrmPatientMiByPId(@Param("pId") String pId);
  24. @Delete(" delete from crm_patient_mi where social_no = #{socialNo} ")
  25. void deleteCrmPatientMiBySocialNo(@Param("socialNo") String socialNo);
  26. @Delete(" delete from crm_patient_mi where p_id = #{pId} ")
  27. void deleteCrmPatientMiByPId(@Param("pId") String pId);
  28. @Select(" select top 1 rtrim(mi.name) as p_name, mi.sex, rtrim(mi.patient_id) as his_mz_no, mi.social_no, mi.age, mi.birth_day as birth_date, " +
  29. " rtrim(mi.phone_no) as rel_tel, mi.province_code, mi.city_code, rtrim(mi.detail) as detail_adress, " +
  30. " mi.district_code as area_code " +
  31. " from mz_patient_mi mi " +
  32. " where mi.patient_id = #{code} or mi.social_no = #{code} or mi.tj_no = #{code} or mi.ic_card_no = #{code} ")
  33. CrmPatientMi selectCrmPatientMiMzByCode(@Param("code") String code);
  34. @Select(" select top 1 rtrim(mi.name) as p_name, mi.sex, rtrim(mi.inpatient_no) as his_zy_no, mi.social_no, mi.birth_date as birth_date, " +
  35. " rtrim(mi.relation_tel) as rel_tel, mi.province_code, mi.city_code, mi.district_code as area_code, rtrim(mi.relation_district) as detail_adress, " +
  36. " rtrim(mi.mz_no) as his_mz_no, rtrim(mi.relation_name) as rel_name " +
  37. " from a_patient_mi mi " +
  38. " where mi.inpatient_no = #{code} or mi.social_no = #{code} or mi.mz_no = #{code} ")
  39. CrmPatientMi selectCrmPatientMiZyByCode(@Param("code") String code);
  40. @Select("<script> " +
  41. " select mi.*, tz.height, tz.weight, tz.temperature, tz.respiratory_rate, tz.heart_rate, " +
  42. " tz.blood_sugar, tz.blood_pressure_high, tz.blood_pressure_low, tz.blood_oxygen, rtrim(f.name) as userName, " +
  43. " rtrim(p.name) as referPhysicianName " +
  44. " from crm_patient_mi mi" +
  45. " left join crm_patient_tzxx tz on (mi.p_id = tz.p_id collate Chinese_PRC_BIN) and mi.visit_times = tz.visit_times " +
  46. " left join a_employee_mi p on mi.refer_physician = p.code collate Chinese_PRC_BIN " +
  47. " left join a_employee_mi f on mi.creat_id = f.code collate Chinese_PRC_BIN " +
  48. " where (mi.social_no like '%${keyCode}%' or mi.his_mz_no like '%${keyCode}%' " +
  49. " or mi.his_zy_no like '%${keyCode}%' or mi.p_name like '%${keyCode}%')" +
  50. "<if test=\"startTime != null and startTime != '' \">" +
  51. " and mi.create_date &gt;= #{startTime} " +
  52. "</if>" +
  53. "<if test=\"endTime != null and endTime != '' \">" +
  54. " and mi.create_date &lt;= #{endTime} " +
  55. "</if>" +
  56. "<if test=\"diseaseType != null and diseaseType != '' \">" +
  57. " and chronic_disease_type like '%${diseaseType}%' " +
  58. "</if>" +
  59. " order by mi.create_date " +
  60. "</script> ")
  61. List<CrmPatientMi> selectChronicDisease(CrmPatientVo vo);
  62. }