BedDeptDictDao.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. package thyyxxk.webserver.dao.his.dictionary;
  2. import org.apache.ibatis.annotations.Delete;
  3. import org.apache.ibatis.annotations.Insert;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Param;
  6. import org.apache.ibatis.annotations.Select;
  7. import org.apache.ibatis.annotations.Update;
  8. import java.util.List;
  9. import java.util.Map;
  10. @Mapper
  11. public interface BedDeptDictDao {
  12. @Select(" select a.ward_code as wardCode, " +
  13. " a.dept_code as deptCode, " +
  14. " a.openbed_num as openbedNum, " +
  15. " a.borrowbed_num as borrowBedNum, " +
  16. " a.lentbed_num as lentbedNum, " +
  17. " rtrim(a.ward_name) as wardName, " +
  18. " rtrim(a.dept_name) as deptName, " +
  19. " rtrim(a.ward_py_code) as wardPyCode, " +
  20. " rtrim(a.ward_d_code) as wardDCode, " +
  21. " rtrim(a.dept_py_code) as deptPyCode, " +
  22. " rtrim(a.dept_d_code) as deptDCode, " +
  23. " a.start_day_time_kf as startDayTimeKf, " +
  24. " a.ward_only as wardOnly, " +
  25. " a.deposit_limit as depositLimit, " +
  26. " a.owe_limit as oweLimit " +
  27. " from zy_adtward as a " +
  28. " where (a.dept_py_code like '${text}%' or a.ward_py_code like '${text}%') " +
  29. " or (a.dept_d_code like '${text}%' or a.ward_d_code like '${text}%') " +
  30. " or (a.dept_code like '${text}%' or a.ward_code like '${text}%') " +
  31. " or (a.dept_name like '${text}%' or a.ward_name like '${text}%') " +
  32. "order by a.dept_code,a.ward_code ")
  33. List<Map<String, Object>> selectDeptInfoForBed(@Param("text") String text);
  34. @Select(" select b.ward_code as wardCode, " +
  35. " b.bed_status as bedStatus, " +
  36. " case when b.bed_status='2' then '占用' else '空闲' end as bedStatusName, " +
  37. " b.bed_no as bedNo, " +
  38. " b.room_no as roomNo, " +
  39. " b.dept_code as deptCode, " +
  40. " b.room_rate1 as roomRate1, " +
  41. " b.room_rate2 as roomRate2, " +
  42. " b.eff_date1 as effDate1, " +
  43. " b.eff_date2 as effDate2, " +
  44. " b.heating_fee as heatingFee, " +
  45. " b.aircondition_fee as airConditionFee, " +
  46. " b.heatcold_flag as heatColdFlag, " +
  47. " b.inpatient_no as inpatientNo, " +
  48. " b.admiss_times as admissTimes, " +
  49. " b.sex, " +
  50. " b.percent2, " +
  51. " b.percent3, " +
  52. " b.percent4, " +
  53. " b.percent5, " +
  54. " b.type, " +
  55. " b.percent1, " +
  56. " b.special_charge as specialCharge, " +
  57. " b.remark, " +
  58. " b.zy_serial_no as zySerialNo, " +
  59. " b.charge_code_bed as chargeCodeBed, " +
  60. " rtrim(t.name) as chargeCodeBedName, " +
  61. " b.charge_code_air as chargeCodeAir, " +
  62. " rtrim(s.name) as chargeCodeAirName " +
  63. " from zy_bed_mi as b left join zd_charge_item as t " +
  64. " on b.charge_code_bed = t.code " +
  65. " left join zd_charge_item as s " +
  66. " on b.charge_code_air = s.code " +
  67. " where b.ward_code = #{wardCode} " +
  68. "order by b.bed_no ")
  69. List<Map<String, Object>> selectBedInfoForDept(@Param("wardCode") String wardCode);
  70. @Select(" select a.code as value, " +
  71. " a.exec_unit as execUnit, " +
  72. " a.name as label, " +
  73. " a.charge_amount as price, " +
  74. " a.bill_item_zy as billItemCode, " +
  75. " a.py_code as pyCode, " +
  76. " a.d_code as dCode, " +
  77. " isnull(a.suppress_flag,'0') as suppressFlag, " +
  78. " a.bill_item_out as billItemOut, " +
  79. " a.n_code as nCode, " +
  80. " isnull(a.self_flag,'0') as selfFlag, " +
  81. " isnull(a.separate_flag,'0') as separateFlag ," +
  82. " a.charge_unit as spec, " +
  83. " b.name as execName, " +
  84. " '00' as serial, " +
  85. " '00' as groupNo " +
  86. " from zd_charge_item a left join zd_unit_code b on a.exec_unit = b.code " +
  87. " where isnull(a.del_flag,'') <> '1' " +
  88. " and isnull(a.in_out_flag,'') <> '1' " +
  89. " and (a.py_code like '${text}%' " +
  90. " or a.d_code like '${text}%' " +
  91. " or a.code like '${text}%' " +
  92. " or a.name like '${text}%' " +
  93. " or a.n_code like '${text}%') " +
  94. "order by a.name ")
  95. List<Map<String, Object>> selectAirItemInfo(@Param("text") String text);
  96. @Update("<script>" +
  97. "<foreach item='item' collection='list' >" +
  98. " update zy_adtward set openbed_num = #{item.openbedNum} " +
  99. " where ward_code = #{item.deptCode} and dept_code = #{item.deptCode} " +
  100. "</foreach>" +
  101. "</script>")
  102. int updateDeptInfoForBed(@Param("list") List<Map<String, Object>> list);
  103. @Update("<script>" +
  104. "<foreach item='item' collection='list' >" +
  105. " update zy_bed_mi set type = #{item.type}, bed_no = #{item.bedNo}, room_no = #{item.roomNo}, sex = #{item.sex}, " +
  106. " room_rate1 = #{item.roomRate1}, charge_code_bed = #{item.chargeCodeBed}, heating_fee = #{item.heatingFee}, " +
  107. " aircondition_fee = #{item.airConditionFee}, charge_code_air = #{item.chargeCodeAir}, special_charge = #{item.specialCharge}, " +
  108. " room_rate2 = #{item.roomRate2}, heatcold_flag = #{item.heatColdFlag} " +
  109. " where ward_code = #{item.deptCode} and bed_no = #{item.bedNo} and dept_code = #{item.deptCode} " +
  110. "</foreach>" +
  111. "</script>")
  112. int updateBedInfoForDept(@Param("list") List<Map<String, Object>> list);
  113. @Select(" select count(*) as num from zy_bed_mi where ward_code = #{wardCode} and dept_code = #{deptCode} and bed_no = #{bedNo} ")
  114. int selectBedInfoForDeptAndBedNo(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode, @Param("bedNo") String bedNo);
  115. @Insert("insert into zy_bed_mi (ward_code, bed_no, room_no, dept_code, bed_status, room_rate1, room_rate2, heating_fee," +
  116. " aircondition_fee, heatcold_flag, sex, type, special_charge, charge_code_bed, charge_code_air) values " +
  117. " (#{wardCode}, #{bedNo}, #{roomNo}, #{deptCode}, #{bedStatus}, #{roomRate1}, #{roomRate2}, #{heatingFee}," +
  118. " #{airConditionFee}, #{heatColdFlag}, #{sex}, #{type}, #{specialCharge}, #{chargeCodeBed}, #{chargeCodeAir}) ")
  119. int saveBedForDeptAndBedNo(Map<String, Object> bedInfo);
  120. @Select(" select * from zy_adtward where ward_code = #{wardCode} and dept_code = #{deptCode} ")
  121. Map<String, Object> selectRoomDeptByCode(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode);
  122. @Update("<script>" +
  123. "update zy_adtward " +
  124. "<trim prefix=\"set\" suffixOverrides=\",\">" +
  125. "<if test=\"wardCode != null and wardCode != '' \">" +
  126. "ward_code = #{wardCode}, " +
  127. "</if>" +
  128. "<if test=\"wardName != null and wardName != '' \">" +
  129. "ward_name = #{wardName}, " +
  130. "</if>" +
  131. "<if test=\"deptCode != null and deptCode != '' \">" +
  132. "dept_code = #{deptCode}, " +
  133. "</if>" +
  134. "<if test=\"deptName != null and deptName != '' \">" +
  135. "dept_name = #{deptName}, " +
  136. "</if>" +
  137. "<if test=\"wardPyCode != null and wardPyCode != '' \">" +
  138. "ward_py_code = #{wardPyCode}, " +
  139. "</if>" +
  140. "<if test=\"wardDCode != null and wardDCode != '' \">" +
  141. "ward_d_code = #{wardDCode}, " +
  142. "</if>" +
  143. "<if test=\"deptPyCode != null and deptPyCode != '' \">" +
  144. "dept_py_code = #{deptPyCode}, " +
  145. "</if>" +
  146. "<if test=\"deptDCode != null and deptDCode != '' \">" +
  147. "dept_d_code = #{deptDCode}, " +
  148. "</if>" +
  149. "<if test=\"openbedNum != null and openbedNum != '' \">" +
  150. "openbed_num = #{openbedNum}, " +
  151. "</if>" +
  152. "<if test=\"oweLimit != null and oweLimit != '' \">" +
  153. "owe_limit = #{oweLimit}, " +
  154. "</if>" +
  155. "</trim>" +
  156. "where ward_code = #{wardCode} and dept_code = #{deptCode} " +
  157. "</script>")
  158. int updateRoomDeptByCode(Map<String, Object> roomDept);
  159. @Insert(" insert into zy_adtward(ward_code, dept_code, openbed_num, ward_name, dept_name, " +
  160. " ward_py_code, ward_d_code, dept_py_code, dept_d_code, owe_limit) " +
  161. " values (#{wardCode}, #{deptCode}, #{openbedNum}, #{wardName}, #{deptName}, " +
  162. " #{wardPyCode}, #{wardDCode}, #{deptPyCode}, #{deptDCode}, #{oweLimit})")
  163. int insertRoomDept(Map<String, Object> roomDept);
  164. @Delete(" delete from zy_adtward where ward_code = #{wardCode} and dept_code = #{deptCode} ")
  165. int deleteRoomDeptByCode(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode);
  166. @Select("select ad2.dept_code as deptCode, ad1.ward_code as wardCode, " +
  167. " ad2.dept_name as deptName, ad1.ward_name as wardName, " +
  168. " ad2.dept_py_code as deptPyCode, ad1.ward_py_code as wardPyCode, " +
  169. " ad2.dept_d_code as deptDCode, ad1.ward_d_code as wardDCode, " +
  170. " al.dept, al.small_dept as smallDept, al.dept_id as deptId " +
  171. " from zd_dept_all as al " +
  172. " inner join zy_adtward as ad1 on ad1.ward_code = al.dept " +
  173. " inner join zy_adtward as ad2 on ad2.ward_code = al.small_dept " +
  174. " where (ad1.dept_py_code like '${text}%' or ad1.ward_py_code like '${text}%' " +
  175. " or ad1.dept_d_code like '${text}%' or ad1.ward_d_code like '${text}%' " +
  176. " or ad1.dept_code like '${text}%' or ad1.ward_code like '${text}%' " +
  177. " or ad1.dept_name like '${text}%' or ad1.ward_name like '${text}%') ")
  178. List<Map<String, Object>> selectSmallDept(@Param("text") String text);
  179. @Select(" select * from zd_dept_all where dept_id = #{deptId} ")
  180. Map<String, Object> selectSmallDeptByCode(@Param("deptId") Integer deptId);
  181. @Select(" select count(*) cs from zd_dept_all where dept = #{dept} and small_dept = #{smallDept} ")
  182. int selectSmallDeptByDept(@Param("dept") String dept, @Param("smallDept") String smallDept);
  183. @Update("<script>" +
  184. "update zd_dept_all " +
  185. "<trim prefix=\"set\" suffixOverrides=\",\">" +
  186. "<if test=\"dept != null and dept != '' \">" +
  187. "dept = #{dept}, " +
  188. "</if>" +
  189. "<if test=\"smallDept != null and smallDept != '' \">" +
  190. "small_dept = #{smallDept}, " +
  191. "</if>" +
  192. "</trim>" +
  193. "where dept_id = #{deptId} " +
  194. "</script>")
  195. int updateSmallDeptByCode(Map<String, Object> smallMap);
  196. @Insert(" insert into zd_dept_all(dept, small_dept) values (#{dept}, #{smallDept})")
  197. int insertSmallDept(Map<String, Object> smallMap);
  198. @Delete(" delete from zd_dept_all where dept_id = #{deptId} ")
  199. int deleteSmallDeptByCode(@Param("deptId") String deptId);
  200. }