JianYanJianChaDao.java 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import com.baomidou.mybatisplus.core.metadata.IPage;
  5. import com.baomidou.mybatisplus.core.toolkit.Constants;
  6. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7. import org.apache.ibatis.annotations.*;
  8. import thyyxxk.webserver.entity.casefrontsheet.YshHzRecord;
  9. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  10. import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.*;
  11. import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.dto.JyJcCheckItemDto;
  12. import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.vo.ViewInspectionItemDetailsVo;
  13. import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.PatientTemp;
  14. import java.math.BigDecimal;
  15. import java.util.Date;
  16. import java.util.List;
  17. import java.util.Map;
  18. /**
  19. * <p>
  20. * 描述: 检查申请
  21. * </p>
  22. *
  23. * @author xc
  24. * @date 2022-02-10 15:42
  25. */
  26. @Mapper
  27. public interface JianYanJianChaDao {
  28. @Select("select order_name,req_no,act_order_no, " +
  29. "start_time,inpatient_no,admiss_times,receive_flag," +
  30. "patient_uid,inspect_stuff_name = (select rtrim(name) from ysh_zd_part_code where code = inspect_stuff)," +
  31. " (select rtrim(name)\n" +
  32. " from ysh_zd_part_code\n" +
  33. " where code = inspect_part) inspect_part_name " +
  34. "from ysh_yj_req with (NOLOCK) " +
  35. " ${ew.customSqlSegment} ")
  36. List<YshYjReq> huoQuJianChaShenQingV2(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
  37. @Select("select req_no,\n" +
  38. " inpatient_no,\n" +
  39. " p_name,\n" +
  40. " p_age,\n" +
  41. " admiss_times,\n" +
  42. " bed_no,\n" +
  43. " p_bar_code,\n" +
  44. " group_name,\n" +
  45. " act_order_no,\n" +
  46. " order_code,\n" +
  47. " order_name,\n" +
  48. " page_no,\n" +
  49. " req_comment,\n" +
  50. " req_doctor,\n" +
  51. " req_dept,\n" +
  52. " req_ward,\n" +
  53. " exec_dept,\n" +
  54. " req_date,\n" +
  55. " sample_status,\n" +
  56. " print_flag,\n" +
  57. " receive_flag,\n" +
  58. " req_type,\n" +
  59. " result_comment,\n" +
  60. " sys_date,\n" +
  61. " start_time,\n" +
  62. " isnull(diag_text,\n" +
  63. " (select name\n" +
  64. " from zd_icd_code_new\n" +
  65. " where code = diag_code)) as diag_text,\n" +
  66. " order_type,\n" +
  67. " report_no,\n" +
  68. " jz_flag,\n" +
  69. " req_studyid,\n" +
  70. " req_tz_comment,\n" +
  71. " req_other_result,\n" +
  72. " receive_jc,\n" +
  73. " diag_code,\n" +
  74. " confirm_flag,\n" +
  75. " confirm_time,\n" +
  76. " confirm_id,\n" +
  77. " quantity,\n" +
  78. " inspect_part,\n" +
  79. " inspect_stuff,\n" +
  80. " (select rtrim(name)\n" +
  81. " from jy_zd_sample with (NOLOCK)\n" +
  82. " where code = inspect_stuff) inspect_stuff_name,\n" +
  83. " (select rtrim(name)\n" +
  84. " from ysh_zd_part_code\n" +
  85. " where code = inspect_part) inspect_part_name,\n" +
  86. " (select rtrim(name)\n" +
  87. " from zd_unit_code\n" +
  88. " where code = req_dept) as req_dept_name,\n" +
  89. " (select rtrim(name)\n" +
  90. " from zd_unit_code\n" +
  91. " where code = req_ward) as req_ward_name,\n" +
  92. " (select rtrim(name)\n" +
  93. " from a_employee_mi\n" +
  94. " where code = req_doctor) as req_doctor_name,\n" +
  95. " case\n" +
  96. " when req_type = '2' then (select rtrim(class)\n" +
  97. " from jy_zd_item c\n" +
  98. " where c.zy_order_code = order_code)\n" +
  99. " else '00'\n" +
  100. " end classes\n" +
  101. "from ysh_yj_req with (NOLOCK)" +
  102. "${ew.customSqlSegment}")
  103. List<YshYjReq> huoQuShengQingXiangQing(@Param("ew") QueryWrapper<YshYjReq> reqNo);
  104. @Select("select top 1 sex, " +
  105. " rtrim(home_street) as home_street," +
  106. " rtrim(home_tel) as home_tel," +
  107. " responceTypeName = (select responce_type_name = (select rtrim(name) from zy_zd_responce_type where code = responce_type) \n" +
  108. "from zy_actpatient with (NOLOCK) \n" +
  109. "where inpatient_no = #{patNo}) " +
  110. "from a_patient_mi with (NOLOCK) " +
  111. "where inpatient_no = #{patNo}")
  112. PatientTemp huoQuHuanZheXinXi(@Param("patNo") String patNo);
  113. @Select("select responce_type_name = (select rtrim(name) from zy_zd_responce_type where code = responce_type) " +
  114. "from zy_actpatient with (NOLOCK) " +
  115. "where inpatient_no = #{patNo}")
  116. String huoQuHuanZheShenFen(@Param("patNo") String patNo);
  117. @Select("select rtrim(comm) comm, " +
  118. " comment1, " +
  119. " comment2, " +
  120. " comment3, " +
  121. " comment4, " +
  122. " comment5, " +
  123. " comment6, " +
  124. " comment7, " +
  125. " comment8 " +
  126. "from jc_zd_class with (NOLOCK) " +
  127. "where code = #{code}")
  128. JcZdClass daYingXiangQing(@Param("code") String code);
  129. @Select("select tc_name as name," +
  130. " rtrim(tc_no) as code," +
  131. " '1' as isTheParentNode " +
  132. "from zy_tc_yj c with (NOLOCK)" +
  133. "where isnull(del_flag, '0') = '0' and " +
  134. "${ew.sqlSegment}")
  135. List<JcZdClass> getTemplate(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
  136. @Select("select op_id,tc_exec " +
  137. "from zy_tc_yj with (NOLOCK) " +
  138. "where tc_no = #{code}")
  139. ZyTcYj jianChaLuRuRen(String code);
  140. @Delete("delete zy_tc_yj " +
  141. "where tc_no = #{code}; " +
  142. "delete zy_tc_detail_yj " +
  143. "where tc_no = #{code};")
  144. void shanChuJianChaMuBan(String code);
  145. @Select("SELECT rtrim(a.order_code) as orderCode, " +
  146. " rtrim(a.order_name) as orderName, " +
  147. " rtrim(a.order_code) as code, " +
  148. " rtrim(a.order_name) as name, " +
  149. " rtrim(a.yb_comment) ybComment, " +
  150. " '0' as checkFlag, " +
  151. " a.exec_dept as execDept, " +
  152. " a.order_type as orderType, " +
  153. " (select rtrim(name) from zd_unit_code with (NOLOCK) where code = a.exec_dept) execDeptName, " +
  154. " CONVERT(varchar(100), GETDATE(), 20) as startTime," +
  155. " inspect_stuff as inspectStuff , " +
  156. " inspectStuffName = (select rtrim(name) from jy_zd_sample with (NOLOCK) where code = inspect_stuff)," +
  157. " rtrim(c.tc_no) as tc_no," +
  158. " '2' as isTheParentNode, " +
  159. " case when c.req_type = '2' then (select rtrim(class) from jy_zd_item yj where yj.zy_order_code = a.order_code) " +
  160. " else (select rtrim(class) from jc_zd_item yj where yj.zy_order_code = a.order_code) end as classes " +
  161. "FROM yz_order_item a with (NOLOCK), " +
  162. " zy_tc_detail_yj b with (NOLOCK), " +
  163. " zy_tc_yj c with (NOLOCK) " +
  164. "where b.tc_no = c.tc_no " +
  165. " and a.order_code = b.order_code " +
  166. " and isnull(a.del_flag, '') <> '1'" +
  167. " and isnull(c.del_flag, '') <> '1' " +
  168. " and ${ew.sqlSegment} " +
  169. " order by sort_no desc ")
  170. List<Map<String, String>> selectTemplateContent(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
  171. @Select("SELECT rtrim(a.order_code) as orderCode,\n" +
  172. " rtrim(a.order_name) as orderName,\n" +
  173. " rtrim(a.order_code) as code,\n" +
  174. " rtrim(a.order_name) as name,\n" +
  175. " rtrim(a.yb_comment) ybComment,\n" +
  176. " '0' as checkFlag,\n" +
  177. " a.exec_dept as execDept,\n" +
  178. " a.order_type as orderType,\n" +
  179. " (select rtrim(name)\n" +
  180. " from zd_unit_code with (NOLOCK)\n" +
  181. " where code = a.exec_dept) execDeptName,\n" +
  182. " CONVERT(varchar(100), GETDATE(), 20) as startTime,\n" +
  183. " inspect_stuff as inspectStuff,\n" +
  184. " inspectStuffName = (select rtrim(name) from jy_zd_sample with (NOLOCK) where code = inspect_stuff)," +
  185. " inspect_part AS inspectPart, " +
  186. " (select rtrim(name)\n" +
  187. " from ysh_zd_part_code\n" +
  188. " where code = inspect_part) inspectPartName,\n" +
  189. " rtrim(c.tc_no) as tc_no,\n" +
  190. " '2' as isTheParentNode,\n" +
  191. " class as classes,\n" +
  192. " note,\n" +
  193. " collection_info as collectionInfo,\n" +
  194. " gender_restriction AS genderRestriction,\n" +
  195. " min_age_restriction AS minAgeRestriction,\n" +
  196. " max_age_restriction AS maxAgeRestriction\n" +
  197. "FROM yz_order_item a with (NOLOCK),\n" +
  198. " zy_tc_detail_yj b with (NOLOCK),\n" +
  199. " zy_tc_yj c with (NOLOCK),\n" +
  200. " ${tableName} jyjc\n" +
  201. "where b.tc_no = c.tc_no\n" +
  202. " and a.order_code = b.order_code\n" +
  203. " and isnull(a.del_flag, '') <> '1'\n" +
  204. " and isnull(c.del_flag, '') <> '1'\n" +
  205. " and jyjc.zy_order_code = a.order_code\n" +
  206. " and isnull(jyjc.zy_flag, '0') != '1'\n" +
  207. " and c.tc_no = #{code}\n" +
  208. " and c.req_type = #{type}\n" +
  209. "order by item_no ")
  210. List<Map<String, String>> getTemplateByCodeAndType(@Param("code") String code, @Param("type") String type,
  211. @Param("tableName") String tableName);
  212. @Select("<script>" +
  213. "SELECT jc_text,name,code,wh_flag,op_id " +
  214. "FROM ysh_zd_yj_template with (NOLOCK) " +
  215. "WHERE (py_code like #{name} or d_code like #{name} or name like #{name}) " +
  216. "<if test=\"leiXing == 1\">" +
  217. " and op_id = #{userCode} " +
  218. "</if>" +
  219. "<if test=\"leiXing == 2\">" +
  220. " and dept_code = (select rtrim(dept_code) from a_employee_mi where code = #{userCode}) and wh_flag = '2' " +
  221. "</if>" +
  222. "<if test=\"leiXing == 3\">" +
  223. " and wh_flag = '3' " +
  224. "</if>" +
  225. "</script>")
  226. Page<YshZdYjTemplate> huoQuShuoMingMuBan(IPage<YshZdYjTemplate> page,
  227. @Param("name") String name,
  228. @Param("leiXing") Integer leiXing,
  229. @Param("userCode") String userCode);
  230. @Select("select * from ysh_zd_yj_template with (NOLOCK) where code = #{code}")
  231. YshZdYjTemplate muBanShuJu(String code);
  232. @Update("update ysh_zd_yj_template " +
  233. "set jc_text = #{jcText}, " +
  234. " name = #{name}, " +
  235. " py_code = #{pyCode}, " +
  236. " d_code = #{dCode}, " +
  237. " sys_date = getdate() " +
  238. "where code = #{code} ")
  239. void genXingShouMingMuBan(@Param("jcText") String jcText,
  240. @Param("name") String name,
  241. @Param("pyCode") String pyCode,
  242. @Param("dCode") String dCode,
  243. @Param("code") String code);
  244. @Delete("delete from ysh_zd_yj_template where code = #{code} ")
  245. void shanChuShouMingMuBan(String code);
  246. @Insert("insert into ysh_zd_yj_template (code, name, py_code, d_code, jc_text, jc_type, dept_code, op_id, sys_date, wh_flag) " +
  247. "values (#{code}, #{name}, #{pyCode}, #{dCode}, #{jcText}, 3, " +
  248. "(select rtrim(a_employee_mi.dept_code) from a_employee_mi where a_employee_mi.code = #{opId}), #{opId}, getdate(), #{whFlag})")
  249. void xinZengShouMingMuBan(YshZdYjTemplate param);
  250. @Select("select rtrim(code) as code, rtrim(name) as name " +
  251. "from zd_icd_code_new with (NOLOCK) where del_flag=0 " +
  252. "and (yb_code like #{name} or yb_name like #{name} or yb_py_code like #{name})")
  253. List<GetDropdownBox> diagnosisInOurHospital(String name);
  254. @Select("select tc_no " +
  255. "from zy_tc_yj with (NOLOCK) " +
  256. "where op_id = #{code} " +
  257. " and tc_name = #{name}" +
  258. " and req_type = #{reqType} ")
  259. List<String> huoQuJianChaJianYanChongFuMuBanMing(@Param("name") String name,
  260. @Param("code") String code,
  261. @Param("reqType") String reqType);
  262. /**
  263. * 插入检查或检验模板
  264. */
  265. @Insert("INSERT INTO zy_tc_yj (tc_no, tc_name, tc_exec, del_flag, py_code, d_code, n_code, order_type/*1个人 2-科室*/,op_id, " +
  266. " req_type, tc_flag/*录入方式 1-手工选择 0-自动选择*/, create_date, sort_no) " +
  267. "VALUES (#{tcNo}, #{tcName}, #{tcExec}, N'0',#{pyCode}, #{dCode}, null, #{orderType}, #{opId}, #{reqType}, #{tcFlag}, getdate(), #{sortNo});")
  268. void chaRuJCJYMuBan(ZyTcYj param);
  269. @Insert("<script>" +
  270. "insert into zy_tc_detail_yj (tc_no, order_code, inspect_part, inspect_stuff, item_no) " +
  271. "values " +
  272. "<foreach collection='list' item='item' index='index' separator=','>" +
  273. "(#{tcNo}, #{item.orderCode}, " +
  274. "(select bw_code " +
  275. "from jc_zd_item " +
  276. "where zy_order_code = #{item.orderCode}) , #{item.inspectStuff}" +
  277. ", ${index} + 1)" +
  278. "</foreach>" +
  279. "</script>")
  280. void chaRuJCJYMuBanNeiRong(List<YshHzRecord> list,
  281. @Param("tcNo") String tcNo,
  282. @Param("reqType") String reqType);
  283. @Insert("<script>" +
  284. "insert into ysh_yj_req (req_no, inpatient_no, p_name, p_age, admiss_times, bed_no, group_name/* order_name一样*/, " +
  285. " act_order_no, order_code, order_name, page_no/* req_no */, req_comment, req_doctor, " +
  286. " req_dept, req_ward, exec_dept, req_date,/*getdate*/ " +
  287. " receive_flag/*1*/, req_type/*2检验3检查*/, sys_date/*getdate*/, start_time , diag_code, " +
  288. " diag_text, " +
  289. " order_type, jz_flag/*1 和 null*/, req_tz_comment/*体征信息*/, req_other_result/*相关辅检结果*/," +
  290. "inspect_stuff,inspect_part,quantity, charge_fee) " +
  291. "values " +
  292. "<foreach collection='list' item='item' separator=','>" +
  293. "(#{item.reqNo}, #{inpatientNo}, #{name}, #{age}, #{admissTimes}, #{bedNo}, #{item.orderName}, " +
  294. " #{item.actOrderNo}, #{item.orderCode}, cast(#{item.orderName} as varchar(60)) , #{item.reqNo}, #{item.reqComment}, #{userCode}, " +
  295. " #{deptCode}, #{wardCode}, #{item.execDept}, #{reqDate}, '1', #{reqType}, #{reqDate}, #{reqDate},#{item.diagCode},#{item.diagText}, " +
  296. " (select class from ${orderTypeTable} where zy_order_code = #{item.orderCode})," +
  297. " #{item.jzFlag},#{item.reqTzComment},#{item.reqOtherResult}," +
  298. " #{item.inspectStuff}, #{item.inspectPart},#{item.quantity},#{item.chargeFee})" +
  299. "</foreach>" +
  300. "</script>")
  301. void chaRuShenQing(@Param("list") List<YshYjReq> list,
  302. @Param("inpatientNo") String inpatientNo,
  303. @Param("name") String name,
  304. @Param("age") String age,
  305. @Param("admissTimes") Integer admissTimes,
  306. @Param("bedNo") String bedNo,
  307. @Param("userCode") String userCode,
  308. @Param("deptCode") String deptCode,
  309. @Param("wardCode") String wardCode,
  310. @Param("reqType") String reqType,
  311. @Param("orderTypeTable") String orderTypeTable,
  312. @Param("reqDate") Date reqDate);
  313. @Insert("<script>" +
  314. "INSERT INTO yz_act_order (order_code, order_name, frequ_code, infant_flag/*婴儿标志*/, order_time, physician, start_time, " +
  315. " act_order_no, inpatient_no, admiss_times, drug_flag/*o*/, enter_oper/*录入人*/, enter_time/*录时间*/, " +
  316. " status_flag/*2*/, confirm_time, signer,/*在我这里保存了医嘱就直接确定了*/ " +
  317. " self_buy/*0*/, pay_self/*0*/, serial/*00*/, group_no/*00*/, doctor_flag, exec_unit, dept_code, " +
  318. " ward_code, reg_flag/*1*/,emergency_flag,yb_self_flag, dose,drug_quan) " +
  319. "VALUES " +
  320. "<foreach collection='list' item='item' separator=','>" +
  321. "(#{item.orderCode}, #{item.orderName}, 'ONCE', #{infantFlag}, #{item.startTime}, #{userCode}, #{item.startTime}, " +
  322. " #{item.actOrderNo}, #{inpatientNo}, " +
  323. " #{admissTimes}, 'o', #{userCode}, #{reqDate}, '2', #{reqDate}, #{userCode}, '0', '0', '00', '00', '1', " +
  324. " #{item.execDept}, " +
  325. " #{deptCode}, #{wardCode}, '1',#{item.jzFlag},#{item.ybSelfFlag},#{item.quantity},#{item.quantity})" +
  326. "</foreach>" +
  327. "</script>")
  328. void chaRuShenQingYiZhu(@Param("list") List<YshYjReq> list,
  329. @Param("inpatientNo") String inpatientNo,
  330. @Param("admissTimes") Integer admissTimes,
  331. @Param("userCode") String userCode,
  332. @Param("deptCode") String deptCode,
  333. @Param("wardCode") String wardCode,
  334. @Param("infantFlag") Integer infantFlag,
  335. @Param("reqDate") Date reqDate);
  336. @Select("select req_no," +
  337. " inpatient_no," +
  338. " admiss_times, " +
  339. " group_name," +
  340. " order_name, " +
  341. " act_order_no, " +
  342. " order_code, " +
  343. " req_comment, " +
  344. " req_doctor, " +
  345. " req_doctor_name= (select rtrim(name) from a_employee_mi with (NOLOCK) where code = req_doctor), " +
  346. " req_dept, " +
  347. " req_dept_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = req_dept)," +
  348. " req_ward_name = (select rtrim(name) from zd_unit_code where code = req_ward), " +
  349. " exec_dept, " +
  350. " exec_dept_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_dept), " +
  351. " req_date, " +
  352. " inspect_stuff, " +
  353. " inspect_stuff_name = (select rtrim(name) from jy_zd_sample with (NOLOCK) where code = inspect_stuff), " +
  354. " jz_flag," +
  355. " receive_flag " +
  356. " from ysh_yj_req with (NOLOCK) " +
  357. " ${ew.customSqlSegment} ")
  358. List<YshYjReq> huoQuJianYanV2(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
  359. @Select("SELECT rtrim(a.code) as code, " +
  360. " rtrim(a.name) as name " +
  361. "FROM jy_zd_class a with (NOLOCK), " +
  362. " yz_order_item b with (NOLOCK) " +
  363. "where a.code = b.jy_type " +
  364. " and isnull(b.del_flag, '') <> '1' " +
  365. "group by a.code, a.name ")
  366. IPage<JcZdClass> jianYanFenLei(IPage<JcZdClass> page);
  367. @Select("select rtrim(code) as code,name from ${tableName} with (NOLOCK) " +
  368. "where isnull(del_flag, '0') = '0' and (name like #{name} " +
  369. " or py_code like #{name} " +
  370. " or code like #{name} or d_code like #{name} )")
  371. List<GetDropdownBox> biaoBenOrBuWei(String name, String tableName);
  372. @Select("select * " +
  373. "from ysh_yj_req with (NOLOCK) where req_no = #{reqNo} and inpatient_no = #{patNo} and admiss_times = #{times}")
  374. YshYjReq huoQuJianYanJianCha(@Param("reqNo") Integer reqNo,
  375. @Param("patNo") String patNo,
  376. @Param("times") Integer times);
  377. @Select("select count(1) " +
  378. "from yz_zy_patient_fee " +
  379. "where act_order_no = #{yj.actOrderNo} " +
  380. " and inpatient_no = #{yj.inpatientNo} " +
  381. " and admiss_times = #{yj.admissTimes} " +
  382. " and charge_status not in ('3','2') ")
  383. int selecePatientFee(@Param("yj") YshYjReq yj);
  384. @Delete("delete from ysh_yj_req where req_no = #{reqNo} and inpatient_no = #{patNo} and admiss_times = #{times}")
  385. void shanChuJianYanJianCha(@Param("reqNo") Integer reqNo,
  386. @Param("patNo") String patNo,
  387. @Param("times") Integer times);
  388. @Update("update yz_zy_patient_fee " +
  389. "set charge_status = '2', " +
  390. " op_id = #{userCode}, " +
  391. " op_date = getdate() " +
  392. "where inpatient_no = #{yj.inpatientNo} " +
  393. " and admiss_times = #{yj.admissTimes} " +
  394. " and act_order_no = #{yj.actOrderNo} " +
  395. " and charge_status = '3'")
  396. void cancellationOfConfirmedFees(@Param("yj") YshYjReq yj,
  397. @Param("userCode") String userCode);
  398. @Update("update yz_act_order " +
  399. "set status_flag = '-1', " +
  400. " instruction = N'作废'," +
  401. " order_name = N'作废' + order_name " +
  402. "where act_order_no = #{orderNo} ")
  403. void shanChuYiZhu(@Param("orderNo") BigDecimal orderNo);
  404. @Select("select a.order_code, " +
  405. " a.occ_code, " +
  406. " b.name, " +
  407. " a.amount, " +
  408. " cast(a.amount * b.charge_amount as varchar) as charge_amount, " +
  409. " cast(b.charge_amount as varchar) as unit_price," +
  410. " national_code, " +
  411. " national_name " +
  412. "from yz_order_occurence a, " +
  413. " zd_charge_item b " +
  414. "where a.occ_code = b.code " +
  415. " and a.order_code = #{orderCode}")
  416. List<ViewInspectionItemDetailsVo.Item> viewInspectionItemDetails(String orderCode);
  417. @Select("select top 1 jc_id from yj_jc_patient where ba_no = #{patNo} ")
  418. String getJcIdByPatNo(String patNo);
  419. @Select("select count(1) from zy_detail_charge where order_no = #{yj.actOrderNo} and inpatient_no = #{yj.inpatientNo} and admiss_times = #{yj.admissTimes} ")
  420. int selectedFeeCount(@Param("yj") YshYjReq yj);
  421. @Select("select fs_icd_text,report_no,check_date,his_req_no,report_id," +
  422. "report_name = (select name from a_employee_mi where code = report_id)," +
  423. "report_date,confirm_id,confirm_name = (select name from a_employee_mi where code = confirm_id),confirm_date " +
  424. "from yj_jc_record where his_req_no = #{reqNo} and jc_id = #{jcId}")
  425. YjJcRecord getJcRecord(String reqNo, String jcId);
  426. @Select("select text_zd,text_jc from " +
  427. "yj_jc_record_report where report_no = #{report} and title_code = '01' ")
  428. Map<String, String> selectTextJc(String report);
  429. @Select("select time_limit, note, collection_info\n" +
  430. "from ${tableName}\n" +
  431. "where zy_order_code = #{code}\n")
  432. ViewInspectionItemDetailsVo selectJcJyItem(String tableName, String code);
  433. /**
  434. * 获取检验大类
  435. *
  436. * @return
  437. */
  438. @Select("select rtrim(code) as code,name as name from jy_zd_class")
  439. List<JyJcItem> queryInspectionClassification();
  440. /**
  441. * 获取详细的检验项目
  442. *
  443. * @return
  444. */
  445. @Select("select rtrim(a.zy_order_code) as code,\n" +
  446. " rtrim(a.name) as name,\n" +
  447. " rtrim(a.class) as classes,\n" +
  448. " exec_unit,\n" +
  449. " exec_unit_name = (select name from zd_unit_code where code = a.exec_unit),\n" +
  450. " '2' as type,\n" +
  451. " isnull(b.sample, a.sample_code) as inspectStuff,\n" +
  452. " inspectStuffName = (select rtrim(name)\n" +
  453. " from jy_zd_sample with (NOLOCK)\n" +
  454. " where code = isnull(b.sample, a.sample_code)),\n" +
  455. " note,\n" +
  456. " collection_info,\n" +
  457. " gender_restriction,\n" +
  458. " min_age_restriction,\n" +
  459. " max_age_restriction,\n" +
  460. " rtrim(a.py_code) as py_code,\n" +
  461. " rtrim(a.d_code) as d_code\n" +
  462. "from jy_zd_item a\n" +
  463. " left join yz_order_item b on (a.zy_order_code = b.order_code)\n" +
  464. "where isnull(a.del_flag, '0') != '1'\n" +
  465. " and isnull(b.del_flag, '0') <> '1'")
  466. List<JyJcItem> getJyDetailedItems();
  467. @Select("select rtrim(code) as code,rtrim(name) as name from jc_zd_class")
  468. List<JyJcItem> queryCheckClassification();
  469. @Select("select a.zy_order_code as code, " +
  470. " isnull(b.name,'') as bw, " +
  471. " a.name, " +
  472. " rtrim(class) as classes, " +
  473. " exec_unit," +
  474. " exec_unit_name = (select name from zd_unit_code where zd_unit_code.code = exec_unit)," +
  475. " note , collection_info , gender_restriction ," +
  476. " min_age_restriction, max_age_restriction, " +
  477. "rtrim(a.py_code) as py_code , " +
  478. "rtrim(a.d_code) as d_code " +
  479. "from jc_zd_item a " +
  480. " left join ysh_zd_part_code b on (a.bw_code = b.code)" +
  481. " left join yz_order_item c on (c.order_code = a.zy_order_code) " +
  482. "where isnull(a.del_flag, '0')<> '1' " +
  483. " and isnull(zy_flag, '0') <> '1'" +
  484. " and isnull(c.del_flag, '0') <> '1' " +
  485. "order by class")
  486. List<JyJcItem> selectJcDetailItems();
  487. @Select("select top 1 req_comment,req_tz_comment,req_other_result,diag_code,diag_text " +
  488. "from ysh_yj_req where inpatient_no = #{patNo} and admiss_times = #{times} and req_comment is not null order by start_time desc")
  489. YshYjReq getAncillaryInformation(@Param("patNo") String patNo,
  490. @Param("times") Integer times);
  491. @Update("update ysh_yj_req set patient_uid = #{uid} where req_no = #{reqNo}")
  492. void setCheckPatientUid(String uid, Integer reqNo);
  493. @Select("select jc_id from yj_jc_patient where ba_no = #{patNo}")
  494. List<String> getJcIdByPatNoList(String patNo);
  495. @Select("select apply_date,\n" +
  496. " apply_doctor_name = (select rtrim(name) from a_employee_mi where code = apply_doctor),\n" +
  497. " orderName = (select rtrim(name) from jc_zd_item where zy_order_code = order_code),\n" +
  498. " text_zd,\n" +
  499. " text_jc " +
  500. "from yj_jc_record a,\n" +
  501. " yj_jc_record_report b\n" +
  502. "where a.jc_id = #{jcId}" +
  503. " and a.report_no = b.report_no\n" +
  504. " and b.title_code = '01' " +
  505. " order by apply_date desc")
  506. List<JianChaJieGuo> selectJieGuo(String jcId);
  507. @Select("select note , collection_info as collectionInfo from ${tableName} where zy_order_code= #{orderCode}")
  508. JSONObject getExamineIllustrate(String orderCode, String tableName);
  509. @Select("select gender_restriction,\n" +
  510. " max_age_restriction,\n" +
  511. " min_age_restriction,\n" +
  512. " zy_order_code as code,rtrim(class) as order_type," +
  513. " rtrim(name) as name," +
  514. " cast(rtrim(isnull(nullif(del_flag,\n" +
  515. " ''),\n" +
  516. " 0)) as int) as del_flag ${col} " +
  517. " from ${tableName} \n" +
  518. " where ${ew.sqlSegment};")
  519. List<JyJcCheckItemDto> selectJyJcCheckItemDtoByOrderCode(@Param("ew") QueryWrapper<?> queryWrapper,
  520. @Param("tableName") String tableName,
  521. @Param("col") String col);
  522. @Select("select cast(rtrim(isnull(nullif(c.del_flag,\n" +
  523. " ''),\n" +
  524. " 0)) as int) item_del_flag,\n" +
  525. " cast(rtrim(isnull(nullif(a.del_flag,\n" +
  526. " ''),\n" +
  527. " 0)) as int) as order_del_flag,\n" +
  528. " a.order_name,\n" +
  529. " c.name,rtrim(a.order_code) as code " +
  530. "from yz_order_item a\n" +
  531. " left join yz_order_occurence b on (a.order_code = b.order_code)\n" +
  532. " left join zd_charge_item c on (c.code = b.occ_code)\n" +
  533. "where ${ew.sqlSegment};")
  534. List<JyJcCheckItemDto.ItemInfo> selectItemDetailsByOrderCode(@Param("ew") QueryWrapper<?> queryWrapper);
  535. @Select("select rtrim(code) code, rtrim(name) name , rtrim(parent_code) as parent_code\n" +
  536. "from ysh_zd_part_code\n" +
  537. "where isnull(del_flag, 0) = 0\n")
  538. List<GetDropdownBox> selectBuWeiAll();
  539. @Select("select rtrim(parent_code) as parent_code\n" +
  540. "from ysh_zd_part_code\n" +
  541. "where isnull(del_flag, 0) = 0\n" +
  542. " and parent_code is not null\n" +
  543. "group by parent_code")
  544. List<String> selectBuWeiParentCode();
  545. }