YiZhuLuRuDao.java 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. package thyyxxk.webserver.dao.his.zhuyuanyisheng;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.baomidou.mybatisplus.core.conditions.Wrapper;
  4. import com.baomidou.mybatisplus.core.toolkit.Constants;
  5. import org.apache.ibatis.annotations.*;
  6. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  7. import thyyxxk.webserver.entity.datamodify.SelectV2;
  8. import thyyxxk.webserver.entity.datamodify.YzActOrder;
  9. import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
  10. import thyyxxk.webserver.entity.inpatient.patient.Overview;
  11. import thyyxxk.webserver.entity.inpatient.patient.Patient;
  12. import thyyxxk.webserver.entity.login.UserInfo;
  13. import thyyxxk.webserver.entity.medicine.YpZdGroupName;
  14. import thyyxxk.webserver.entity.yzcheck.ChargeLimitations;
  15. import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
  16. import thyyxxk.webserver.entity.zhuyuanyisheng.OneClickOrder;
  17. import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
  18. import thyyxxk.webserver.entity.zhuyuanyisheng.dto.doctorAuth.DoctorAuthParams;
  19. import thyyxxk.webserver.entity.zhuyuanyisheng.vo.doctorAuth.DoctorAuthRest;
  20. import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
  21. import java.math.BigDecimal;
  22. import java.util.Date;
  23. import java.util.List;
  24. import java.util.Set;
  25. /**
  26. * <p>
  27. * 描述: 医嘱录入dao
  28. * </p>
  29. *
  30. * @author xc
  31. * &#064;date 2022-01-04 17:00
  32. */
  33. @Mapper
  34. public interface YiZhuLuRuDao {
  35. @Select("SELECT " +
  36. "RTRIM(a.bed_no) bedNo, " +
  37. "RTRIM(a.inpatient_no) inpatientNo, " +
  38. "a.admiss_times, " +
  39. "RTRIM(a.name) as name, " +
  40. "sex=isnull(a.sex, 9), " +
  41. "mdtrtId=(select b.mdtrt_id from t_si_pat_info b where b.pat_no=a.inpatient_no " +
  42. "and b.times=a.admiss_times and b.ledger_sn=a.times_billed), " +
  43. "injurySerialNo=(select serial_no from t_injury_si_pat_info where pat_no=a.inpatient_no " +
  44. "and times=a.admiss_times and ledger_sn=a.times_billed), " +
  45. "medType=a.med_type, " +
  46. "dismissOrder=(select count(1) from yz_act_order b where b.inpatient_no=a.inpatient_no " +
  47. "and b.admiss_times=a.admiss_times and status_flag > '1' and isnull(group_no,'00')='00' " +
  48. "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')))," +
  49. "orderNoCount = (select count(1) " +
  50. " from yz_act_order c " +
  51. " where a.inpatient_no = c.inpatient_no " +
  52. " and c.admiss_times = a.admiss_times " +
  53. " and c.status_flag = '1' " +
  54. " and c.enter_oper = #{userCode}), " +
  55. " refer_physician, " +
  56. " (select name from a_employee_mi where code = refer_physician) as refer_physician_name, " +
  57. " consult_physician, " +
  58. " (select name from a_employee_mi where code = refer_physician) as consult_physician_name, " +
  59. " dept_director, " +
  60. " (select name from a_employee_mi where code = refer_physician) as dept_director_name " +
  61. "FROM zy_actpatient a with (NOLOCK) " +
  62. "where refer_physician = #{code} " +
  63. "ORDER BY cast(bed_no AS int) ")
  64. List<Patient> getMyPatient(String code);
  65. @Select("select isnull(balance,0) balance, " +
  66. " total_charge, " +
  67. " charge1, " +
  68. " charge2, " +
  69. " charge3, " +
  70. " charge4, " +
  71. " charge5, " +
  72. " charge6, " +
  73. " charge7, " +
  74. " charge8, " +
  75. " charge9, " +
  76. " charge10, " +
  77. " charge11, " +
  78. " charge12, " +
  79. " charge13, " +
  80. " charge14, " +
  81. " charge15, " +
  82. " charge16, " +
  83. " charge17, " +
  84. " charge18, " +
  85. " charge19, " +
  86. " charge20, " +
  87. " charge21, " +
  88. " charge22, " +
  89. " charge23, " +
  90. " charge24, " +
  91. " charge25, " +
  92. " charge26, " +
  93. " charge27, " +
  94. " charge28, " +
  95. " charge29, " +
  96. " charge30, " +
  97. " yp = (isnull(charge1 + charge2 + charge28, 0))," +
  98. " jyjc = (isnull(charge8 + charge9 + charge11 + charge18 + charge13, 0))," +
  99. " isnull(charge_yb, 0) charge_yb " +
  100. "from zy_ledger_file with (NOLOCK) " +
  101. "where inpatient_no = #{inpatientNo} " +
  102. " and admiss_times = #{admissTimes} " +
  103. " and ledger_sn = #{ledgerSn} ")
  104. HuanZheFeiYong feiYongXinXi(@Param("inpatientNo") String inpatientNo,
  105. @Param("admissTimes") Integer admissTimes,
  106. @Param("ledgerSn") Integer ledgerSn);
  107. @Select("select cast(a.act_order_no as decimal) as act_order_no, " +
  108. " cast(cast(a.act_order_no as decimal) as varchar) id, " +
  109. " newOrderFlag = (select count(*) " +
  110. " from new_act_order_recording " +
  111. " where new_act_order_recording.act_order_no = a.act_order_no), " +
  112. " order_code, " +
  113. " order_name, " +
  114. " rtrim(frequ_code) frequ_code, " +
  115. " frequ_code_name = (select rtrim(comm) " +
  116. " from yz_order_frequency " +
  117. " where code = frequ_code), " +
  118. " instruction, " +
  119. " discription, " +
  120. " infant_flag, " +
  121. " order_time, " +
  122. " physician, " +
  123. " start_time, " +
  124. " drug_specification, " +
  125. " drug_quan, " +
  126. " mini_unit_name = (select name " +
  127. " from yp_zd_unit with (NOLOCK) " +
  128. " where code = mini_unit), " +
  129. " rtrim(supply_code) supply_code, " +
  130. " supply_code_name = (select rtrim(supply_name) " +
  131. " from yz_supply_type with (NOLOCK) " +
  132. " where yz_supply_type.supply_code = a.supply_code), " +
  133. " a.inpatient_no, " +
  134. " a.admiss_times, " +
  135. " drug_flag, " +
  136. " enter_oper, " +
  137. " enter_oper_name = (select top (1) rtrim(name) " +
  138. " from a_employee_mi with (NOLOCK) " +
  139. " where code = enter_oper) /* 录入人 */, " +
  140. " enter_time, " +
  141. " mini_unit, " +
  142. " drug_weight, " +
  143. " drug_weight_unit, " +
  144. " rtrim(status_flag) status_flag, " +
  145. " status_time, " +
  146. " cast(a.parent_no as decimal) as parent_no," +
  147. " cast(cast(a.parent_no as decimal) as varchar) as parent_no_str, " +
  148. " parent_no_name = (select kfc.order_name from yz_act_order kfc where kfc.act_order_no = a.parent_no), " +
  149. " self_buy, " +
  150. " dose, " +
  151. " dose_unit, " +
  152. " dose_unit_name = (select name " +
  153. " from yp_zd_unit with (NOLOCK) " +
  154. " where dose_unit = code), " +
  155. " drug_occ, " +
  156. " drug_volume, " +
  157. " drug_vol_unit, " +
  158. " exclu_back_time, " +
  159. " exclu_act_order_no, " +
  160. " pay_self, " +
  161. " serial, " +
  162. " group_no, " +
  163. " signer, " +
  164. " cl_code, " +
  165. " doctor_flag, " +
  166. " emergency_flag, " +
  167. " exclu_type='', " +
  168. " end_time_b=end_time, " +
  169. " new_flag='0', " +
  170. " order_no_pattern=0, " +
  171. " suprice_flag='', " +
  172. " self_flag ='', " +
  173. " pack_size=0.0, " +
  174. " parent_no_c= -1000, " +
  175. " reg_flag, " +
  176. " parent_flag='', " +
  177. " rtrim(yb_self_flag) as yb_self_flag, " +
  178. " kf_flag, " +
  179. " refer_physician, " +
  180. " consult_physician, " +
  181. " physician_name = (select top (1) rtrim(name) " +
  182. " from a_employee_mi with (NOLOCK) " +
  183. " where code = physician) /* 开这个医嘱的医生 */, " +
  184. " exec_unit, " +
  185. " exec_unit_name = (select top (1) rtrim(name) " +
  186. " from zd_unit_code with (NOLOCK) " +
  187. " where code = exec_unit), " +
  188. " a.dept_code, " +
  189. " dept_name = (select top (1) rtrim(name) " +
  190. " from zd_unit_code with (NOLOCK) " +
  191. " where code = dept_code), " +
  192. " a.ward_code, " +
  193. " ward_name = (select top (1) rtrim(name) " +
  194. " from zd_unit_code with (NOLOCK) " +
  195. " where code = a.ward_code), " +
  196. " /*管床医生*/ " +
  197. " refer_physician_name = (select rtrim(name) " +
  198. " from a_employee_mi with (NOLOCK) " +
  199. " where code = refer_physician), " +
  200. " group_no_name = (select rtrim(group_name) " +
  201. " from yp_zd_group_name with (NOLOCK) " +
  202. " where a.group_no = group_no), " +
  203. " signer_name = (select top (1) rtrim(name) " +
  204. " from a_employee_mi with (NOLOCK) " +
  205. " where code = signer) /*确认人*/, " +
  206. " confirm_time /*确认时间*/, " +
  207. " modifier, " +
  208. " modifier_name = (select top (1) rtrim(name) " +
  209. " from a_employee_mi with (NOLOCK) " +
  210. " where code = modifier) /*停止人*/, " +
  211. " end_time /*停止时间*/, " +
  212. " b.new_ward as zkWardCode, " +
  213. " b.new_dept as zkDeptCode, " +
  214. " kss.yyfs, " +
  215. " kss.ssqk, " +
  216. " kss.yysj, " +
  217. " executer1 = (select name from a_employee_mi where code = executer1), " +
  218. " executer2= (select name from a_employee_mi where code = executer2)," +
  219. " superiorDoctor = (select rtrim(authorized_doctor) from new_act_order_recording na where na.act_order_no = a.act_order_no) " +
  220. "from view_xc_all_yz a with (NOLOCK) left join " +
  221. "zy_order_zk b with (NOLOCK) on (a.act_order_no = b.act_order_no) left join " +
  222. "yz_act_record_kss kss on (a.act_order_no = kss.act_order_no) " +
  223. " ${ew.customSqlSegment} ")
  224. List<XinZhenYzActOrder> selectOrderNo(@Param(Constants.WRAPPER) Wrapper<?> wq);
  225. @Select("select act_order_no, " +
  226. "rtrim(status_flag) status_flag," +
  227. "frequ_code," +
  228. "enter_oper," +
  229. "inpatient_no " +
  230. "from yz_act_order with (NOLOCK) " +
  231. "${ew.customSqlSegment}")
  232. List<XinZhenYzActOrder> getOrdersToDelete(@Param(Constants.WRAPPER) Wrapper<?> wq);
  233. @Update("update yz_act_order " +
  234. "set " +
  235. " order_time = #{order.orderTime,jdbcType=TIMESTAMP}, " +
  236. " start_time = #{order.startTime,jdbcType=TIMESTAMP}, " +
  237. " end_time = #{order.endTime,jdbcType=TIMESTAMP}, " +
  238. " supply_code = '044', " +
  239. " frequ_code = #{order.frequCode}," +
  240. " group_no = #{order.groupNo}," +
  241. " exec_unit = #{order.execUnit}, " +
  242. " modifier = #{order.modifier} " +
  243. "where act_order_no = ${orderNo} ")
  244. void updateSubOrderStatus(BigDecimal orderNo, XinZhenYzActOrder order);
  245. @Delete("delete yz_act_order ${ew.customSqlSegment} ")
  246. void deleteMultipleOrders(@Param(Constants.WRAPPER) Wrapper<?> wq);
  247. @Update("<script>" +
  248. "update yz_act_order " +
  249. "set parent_no = null " +
  250. "where inpatient_no = #{patNo} " +
  251. " and admiss_times = #{times} " +
  252. " and parent_no in " +
  253. "<foreach collection='list' item='item' open='(' close=')' separator=','>" +
  254. "#{item}" +
  255. "</foreach>" +
  256. "</script>")
  257. void deleteParentChildRelationship(String patNo,
  258. Integer times,
  259. List<BigDecimal> list);
  260. @Select("<script>" +
  261. "<foreach collection=\"list\" item=\"item\" index=\"index\" separator=\";\">" +
  262. "update yz_act_order " +
  263. "set modifier = #{userCode}, " +
  264. " end_time = #{item.endTime} " +
  265. "where inpatient_no = #{patNo} " +
  266. " and admiss_times = #{times}" +
  267. " and (act_order_no = #{item.actOrderNo} or parent_no = #{item.actOrderNo}) " +
  268. " and end_time is null" +
  269. "</foreach>" +
  270. "</script>")
  271. void setStopTime(List<XinZhenYzActOrder> list,
  272. String userCode,
  273. String patNo,
  274. Integer times);
  275. @Select("SELECT rtrim(a.code) + rtrim(serial) as id, " +
  276. " py_code=a.py_code, " +
  277. " d_code =a.d_code, " +
  278. " order_code =a.code, " +
  279. " order_name =a.name, " +
  280. " drug_specification=a.specification, " +
  281. " drug_flag =case a.infusion_flag " +
  282. " when '1' then 'i' " +
  283. " else (case categories_flag " +
  284. " when '0' " +
  285. " then 'd' " +
  286. " else 'z' " +
  287. " end) " +
  288. " end, " +
  289. " parent_code=null, " +
  290. " exclu_group_type=null, " +
  291. " discription=case a.infusion_flag " +
  292. " when '1' then '大输液' " +
  293. " else (case " +
  294. " when a.code >= '30000' and a.code < '50000' then '中药' " +
  295. " else '西药 ' end) end + convert(char(10), a.pack_retprice) + '元' + '(医保类别:' + " +
  296. " ltrim(rtrim(yb_flag_new)) + ';报销比例:' + ltrim(rtrim(yb_bl_new)) + ';医保说明:' + " +
  297. " ltrim(rtrim(yb_comment_new)) + ')', " +
  298. " serial=a.serial, " +
  299. " group_no=a.group_no, " +
  300. " infusion_flag=a.infusion_flag, " +
  301. " group_name =a.group_name, " +
  302. " pack_size=a.pack_size," +
  303. " (select name " +
  304. " from yp_zd_unit with (NOLOCK) " +
  305. " where code = pack_unit) as pack_size_name, " +
  306. " order_class='Y', " +
  307. " spec_pack=a.spec_pack, " +
  308. " jsy_flag =a.jsy_flag, " +
  309. " xnh_flag, " +
  310. " yb_comment, " +
  311. " dosage = a.dosage, " +
  312. " yb_type, " +
  313. " yb_flag_new," +
  314. " father_flag, " +
  315. " manu_name=(select name from yp_zd_manufactory with (NOLOCK) where code = a.manu_code), " +
  316. " stock_amount=a.stock_amount, " +
  317. " national_code," +
  318. " national_name,mini_unit_name = (select name from yp_zd_unit where code = mini_unit) " +
  319. "FROM view_yp_zd_dict_base_yf a with (NOLOCK) " +
  320. "WHERE isnull(a.visible_flag_zy, '') <> '1' " +
  321. " and (a.py_code like #{code} or a.name like #{code} or code like #{code}) " +
  322. " and group_no = '${groupNo}' ")
  323. List<YiZhuMingChen> yiZhuYaoPing(@Param("code") String code,
  324. @Param("groupNo") String groupNo);
  325. @Select("select act_order_no, " +
  326. "rtrim(status_flag) as status_flag," +
  327. "rtrim(frequ_code) as frequ_code," +
  328. "rtrim(supply_code) as supply_code, " +
  329. "inpatient_no," +
  330. "admiss_times," +
  331. "enter_oper," +
  332. "rtrim(serial) as serial," +
  333. "order_time," +
  334. "start_time," +
  335. "end_time," +
  336. "group_no," +
  337. "ward_code," +
  338. "parent_no " +
  339. "from yz_act_order with (NOLOCK) " +
  340. "where act_order_no = #{orderNo} ")
  341. XinZhenYzActOrder getActOrderNoOne(String orderNo);
  342. @Select("select frequ_code from yz_act_order where act_order_no = ${orderNo} ")
  343. String selectParentNo(String orderNo);
  344. /**
  345. * 获取,有未确认和未执行的医嘱
  346. *
  347. * @param patNo 住院号
  348. * @param times 住院次数
  349. * @param orderNo 医嘱号
  350. * @return 数据
  351. */
  352. @Select("select rtrim(status_flag) status_flag,order_name, act_order_no,frequ_code " +
  353. "from yz_act_order with (NOLOCK) " +
  354. "where inpatient_no = #{patNo} " +
  355. " and admiss_times = #{times} " +
  356. " and status_flag in ('1', '2')" +
  357. " and act_order_no <> #{orderNo} " +
  358. " and frequ_code = N'ONCE'" +
  359. " union all " +
  360. "select rtrim(status_flag) status_flag,order_name, act_order_no,frequ_code " +
  361. "from yz_act_order with (NOLOCK) " +
  362. "where inpatient_no = #{patNo} " +
  363. " and admiss_times = #{times} " +
  364. " and status_flag in ('1') " +
  365. " and act_order_no <> #{orderNo} " +
  366. " and frequ_code <> N'ONCE' ")
  367. List<XinZhenYzActOrder> thereAreUnexecutedOrders(String patNo, Integer times, BigDecimal orderNo);
  368. @Select("select count(1) " +
  369. "from yz_act_order " +
  370. "where inpatient_no = #{yz.inpatientNo} " +
  371. " and admiss_times = #{yz.admissTimes} " +
  372. " and status_flag = 1 " +
  373. " and isnull(self_buy, '0') <> '4' " +
  374. " and enter_oper = #{userCode} " +
  375. " and order_code in (select rtrim(order_code) " +
  376. " from yz_zd_order_item_confirm " +
  377. " where item_name = N'出院')")
  378. int selectDischargeOrde(@Param("yz") XinZhenYiZhu yz,
  379. @Param("userCode") String userCode);
  380. @Update("update yz_act_order set frequ_code = 'ONCE' WHERE act_order_no = #{orderNo};" +
  381. "update yz_act_order " +
  382. "set modifier = #{userCode}, " +
  383. " end_time = #{date}, " +
  384. " exclu_act_order_no = #{orderNo}, " +
  385. " status_flag = '5' " +
  386. "where inpatient_no = #{patNo} " +
  387. " and admiss_times = #{times} " +
  388. " and status_flag in ('2','3','4') " +
  389. " and frequ_code != 'ONCE' " +
  390. " and act_order_no <> #{orderNo}" +
  391. " and (end_time > #{date} or end_time is null )")
  392. void stopOrder(String patNo, Integer times, Date date, String userCode, BigDecimal orderNo);
  393. @Update("update yz_act_order " +
  394. "set confirm_time = #{confirmDate}, " +
  395. " signer = #{userCode}, " +
  396. " status_time = #{confirmDate}, " +
  397. " status_flag = '2'," +
  398. " supply_code = case " +
  399. " when parent_no is not null then (select isnull(nullif(supply_child, ''), '044') " +
  400. " from yz_supply_type c " +
  401. " where c.supply_code = (select supply_code " +
  402. " from yz_act_order b " +
  403. " where b.act_order_no = yz_act_order.parent_no)) " +
  404. " else " +
  405. " yz_act_order.supply_code end " +
  406. " where act_order_no = #{decimal}")
  407. void confirmOrders(BigDecimal decimal, String userCode, Date confirmDate);
  408. @Update("update yz_act_order " +
  409. "set confirm_time = #{confirmDate}, " +
  410. " signer = #{userCode}, " +
  411. " status_time = #{confirmDate}, " +
  412. " status_flag = '2'," +
  413. " supply_code = case " +
  414. " when parent_no is not null then (select isnull(nullif(supply_child, ''), '044') " +
  415. " from yz_supply_type c " +
  416. " where c.supply_code = (select supply_code " +
  417. " from yz_act_order b " +
  418. " where b.act_order_no = yz_act_order.parent_no)) " +
  419. " else " +
  420. " yz_act_order.supply_code end," +
  421. " enter_oper = #{userCode},physician = #{userCode} " +
  422. " where act_order_no = #{decimal}")
  423. void confirmOrdersSuperiorDoctor(BigDecimal decimal, String userCode, Date confirmDate);
  424. @Update("update yz_act_order " +
  425. "set confirm_time = #{confirmDate}, " +
  426. " signer = #{userCode}, " +
  427. " status_time = #{confirmDate}, " +
  428. " status_flag = '2'," +
  429. " modifier = #{userCode}," +
  430. " end_time = #{confirmDate}, " +
  431. " frequ_code = 'ONCE' " +
  432. " where act_order_no = #{decimal} ")
  433. void takeMedicineAfterDischargeStopOrder(BigDecimal decimal, String userCode, Date confirmDate);
  434. @Update("update yz_act_order " +
  435. "set confirm_time = #{confirmDate}, " +
  436. " signer = #{userCode}, " +
  437. " status_time = #{confirmDate}, " +
  438. " status_flag = '2'," +
  439. " modifier = #{userCode}," +
  440. " end_time = #{confirmDate}, " +
  441. " frequ_code = 'ONCE',enter_oper = #{userCode},physician = #{userCode} " +
  442. " where act_order_no = #{decimal} ")
  443. void takeMedicineAfterDischargeStopOrderAndSuperiorDoctor(BigDecimal decimal, String userCode, Date confirmDate);
  444. @Delete("delete yz_act_record_kss where act_order_no =#{orderNo}; " +
  445. "delete zy_order_zk where act_order_no =#{orderNo};" +
  446. "delete op_record where inpatient_no = #{patNo} and act_order_no =#{orderNo};" +
  447. "delete ysh_yj_req where inpatient_no =#{patNo} and act_order_no =#{orderNo};" +
  448. "DELETE FROM yz_act_order WHERE act_order_no = #{orderNo}; ")
  449. void toDeleteAnOrder(String orderNo, String patNo);
  450. @Update("UPDATE yz_act_order SET parent_no = NULL WHERE parent_no = #{orderNo} ")
  451. void deleteGroup(String orderNo);
  452. @Delete("delete yz_act_order where " +
  453. "act_order_no = #{orderNo} ")
  454. void deleteOrderNo(String orderNo);
  455. @Insert("INSERT INTO yz_act_order (order_code, order_name, frequ_code, instruction, discription, infant_flag, order_time, " +
  456. " /*录入人*/physician, start_time, drug_specification, drug_quan, supply_code, act_order_no, inpatient_no, " +
  457. " admiss_times, drug_flag/*药品中找这个是 药品的类型 a i d*/, enter_oper, /*录入时间*/ " +
  458. " enter_time, " +
  459. " mini_unit /*药品中找 最小包装规格*/, " +
  460. " drug_weight/*药品的重量*/, drug_weight_unit/*药品重量单位*/, " +
  461. " status_flag/*1*/, self_buy, dose, dose_unit, drug_occ, drug_volume/*药品中的 volum 找*/, " +
  462. " drug_vol_unit/* 药品中的 vol_unit */, pay_self/*0*/, " +
  463. " serial/*前端传*/, group_no/*药房 */, doctor_flag/*写死为 1*/, exec_unit, dept_code/* 在院病人表中的 dept */, " +
  464. " ward_code /* 在院病人表中的 zk_ward*/, " +
  465. " reg_flag/* 0 */, " +
  466. " yb_self_flag/*医保自费标志*/, emergency_flag, " +
  467. " kf_flag /*饭前饭后*/, parent_no, refer_physician/*患者的管床医生*/, end_time," +
  468. " modifier) " +
  469. "values (#{pa.orderCode}, #{pa.orderName}, #{pa.frequCode}, #{pa.instruction}, #{pa.discription}, #{patInfo.infantFlag}, " +
  470. " #{pa.orderTime}, #{userCode}, " +
  471. " #{pa.startTime}, cast(#{pa.drugSpecification} as varchar(16)), #{pa.drugQuan,jdbcType=REAL}, #{pa.supplyCode}, #{pa.actOrderNo,jdbcType=REAL}, #{patInfo.inpatientNo}, " +
  472. " #{patInfo.admissTimes}, #{pa.drugFlag}, #{userCode}, getdate(), " +
  473. " #{pa.miniUnit}, #{pa.drugWeight,jdbcType = REAL}, #{pa.drugWeightUnit,jdbcType=REAL}, '1', #{pa.selfBuy}, " +
  474. " #{pa.dose ,jdbcType = REAL}, #{pa.doseUnit}, #{pa.drugOcc ,jdbcType = REAL}, " +
  475. " #{pa.drugVolume,jdbcType=REAL}, #{pa.drugVolUnit}, '0', #{pa.serial}, #{pa.groupNo}, '1', #{pa.execUnit}, " +
  476. " #{patInfo.deptCode}, #{patInfo.deptCode}, '0', #{pa.ybSelfFlag}, #{pa.emergencyFlag}, " +
  477. " #{pa.kfFlag}, #{pa.parentNo,jdbcType=REAL}, #{patInfo.referPhysician}, #{pa.endTime}," +
  478. " #{pa.modifier})")
  479. void insertEntryOrder(XinZhenYiZhu patInfo, XinZhenYzActOrder pa, String userCode);
  480. @Update("update yz_act_order set " +
  481. "frequ_code = #{pa.frequCode}," +
  482. "supply_code = #{supplyCode}," +
  483. "exec_unit = #{pa.execUnit}," +
  484. "order_time = #{pa.orderTime}," +
  485. "start_time = #{pa.startTime,jdbcType=TIMESTAMP}," +
  486. "end_time = #{pa.endTime,jdbcType=TIMESTAMP}," +
  487. "group_no = #{pa.groupNo}," +
  488. "modifier = #{pa.modifier} " +
  489. "where inpatient_no = #{pa.inpatientNo} " +
  490. " and admiss_times = #{pa.admissTimes} " +
  491. " and parent_no = #{pa.actOrderNo,jdbcType=REAL} ")
  492. void howOftenTheSubPhysicianOrderIsModified(@Param("pa") XinZhenYzActOrder pa,
  493. @Param("supplyCode") String supplyCode);
  494. @Select("select isnull(nullif(supply_child, ''), '044') " +
  495. "from yz_supply_type " +
  496. "where supply_code = '${code}'")
  497. String selectSupplyCode(String code);
  498. @Select("SELECT rtrim(a.order_code) + '00' as id," +
  499. "a.py_code, " +
  500. " a.d_code, " +
  501. " a.order_code , " +
  502. " rtrim(a.order_name) order_name, " +
  503. " drug_specification='诊疗项目', " +
  504. " drug_flag = isnull(operation,'o') , " +
  505. " a.parent_code , " +
  506. " a.exclu_group_type, " +
  507. " discription=a.discription + ' ' + a.yb_comment, " +
  508. " serial ='00', " +
  509. " group_no='00', " +
  510. " infusion_flag='', " +
  511. " group_name ='', " +
  512. " pack_size=1, " +
  513. " order_class=a.order_class, " +
  514. " spec_pack='', " +
  515. " jsy_flag ='', " +
  516. " xnh_flag='', " +
  517. " yb_comment =null," +
  518. " exec_dept," +
  519. " exec_dept_name = (select rtrim(name) from zd_unit_code where code = exec_dept), " +
  520. " dosage='', " +
  521. " yb_type='', " +
  522. " father_flag='0', " +
  523. " manu_name='', " +
  524. " stock_amount=0 " +
  525. "FROM yz_order_item a with (NOLOCK) " +
  526. "WHERE isnull(a.del_flag, '') <> '1' " +
  527. " and (py_code like #{code} or order_name like #{code} or order_code like #{code}) " +
  528. " and order_code not in (select zy_order_code from jc_zd_item) " +
  529. " and isnull(exec_dept, '') <> '2010000' " +
  530. " and order_class not in ('B','C','D') ")
  531. List<YiZhuMingChen> yiZhuXiangMu(String code);
  532. @Select("SELECT a.py_code, " +
  533. " a.d_code, " +
  534. " a.pattern_code as order_code, " +
  535. " a.pattern_name as order_name, " +
  536. " specification=' ', " +
  537. " order_type ='t', " +
  538. " parent_code=space(7), " +
  539. " exclu_group_type=space(1), " +
  540. " discription='成组医嘱', " +
  541. " serial ='0000', " +
  542. " group_no='0000', " +
  543. " infusion_flag='', " +
  544. " drug_flag ='', " +
  545. " group_name ='', " +
  546. " pack_size =1, " +
  547. " order_class ='', " +
  548. " spec_pack='', " +
  549. " jsy_flag ='', " +
  550. " exclu_group_type='', " +
  551. " xnh_flag='', " +
  552. " yb_comment =null, " +
  553. " dosage = '', " +
  554. " yb_type='', " +
  555. " father_flag='0', " +
  556. " manu_name='', " +
  557. " stock_amount=0 " +
  558. "FROM yz_OrderPattern a with (NOLOCK) " +
  559. "where (py_code like #{code} or " +
  560. "pattern_name like #{code} or " +
  561. "d_code like #{code}) and dept_code = #{deptCode} ")
  562. List<YiZhuMingChen> composeOrders(String code, String deptCode);
  563. @Select("SELECT cast(rtrim(isnull(nullif(del_flag, " +
  564. " ''), " +
  565. " 0)) as int) as del_flag, " +
  566. " national_code as national_code, " +
  567. " name as order_name " +
  568. "FROM yz_order_occurence a with (NOLOCK), " +
  569. " zd_charge_item b with (NOLOCK) " +
  570. "where a.occ_code = b.code " +
  571. " and a.order_code = #{code}")
  572. List<XinZhenYzActOrder> huoQuXiangMu(String code);
  573. @Select("select CAST(isnull(exclu_group_type, 0) AS INT) " +
  574. "from yz_order_item with (NOLOCK) where order_code = #{code}")
  575. Integer shiFouPaiChiYiZhu(String code);
  576. @Select("select drug_flag,\n" +
  577. " categories_flag,\n" +
  578. " a.serial,\n" +
  579. " /* 医保自费 */\n" +
  580. " cast(isnull(NULLIF(self_flag_yb,\n" +
  581. " ''),\n" +
  582. " 0) as int) as self_flag_yb,\n" +
  583. " /* 重量 */\n" +
  584. " weight,\n" +
  585. " /* 重量单位 */\n" +
  586. " weigh_unit,\n" +
  587. " weigh_unit_name = (select name\n" +
  588. " from yp_zd_unit with (NOLOCK)\n" +
  589. " where code = weigh_unit),\n" +
  590. " /*体积*/\n" +
  591. " volum,\n" +
  592. " /*体积单位*/\n" +
  593. " vol_unit,\n" +
  594. " vol_unit_name = (select name\n" +
  595. " from yp_zd_unit with (NOLOCK)\n" +
  596. " where code = vol_unit),\n" +
  597. " /*包装体积*/\n" +
  598. " pack_size,\n" +
  599. " /*包装单位*/\n" +
  600. " pack_unit,\n" +
  601. " pack_unit_name = (select name\n" +
  602. " from yp_zd_unit with (NOLOCK)\n" +
  603. " where code = pack_unit),\n" +
  604. " /*最小单位*/\n" +
  605. " mini_unit,\n" +
  606. " mini_unit_name = (select name\n" +
  607. " from yp_zd_unit with (NOLOCK)\n" +
  608. " where code = mini_unit),\n" +
  609. " /* 需要判断医生的权限 在 select\n" +
  610. " doctor_xz_yp\n" +
  611. " from\n" +
  612. " a_employee_mi */\n" +
  613. " cast(isnull(NULLIF(yp_level,\n" +
  614. " ''),\n" +
  615. " 0) as int) as yp_level,\n" +
  616. " /*需要皮试*/\n" +
  617. " cast(isnull(NULLIF(a.ps_flag,\n" +
  618. " ''),\n" +
  619. " 0) as int) as ps_flag,\n" +
  620. " cast(isnull(NULLIF(kss_flag,\n" +
  621. " ''),\n" +
  622. " 0) as int) as kss_flag,\n" +
  623. " cast(isnull(NULLIF(kjyw_flag,\n" +
  624. " ''),\n" +
  625. " 0) as int) as kjyw_flag,\n" +
  626. " code as order_code,\n" +
  627. " name as order_name,\n" +
  628. " frequency as frequCode,\n" +
  629. " (select isnull(rtrim(comm),\n" +
  630. " '')\n" +
  631. " from yz_order_frequency\n" +
  632. " where yz_order_frequency.code = frequency) as frequCodeName,\n" +
  633. " supply_code as supply_code,\n" +
  634. " supply_code_name =supply_name,\n" +
  635. " national_code,\n" +
  636. " rtrim(jb_flag) as jb_flag,\n" +
  637. " high_warning_flag,\n" +
  638. " winning_bidder_flag,\n" +
  639. " focus_monitor_flag\n" +
  640. "from yp_zd_dict a with (NOLOCK)\n" +
  641. " left join yz_supply_type c on (a.supply_type = c.supply_code)\n" +
  642. "where rtrim(code) + rtrim(a.serial) = '${code}'\n" +
  643. " and cast(isnull(NULLIF(a.del_flag, ''), 0) as int) = 0;")
  644. YaoPinXinXi huoQuYaoPin(@Param("code") String code);
  645. @Select("select stock_amount, cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy " +
  646. "from yp_base_yf " +
  647. "where rtrim(charge_code) + rtrim(serial) = '${code}' " +
  648. " and group_no = '${groupNo}'")
  649. YaoPinXinXi huoQuJinYongXinXi(@Param("code") String code,
  650. @Param("groupNo") String groupNo);
  651. @Select("select count(1) " +
  652. "from yp_zd_dept " +
  653. "where charge_code = #{code} " +
  654. " and dept_code = #{dept} ")
  655. Integer restrictedUseInTheDepartment(@Param("code") String code,
  656. @Param("dept") String dept);
  657. @Select("select cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 from a_employee_mi with (NOLOCK) where code = #{code}")
  658. Integer huoQuYiShenDengJi(String code);
  659. @Select("select cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel," +
  660. " doctor_zy as doctorZy, " +
  661. " dept_code," +
  662. " code " +
  663. "from a_employee_mi with (NOLOCK) " +
  664. "where code = #{code} ")
  665. UserInfo selectedUserInfoByCode(String code);
  666. @Select("select rtrim(supply_code) code,rtrim(supply_name) name " +
  667. "from yz_supply_type with (NOLOCK) " +
  668. "where ps_flag in ('1', '0')")
  669. List<GetDropdownBox> piShiGeiYaoFangShi();
  670. @Select("select rtrim(code) code, rtrim(comm) name " +
  671. "from yz_order_frequency with (NOLOCK) " +
  672. "where (code like #{code} or comm like #{code})")
  673. List<GetDropdownBox> huoQuZhuYuanPinLv(String code);
  674. @Select("select rtrim(code) as code, rtrim(code) name " +
  675. "from yz_order_frequency")
  676. List<GetDropdownBox> selectFrequency();
  677. @Select("select rtrim(supply_code) code, " +
  678. " rtrim(supply_name) name, " +
  679. " py_code, " +
  680. " d_code as w_code " +
  681. "from yz_supply_type with (NOLOCK) where isnull(del_flag , '0') <> '1'")
  682. List<SelectV2> selectSupplyType();
  683. @Select("select rtrim(supply_code) code, rtrim(supply_name) name " +
  684. "from yz_supply_type with (NOLOCK) " +
  685. "where (supply_code like #{code} or supply_name like #{code} or py_code like #{code} )")
  686. List<GetDropdownBox> huoQuGeiYaoFangShi(String code);
  687. @Select("SELECT a.code code, " +
  688. " a.name name " +
  689. "FROM zd_unit_code a with (NOLOCK), " +
  690. " zd_dept_all b with (NOLOCK) " +
  691. "where isnull(a.del_flag, '0') <> '1' " +
  692. " and a.code = b.small_dept " +
  693. " and (a.code like #{code} or a.name like #{code} or py_code like #{code}) " +
  694. "group by code,name")
  695. List<GetDropdownBox> huoQuZhiXinKeShi(String code);
  696. @Select("<script>" +
  697. "select rtrim(code) order_code, " +
  698. " rtrim(a.serial) serial, " +
  699. " rtrim(group_no) group_no, " +
  700. " rtrim(name) order_name," +
  701. " case infusion_flag " +
  702. " when '1' then 'i' " +
  703. " else " +
  704. " (case " +
  705. " when rtrim(code) &gt;= '30000' and rtrim(code) &lt; '50000' then 'z' " +
  706. " else 'd' end) end as drug_flag, " +
  707. " mini_unit, " +
  708. " isnull(weight,1) drug_weight, " +
  709. " weigh_unit drug_weight_unit, " +
  710. " isnull(volum,1) drug_volume, " +
  711. " vol_unit drug_vol_unit," +
  712. " isnull(pack_size,1) pack_size, " +
  713. " pack_unit," +
  714. " a.pack_retprice, " +
  715. " national_code," +
  716. " cast(isnull(NULLIF(kjyw_flag, ''), 0) as int) as kjyw_flag," +
  717. " cast(isnull(NULLIF(yp_level, ''), 0) as int) as yp_level," +
  718. " cast(isnull(NULLIF(del_flag, ''), 0) as int) as del_flag, " +
  719. " CASE " +
  720. " WHEN isnull(b.open_virtual2, '') = '1' then isnull(b.stock_amount_virtual2, 0) " +
  721. " else isnull(stock_amount,0) end as stock_amount," +
  722. " cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy," +
  723. " deptRestrictions = (select count(1) from yp_zd_dept where code = yp_zd_dept.charge_code and dept_code = '${dept}')," +
  724. " a.bill_item_zy " +
  725. " from yp_zd_dict a with (NOLOCK) " +
  726. " left join yp_base_yf b on (code = b.charge_code and a.serial = b.serial) " +
  727. "where rtrim(code) + rtrim(a.serial) + rtrim(group_no) in " +
  728. "<foreach collection='code' item='item' index='index' open='(' close=')' separator=','>" +
  729. "#{item}" +
  730. "</foreach>" +
  731. "</script>")
  732. List<XinZhenYzActOrder> huoQuYaoPinXinXi(@Param("code") Set<String> code,
  733. @Param("dept") String dept);
  734. @Select("<script>" +
  735. "select b.order_code, " +
  736. " rtrim(c.name) order_name, " +
  737. " national_code, " +
  738. " kjyw_flag = 0, " +
  739. " cast(rtrim(isnull(nullif(c.del_flag, " +
  740. " ''), " +
  741. " 0)) as int) del_flag " +
  742. " from " +
  743. " yz_order_occurence b with (NOLOCK) , " +
  744. " zd_charge_item c with (NOLOCK) " +
  745. "where b.order_code in " +
  746. "<foreach collection='code' item='item' index='index' open='(' close=')' separator=','>" +
  747. "#{item}" +
  748. "</foreach>" +
  749. " and b.occ_code = c.code" +
  750. "</script>")
  751. List<XinZhenYzActOrder> huoQuXiangMuXinXi(Set<String> code);
  752. @Select("select b.order_code, " +
  753. " rtrim(c.name) order_name, " +
  754. " national_code, " +
  755. " kjyw_flag = 0, " +
  756. " cast(rtrim(isnull(nullif(c.del_flag, " +
  757. " ''), " +
  758. " 0)) as int) as del_flag " +
  759. "from yz_order_occurence b with (NOLOCK), " +
  760. " zd_charge_item c with (NOLOCK) " +
  761. "where b.order_code = #{code} " +
  762. " and b.occ_code = c.code")
  763. List<XinZhenYzActOrder> itemDataOne(String code);
  764. @Select("select order_code, order_name, cast(ISNULL(del_flag, 0) as int) as del_flag \n" +
  765. "from yz_order_item\n" +
  766. "where order_code = '${code}'")
  767. XinZhenYzActOrder yzItem(String code);
  768. @Select("select rtrim(code) order_code, " +
  769. " rtrim(a.serial) as serial, " +
  770. " rtrim(group_no) as group_no, " +
  771. " rtrim(name) order_name, " +
  772. " case infusion_flag " +
  773. " when '1' then 'i' " +
  774. " else " +
  775. " (case " +
  776. " when rtrim(code) >= '30000' and rtrim(code) < " +
  777. " '50000' then 'z' " +
  778. " else 'd' end) end as drug_flag, " +
  779. " mini_unit, " +
  780. " isnull(weight, 1) drug_weight, " +
  781. " weigh_unit drug_weight_unit, " +
  782. " isnull(volum, 1) drug_volume, " +
  783. " vol_unit drug_vol_unit, " +
  784. " isnull(pack_size, 1) as pack_size, " +
  785. " pack_unit, " +
  786. " a.pack_retprice, " +
  787. " national_code, " +
  788. " cast(isnull(NULLIF(kjyw_flag, ''), 0) as int) as kjyw_flag, " +
  789. " cast(isnull(NULLIF(yp_level, ''), 0) as int) as yp_level, " +
  790. " cast(isnull(NULLIF(del_flag, ''), 0) as int) as del_flag, " +
  791. " CASE " +
  792. " WHEN isnull(b.open_virtual2, '') = '1' then isnull(b.stock_amount_virtual2, 0) " +
  793. " else isnull(stock_amount, 0) end as stock_amount, " +
  794. " cast(isnull(nullif(visible_flag_zy, ''), 0) as int) as visible_flag_zy," +
  795. " cast(isnull(NULLIF(kss_flag, ''), 0) as int) as kss_flag, " +
  796. " deptRestrictions = (select count(1) from yp_zd_dept where code = yp_zd_dept.charge_code and dept_code = '${dept}')," +
  797. " supplyCode = ( select isnull(del_flag, 0) from yz_supply_type where supply_code = '${supplyCode}') " +
  798. "from yp_zd_dict a " +
  799. " with (NOLOCK) " +
  800. " left join yp_base_yf b on (code = b.charge_code and a.serial = b.serial) " +
  801. "where rtrim(code) + rtrim(a.serial) + rtrim(group_no) = #{code} ")
  802. XinZhenYzActOrder drugDataOne(String code, String dept, String supplyCode);
  803. @Select("select rtrim(a.inpatient_no) as inpatient_no,\n" +
  804. " admiss_times,\n" +
  805. " rtrim(a.name) as name,\n" +
  806. " rtrim(dept) as dept_code,\n" +
  807. " a.sex,\n" +
  808. " birth_date,\n" +
  809. " rtrim(zk_ward) as ward_code,\n" +
  810. " refer_physician,\n" +
  811. " dept_director,\n" +
  812. " times_billed,\n" +
  813. " admiss_date,\n" +
  814. " small_dept,\n" +
  815. " bed_no,\n" +
  816. " zk_ward,\n" +
  817. " ledger_sn = (select max(ledger_sn)\n" +
  818. " from zy_ledger_file with (NOLOCK)\n" +
  819. " where a.inpatient_no = zy_ledger_file.inpatient_no\n" +
  820. " and a.admiss_times = zy_ledger_file.admiss_times),\n" +
  821. " consult_physician,\n" +
  822. " zy_serial_no\n" +
  823. "from zy_actpatient a with (NOLOCK),\n" +
  824. " a_patient_mi b\n" +
  825. "where a.inpatient_no = b.inpatient_no\n" +
  826. " and a.inpatient_no = #{patNo}\n" +
  827. " and admiss_times = #{times}")
  828. XinZhenYiZhu queryPatientInfo(@Param("patNo") String patNo,
  829. @Param("times") Integer times);
  830. @Select("<script>" +
  831. "select top 20 * from (" +
  832. "SELECT row_number() over (order by pattern_code ) row_number," +
  833. " rtrim(pattern_code) pattern_code, " +
  834. " rtrim(pattern_name) pattern_name," +
  835. " rtrim(input_id) input_id," +
  836. " input_date," +
  837. " rtrim(input_type) input_type, " +
  838. " sort_no," +
  839. " yiBeiShouCang = (select count(1) from yz_OrderPattern b with (NOLOCK) where b.collect_code = a.pattern_code " +
  840. " and b.input_id = #{inputId})," +
  841. " collect_code " +
  842. "FROM yz_OrderPattern a with (NOLOCK) " +
  843. "where 1=1 " +
  844. "<if test=\"code != null and code != '' \">" +
  845. "and (py_code like #{code} " +
  846. " or pattern_code like #{code} " +
  847. " or pattern_name like #{code}) " +
  848. "</if>" +
  849. "<if test=\"muBanLeiXing == 2 \">" +
  850. " and dept_code = #{deptCode} AND input_type = '2' " +
  851. "</if>" +
  852. "<if test=\"muBanLeiXing == 3 \">" +
  853. " and input_id = #{inputId} AND input_type = '3' " +
  854. "</if>" +
  855. "<if test=\"muBanLeiXing == 1\">" +
  856. " and input_type = '1' " +
  857. "</if>" +
  858. "<if test=\"muBanLeiXing == 4\">" +
  859. " and input_id = #{inputId} AND input_type = '4' " +
  860. "</if>" +
  861. "<if test=\"muBanLeiXing == 0\">" +
  862. " AND input_type &lt;&gt; '4' " +
  863. "</if>" +
  864. ") temp where row_number > (${currentPage} - 1) * 20 " +
  865. "<if test=\"muBanLeiXing == 3 \">" +
  866. " order by sort_no desc " +
  867. "</if>" +
  868. "</script>")
  869. List<YzOrderPattern> huoQuMuBan(@Param("code") String code,
  870. @Param("inputId") String inputId,
  871. @Param("deptCode") String deptCode,
  872. @Param("muBanLeiXing") Integer muBanLeiXing,
  873. @Param("currentPage") long currentPage);
  874. @Select("select max(sort_no + 1) " +
  875. "from yz_OrderPattern " +
  876. "where input_id = #{code}")
  877. Integer getMyTemplateMaxSortNo(String code);
  878. @Select("<script>" +
  879. "SELECT count(*) " +
  880. "FROM yz_OrderPattern with (NOLOCK) " +
  881. "where 1=1 " +
  882. "<if test=\"code != null and code != '' \">" +
  883. "and (py_code like #{code} " +
  884. " or pattern_code like #{code} " +
  885. " or pattern_name like #{code}) " +
  886. "</if>" +
  887. "<if test=\"muBanLeiXing == 2 \">" +
  888. " and dept_code = #{deptCode} AND input_type = '2' " +
  889. "</if>" +
  890. "<if test=\"muBanLeiXing == 3 \">" +
  891. " and input_id = #{inputId} AND input_type = '3' " +
  892. "</if>" +
  893. "<if test=\"muBanLeiXing == 1\">" +
  894. " and input_type = '1' " +
  895. "</if>" +
  896. "<if test=\"muBanLeiXing == 4\">" +
  897. " and input_id = #{inputId} AND input_type = '4' " +
  898. "</if>" +
  899. "<if test=\"muBanLeiXing == 0\">" +
  900. " AND input_type &lt;&gt; '4' " +
  901. "</if>" +
  902. "</script>")
  903. long huoQuMuBanTotal(@Param("code") String code,
  904. @Param("inputId") String inputId,
  905. @Param("deptCode") String deptCode,
  906. @Param("muBanLeiXing") Integer muBanLeiXing);
  907. @Select("SELECT cast(cast(act_order_no as decimal) as varchar) id, " +
  908. " act_order_no, " +
  909. " rtrim(a.order_name) order_name, " +
  910. " rtrim(a.order_code) order_code, " +
  911. " a.frequ_code, " +
  912. " frequ_code_name = (select rtrim(comm) " +
  913. " from yz_order_frequency with (NOLOCK) " +
  914. " where yz_order_frequency.code = a.frequ_code), " +
  915. " a.drug_specification, " +
  916. " a.supply_code, " +
  917. " supply_code_name = (select rtrim(supply_name) " +
  918. " from yz_supply_type with (NOLOCK) " +
  919. " where yz_supply_type.supply_code = a.supply_code), " +
  920. " a.drug_quan, " +
  921. " a.instruction, " +
  922. " a.mini_unit, " +
  923. " mini_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = mini_unit), " +
  924. " a.drug_weight, " +
  925. " a.drug_weight_unit, " +
  926. " a.parent_no, " +
  927. " a.drug_volume, " +
  928. " a.drug_vol_unit, " +
  929. " a.dose, " +
  930. " a.dose_unit, " +
  931. " dose_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = dose_unit), " +
  932. " a.exclu_act_order_no, " +
  933. " a.discription, " +
  934. " a.pattern_code, " +
  935. " a.order_type, " +
  936. " a.serial, " +
  937. " self_buy=isnull(a.self_buy, '0'), " +
  938. " del_flag=isnull(b.del_flag, ''), " +
  939. " a.drug_flag, " +
  940. " suprice_flag='', " +
  941. " self_flag ='', " +
  942. " parent_flag='', " +
  943. " a.exec_unit, " +
  944. " exec_unit_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_unit)," +
  945. " group_no = '00', " +
  946. " group_no_name = N'项目' " +
  947. "FROM yz_pattern_order a with (NOLOCK), " +
  948. " yz_order_item b with (NOLOCK) " +
  949. "WHERE a.pattern_code = #{code} " +
  950. " and isnull(a.group_no, '00') = '00' " +
  951. " and a.order_code = b.order_code " +
  952. " and b.order_class not in ('B','C','D') " +
  953. "UNION " +
  954. "SELECT cast(cast(act_order_no as decimal) as varchar) id," +
  955. " act_order_no, " +
  956. " a.order_name, " +
  957. " a.order_code, " +
  958. " a.frequ_code, " +
  959. " frequ_code_name = (select rtrim(comm) " +
  960. " from yz_order_frequency with (NOLOCK) " +
  961. " where yz_order_frequency.code = a.frequ_code), " +
  962. " a.drug_specification, " +
  963. " a.supply_code, " +
  964. " supply_code_name = (select rtrim(supply_name) " +
  965. " from yz_supply_type with (NOLOCK) " +
  966. " where yz_supply_type.supply_code = a.supply_code), " +
  967. " a.drug_quan, " +
  968. " a.instruction, " +
  969. " b.pack_unit as mini_unit, " +
  970. " mini_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = b.pack_unit), " +
  971. " a.drug_weight, " +
  972. " a.drug_weight_unit, " +
  973. " a.parent_no, " +
  974. " a.drug_volume, " +
  975. " a.drug_vol_unit, " +
  976. " a.dose, " +
  977. " a.dose_unit, " +
  978. " dose_unit_name = (select rtrim(name) from yp_zd_unit with (NOLOCK) where code = dose_unit), " +
  979. " a.exclu_act_order_no, " +
  980. " a.discription, " +
  981. " a.pattern_code, " +
  982. " a.order_type, " +
  983. " a.serial, " +
  984. " self_buy=isnull(a.self_buy, case when b.jsy_flag = '1' then '3' else '0' end), " +
  985. " del_flag=isnull(b.visible_flag_zy, ''), " +
  986. " a.drug_flag, " +
  987. " suprice_flag=b.suprice_flag, " +
  988. " self_flag =b.self_flag, " +
  989. " parent_flag='', " +
  990. " a.exec_unit, " +
  991. " exec_unit_name = (select rtrim(name) from zd_unit_code with (NOLOCK) where code = exec_unit)," +
  992. " a.group_no, " +
  993. " (select yp_zd_group_name.group_name " +
  994. " from yp_zd_group_name " +
  995. " where yp_zd_group_name.group_no = a.group_no) " +
  996. "FROM yz_pattern_order a with (NOLOCK), " +
  997. " view_yp_zd_dict_base_yf b with (NOLOCK) " +
  998. "WHERE a.pattern_code = #{code} " +
  999. " and a.group_no = b.group_no " +
  1000. " and a.order_code = b.code " +
  1001. " and a.serial = b.serial " +
  1002. " and isnull(b.visible_flag_zy, '') <> '1'")
  1003. List<YzActOrder> huoQuMuBanShuJu(String code);
  1004. @Select("select pattern_code," +
  1005. " rtrim(input_type) as input_type," +
  1006. " input_id " +
  1007. "from yz_OrderPattern with (NOLOCK) " +
  1008. "where pattern_name = #{patternName} " +
  1009. " and input_id = #{inputId}" +
  1010. " and input_type <> 4 ")
  1011. YzOrderPattern yuanLaiDeMuBanBianMa(@Param("patternName") String patternName,
  1012. @Param("inputId") String inputId);
  1013. @Delete("<script>" +
  1014. "delete yz_OrderPattern " +
  1015. "where pattern_code = #{patternCode}; " +
  1016. "delete yz_pattern_order " +
  1017. "where pattern_code = #{patternCode} " +
  1018. "</script>")
  1019. void shanChuLaoMuBan(@Param("patternCode") String patternCode);
  1020. @Insert("insert yz_OrderPattern (pattern_code, pattern_name, py_code, d_code, dept_code, " +
  1021. " ward_code, input_id, " +
  1022. " input_type, input_date, sort_no) " +
  1023. "values (#{patternCode},#{patternName},#{pyCode},#{dCode},#{deptCode},#{deptCode}," +
  1024. "#{inputId},#{inputType}," +
  1025. "getdate(),#{sortNo})")
  1026. void chaRuMuBan(YzOrderPattern param);
  1027. @Select("select count(1) " +
  1028. "from yz_OrderPattern " +
  1029. "where pattern_name = #{name} and input_id = #{userCode} ")
  1030. Integer duplicateTemplateName(@Param("name") String name,
  1031. @Param("userCode") String userCode);
  1032. @Insert("<script>" +
  1033. "INSERT INTO yz_pattern_order (act_order_no, order_code, frequ_code, drug_flag, supply_code, drug_quan, instruction, " +
  1034. " drug_specification, mini_unit, drug_weight, drug_weight_unit, parent_no, drug_volume, " +
  1035. " drug_vol_unit, dose, dose_unit, drug_occ, order_name, discription, " +
  1036. " pattern_code, serial, self_buy, exec_unit,group_no) " +
  1037. "VALUES " +
  1038. "<foreach collection='list' item='item' separator=','>" +
  1039. "(#{item.actOrderNo}, #{item.orderCode}, #{item.frequCode}," +
  1040. "<if test=\"item.drugFlag !=null and item.drugFlag != '' \">" +
  1041. "#{item.drugFlag}," +
  1042. "</if>" +
  1043. "<if test=\"item.drugFlag == null or item.drugFlag == '' \">" +
  1044. "'o'," +
  1045. "</if>" +
  1046. " #{item.supplyCode}," +
  1047. "<if test=\"item.drugQuan != null \">" +
  1048. "#{item.drugQuan}," +
  1049. "</if>" +
  1050. "<if test=\"item.drugQuan == null \">" +
  1051. "null," +
  1052. "</if>" +
  1053. "#{item.instruction}, #{item.drugSpecification}, #{item.miniUnit}, " +
  1054. "<if test=\"item.drugWeight != null\">" +
  1055. "#{item.drugWeight}, " +
  1056. "</if>" +
  1057. "<if test=\"item.drugWeight == null\">" +
  1058. "null, " +
  1059. "</if>" +
  1060. "#{item.drugWeightUnit}, " +
  1061. "<if test=\"item.parentNo != null \">" +
  1062. "#{item.parentNo}," +
  1063. "</if>" +
  1064. "<if test=\"item.parentNo == null \">" +
  1065. "null," +
  1066. "</if>" +
  1067. "<if test=\"item.drugVolume != null\">" +
  1068. "cast(#{item.drugVolume,jdbcType=DECIMAL} as decimal(10,2))," +
  1069. "</if>" +
  1070. "<if test=\"item.drugVolume == null\">" +
  1071. "null," +
  1072. "</if>" +
  1073. " #{item.drugVolUnit}, " +
  1074. "<if test=\"item.dose != null\">" +
  1075. "cast(#{item.dose,jdbcType=DECIMAL} as decimal(10,2))," +
  1076. "</if>" +
  1077. "<if test=\"item.dose == null\">" +
  1078. "null," +
  1079. "</if>" +
  1080. "#{item.doseUnit}," +
  1081. "<if test=\"item.drugOcc != null \">" +
  1082. "cast(#{item.drugOcc,jdbcType=DECIMAL} as decimal(10,2))," +
  1083. "</if>" +
  1084. "<if test=\"item.drugOcc == null \">" +
  1085. "null," +
  1086. "</if>" +
  1087. " #{item.orderName},#{item.discription},#{patternCode},#{item.serial},#{item.selfBuy},#{item.execUnit},#{item.groupNo})" +
  1088. "</foreach>" +
  1089. "</script>")
  1090. void chaRuMuBanShuJu(List<XinZhenYzActOrder> list, String patternCode);
  1091. @Select("select * " +
  1092. "from yz_OrderPattern with (NOLOCK) " +
  1093. "where pattern_code = #{code}")
  1094. YzOrderPattern huoQuMuBanXinXi(@Param("code") String code);
  1095. @Update("update yz_OrderPattern " +
  1096. "set pattern_name = #{patternName}, " +
  1097. " py_code = #{pyCode}, " +
  1098. " d_code = #{dCode}, " +
  1099. " input_date = getdate()," +
  1100. " sort_no = #{sortNo} " +
  1101. "where pattern_code = #{patternCode} ")
  1102. void genXingMuBan(@Param("patternName") String patternName,
  1103. @Param("pyCode") String pyCode,
  1104. @Param("dCode") String dCode,
  1105. @Param("patternCode") String patternCode,
  1106. @Param("sortNo") Integer sortNo);
  1107. @Select("select rtrim(dept_code) from a_employee_mi where code = '${code}'")
  1108. String userDeptCode(@Param("code") String code);
  1109. @Delete("/* 父模板 */ " +
  1110. "delete yz_OrderPattern " +
  1111. "where pattern_code = #{patternCode}; " +
  1112. "/* 模板下面的数据 */ " +
  1113. "delete yz_pattern_order " +
  1114. "where pattern_code = #{patternCode} ")
  1115. void shanChuMuBan(@Param("patternCode") String patternCode);
  1116. @Select("select pattern_code " +
  1117. "from yz_OrderPattern " +
  1118. "where collect_code = #{patternCode} and input_id = #{userId}")
  1119. String whetherToSaveTheDoctorSOrderTemplate(@Param("patternCode") String patternCode,
  1120. @Param("userId") String userId);
  1121. @Select("select collect_code " +
  1122. "from yz_OrderPattern with (NOLOCK) " +
  1123. "where input_id = #{inputId} " +
  1124. " and collect_code = #{collectCode} ")
  1125. String chongFuShouCang(@Param("inputId") String inputId,
  1126. @Param("collectCode") String collectCode);
  1127. @Insert("insert into yz_OrderPattern (pattern_code, pattern_name, py_code, d_code, dept_code, ward_code, " +
  1128. " input_id, input_type, input_date, sort_no, collect_code) " +
  1129. "values (#{patternCode},#{patternName},#{pyCode},#{dCode},#{deptCode},#{deptCode},#{inputId},'4',getdate(),0,#{collectCode});")
  1130. void chaRuShouCang(@Param("patternCode") String patternCode,
  1131. @Param("patternName") String patternName,
  1132. @Param("pyCode") String pyCode,
  1133. @Param("dCode") String dCode,
  1134. @Param("deptCode") String deptCode,
  1135. @Param("inputId") String inputId,
  1136. @Param("collectCode") String collectCode);
  1137. @Delete("delete yz_act_record_kss where act_order_no = #{orderNo}")
  1138. void deleteAntimicrobialInformation(String orderNo);
  1139. @Insert("insert into yz_act_record_kss " +
  1140. "(act_order_no, charge_code, input_id, inpatient_no, " +
  1141. "admiss_times, yyfs, ssqk, yysj)" +
  1142. "values " +
  1143. "(#{orderNo},#{kss.chargeCode},#{userCode},#{patNo}," +
  1144. "#{times},#{kss.yyfs},#{kss.ssqk},#{kss.yysj})")
  1145. void insertAntimicrobialInformation(String orderNo,
  1146. YzActRecordKss kss,
  1147. String userCode,
  1148. String patNo,
  1149. Integer times);
  1150. @Delete("delete zy_order_zk where act_order_no = #{orderNo}")
  1151. void deleteTransferOrder(String orderNo);
  1152. @Insert("insert into zy_order_zk (act_order_no, old_ward, " +
  1153. "old_dept, new_ward, new_dept) " +
  1154. "values (#{actOrderNo},#{oldWard},#{oldDept},#{newWard},#{newDept})")
  1155. void insertDoctorSOrder(ZyOrderZk zk);
  1156. @Select("execute dbo.xc_zy_order_fee;1 @in_no = #{patNo}, @in_times = #{times}")
  1157. List<DoctorSOrderFee> expensesForGettingADoctorSOrder(@Param("patNo") String patNo,
  1158. @Param("times") Integer times);
  1159. @Update("UPDATE zy_actpatient " +
  1160. "SET refer_physician = #{param.referPhysician}, " +
  1161. " consult_physician = #{param.consultPhysician}, " +
  1162. " dept_director = #{param.deptDirector} " +
  1163. "WHERE inpatient_no = #{param.inpatientNo} " +
  1164. " AND admiss_times = #{param.admissTimes} ")
  1165. void updateTheThirdLevelDoctor(@Param("param") Overview param);
  1166. @Update("update yz_act_order " +
  1167. " set " +
  1168. " parent_no = ${order.actOrderNo}," +
  1169. " order_time = #{order.orderTime,jdbcType=TIMESTAMP}, " +
  1170. " start_time = #{order.startTime,jdbcType=TIMESTAMP}, " +
  1171. " end_time = #{order.endTime,jdbcType=TIMESTAMP}, " +
  1172. " supply_code = dbo.get_child_supply(${order.actOrderNo}), " +
  1173. " frequ_code = #{order.frequCode}," +
  1174. " group_no = #{order.groupNo} " +
  1175. "where act_order_no = ${children} " +
  1176. " and status_flag = '1' ")
  1177. void associateOrders(BigDecimal children, XinZhenYzActOrder order);
  1178. @Select("SELECT a.gen_time, " +
  1179. " inpatient_no, " +
  1180. " admiss_times, " +
  1181. " ledger_sn, " +
  1182. " a.detail_sn, " +
  1183. " a.charge_date, " +
  1184. " a.charge_code_mx, " +
  1185. " charge_code_name = (case " +
  1186. " when serial = '99' or serial = '01' " +
  1187. " then (select top 1 rtrim(name) " +
  1188. " from yp_zd_dict " +
  1189. " where code = charge_code_mx " +
  1190. " and yp_zd_dict.serial = a.serial) " +
  1191. " else (select rtrim(name) from zd_charge_item where code = charge_code_mx) end), " +
  1192. " a.charge_fee, " +
  1193. " a.charge_status, " +
  1194. " a.serial, " +
  1195. " charge_amount=a.charge_amount, " +
  1196. " exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
  1197. " dept_code = (select name from zd_unit_code where code = a.ward_code), " +
  1198. " isnull(a.ori_detail_sn, 0) as ori_detail_sn " +
  1199. "FROM zy_detail_charge a " +
  1200. "where abs(order_no) = #{yz.actOrderNo} " +
  1201. " and inpatient_no = #{yz.inpatientNo} " +
  1202. " and admiss_times = #{yz.admissTimes} " +
  1203. "order by charge_date desc ")
  1204. List<ZyDetailCharge> selectOrderFee(@Param("yz") XinZhenYzActOrder yz);
  1205. @Update("update yz_act_order " +
  1206. "set modifier = #{userCode}, " +
  1207. " end_time = #{param.date}, " +
  1208. " exclu_act_order_no = #{param.orderNo} " +
  1209. "where inpatient_no = #{param.patNo} " +
  1210. " and admiss_times = #{param.times} " +
  1211. " and status_flag in ('3', '4') " +
  1212. " and frequ_code <> 'ONCE' " +
  1213. " and end_time is null")
  1214. int oneClickStopOrder(@Param("param") OneClickOrder param,
  1215. @Param("userCode") String userCode);
  1216. @Insert("insert into yz_act_order (act_order_no, inpatient_no, admiss_times, order_code, order_time, frequ_code, enter_time, " +
  1217. " enter_oper, start_time, end_time, infant_flag, drug_flag, " +
  1218. " physician, confirm_time, signer, modifier, status_flag, status_time, " +
  1219. " instruction, order_name, pay_self, serial, group_no, ward_code, " +
  1220. " doctor_flag, dept_code, exec_unit, zy_serial_no, refer_physician, consult_physician) " +
  1221. "values (#{one.orderNo}, #{one.patNo}, #{one.times}, '10507', #{one.nowDate}, 'ONCE', #{one.nowDate}," +
  1222. " #{one.userCode},#{one.nowDate}, null, #{p.infantFlag}, 'o'," +
  1223. " #{one.userCode}, #{one.nowDate}, #{one.userCode}, #{one.userCode}, '5', #{one.nowDate}," +
  1224. " '一键停止医嘱' + N'${one.dateStr}' , #{one.name}, '0','00', '00', #{p.deptCode}, '1', #{p.deptCode}, #{p.zkWard}, '', #{p.referPhysician}, #{p.consultPhysician})")
  1225. void insertOneClickStopOrder(@Param("one") OneClickOrder one,
  1226. @Param("p") XinZhenYiZhu p);
  1227. @Select("select rtrim(a.name) as name, a.code, a.code_rs, cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel " +
  1228. "from dj_user_base dj, " +
  1229. " a_employee_mi a " +
  1230. "where dj.code = a.code " +
  1231. " and isnull(a.del_flag, '0') = '0' " +
  1232. " and a.code = #{us.code} " +
  1233. " and dj.password = #{us.password} ")
  1234. DoctorAuthRest doctorAuthorizationLogin(@Param("us") DoctorAuthParams us);
  1235. @Select("select code_rs, code, name, cast(isnull(NULLIF(doctor_xz_yp, ''), 0) as int) + 1 as doctorLevel\n" +
  1236. "from a_employee_mi\n" +
  1237. "where code = #{us.code}\n" +
  1238. " and emr_sign_pwd = #{us.signCode}")
  1239. DoctorAuthRest doctorAuthorizationLoginByEmrSignPwd(@Param("us") DoctorAuthParams us);
  1240. @Select("select isnull(yp_level, 0) " +
  1241. "from yp_zd_dict " +
  1242. "where code + '_' + serial = '${code}'")
  1243. Integer selectYpLevel(@Param("code") String code);
  1244. @Select("update new_act_order_recording " +
  1245. "set authorized_doctor = #{userCode} " +
  1246. "where act_order_no = #{orderNo}")
  1247. void updateAuthorizedDoctor(@Param("orderNo") BigDecimal orderNo,
  1248. @Param("userCode") String userCode);
  1249. @Update("update yz_act_order set instruction = cast('${str}' as char(100)) where act_order_no = #{order} ")
  1250. void updateOrderInstruction(@Param("order") BigDecimal order,
  1251. @Param("str") String str);
  1252. @Select("select count(1) from yz_order_frequency where code = #{code}")
  1253. int getTheFrequency(@Param("code") String code);
  1254. @Select("select item_name, order_code , count from yz_zd_order_item_confirm ")
  1255. List<YzZdOrderItemConfirm> selectYzItemConfirm();
  1256. @Select("select count(1) from yz_act_order where inpatient_no = '${patNo}' and admiss_times = ${times} and " +
  1257. "order_code = '${orderCode}' and serial = '00'")
  1258. Integer selectCountByOrderCode(String patNo, Integer times, String orderCode);
  1259. @Select("SELECT 收费编码=a.occ_code , \n" +
  1260. " 项目名称=b.name , \n" +
  1261. "\t\t 数量=a.amount ,\n" +
  1262. " 单价=b.charge_amount ,\n" +
  1263. "\t\t 个人自付比例=cast(cast(selfpay_prop as decimal(10,2))*100 as varchar)+'%',\n" +
  1264. "\t\t 医保说明=isnull(b.connotation,'无')+'|'+isnull(b.descriptions,'无'),\n" +
  1265. "\t\t 医保编码=national_code \n" +
  1266. " FROM yz_order_occurence a ,zd_charge_item b\n" +
  1267. "where a.order_code='${code}' and \n" +
  1268. " a.occ_code=b.code ")
  1269. List<JSONObject> getItemInstructions(String code);
  1270. @Select("select case when a.serial = '00' then c.occ_code else a.order_code end\n" +
  1271. "from yz_act_order a\n" +
  1272. " left join yz_order_occurence c on (a.serial = '00' and a.order_code = c.order_code)" +
  1273. " ${ew.customSqlSegment} ")
  1274. Set<String> selectOrderCode(@Param(Constants.WRAPPER) Wrapper<?> qw);
  1275. @Select("select order_code\n" +
  1276. "from yz_zd_order_item_confirm\n" +
  1277. "where item_name = #{name}")
  1278. Set<String> getOrderCodeByName(String name);
  1279. @Select("select count(1)\n" +
  1280. "from yz_act_order\n" +
  1281. "where inpatient_no = '${patNo}'\n" +
  1282. " and admiss_times = #{times}\n" +
  1283. " and start_time >= (select top 1 start_time\n" +
  1284. " from yz_act_order a\n" +
  1285. " where a.inpatient_no = '${patNo}'\n" +
  1286. " and a.admiss_times = #{times}\n" +
  1287. " and a.order_code in (select order_code from yz_zd_order_item_confirm where item_name = N'出院')\n" +
  1288. " and serial = '00' " +
  1289. " and a.act_order_no <> yz_act_order.act_order_no" +
  1290. " order by start_time desc)")
  1291. Integer prescribeMedicalAdviceAfterDischarge(String patNo,
  1292. Integer times);
  1293. @Select("select top 1 ward_code\n" +
  1294. "from op_record\n" +
  1295. "where inpatient_no = #{patNo}\n" +
  1296. " and admiss_times = #{times}\n" +
  1297. "order by op_times desc")
  1298. String getOpRecordWard(String patNo, Integer times);
  1299. @Update("update zy_detail_charge\n" +
  1300. "set ward_code = '${ward}'\n" +
  1301. "where inpatient_no = '${patNo}'\n" +
  1302. " and admiss_times = ${times}\n" +
  1303. " and ward_code = '${ssWard}'")
  1304. void updateChargeWard(String patNo, Integer times, String ward, String ssWard);
  1305. @Select("select *\n" +
  1306. "from zd_charge_limitations\n" +
  1307. "where charge_code = '${code}'")
  1308. ChargeLimitations hasCharge(String code);
  1309. @Select("select a.limit_day, limit_times, convert(varchar(10), charge_date, 21) as charge_date " +
  1310. "from zd_charge_limitations a,\n" +
  1311. " zy_detail_charge b\n" +
  1312. "where a.charge_code = '${chargeCode}'\n" +
  1313. " and b.inpatient_no = '${patNo}'\n" +
  1314. " and b.admiss_times = ${times} \n" +
  1315. " and a.charge_code = b.charge_code_mx\n" +
  1316. " and ledger_sn = ${ledgerSn}\n" +
  1317. " and ori_detail_sn is null\n" +
  1318. " and a.del_flag <> '1'\n" +
  1319. " and isnull(yb_self_flag, '0') != '1' " +
  1320. "group by charge_date, limit_day, limit_times")
  1321. List<ChargeLimitations> getChargeDay(String patNo, Integer times, Integer ledgerSn, String chargeCode);
  1322. @Select("select group_no, group_name,start_time, end_time " +
  1323. "from yp_zd_group_name\n" +
  1324. "where zy_flag = 1\n" +
  1325. " and del_flag = 0\n" +
  1326. " and xy_flag = 1")
  1327. List<YpZdGroupName> selectYpZdGroup();
  1328. @Select("select group_no, group_name,start_time, end_time " +
  1329. "from yp_zd_group_name\n" +
  1330. "where zy_flag = 1\n" +
  1331. " and del_flag = 0\n" +
  1332. " and zcy_flag = 1")
  1333. List<YpZdGroupName> selectYpCyGroup();
  1334. }