BedDeptDictDao.java 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package thyyxxk.webserver.dao.his.dictionary;
  2. import org.apache.ibatis.annotations.Insert;
  3. import org.apache.ibatis.annotations.Mapper;
  4. import org.apache.ibatis.annotations.Param;
  5. import org.apache.ibatis.annotations.Select;
  6. import org.apache.ibatis.annotations.Update;
  7. import java.util.List;
  8. import java.util.Map;
  9. @Mapper
  10. public interface BedDeptDictDao {
  11. @Select(" select a.ward_code as wardCode, " +
  12. " a.dept_code as deptCode, " +
  13. " a.openbed_num as openBedNum, " +
  14. " a.borrowbed_num as borrowBedNum, " +
  15. " a.lentbed_num as lentbedNum, " +
  16. " rtrim(a.ward_name) as wardName, " +
  17. " rtrim(a.dept_name) as deptName, " +
  18. " rtrim(a.ward_py_code) as wardPyCode, " +
  19. " rtrim(a.ward_d_code) as wardDCode, " +
  20. " rtrim(a.dept_py_code) as deptPyCode, " +
  21. " rtrim(a.dept_d_code) as deptDCode, " +
  22. " a.start_day_time_kf as startDayTimeKf, " +
  23. " a.ward_only as wardOnly, " +
  24. " a.deposit_limit as depositLimit, " +
  25. " a.owe_limit as oweLimit " +
  26. " from zy_adtward as a " +
  27. " where (a.dept_py_code like '${text}%' or a.ward_py_code like '${text}%') " +
  28. " or (a.dept_d_code like '${text}%' or a.ward_d_code like '${text}%') " +
  29. " or (a.dept_code like '${text}%' or a.ward_code like '${text}%') " +
  30. " or (a.dept_name like '${text}%' or a.ward_name like '${text}%') " +
  31. "order by a.dept_code,a.ward_code ")
  32. List<Map<String, Object>> selectDeptInfoForBed(@Param("text") String text);
  33. @Select(" select b.ward_code as wardCode, " +
  34. " b.bed_status as bedStatus, " +
  35. " case when b.bed_status = '2' then '占用' else '空闲' end as bedStatusName, " +
  36. " b.bed_no as bedNo, " +
  37. " b.room_no as roomNo, " +
  38. " b.dept_code as deptCode, " +
  39. " b.room_rate1 as roomRate1, " +
  40. " b.room_rate2 as roomRate2, " +
  41. " b.eff_date1 as effDate1, " +
  42. " b.eff_date2 as effDate2, " +
  43. " b.heating_fee as heatingFee, " +
  44. " b.aircondition_fee as airConditionFee, " +
  45. " b.heatcold_flag as heatColdFlag, " +
  46. " b.inpatient_no as inpatientNo, " +
  47. " b.admiss_times as admissTimes, " +
  48. " b.sex, " +
  49. " b.percent2, " +
  50. " b.percent3, " +
  51. " b.percent4, " +
  52. " b.percent5, " +
  53. " b.type, " +
  54. " b.percent1, " +
  55. " b.special_charge as specialCharge, " +
  56. " b.remark, " +
  57. " b.zy_serial_no as zySerialNo, " +
  58. " b.charge_code_bed as chargeCodeBed, " +
  59. " rtrim(t.name) as chargeCodeBedName, " +
  60. " b.charge_code_air as chargeCodeAir, " +
  61. " rtrim(s.name) as chargeCodeAirName " +
  62. " from zy_bed_mi as b left join zd_charge_item as t " +
  63. " on b.charge_code_bed = t.code " +
  64. " left join zd_charge_item as s " +
  65. " on b.charge_code_air = s.code " +
  66. " where b.ward_code = #{wardCode} " +
  67. "order by b.bed_no ")
  68. List<Map<String, Object>> selectBedInfoForDept(@Param("wardCode") String wardCode);
  69. @Select(" select a.code as value, " +
  70. " a.exec_unit as execUnit, " +
  71. " a.name as label, " +
  72. " a.charge_amount as price, " +
  73. " a.bill_item_zy as billItemCode, " +
  74. " a.py_code as pyCode, " +
  75. " a.d_code as dCode, " +
  76. " isnull(a.suppress_flag,'0') as suppressFlag, " +
  77. " a.bill_item_out as billItemOut, " +
  78. " a.n_code as nCode, " +
  79. " isnull(a.self_flag,'0') as selfFlag, " +
  80. " isnull(a.separate_flag,'0') as separateFlag ," +
  81. " a.charge_unit as spec, " +
  82. " b.name as execName, " +
  83. " '00' as serial, " +
  84. " '00' as groupNo " +
  85. " from zd_charge_item a left join zd_unit_code b on a.exec_unit = b.code " +
  86. " where isnull(a.del_flag,'') <> '1' " +
  87. " and isnull(a.in_out_flag,'') <> '1' " +
  88. " and (a.py_code like '${text}%' " +
  89. " or a.d_code like '${text}%' " +
  90. " or a.code like '${text}%' " +
  91. " or a.name like '${text}%' " +
  92. " or a.n_code like '${text}%') " +
  93. "order by a.name ")
  94. List<Map<String, Object>> selectAirItemInfo(@Param("text") String text);
  95. @Update("<script>" +
  96. "<foreach item='item' collection='list' >" +
  97. " update zy_adtward set openbed_num = #{item.openBedNum} " +
  98. " where ward_code = #{item.deptCode} and dept_code = #{item.deptCode} " +
  99. "</foreach>" +
  100. "</script>")
  101. int updateDeptInfoForBed(@Param("list") List<Map<String, Object>> list);
  102. @Update("<script>" +
  103. "<foreach item='item' collection='list' >" +
  104. " update zy_bed_mi set type = #{item.type}, bed_no = #{item.bedNo}, room_no = #{item.roomNo}, sex = #{item.sex}, " +
  105. " room_rate1 = #{item.roomRate1}, charge_code_bed = #{item.chargeCodeBed}, heating_fee = #{item.heatingFee}, " +
  106. " aircondition_fee = #{item.airConditionFee}, charge_code_air = #{item.chargeCodeAir}, special_charge = #{item.specialCharge}, " +
  107. " room_rate2 = #{item.roomRate2}, heatcold_flag = #{item.heatColdFlag} " +
  108. " where ward_code = #{item.deptCode} and bed_no = #{item.bedNo} and dept_code = #{item.deptCode} " +
  109. "</foreach>" +
  110. "</script>")
  111. int updateBedInfoForDept(@Param("list") List<Map<String, Object>> list);
  112. @Select(" select count(*) as num from zy_bed_mi where ward_code = #{wardCode} and dept_code = #{deptCode} and bed_no = #{bedNo} ")
  113. int selectBedInfoForDeptAndBedNo(@Param("wardCode") String wardCode, @Param("deptCode") String deptCode, @Param("bedNo") String bedNo);
  114. @Insert("insert into zy_bed_mi (ward_code, bed_no, room_no, dept_code, bed_status, room_rate1, room_rate2, heating_fee," +
  115. " aircondition_fee, heatcold_flag, sex, type, special_charge, charge_code_bed, charge_code_air) values " +
  116. " (#{wardCode}, #{bedNo}, #{roomNo}, #{deptCode}, #{bedStatus}, #{roomRate1}, #{roomRate2}, #{heatingFee}," +
  117. " #{airConditionFee}, #{heatColdFlag}, #{sex}, #{type}, #{specialCharge}, #{chargeCodeBed}, #{chargeCodeAir}) ")
  118. int saveBedForDeptAndBedNo(Map<String, Object> bedInfo);
  119. }