VisitMapper.xml 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.web.work.mapper.VisitMapper">
  6. <select id="selectList" resultType="com.ruoyi.web.work.domain.Visit">
  7. select * from tb_visit
  8. <where>
  9. <if test="id != null "> and id = #{id}</if>
  10. <if test="patId != null "> and pat_id = #{patId}</if>
  11. <if test="cardId != null "> and card_id = #{cardId}</if>
  12. <if test="patClass != null and patClass != ''"> and pat_class = #{patClass}</if>
  13. <if test="bed != null and bed != ''"> and bed = #{bed}</if>
  14. <if test="department != null and department != ''"> and department = #{department}</if>
  15. <if test="physician != null and physician != ''"> and physician = #{physician}</if>
  16. <if test="nurseCode != null and nurseCode != ''"> and nurse_code = #{nurseCode}</if>
  17. <if test="doctorCode != null and doctorCode != ''"> and doctor_code = #{doctorCode}</if>
  18. <if test="hospitalizedNumber != null and hospitalizedNumber != ''"> and hospitalized_number = #{hospitalizedNumber}</if>
  19. <if test="feeCategory != null and feeCategory != ''"> and fee_category = #{feeCategory}</if>
  20. <if test="dischargeMethod != null and dischargeMethod != ''"> and discharge_method = #{dischargeMethod}</if>
  21. <if test="medicalCode != null and medicalCode != ''"> and medical_code = #{medicalCode}</if>
  22. <if test="hospitalStatus != null and hospitalStatus != ''"> and hospital_status = #{hospitalStatus}</if>
  23. <if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
  24. <if test="admissionTime != null and admissionTime != ''"> and admission_time = #{admissionTime}</if>
  25. <if test="dischargeTime != null and dischargeTime != ''"> and discharge_time = #{dischargeTime}</if>
  26. <if test="level != null and level != ''"> and level = #{level}</if>
  27. <if test="reasonArea != null and reasonArea != ''"> and reasonArea = #{reasonArea}</if>
  28. <if test="wardCode != null and wardCode != ''"> and ward_code = #{wardCode}</if>
  29. <if test="wardName != null and wardName != ''"> and ward_name = #{wardName}</if>
  30. </where>
  31. </select>
  32. <select id="getPatientCardByNameOrDepartmentOrPhysician" resultType="com.ruoyi.web.work.domain.dto.PatientCardDto">
  33. SELECT
  34. tb_visit.department,
  35. tb_visit.physician,
  36. tb_patient.`name`,
  37. tb_visit.discharge_method,
  38. tb_visit.discharge_time,
  39. tb_visit.id,
  40. tb_visit.pat_id,
  41. tb_visit.card_id
  42. FROM
  43. tb_visit
  44. JOIN
  45. tb_patient ON tb_visit.pat_id = tb_patient.id
  46. <where>
  47. <if test="patientName!='' and patientName!=null">
  48. AND tb_patient.`name` like concat('%', #{patientName}, '%')
  49. </if>
  50. <if test="departmentName!='' and departmentName!= null">
  51. AND tb_visit.department =#{departmentName}
  52. </if>
  53. <if test="physician!='' and physician!= null">
  54. AND tb_visit.physician like concat('%', #{physician}, '%')
  55. </if>
  56. </where>
  57. </select>
  58. <select id="getAllDepartment" resultType="com.ruoyi.web.work.domain.dto.PatientCardDto">
  59. select department from tb_visit GROUP BY department
  60. </select>
  61. <select id="getMedicalRecord" resultType="com.ruoyi.web.work.domain.Visit">
  62. SELECT *
  63. FROM tb_visit
  64. <where>
  65. <if test="patientId != '' and patientId != null"></if>
  66. and tb_visit.pat_id=#{patientId}
  67. <if test="beginTime !=null and beginTime != '' and endTime != null and endTime != ''">
  68. and tb_visit.admission_time BETWEEN #{beginTime} AND #{endTime}
  69. </if>
  70. </where>
  71. </select>
  72. </mapper>