HuiZhenShenQingDao.java 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import com.alibaba.fastjson.JSONObject;
  3. import org.apache.ibatis.annotations.*;
  4. import thyyxxk.webserver.entity.casefrontsheet.YshHzRecord;
  5. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  6. import thyyxxk.webserver.entity.login.UserInfo;
  7. import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYiZhu;
  8. import java.math.BigDecimal;
  9. import java.util.List;
  10. /**
  11. * <p>
  12. * 描述: 会诊申请
  13. * </p>
  14. *
  15. * @author xc
  16. * @date 2021-05-07 11:01
  17. */
  18. @Mapper
  19. public interface HuiZhenShenQingDao {
  20. /**
  21. * 获取科室
  22. *
  23. * @return 返回科室
  24. */
  25. @Select("select code,rtrim(name) name from zy_ward_code with(nolock) where " +
  26. " (py_code like #{pyCode} or name like #{pyCode} or code like #{pyCode})")
  27. List<GetDropdownBox> getZdUnitCode(String pyCode);
  28. /**
  29. * 获取会诊类别
  30. *
  31. * @return 返回科室
  32. */
  33. @Select("select code,rtrim(name) name from ysh_zd_hz_level with(nolock)")
  34. List<GetDropdownBox> getYshZdHzLevel();
  35. /**
  36. * 插入会诊申请
  37. *
  38. * @param param 要插入的实体类
  39. */
  40. @Insert("INSERT INTO ysh_hz_record " +
  41. "(inpatient_no, admiss_times, req_times, req_comment, input_id, input_date, req_date, dept_code, ward_code," +
  42. " req_dept1, status_flag, hz_type, hz_level, hz_zd, hz_md, act_order_no , hz_doctor1,hz_id ) " +
  43. "VALUES ( #{inpatientNo}, #{admissTimes}, #{reqTimes}, #{reqComment}, #{inputId}, #{inputDate}, #{reqDate}, " +
  44. "#{deptCode}, #{wardCode}, #{reqDept1}, '1', #{hzType}, #{hzLevel}, #{hzZd}, #{hzMd}, #{actOrderNo} ,#{hzDoctor1},#{hzDoctor1})")
  45. void chaRuHuiZhenShenQing(YshHzRecord param);
  46. /**
  47. * 插入一条医嘱
  48. *
  49. * @param param 参数
  50. */
  51. @Insert("INSERT INTO yz_act_order ( order_code, order_name, frequ_code, infant_flag, order_time, physician, start_time, " +
  52. "act_order_no, inpatient_no, admiss_times, drug_flag, enter_oper, enter_time, status_flag, self_buy, pay_self, " +
  53. "serial, group_no, doctor_flag, exec_unit, dept_code, ward_code, reg_flag,confirm_time,signer,emergency_flag,yb_self_flag) " +
  54. "VALUES ( #{orderCode}, #{orderName}, 'ONCE', '0', #{inputDate}, #{inputId}, #{inputDate}, " +
  55. "#{actOrderNo}, #{inpatientNo}, #{admissTimes}, 'o', #{inputId}, #{inputDate}, '2', '0', '0', '00', '00', '1'," +
  56. " #{reqDept1}, #{deptCode}, #{wardCode}, '',#{inputDate}, #{inputId},#{emergencyFlag},#{ybSelfFlag})")
  57. void chaRuYiZhu(YshHzRecord param);
  58. /**
  59. * 获取到最大的 req_times 每次插入都要加一
  60. *
  61. * @param inpatientNo 住院号
  62. * @param admissTimes 住院次数
  63. * @return 返回最大的 req_times
  64. */
  65. @Select("select isnull(max ( req_times ),0) from ysh_hz_record with(nolock) where inpatient_no = #{inpatientNo} and admiss_times =#{admissTimes} ")
  66. Integer getMaxReqTimes(@Param("inpatientNo") String inpatientNo,
  67. @Param("admissTimes") int admissTimes);
  68. @Select("select code, emp_tit_code " +
  69. "from a_employee_mi " +
  70. "where dept_code = #{deptCode} " +
  71. " and isnull(del_flag, 0) = 0 " +
  72. " and emp_tit_code in ('001', '002', '003')")
  73. List<String> obtainDepartmentDoctor(String deptCode);
  74. @Select("<script>" +
  75. "select inpatient_no,admiss_times,act_order_no, " +
  76. "(select rtrim(name) from a_employee_mi with(nolock) where code = input_id) input_name," +
  77. "(select rtrim(name) from zd_unit_code with(nolock) where code = a.dept_code) dept_name, " +
  78. "(select rtrim(name) from zd_unit_code with(nolock) where code = req_dept1) req_dept_name,hz_date," +
  79. "(select rtrim(name) from a_employee_mi with(nolock) where code = hz_doctor1) hz_doctor1_name," +
  80. "(select rtrim(name) from a_employee_mi with(nolock) where code = hz_doctor2) hz_doctor2_name, " +
  81. "rtrim(c.name) hz_level_name,hz_comment,status_flag, " +
  82. "input_date,req_times,hz_type " +
  83. "from ysh_hz_record a with(nolock) " +
  84. "inner join ysh_zd_hz_level c on c.code = a.hz_level " +
  85. "where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
  86. "<if test=\" actOrderNo != null \">" +
  87. "and act_order_no = #{actOrderNo} " +
  88. "</if>" +
  89. " order by req_times " +
  90. "</script>")
  91. List<YshHzRecord> chaKanHuiZhenShenQing(@Param("inpatientNo") String inpatientNo,
  92. @Param("admissTimes") int admissTimes,
  93. @Param("actOrderNo") BigDecimal actOrderNo);
  94. /**
  95. * 删除 会诊申请
  96. *
  97. * @param inpatientNo 住院号
  98. * @param admissTimes 住院次数
  99. * @param reqTimes 申请次数
  100. */
  101. @Delete("delete ysh_hz_record where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and req_times = #{reqTimes}")
  102. void shanChuShenQing(@Param("inpatientNo") String inpatientNo,
  103. @Param("admissTimes") int admissTimes,
  104. @Param("reqTimes") int reqTimes);
  105. /**
  106. * 删除医嘱
  107. *
  108. * @param actOrderNo 医嘱号
  109. */
  110. @Delete("DELETE FROM yz_act_order WHERE act_order_no = #{actOrderNo} ")
  111. void shanChuYiZhu(@Param("actOrderNo") BigDecimal actOrderNo);
  112. @Select(" select code,name, " +
  113. " dept_name = (select rtrim(name) from zd_unit_code where zd_unit_code.code = dept_code)," +
  114. " emp_tit_name = (select rtrim(name) from zd_emp_title where zd_emp_title.code = emp_tit_code) " +
  115. " from a_employee_mi with(nolock) where dept_code = #{deptCode} and emp_tit_code = #{hzType} and isnull(del_flag,0)=0")
  116. List<GetDropdownBox> huiZhenYiSheng(@Param("deptCode") String deptCode,
  117. @Param("hzType") String hzType);
  118. @Select("select code, " +
  119. " rtrim(name) as name, " +
  120. " dept_code, " +
  121. " dept_name = (select rtrim(name) from zd_unit_code where zd_unit_code.code = dept_code), " +
  122. " emp_tit_code= right(emp_tit_code, 1), " +
  123. " empTitName = (select rtrim(name) from zd_emp_title where zd_emp_title.code = emp_tit_code), " +
  124. " code_rs " +
  125. "from a_employee_mi " +
  126. "where isnull(del_flag " +
  127. " , 0) = 0 " +
  128. " and emp_tit_code in ('001', '002', '003')" +
  129. " and nullif(yb_code,'') is not null " +
  130. " and (name like #{name} " +
  131. " or py_code like #{name} " +
  132. " or d_code like #{name})")
  133. List<UserInfo> getConsultingDoctorInfo(@Param("name") String name);
  134. @Select("select data_element " +
  135. "from emr_data_element " +
  136. "where pat_no = #{patNo} " +
  137. " and times = #{times}")
  138. JSONObject getPatientEmrDiag(String patNo,
  139. Integer times);
  140. }