PatientDao.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. package thyyxxk.webserver.dao.his.inpatient;
  2. import org.apache.ibatis.annotations.*;
  3. import org.springframework.web.bind.annotation.RequestParam;
  4. import thyyxxk.webserver.entity.dictionary.CodeName;
  5. import thyyxxk.webserver.entity.inpatient.ZyActpatient;
  6. import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbDiag;
  7. import thyyxxk.webserver.entity.inpatient.patient.*;
  8. import java.util.Date;
  9. import java.util.List;
  10. @Mapper
  11. public interface PatientDao {
  12. @Select("select " +
  13. "RTRIM(a.bed_no) bedNo, " +
  14. "RTRIM(a.inpatient_no) inpatientNo, " +
  15. "a.admiss_times, " +
  16. "RTRIM(a.name) as name, " +
  17. "sex=isnull(a.sex, 9), " +
  18. "mdtrtId=(select b.mdtrt_id from t_si_pat_info b where b.pat_no=a.inpatient_no " +
  19. "and b.times=a.admiss_times and b.ledger_sn=a.times_billed), " +
  20. "injurySerialNo=(select serial_no from t_injury_si_pat_info where pat_no=a.inpatient_no " +
  21. "and times=a.admiss_times and ledger_sn=a.times_billed), " +
  22. "medType=a.med_type, " +
  23. "dismissOrder=(select count(1) from yz_act_order b where b.inpatient_no=a.inpatient_no " +
  24. "and b.admiss_times=a.admiss_times and status_flag > '1' and isnull(group_no,'00')='00' " +
  25. "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')))," +
  26. "orderNoCount = (select count(1) " +
  27. " from yz_act_order c " +
  28. " where a.inpatient_no = c.inpatient_no " +
  29. " and c.admiss_times = a.admiss_times " +
  30. " and c.status_flag = '1' " +
  31. " and c.enter_oper = #{userCode}), " +
  32. " rtrim(refer_physician) refer_physician, " +
  33. " (select rtrim(name) from a_employee_mi where code = refer_physician) as refer_physician_name, " +
  34. " rtrim(consult_physician) consult_physician, " +
  35. " (select rtrim(name) from a_employee_mi where code = consult_physician) as consult_physician_name, " +
  36. " rtrim(dept_director) dept_director, " +
  37. " (select rtrim(name) from a_employee_mi where code = dept_director) as dept_director_name, " +
  38. " total_charge, " +
  39. " balance, " +
  40. " rtrim(admiss_diag) as admiss_diag, " +
  41. " rtrim(admiss_diag_str) as admiss_diag_str, " +
  42. " rtrim(clinic_diag_str) as clinic_diag_str, " +
  43. " responce_type_name = (select rtrim(name) from zy_zd_responce_type where code = responce_type)," +
  44. " admiss_date,zkys," +
  45. " zkys_name =(select rtrim(name) from a_employee_mi where code = zkys) " +
  46. "from zy_actpatient a left join batj_ba2 ba on (a.inpatient_no = ba.zyh and a.admiss_times = ba.zycs) " +
  47. "where a.bed_status <> '0' and a.ward like #{ward} ${sql} " +
  48. "ORDER BY cast(a.bed_no AS int)")
  49. List<Overview> getOverView(@Param("ward") String ward,
  50. @Param("userCode") String userCode,
  51. @Param("sql") String sql);
  52. @Select("<script>" +
  53. "select inpatientNo=rtrim(a.inpatient_no),a.admiss_times,a.med_type,b.social_no,dis_date,consult_physician,dept_director," +
  54. "consult_physician_name = (select name from a_employee_mi where a_employee_mi.code = consult_physician)," +
  55. "dept_director_name = (select name from a_employee_mi where a_employee_mi.code = dept_director)," +
  56. "zkys= (select zkys from batj_ba2 ba where ba.zyh = a.inpatient_no and ba.zycs = a.admiss_times)," +
  57. "mz_no = (select rtrim(mz_no) from a_patient_mi where a_patient_mi.inpatient_no = a.inpatient_no)," +
  58. "zk_ward,zk_ward_name = (select rtrim(name) from zd_unit_code where code=zk_ward), " +
  59. "name=rtrim(a.name),sex=isnull(a.sex, b.sex),act_ipt_days=(datediff(day, admiss_date, isnull(dis_date,getdate()))), " +
  60. "birthDate=(convert(varchar(10), birth_date, 21)),home_tel=rtrim(b.home_tel), " +
  61. "admissPhysician=rtrim(a.admiss_physician),b.psn_cert_type, " +
  62. "insutype=(select top 1 insutype from t_si_pat_info with(nolock) where pat_no=#{inpatientNo} and " +
  63. "times=a.admiss_times order by ledger_sn desc), " +
  64. "psnType=(select max(psn_type) from t_si_pat_info with(nolock) where pat_no=#{inpatientNo} and times=a.admiss_times), " +
  65. "psnIdetType=(select max(psn_idet_type) from t_si_pat_info with(nolock) where pat_no=#{inpatientNo} and times=a.admiss_times), " +
  66. "admissPhysicianName=rtrim((select name FROM a_employee_mi WHERE code = a.admiss_physician)), " +
  67. "referPhysician=rtrim(a.refer_physician), " +
  68. "referPhysicianName=rtrim((select name FROM a_employee_mi WHERE code = a.refer_physician)), " +
  69. "admissDiag=rtrim(isnull(a.admiss_diag,'')), " +
  70. "admissDiagStr=rtrim(isnull(a.admiss_diag_str,'')), " +
  71. "clinicDiagStr=rtrim(isnull(a.clinic_diag_str,'')), " +
  72. "admissWard=rtrim(isnull(a.ward,a.admiss_ward)), " +
  73. "admissWardName=(select rtrim(name) from zd_unit_code where code=a.ward), " +
  74. "admissDept=rtrim(a.admiss_dept), a.matn_type,smallDept=rtrim(a.small_dept), " +
  75. "smallDeptName=rtrim((select name from zd_unit_code where code=small_dept)), " +
  76. "admiss_date,ybRegisterDate=isnull(yb_register_date, admiss_date), " +
  77. "responceType=a.med_type,a.dise_code,a.dise_name, " +
  78. "zkWard=rtrim(a.zk_ward),ward=(a.ward),a.latechb_flag,a.pret_flag,ledgerSn=a.times_billed, " +
  79. "admissStatus=rtrim(a.admiss_status), " +
  80. "dismissOrder=(select count(1) from yz_act_order y where y.inpatient_no=b.inpatient_no " +
  81. "and y.admiss_times=a.admiss_times and status_flag>'1' and isnull(group_no,'00')='00' " +
  82. "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))), " +
  83. "disDiagStatus=(select RTRIM(dis_diag_status) from zy_dis_diag_yb where inpatient_no=a.inpatient_no " +
  84. "and admiss_times=a.admiss_times and dis_diag_no=1), " +
  85. "operation=rtrim(a.operation),a.zy_serial_no, " +
  86. "bedNo=rtrim(a.bed_no),a.admdvs,a.exp_content, " +
  87. "dutyNurse=(select rtrim(job_nurse) from batj_ba2 t where t.zyh=a.inpatient_no and t.zycs=a.admiss_times), " +
  88. "rtrim(b.country) as country, rtrim(b.nation_code) as nation," +
  89. "rtrim(b.relation_name) as contactName, rtrim(relation_code) as contactRelation, " +
  90. "rtrim(b.relation_street) as contactAddrName, rtrim(relation_tel) as contactPhone, " +
  91. "mdtrtId=(select mdtrt_id from t_si_pat_info where pat_no=a.inpatient_no and times=a.admiss_times and ledger_sn=a.times_billed), " +
  92. "injurySerialNo=(select serial_no from t_injury_si_pat_info where pat_no=a.inpatient_no " +
  93. "and times=a.admiss_times and ledger_sn=a.times_billed), " +
  94. "chargeYb=(select isnull(charge_yb, '0.00') from zy_ledger_file where inpatient_no=a.inpatient_no " +
  95. "and admiss_times=a.admiss_times and ledger_sn=a.times_billed), " +
  96. "totalCharge=(select rtrim(isnull(total_charge, '0.00')) from zy_ledger_file where inpatient_no=a.inpatient_no " +
  97. "and admiss_times=a.admiss_times and ledger_sn=a.times_billed), " +
  98. "isnull(final_control,0) as final_control FROM ${table} a with(nolock), " +
  99. "a_patient_mi b with(nolock) WHERE a.inpatient_no=#{inpatientNo} " +
  100. "<if test=\"times != null and times != 0 \">" +
  101. "and a.admiss_times =#{times} " +
  102. "</if>" +
  103. " AND b.inpatient_no=a.inpatient_no" +
  104. "</script>")
  105. Patient getPatientInfo(@Param("inpatientNo") String inpatientNo, @Param("table") String table, @Param("times") Integer times);
  106. @Select("select max(insuplc_admdvs) from t_si_pat_info where pat_no=#{patNo} " +
  107. "and times=#{times} and ledger_sn=#{ledgerSn}")
  108. Integer getPatAdmdvs(String patNo, int times, int ledgerSn);
  109. @Select("select parent_code from t_region where code=#{code}")
  110. Integer selectParentRegion(Integer code);
  111. @Select("select dis_diag_no, " +
  112. "rtrim(dis_diag) disDiag, " +
  113. "rtrim(dis_diag_comment) disDiagComment, " +
  114. "dis_diag_status, " +
  115. "opName=(select rtrim(name) from a_employee_mi where code=op_id_code) " +
  116. "from zy_dis_diag_yb where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
  117. List<ZyDisYbDiag> getYibaoDisDiags(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
  118. @Select("select * from zy_dis_diag_yb where inpatient_no=#{patNo} and admiss_times=#{times}")
  119. List<ZyDisYbDiag> getZyDisYbDiags(@Param("patNo") String patNo, @Param("times") Integer times);
  120. @Select("SELECT dis_diag_no, " +
  121. "rtrim(dis_diag) disDiag, " +
  122. "rtrim(dis_diag_comment) disDiagComment, " +
  123. "disDiagStatusName=(select rtrim(name) from zd_dis_diag_status WHERE code=dis_diag_status), " +
  124. "opName=(select rtrim(name) from a_employee_mi where code=op_id_code) " +
  125. "from ba_first_page1 where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
  126. List<ZyDisYbDiag> getBingliDisDiags(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
  127. @Select("select rtrim(inpatient_no) from a_patient_mi where social_no=#{idCard}")
  128. List<String> getInpatientNo(@Param("idCard") String idCard);
  129. @Select("SELECT item_no, inpatient_no, admiss_times, agency, expirestart, file_sfz " +
  130. "FROM zy_xnh_record_sfz WHERE inpatient_no=#{inpatientNo} AND admiss_times=#{admissTimes}")
  131. List<IdCard> getIdCard(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
  132. @Select("select agency, expirestart, sfz_image as fileSfz " +
  133. "from patient_mi_sfz where social_no=#{socialNo}")
  134. List<IdCard> selectIdCard(@Param("socialNo") String socialNo);
  135. @Select("SELECT item_no,inpatient_no,admiss_times,file_xnh AS file_sfz FROM zy_xnh_record " +
  136. "WHERE inpatient_no=#{inpatientNo} AND admiss_times=#{admissTimes}")
  137. List<IdCard> getScanFile(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
  138. @Select("select settle_type from zy_ledger_file where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} " +
  139. "and ledger_sn=(select isnull(max ( ledger_sn ), min ( ledger_sn )) from zy_ledger_file where " +
  140. "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes})")
  141. Integer getSettleType(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
  142. @Select("select count(id) from zy_retract_yb where inpatientNo=#{inpatientNo} " +
  143. "and admissTimes=#{admissTimes} and requestType=#{requestType}")
  144. Integer getRequestCount(@Param("inpatientNo") String inpatientNo,
  145. @Param("admissTimes") Integer admissTimes,
  146. @Param("requestType") Integer requestType);
  147. @Select("select * from zy_retract_yb where inpatientNo=#{inpatientNo} and " +
  148. "admissTimes=#{admissTimes} and requestType=#{requestType}")
  149. List<ToYbkRequest> getRetractRequests(@Param("inpatientNo") String inpatientNo,
  150. @Param("admissTimes") Integer admissTimes,
  151. @Param("requestType") Integer requestType);
  152. @Insert("insert into zy_retract_yb (inpatientNo, admissTimes, name, sex, responceType, ybType, treatType, " +
  153. "remark, inputId, inputName, inputTimes, statusFlag, requestType) values (#{inpatientNo}, #{admissTimes}, " +
  154. "#{name}, #{sex}, #{responceType}, #{ybType}, #{treatType}, #{remark}, #{inputId}, #{inputName}," +
  155. "#{inputTimes}, 1, #{requestType})")
  156. void submitNewRequest(ToYbkRequest indata);
  157. @Select("select isnull(max ( ledger_sn ), isnull(min ( ledger_sn ), 1)) from zy_ledger_file where " +
  158. "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
  159. Integer getLedgerSn(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes);
  160. @Update("update zy_actpatient set yb_register_date=#{ybRegisterDate},med_type=#{medType},responce_type=#{responceType}, " +
  161. "admdvs=#{admdvs},refer_physician=#{referPhysician},matn_type=#{matnType},latechb_flag=#{latechbFlag}," +
  162. "pret_flag=#{pretFlag},dise_code=#{diseCode},dise_name=#{diseName},exp_content=#{expContent},name=#{name}, " +
  163. "sex=#{sex} where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
  164. void updateZyActpatient(Patient param);
  165. @Select("select count(1) from batj_ba2 with(nolock) where bah=#{bah} and zycs=#{times}")
  166. int isBatjBa2Exist(@Param("bah") String bah, @Param("times") int times);
  167. @Insert("insert into batj_ba2 (bah, zyh, zycs, job_nurse) values (#{bah}, #{bah}, #{times}, #{dutyNurse})")
  168. void createBatjBa2(@Param("bah") String bah, @Param("times") int times, @Param("dutyNurse") String dutyNurse);
  169. @Update("update batj_ba2 set job_nurse=#{dutyNurse} where zyh=#{bah} and zycs=#{times}")
  170. void updateBatjBa2(@Param("bah") String bah, @Param("times") int times, @Param("dutyNurse") String dutyNurse);
  171. @Update("update a_patient_mi set psn_cert_type=#{psnCertType},social_no=#{socialNo}," +
  172. "country=#{country},nation_code=#{nation},relation_name=#{contactName}," +
  173. "relation_code=#{contactRelation},relation_street=#{contactAddrName},sex=#{sex}, " +
  174. "relation_tel=#{contactPhone},home_tel=#{homeTel} where inpatient_no=#{inpatientNo}")
  175. void updateAPatientMi(Patient patient);
  176. @Select("select * from zy_in_diag_yb where inpatient_no=#{inpatientNo} and admiss_times=#{times} order by diag_no")
  177. List<ZyInYbDiag> getZyInYbDiag(@Param("inpatientNo") String inpatientNo, @Param("times") Integer times);
  178. @Delete("delete from zy_in_diag_yb where inpatient_no=#{inpatientNo} and admiss_times=#{times}")
  179. void deleteOldZyInYbDiag(@Param("inpatientNo") String inpatientNo, @Param("times") Integer times);
  180. @Insert("<script>" +
  181. "insert into zy_in_diag_yb (inpatient_no, admiss_times, diag_no, " +
  182. "icd_code, icd_text, oper_id, op_date, diag_type) values " +
  183. "<foreach collection='list' item='diag' separator=','>" +
  184. "(#{diag.inpatientNo},#{diag.admissTimes},#{diag.diagNo}," +
  185. "#{diag.icdCode},#{diag.icdText},#{operId},#{diag.opDate},#{diag.diagType})" +
  186. "</foreach>" +
  187. "</script>")
  188. void insertNewZyInYbDiag(@Param("operId") String operId, @Param("list") List<ZyInYbDiag> list);
  189. @Insert("<script>" +
  190. "insert into zy_in_diag_yb (inpatient_no, admiss_times, diag_no, " +
  191. "icd_code, icd_text, oper_id, op_date, diag_type) values " +
  192. "<foreach collection='diags' item='diag' separator=','>" +
  193. "(#{inpatientNo},#{admissTimes},#{diag.diagNo},#{diag.icdCode}," +
  194. "#{diag.icdText},#{staffId},getdate(),#{diag.diagType})" +
  195. "</foreach>" +
  196. "</script>")
  197. void insertSiZyInYbDiag(SaveSiZyDiags param);
  198. @Select("select convert (varchar(12),dateadd (day,0,start_time),111) from yz_act_order where " +
  199. "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and status_flag > '1' " +
  200. "and isnull(group_no,'00')='00' and order_code in " +
  201. "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')) ")
  202. String getActOrderDisDate(@Param("inpatientNo") String inpatientNo,
  203. @Param("admissTimes") Integer admissTimes);
  204. @Select("select act_order_no from yz_sequence")
  205. float getActOrderNo();
  206. @Update("update yz_sequence set act_order_no=#{no}")
  207. void updateActorOrderNo(float no);
  208. @Insert("insert into yz_act_order " +
  209. "(act_order_no, inpatient_no, admiss_times, order_code, order_time, frequ_code, enter_time, " +
  210. "enter_oper, start_time, end_time, infant_flag, drug_flag, performance_time, " +
  211. "physician, confirm_time, signer, status_flag, status_time,drug_specification,order_name,discription, " +
  212. "ward_code,dept_code,exec_unit) " +
  213. "values (#{actOrderNo}, #{inpatientNo}, #{admissTimes}, " +
  214. "(select top 1 order_code from yz_zd_order_item_confirm where item_name=N'出院'), " +
  215. "#{dismissOrderDate}, 'ONCE', #{dismissOrderDate},#{staffId}, #{dismissOrderDate}, #{dismissOrderDate}, " +
  216. "0, 0, #{dismissOrderDate}, #{staffId},#{dismissOrderDate}, #{staffId}, 5, #{dismissOrderDate}," +
  217. "'诊疗项目','今日结账出院','0.00 本项目不包含费用'," +
  218. "#{admissWard},#{admissWard},#{admissWard})")
  219. void insertNewDismissActOrder(@Param("actOrderNo") float actOrderNo,
  220. @Param("inpatientNo") String inpatientNo,
  221. @Param("admissTimes") Integer admissTimes,
  222. @Param("dismissOrderDate") Date dismissOrderDate,
  223. @Param("staffId") String staffId,
  224. @Param("admissWard") String admissWard);
  225. @Select("select * from zy_dis_diag_yb where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
  226. List<ZyDisYbDiag> getDisDiags(@Param("inpatientNo") String inpatientNo,
  227. @Param("admissTimes") Integer admissTimes);
  228. @Select("select rtrim(admiss_diag) code,rtrim(admiss_diag_str) name from zy_actpatient where " +
  229. "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes}")
  230. CodeName getAdmissDiag(@Param("inpatientNo") String inpatientNo,
  231. @Param("admissTimes") Integer admissTimes);
  232. @Insert("insert into zy_dis_diag_yb (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " +
  233. "dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, si_diag_type) " +
  234. "values (#{inpatientNo}, #{admissTimes}, 1, 13, #{code}, #{name}, #{staffId}, getDate(), '普通', 0, 1)")
  235. void insertDisDiag(@Param("inpatientNo") String inpatientNo,
  236. @Param("admissTimes") Integer admissTimes,
  237. @Param("code") String code,
  238. @Param("name") String name,
  239. @Param("staffId") String staffId);
  240. @Insert("<script>" +
  241. "insert into zy_dis_diag_yb (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " +
  242. "dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, si_diag_type) values " +
  243. "<foreach collection='list' item='diag' separator=','>" +
  244. "(#{diag.inpatientNo},#{diag.admissTimes},#{diag.diagNo}, 13, " +
  245. "#{diag.icdCode},#{diag.icdText},#{staffId},getdate(), '普通', 0, 1)" +
  246. "</foreach>" +
  247. "</script>")
  248. void insertDisDiags(@Param("staffId") String staffId, @Param("list") List<ZyInYbDiag> list);
  249. @Update("update zy_detail_charge set charge_date=#{newDate} where inpatient_no=#{zyh} " +
  250. "and admiss_times=#{times} and CONVERT(varchar(20), charge_date, 20) <= #{admdate}")
  251. void correctFeeChargeTimeBeforeAdmiss(@Param("zyh") String zyh,
  252. @Param("times") int times,
  253. @Param("admdate") Date admdate,
  254. @Param("newDate") Date newDate);
  255. @Select("select start_time from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  256. "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
  257. "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
  258. Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
  259. @Update("update zy_detail_charge set charge_date=#{disdate} where inpatient_no=#{zyh} " +
  260. "and admiss_times=#{times} and charge_date>#{disdate}")
  261. void correctFeeChargeTimeAfterDismiss(@Param("zyh") String zyh,
  262. @Param("times") int times,
  263. @Param("disdate") Date disdate);
  264. @Update("update zy_ledger_file set deposit=(select isnull(sum(depo_amount),0) from zy_deposit_file f with(nolock) " +
  265. "where f.inpatient_no=#{zyh} and f.admiss_times=#{times} and f.ledger_sn=#{ledger} and f.status in ('1','2') ) " +
  266. "where inpatient_no=#{zyh} and admiss_times=#{times} and ledger_sn=#{ledger} and account_date is null")
  267. void recountDeposit(@Param("zyh") String zyh,
  268. @Param("times") int times,
  269. @Param("ledger") int ledger);
  270. @Update("execute zy_receive_drug #{zyh},#{times},#{zyh},#{infant} ")
  271. void zyReceiveDrug(@Param("zyh") String zyh,
  272. @Param("times") int times,
  273. @Param("infant") int infant);
  274. @Update("execute zy_receive_one #{zyh},#{times},#{zyh},#{infant} ")
  275. void zyReceiveOne(@Param("zyh") String zyh,
  276. @Param("times") int times,
  277. @Param("infant") int infant);
  278. @Update("execute dbo.zy_cngl_fyjs_list_yz #{zyh},#{times} ")
  279. void zyCnglFyjsListYz(@Param("zyh") String zyh,
  280. @Param("times") int times);
  281. @Update("update zy_detail_charge set charge_status='2' where " +
  282. "inpatient_no=#{zyh} and admiss_times=#{times} and ledger_sn=#{ledger} ")
  283. void updateZyDetailCharge(@Param("zyh") String zyh,
  284. @Param("times") int times,
  285. @Param("ledger") int ledger);
  286. @Update("execute zy_calc_detail_again_new #{zyh},#{times},#{ledger},1,1")
  287. void zyCalcDetailAgainNew(@Param("zyh") String zyh,
  288. @Param("times") int times,
  289. @Param("ledger") int ledger);
  290. @Update("update zy_ledger_file set balance=(deposit+isnull(charge_yb,0)-total_charge) where " +
  291. "inpatient_no=#{zyh} and admiss_times=#{times} and ledger_sn=#{ledger}")
  292. void updateBalance(@Param("zyh") String zyh,
  293. @Param("times") int times,
  294. @Param("ledger") int ledger);
  295. @Select("select balance from zy_ledger_file where inpatient_no=#{zyh} and admiss_times=#{times} and ledger_sn=#{ledger}")
  296. String selectLedgerBalance(@Param("zyh") String zyh,
  297. @Param("times") int times,
  298. @Param("ledger") int ledger);
  299. @Update("update zy_actpatient set balance=#{balance} where inpatient_no=#{zyh}")
  300. void updateZyActPatientBalance(@Param("zyh") String zyh, @Param("balance") String balance);
  301. @Select("select chronic_disease_type " +
  302. "from crm_patient_mi " +
  303. "where social_no = #{socialNo} ")
  304. String getCrmBySocialNo(String socialNo);
  305. @Select("select name " +
  306. "from crm_zd_visit_type " +
  307. "where code in (${typeList})")
  308. List<String> getCrmTypeName(String typeList);
  309. /**
  310. * 查询患者的医保参保地行政区划
  311. *
  312. * @param patNo 住院号
  313. * @param times 住院次数
  314. * @param ledgerSn 账页号
  315. * @return 医保参保地行政区划
  316. */
  317. @Select("select insuplc_admdvs from t_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  318. String selectInsuplcAdmdvs(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);
  319. /**
  320. * 查询患者的取消入院登记次数
  321. *
  322. * @param patNo 住院号
  323. * @param times 住院次数
  324. * @param ledgerSn 账页号
  325. * @return 取消入院登记次数
  326. */
  327. @Select("select cance_admiss_count from t_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  328. String selectCanceAdmissCount(@Param("patNo") String patNo, @Param("times") Integer times, @Param("ledgerSn") Integer ledgerSn);
  329. @Select("select * from zy_actpatient z left join a_patient_mi a on a.inpatient_no=z.inpatient_no where a.social_no=#{socialNo}")
  330. ZyActpatient getZyActpatient(@Param("socialNo") String socialNo);
  331. }