ShouShuShenQingDao.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import com.baomidou.mybatisplus.core.metadata.IPage;
  4. import org.apache.ibatis.annotations.*;
  5. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  6. import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.OpRecord;
  7. import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.ShouShuFanHui;
  8. import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.ZdIcd9Cm3;
  9. import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYiZhu;
  10. import java.util.List;
  11. import java.util.Map;
  12. /**
  13. * <p>
  14. * 描述: 手术申请
  15. * </p>
  16. *
  17. * @author xc
  18. * @date 2022-02-22 15:45
  19. */
  20. @Mapper
  21. public interface ShouShuShenQingDao extends BaseMapper<OpRecord> {
  22. @Select("<script>" +
  23. "select op_type_name = (select name from zd_operation_type where code = op_type), " +
  24. " rtrim(code) as code," +
  25. " name " +
  26. "from zd_icd9_cm3 " +
  27. "where (code like #{name} or name like #{name} or py_code like #{name} or d_code like #{name}) " +
  28. "<if test=\"type !=null and type != 0 \">" +
  29. " and op_type = #{type} " +
  30. "</if>" +
  31. "</script>")
  32. List<ZdIcd9Cm3> obtainSurgicalItems(String name,
  33. Integer type);
  34. @Select("select rtrim(op_name) as value " +
  35. "from op_record with (NOLOCK) " +
  36. "where inpatient_no = #{patNo} " +
  37. " and admiss_times = #{times}" +
  38. " and op_name like #{name} ")
  39. List<Map<String, String>> huoQuShouShuMing(@Param("patNo") String patNo,
  40. @Param("times") Integer times,
  41. @Param("name") String name);
  42. @Select("SELECT a.code, a.name " +
  43. "FROM ysh_zd_ss_type a with (NOLOCK), " +
  44. " yz_order_item b with (NOLOCK) " +
  45. "where a.code = b.ss_type " +
  46. " and isnull(b.del_flag, '') <> '1' " +
  47. " and b.operation = 'p' " +
  48. "group by a.code, a.name " +
  49. "order by a.name")
  50. List<GetDropdownBox> shouShuShenQingCeBianLan();
  51. @Select("select a.record_id /*申请单号*/," +
  52. " a.op_name," +
  53. " a.urgent_clinic_flag," +
  54. " a.apply_date, " +
  55. " part_code, " +
  56. " dept_code, " +
  57. " dept_code_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = dept_code), " +
  58. " urgent_clinic_flag, " +
  59. " inpatient_no, " +
  60. " admiss_times, " +
  61. " bed_no, " +
  62. " patient_name, " +
  63. " diag_before_op /* 术前诊断 */, " +
  64. " diag_before_code, " +
  65. " hocus_code, " +
  66. " hocus_code_name = (select rtrim(name) from zd_anaesthesia with (NOLOCK) where code = hocus_code), " +
  67. " op_scale, " +
  68. " /*术后等级不知道*/ " +
  69. " doctor_zd_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = doctor_zd)/*主刀医生*/, " +
  70. " doctor_1_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = doctor_1)/*第1助手*/, " +
  71. " doctor_2_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = doctor_2)/*第2助手*/, " +
  72. " doctor_3_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = doctor_3)/*第2助手*/, " +
  73. " doctor_mz_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = doctor_mz)/*麻醉医生*/, " +
  74. " nurse_qx_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = nurse_qx)/*器械护士*/, " +
  75. " nurse_xh_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = nurse_xh)/*巡回护士*/, " +
  76. " req_date, " +
  77. " op_datetime, " +
  78. " remark/*附注说明*/ " +
  79. "from op_record a with (NOLOCK), " +
  80. " op_record_join b with (NOLOCK)" +
  81. "where inpatient_no = #{patNo} " +
  82. " and admiss_times = #{times} " +
  83. " and a.record_id = #{recordId} " +
  84. " and a.record_id = b.record_id")
  85. OpRecord daYingShouShu(@Param("patNo") String patNo,
  86. @Param("times") Integer times,
  87. @Param("recordId") Integer recordId);
  88. @Select("select refer_physician_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = refer_physician) /*住院医生*/, " +
  89. " dept_director_name = (select rtrim(name) from a_employee_mi with (NOLOCK) where code = dept_director) /*科主任*/, " +
  90. " sex, " +
  91. " birth_date = (select (convert(varchar(10), birth_date, 21)) " +
  92. " from a_patient_mi with (NOLOCK) " +
  93. " where zy_actpatient.inpatient_no = a_patient_mi.inpatient_no) " +
  94. "from zy_actpatient with (NOLOCK) " +
  95. "where inpatient_no = #{patNo} " +
  96. " and admiss_times = #{times};")
  97. OpRecord daYingHuanZheXinXi(@Param("patNo") String patNo,
  98. @Param("times") Integer times);
  99. @Select("<script>" +
  100. "SELECT rtrim(order_code) as opCode, " +
  101. " rtrim(order_name) as opName, " +
  102. " rtrim(ss_type) as orderType " +
  103. "FROM yz_order_item with (NOLOCK) " +
  104. "where operation = 'p' " +
  105. "<if test=\"code != null and code != '' \">" +
  106. " and ss_type = #{code} " +
  107. "</if>" +
  108. " and isnull(del_flag, '') &lt;&gt; '1' " +
  109. " and (order_name like #{name} or order_code like #{name} or py_code like #{name} or d_code like #{name})" +
  110. "</script>")
  111. IPage<ShouShuFanHui> fenLeiXiangQing(IPage<ShouShuFanHui> page,
  112. @Param("code") String code,
  113. @Param("name") String name);
  114. @Select("select code,name from op_zd_part_new " +
  115. "with (NOLOCK) where " +
  116. "(name like #{code} or py_code like #{code} or d_code like #{code} or code like #{code})")
  117. List<GetDropdownBox> huoQuShouShuBuWei(String code);
  118. @Select("Select isnull(Max(op_times),0) " +
  119. "From op_record with (NOLOCK) " +
  120. "Where inpatient_no = #{patNo} " +
  121. " And admiss_times = #{times} ")
  122. Integer shouShuShenQingCiShu(@Param("patNo") String patNo,
  123. @Param("times") Integer times);
  124. @Insert("<script>" +
  125. "Insert Into op_record_join (record_id, zy_serial_no, op_times, doctor_zd, doctor_wp, doctor_1, doctor_2, doctor_3,nurse_qx, nurse_xh,doctor_mz_ys) " +
  126. "Values " +
  127. "<foreach collection='list' item='item' separator=','>" +
  128. "(#{item.recordId}, '', #{item.opTimes}, #{item.doctorZd}, null, #{item.doctor1}, #{item.doctor2}, " +
  129. "#{item.doctor3}, #{item.nurseQx}, #{item.nurseXh},#{item.doctorMzYs})" +
  130. "</foreach>" +
  131. "</script>")
  132. void chaRuShouShuYiSheng(@Param("list") List<OpRecord> list);
  133. @Insert("<script>" +
  134. "INSERT INTO op_record (record_id, inpatient_no, patient_name, admiss_times, op_times, dept_code, ward_code, op_code, " +
  135. " op_datetime, infection_flag, urgent_clinic_flag, isolation_indicator, op_scale, input_id, status, " +
  136. " input_date, apply_date, apply_doc, op_name, act_order_no, patient_type, req_date, req_id, bed_no, " +
  137. " ssbc, ssyz_flag, ward_dept,remark,hocus_code,diag_before_op,diag_before_code," +
  138. " part_code) " +
  139. " VALUES " +
  140. "<foreach collection='list' item='item' separator=','>" +
  141. " (#{item.recordId}, #{patNo}, #{name}, #{times}, #{item.opTimes}, #{dept}, #{ward}, #{item.opCode}, " +
  142. " #{item.opDatetime}, '0', #{item.urgentClinicFlag}, '0', #{item.opScale}, " +
  143. " #{userCode}, '1', getdate(), #{item.applyDate}, #{userCode}, #{item.opName}, #{item.actOrderNo}, '2', " +
  144. " getdate(), #{userCode}, #{bedNo}, #{item.ssbc}, #{item.ssyzFlag}, #{admissWard},#{item.remark},#{item.hocusCode}," +
  145. "#{item.diagBeforeOp},#{item.diagBeforeCode}," +
  146. " #{item.partCode})" +
  147. "</foreach>" +
  148. "</script>")
  149. void chaRuShouShu(@Param("list") List<OpRecord> list,
  150. @Param("patNo") String patNo,
  151. @Param("name") String name,
  152. @Param("times") Integer times,
  153. @Param("dept") String dept,
  154. @Param("ward") String ward,
  155. @Param("userCode") String userCode,
  156. @Param("bedNo") String bedNo,
  157. @Param("admissWard") String admissWard);
  158. @Insert("<script>" +
  159. "INSERT INTO yz_act_order (order_code, order_name, frequ_code, infant_flag, order_time, physician, start_time, " +
  160. " act_order_no, inpatient_no, admiss_times, drug_flag, enter_oper, enter_time, status_flag, " +
  161. " signer, confirm_time, " +
  162. " self_buy, pay_self, serial, group_no, doctor_flag, dept_code, ward_code, reg_flag," +
  163. "yb_self_flag,emergency_flag,exec_unit) " +
  164. " VALUES " +
  165. "<foreach collection='list' item='item' separator=','>" +
  166. " ('${yzCode}', '${item.orderName}', 'ONCE', #{p.infantFlag}, getdate(), #{userCode}, getdate(), " +
  167. " #{item.actOrderNo}, #{p.inpatientNo}, " +
  168. " #{p.admissTimes}, 'p', #{userCode}, getdate(), '1', #{userCode}, getdate(), '0', '0', '00', '00', '1', #{p.deptCode}, #{p.deptCode}," +
  169. "'1',#{item.ybSelfFlag},#{item.urgentClinicFlag},#{execUnit})" +
  170. "</foreach>" +
  171. "</script>")
  172. void chaRuYiZhu(@Param("list") List<OpRecord> list,
  173. @Param("p") XinZhenYiZhu p,
  174. @Param("userCode") String userCode,
  175. @Param("execUnit") String execUnit,
  176. @Param("yzCode") String yzCode);
  177. @Select("select * from op_record with (NOLOCK) where record_id = #{id}")
  178. OpRecord shouShuXinXi(Integer id);
  179. @Update("update op_record set status = 'd' where record_id = #{id}")
  180. void genXingShanChuBiaoZhi(Integer id);
  181. @Select("select count(1) from op_zd_part where name = #{name} and del_flag = 0")
  182. Boolean repeatPartName(String name);
  183. @Select("select cast(max(code) as INTEGER) as code from op_zd_part")
  184. Integer getTheMaximumSurgicalCode();
  185. @Insert("insert into op_zd_part (code, name, py_code, d_code) " +
  186. "values (#{code}, #{name}, #{py}, #{wb})")
  187. void insertNewSurgicalSite(@Param("code") String code,
  188. @Param("name") String name,
  189. @Param("py") String py,
  190. @Param("wb") String wb);
  191. @Update("update op_zd_part set del_flag = 1 where code = #{code}")
  192. void removeSurgicalSite(String code);
  193. }