YiZhuLuRuServer.java 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462
  1. package thyyxxk.webserver.service.zhuyuanyisheng;
  2. import cn.hutool.core.util.StrUtil;
  3. import cn.hutool.extra.spring.SpringUtil;
  4. import com.alibaba.fastjson.JSON;
  5. import com.alibaba.fastjson.JSONObject;
  6. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  7. import com.baomidou.mybatisplus.core.metadata.IPage;
  8. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.apache.commons.collections4.ListUtils;
  11. import org.jetbrains.annotations.NotNull;
  12. import org.springframework.scheduling.annotation.Async;
  13. import org.springframework.stereotype.Service;
  14. import org.springframework.transaction.annotation.Transactional;
  15. import thyyxxk.webserver.config.exception.BizException;
  16. import thyyxxk.webserver.config.exception.ExceptionEnum;
  17. import thyyxxk.webserver.constants.sidicts.ChargeStatus;
  18. import thyyxxk.webserver.dao.his.inpatient.XiangMuLuRuDao;
  19. import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
  20. import thyyxxk.webserver.entity.ResultVo;
  21. import thyyxxk.webserver.entity.RoleCode;
  22. import thyyxxk.webserver.entity.casefrontsheet.SheetOverview;
  23. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  24. import thyyxxk.webserver.entity.datamodify.SelectV2;
  25. import thyyxxk.webserver.entity.datamodify.YzActOrder;
  26. import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
  27. import thyyxxk.webserver.entity.dictionary.CodeName;
  28. import thyyxxk.webserver.entity.inpatient.patient.Overview;
  29. import thyyxxk.webserver.entity.inpatient.patient.Patient;
  30. import thyyxxk.webserver.entity.login.UserInfo;
  31. import thyyxxk.webserver.entity.zhuyuanyisheng.DoctorSOrderFee;
  32. import thyyxxk.webserver.entity.zhuyuanyisheng.OneClickOrder;
  33. import thyyxxk.webserver.entity.zhuyuanyisheng.ZyOrderZk;
  34. import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.*;
  35. import thyyxxk.webserver.service.PublicServer;
  36. import thyyxxk.webserver.service.inpatient.casefrontsheet.CaseFrontSheetMainService;
  37. import thyyxxk.webserver.service.externalhttp.DrgWebServices;
  38. import thyyxxk.webserver.service.redislike.RedisLikeService;
  39. import thyyxxk.webserver.service.zhuyuanyisheng.yizhuverify.Repel;
  40. import thyyxxk.webserver.service.zhuyuanyisheng.yizhuverify.YiZhuCheckData;
  41. import thyyxxk.webserver.utils.*;
  42. import java.math.BigDecimal;
  43. import java.util.*;
  44. import java.util.stream.Collectors;
  45. /**
  46. * <p>
  47. * 描述: 医嘱录入
  48. * </p>
  49. *
  50. * @author xc
  51. * @date 2022-01-04 16:59
  52. */
  53. @Service
  54. @Slf4j
  55. public class YiZhuLuRuServer {
  56. private final YiZhuLuRuDao dao;
  57. private final PublicServer publicServer;
  58. private final RedisLikeService redisLikeService;
  59. private final XiangMuLuRuDao xiangMuLuRuDao;
  60. private final DrgWebServices drgWebServices;
  61. private final CaseFrontSheetMainService caseFrontSheetMainService;
  62. /**
  63. * 转科的医嘱编码
  64. */
  65. private final String ZK_CODE = "06286";
  66. private final String ITEM = "00";
  67. private final String 出院带药 = "007";
  68. private YiZhuLuRuServer getThis() {
  69. return SpringUtil.getBean(this.getClass());
  70. }
  71. public YiZhuLuRuServer(YiZhuLuRuDao dao, PublicServer publicServer, RedisLikeService redisLikeService, XiangMuLuRuDao xiangMuLuRuDao, DrgWebServices drgWebServices, CaseFrontSheetMainService caseFrontSheetMainService) {
  72. this.dao = dao;
  73. this.publicServer = publicServer;
  74. this.redisLikeService = redisLikeService;
  75. this.xiangMuLuRuDao = xiangMuLuRuDao;
  76. this.drgWebServices = drgWebServices;
  77. this.caseFrontSheetMainService = caseFrontSheetMainService;
  78. }
  79. public ResultVo<String> getOrderNo() {
  80. return ResultVoUtil.success(publicServer.getActOrderNo().stripTrailingZeros().toPlainString());
  81. }
  82. public ResultVo<List<Patient>> getMyPatient() {
  83. return ResultVoUtil.success(dao.getMyPatient(TokenUtil.getTokenUserId()));
  84. }
  85. /**
  86. * 获取患者的医嘱
  87. *
  88. * @param param 查询条件 住院号,住院时间
  89. * @return 返回医嘱数据
  90. */
  91. public ResultVo<List<XinZhenYzActOrder>> huoQuYiZhuShuJu(YiZhuFeiYongChaXunTiaoJian param) {
  92. QueryWrapper<?> qw = new QueryWrapper<>();
  93. qw.eq("a.inpatient_no", param.getPatNo())
  94. .eq("a.admiss_times", param.getTimes())
  95. .orderByAsc("a.act_order_no");
  96. List<XinZhenYzActOrder> yiZhuList = dao.selectOrderNo(qw);
  97. if (ListUtil.isBlank(yiZhuList)) {
  98. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "该患者还没有开医嘱。");
  99. }
  100. List<XinZhenYzActOrder> list = getOrderList(yiZhuList);
  101. return ResultVoUtil.success(list);
  102. }
  103. /**
  104. * 设置医嘱号的数状图
  105. *
  106. * @param yiZhuList 医嘱数据
  107. * @return
  108. */
  109. @NotNull
  110. public static List<XinZhenYzActOrder> getOrderList(List<XinZhenYzActOrder> yiZhuList) {
  111. // 还有那些没有被匹配的子级医嘱
  112. Map<BigDecimal, XinZhenYzActOrder> wuFuJiYiZhu = yiZhuList.stream().collect(Collectors.toMap(XinZhenYzActOrder::getActOrderNo, a -> a, (k1, k2) -> k1));
  113. // 做成树状图
  114. Map<BigDecimal, XinZhenYzActOrder> map = new HashMap<>(yiZhuList.size());
  115. List<XinZhenYzActOrder> tree = new ArrayList<>();
  116. for (XinZhenYzActOrder item : yiZhuList) {
  117. if (item.getParentNo() == null) {
  118. tree.add(item);
  119. wuFuJiYiZhu.remove(item.getActOrderNo());
  120. }
  121. map.put(item.getActOrderNo(), item);
  122. EntityStringTrim.beanAttributeValueTrim(item);
  123. if ("00".equals(item.getSerial())) {
  124. item.setGroupNoName("项目");
  125. item.setSerialName("项目");
  126. } else {
  127. if ("01".equals(item.getSerial())) {
  128. item.setSerialName("小包装");
  129. } else if ("99".equals(item.getSerial())) {
  130. item.setSerialName("大包装");
  131. }
  132. }
  133. }
  134. for (XinZhenYzActOrder item : yiZhuList) {
  135. XinZhenYzActOrder actOrder = map.get(item.getParentNo());
  136. if (actOrder != null) {
  137. wuFuJiYiZhu.remove(item.getActOrderNo());
  138. if (actOrder.getChildren() == null) {
  139. actOrder.setChildren(new ArrayList<>());
  140. actOrder.setOrderGroup("┌");
  141. }
  142. item.setOrderGroup("丨");
  143. actOrder.getChildren().add(item);
  144. }
  145. }
  146. if (!wuFuJiYiZhu.isEmpty()) {
  147. tree.addAll(wuFuJiYiZhu.values());
  148. }
  149. List<XinZhenYzActOrder> list = new ArrayList<>();
  150. for (XinZhenYzActOrder zy : tree) {
  151. list.add(zy);
  152. if (ListUtil.notBlank(zy.getChildren())) {
  153. zy.getChildren().get(zy.getChildren().size() - 1).setOrderGroup("└");
  154. list.addAll(zy.getChildren());
  155. zy.setChildren(null);
  156. }
  157. }
  158. return list;
  159. }
  160. /**
  161. * 获取搜索的项目信息,如药品和项目
  162. *
  163. * @param code 拼音首字母,中文,编码来进行搜索
  164. * @return 返回项目信息
  165. */
  166. public ResultVo<List<YiZhuMingChen>> huoQuXiangMu(String code, String groupNo) {
  167. code = StringUtil.isContainChinese(code);
  168. // 药品
  169. List<YiZhuMingChen> list = dao.yiZhuYaoPing(code, groupNo);
  170. // 项目
  171. list.addAll(dao.yiZhuXiangMu(code));
  172. // 模板
  173. list.addAll(dao.composeOrders(code, redisLikeService.getUserInfoByToken().getDeptCode()));
  174. EntityStringTrim.beanAttributeValueTrimList(list);
  175. return ResultVoUtil.success(list);
  176. }
  177. /**
  178. * 获取父医嘱
  179. *
  180. * @param patNo 住院号
  181. * @param times 次数
  182. * @return 返回父医嘱
  183. */
  184. public ResultVo<List<XinZhenYzActOrder>> getParentOrders(String patNo, Integer times) {
  185. return ResultVoUtil.success(dao.getParentOrders(patNo, times));
  186. }
  187. /**
  188. * 把有错误的子医嘱纠正回来,子医嘱要跟随父医嘱的频率 等
  189. *
  190. * @param list 患者的数据
  191. */
  192. public void correctSubOrders(List<XinZhenYzActOrder> list) {
  193. // 父医嘱
  194. Map<BigDecimal, XinZhenYzActOrder> parentOrder = new HashMap<>(list.size());
  195. list.forEach(item -> parentOrder.put(item.getActOrderNo(), item));
  196. list.forEach(item -> {
  197. if (item.getParentNo() != null && parentOrder.containsKey(item.getParentNo())) {
  198. XinZhenYzActOrder order = parentOrder.get(item.getParentNo());
  199. // 判断是否需要更新
  200. if (updateSubOrders(order, item)) {
  201. dao.updateSubOrderStatus(item.getActOrderNo(), order);
  202. }
  203. }
  204. });
  205. }
  206. private boolean updateSubOrders(XinZhenYzActOrder parent, XinZhenYzActOrder children) {
  207. if (!parent.getOrderTime().equals(children.getOrderTime())) {
  208. return true;
  209. }
  210. if (!parent.getStartTime().equals(children.getStartTime())) {
  211. return true;
  212. }
  213. if (parent.getEndTime() != null && !parent.getEndTime().equals(children.getEndTime())) {
  214. return true;
  215. }
  216. if (!parent.getFrequCode().equals(children.getFrequCode())) {
  217. return true;
  218. }
  219. return !parent.getGroupNo().equals(children.getGroupNo());
  220. }
  221. /**
  222. * 确认 医嘱 , 这个是最新的正确的
  223. *
  224. * @param param 数据
  225. * @return 返回提示
  226. */
  227. public ResultVo<Map<String, Object>> confirmOrders(XinZhenYiZhu param) {
  228. QueryWrapper<?> qw = new QueryWrapper<>();
  229. qw.eq("a.inpatient_no", param.getInpatientNo())
  230. .eq("a.admiss_times", param.getAdmissTimes())
  231. .eq("a.status_flag", "1")
  232. .eq("a.enter_oper", TokenUtil.getTokenUserId())
  233. // 排除出院带药的医嘱
  234. .ne("isnull(a.self_buy,'0')", "4")
  235. .orderByAsc("a.act_order_no");
  236. param.setList(dao.selectOrderNo(qw));
  237. List<XinZhenYzActOrder> yiZhuList = param.getList();
  238. if (ListUtil.isBlank(yiZhuList)) {
  239. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有需要确认的医嘱.");
  240. }
  241. // 把错误的子医嘱更正回来
  242. correctSubOrders(param.getList());
  243. String userCode = TokenUtil.getTokenUserId();
  244. XinZhenYiZhu patInfo = dao.queryPatientInfo(param.getInpatientNo(), param.getAdmissTimes());
  245. // 是否可以确认
  246. List<BigDecimal> confirmOrderInformation = new ArrayList<>();
  247. YiZhuCheckData checkData = new YiZhuCheckData(dao);
  248. checkData.init(yiZhuList, patInfo).judgeExclusion();
  249. Map<String, Object> checkMap = checkData.startCheck((item) -> {
  250. confirmOrderInformation.add(item.getActOrderNo());
  251. });
  252. if (checkData.multipleExclusions()) {
  253. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "一次性不能确认多条全排斥医嘱。");
  254. }
  255. if (checkData.getFailed()) {
  256. return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请修改错误的医嘱", checkMap);
  257. }
  258. Repel repel = checkData.getRepel();
  259. if (repel != null && repel.getCount() > 0) {
  260. // 把全排斥医嘱变成临时防止给药方式错误
  261. dao.modifyTheFrequency(repel.getOrderNo());
  262. dao.stopOrder(param.getInpatientNo(), param.getAdmissTimes(), repel.getDate(), userCode, repel.getOrderNo());
  263. }
  264. for (BigDecimal decimal : confirmOrderInformation) {
  265. dao.confirmOrders(decimal, userCode, new Date());
  266. }
  267. getThis().drgOrderUpdate(patInfo.getInpatientNo() + "_" + patInfo.getAdmissTimes() + "_" + patInfo.getLedgerSn());
  268. sendAMessageToTheNurse(param, userCode, patInfo, "新增医嘱");
  269. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
  270. }
  271. /**
  272. * 出院医嘱质控校验
  273. * 暂时废弃
  274. *
  275. * @param param 患者信息
  276. */
  277. @Deprecated
  278. private void dischargeQCVerification(XinZhenYiZhu param) {
  279. if (param.getInpatientNo().contains("$")) {
  280. return;
  281. }
  282. if (dao.selectDischargeOrde(param, TokenUtil.getTokenUserId()) > 0) {
  283. SheetOverview overview = new SheetOverview();
  284. overview.setBah(param.getInpatientNo());
  285. overview.setTimes(param.getAdmissTimes());
  286. overview.setInOutFlag(1);
  287. ResultVo<Map<String, List<CodeName>>> result = caseFrontSheetMainService.sheetVerification(overview);
  288. if (!result.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
  289. throw new BizException(ExceptionEnum.LOGICAL_ERROR, result.getMessage());
  290. }
  291. if (!result.getData().get("force").isEmpty()) {
  292. throw new BizException(ExceptionEnum.LOGICAL_ERROR, "未通过病案首页质控,无法确认出院医嘱。");
  293. }
  294. }
  295. }
  296. /**
  297. * 在开医嘱时 drg 需要调用一下这个接口
  298. *
  299. * @param patientNo 患者id
  300. */
  301. @Async
  302. public void drgOrderUpdate(String patientNo) {
  303. try {
  304. JSONObject jsonDrg = new JSONObject();
  305. jsonDrg.put("visit_id", Collections.singletonList(patientNo));
  306. jsonDrg.put("scene_type", 1);
  307. JSONObject js = drgWebServices.etlClient(jsonDrg);
  308. log.info("调用drg医嘱确认接口:{}", js);
  309. } catch (Exception e) {
  310. e.printStackTrace();
  311. }
  312. }
  313. private void sendAMessageToTheNurse(XinZhenYiZhu param, String inputCode, XinZhenYiZhu patInfo, String name) {
  314. List<String> content = new ArrayList<>();
  315. for (XinZhenYzActOrder item : param.getList()) {
  316. String sb = notificationStyle("医嘱名", "409eff", item.getOrderName()) +
  317. notificationStyle("医嘱时间", "409eff", DateUtil.formatDatetime(item.getStartTime())) +
  318. notificationStyle("床位", "409eff", patInfo.getBedNo()) +
  319. notificationStyle("患者姓名", "409eff", patInfo.getName()) +
  320. notificationStyle("频次", "409eff", item.getFrequCode());
  321. content.add(sb);
  322. }
  323. publicServer.faSongXiaoXi(patInfo, content, name, inputCode);
  324. }
  325. private String notificationStyle(String name, String color, String content) {
  326. return String.format("%s:<span style='color: #%s'>%s</span><br>", name, color, content);
  327. }
  328. /**
  329. * 录入 单条医嘱 新的 下面的保存医嘱的都无效了
  330. *
  331. * @param param 参数
  332. * @return 错误信息和提示
  333. */
  334. public ResultVo<Map<String, Object>> enterOrders(XinZhenYiZhu param) {
  335. XinZhenYzActOrder oldOrderNo = dao.getActOrderNoOne(param.getActOrderNo());
  336. String userCode = TokenUtil.getTokenUserId();
  337. if (oldOrderNo != null) {
  338. if (!"1".equals(oldOrderNo.getStatusFlag().trim())) {
  339. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该医嘱不是录入状态无法保存.");
  340. }
  341. if (!oldOrderNo.getInpatientNo().trim().equals(param.getInpatientNo())) {
  342. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "两次医嘱录入时患者不一致。");
  343. }
  344. if (!oldOrderNo.getEnterOper().equals(userCode)) {
  345. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医嘱录入人不是您,无法修改。");
  346. }
  347. }
  348. XinZhenYiZhu huanZheXinXi = dao.queryPatientInfo(param.getInpatientNo(), param.getAdmissTimes());
  349. XinZhenYzActOrder data = param.getData();
  350. if (ITEM.equals(data.getSerial().trim())) {
  351. data.setGroupNo("00");
  352. }
  353. YiZhuCheckData checkData = new YiZhuCheckData(dao);
  354. Map<String, Object> errorMessageMap = checkData.init(data, huanZheXinXi)
  355. .startCheck(null);
  356. if (data.getParentNo() != null) {
  357. XinZhenYzActOrder parentOrder = dao.getActOrderNoOne(data.getParentNo().stripTrailingZeros().toPlainString());
  358. if (parentOrder != null) {
  359. data.setFrequCode(parentOrder.getFrequCode());
  360. }
  361. }
  362. // 删除抗菌药物信息
  363. dao.deleteAntimicrobialInformation(param.getActOrderNo());
  364. // 先删除转科在插入
  365. dao.deleteTransferOrder(param.getActOrderNo());
  366. if (checkData.getPassTheAudit()) {
  367. if (ZK_CODE.equals(data.getOrderCode())) {
  368. ZyOrderZk transferData = new ZyOrderZk();
  369. transferData
  370. .setActOrderNo(param.getActOrderNo())
  371. .setNewDept(data.getZkDeptCode())
  372. .setNewWard(data.getZkWardCode())
  373. .setOldWard(huanZheXinXi.getDeptCode())
  374. .setOldDept(huanZheXinXi.getSmallDept());
  375. dao.insertDoctorSOrder(transferData);
  376. }
  377. // 判断是不是抗菌药物
  378. XinZhenYzActOrder kssItem = checkData.getDrugData(data.getOrderCode().trim() + data.getSerial().trim() + data.getGroupNo().trim());
  379. if (kssItem != null && kssItem.getKjywFlag() != null && kssItem.getKjywFlag() == 1) {
  380. YzActRecordKss kss = new YzActRecordKss();
  381. kss.setActOrderNo(data.getActOrderNo());
  382. kss.setChargeCode(data.getOrderCode());
  383. kss.setYyfs(data.getYyfs());
  384. kss.setSsqk(data.getSsqk());
  385. kss.setYysj(data.getYysj());
  386. dao.insertAntimicrobialInformation(param.getActOrderNo(),
  387. kss, userCode, param.getInpatientNo(), param.getAdmissTimes());
  388. }
  389. }
  390. dao.deleteOrderNo(param.getActOrderNo());
  391. dao.insertEntryOrder(huanZheXinXi, param.getData(), userCode);
  392. if (StringUtil.notBlank(param.getData().getSuperiorDoctor())) {
  393. dao.updateAuthorizedDoctor(param.getData().getActOrderNo(), param.getData().getSuperiorDoctor());
  394. }
  395. if (param.getData().getParentNo() == null) {
  396. // 子医嘱跟随父医嘱
  397. dao.howOftenTheSubPhysicianOrderIsModified(param.getData());
  398. }
  399. if (checkData.getFailed()) {
  400. return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请修改有错误的医嘱。", errorMessageMap);
  401. }
  402. QueryWrapper<?> qw = new QueryWrapper<>();
  403. qw.eq("a.inpatient_no", param.getInpatientNo());
  404. qw.eq("a.admiss_times", param.getAdmissTimes());
  405. qw.eq("a.status_flag", "1");
  406. if (data.getParentNo() != null) {
  407. qw.and(
  408. wrapper -> wrapper.eq("a.act_order_no", data.getParentNo())
  409. .or()
  410. .eq("a.parent_no", data.getParentNo())
  411. );
  412. } else {
  413. qw.and(wrapper -> wrapper.eq("a.act_order_no", param.getActOrderNo())
  414. .or()
  415. .eq("a.parent_no", param.getActOrderNo())
  416. );
  417. }
  418. qw.orderByAsc("a.act_order_no");
  419. Map<String, Object> successMap = new HashMap<>();
  420. successMap.put("code", 200);
  421. successMap.put("data", getOrderList(dao.selectOrderNo(qw)));
  422. log.info("医嘱录入日志:{}", JSON.toJSONString(param));
  423. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "添加成功。", successMap);
  424. }
  425. /**
  426. * 把医嘱模板中的数据插入到 患者的医嘱表中
  427. *
  428. * @param param 参数
  429. * @return
  430. */
  431. public ResultVo<JSONObject> insertTemplateOrder(XinZhenYiZhu param) {
  432. if (StringUtil.isBlank(param.getInpatientNo())) {
  433. return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请先选择患者.");
  434. }
  435. List<BigDecimal> returnOrderList = new ArrayList<>();
  436. XinZhenYiZhu patInfo = dao.queryPatientInfo(param.getInpatientNo(), param.getAdmissTimes());
  437. List<XinZhenYzActOrder> list = param.getList();
  438. List<XinZhenYzActOrder> resList = new ArrayList<>();
  439. Map<BigDecimal, XinZhenYzActOrder> map = new HashMap<>(list.size());
  440. String userCode = TokenUtil.getTokenUserId();
  441. Queue<BigDecimal> queue = new LinkedList<>();
  442. for (XinZhenYzActOrder item : list) {
  443. if (item.getParentNo() == null) {
  444. resList.add(item);
  445. }
  446. map.put(item.getActOrderNo(), item);
  447. queue.offer(publicServer.getActOrderNo());
  448. }
  449. list.forEach(item -> {
  450. if (item.getParentNo() != null) {
  451. XinZhenYzActOrder mapItem = map.get(item.getParentNo());
  452. if (mapItem != null) {
  453. if (mapItem.getChildren() == null) {
  454. mapItem.setChildren(new ArrayList<>());
  455. }
  456. mapItem.getChildren().add(item);
  457. }
  458. }
  459. });
  460. getThis().templateInsertToOrder(resList, patInfo, userCode, returnOrderList, queue);
  461. JSONObject js = getNewOrderData(returnOrderList);
  462. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "插入模板数据成功。", js);
  463. }
  464. /**
  465. * 把模板数据插入到医嘱中
  466. *
  467. * @param resList 医嘱数据
  468. * @param patInfo 患者信息
  469. * @param userCode 用户编码
  470. * @param returnOrderList 返回的医嘱号
  471. */
  472. @Transactional(rollbackFor = Exception.class)
  473. public void templateInsertToOrder(List<XinZhenYzActOrder> resList,
  474. XinZhenYiZhu patInfo,
  475. String userCode,
  476. List<BigDecimal> returnOrderList,
  477. Queue<BigDecimal> queue) {
  478. CacheOnce<XinZhenYzActOrder> drug = new CacheOnce<>();
  479. resList.forEach(item -> {
  480. setTempInfo(drug, item, patInfo);
  481. item.setActOrderNo(queue.poll());
  482. returnOrderList.add(item.getActOrderNo());
  483. dao.insertEntryOrder(patInfo, item, userCode);
  484. if (ListUtil.notBlank(item.getChildren())) {
  485. item.getChildren().forEach(children -> {
  486. setTempInfo(drug, children, patInfo);
  487. children.setActOrderNo(queue.poll());
  488. returnOrderList.add(children.getActOrderNo());
  489. children.setParentNo(item.getActOrderNo());
  490. dao.insertEntryOrder(patInfo, children, userCode);
  491. });
  492. }
  493. });
  494. }
  495. private void setTempInfo(CacheOnce<XinZhenYzActOrder> drug, XinZhenYzActOrder data, XinZhenYiZhu patInfo) {
  496. XinZhenYzActOrder feiYongXinXi = drug.get(data.getOrderCode().trim() + data.getSerial().trim() + data.getGroupNo().trim(), (temp) -> dao.drugDataOne(temp, patInfo.getZkWard()));
  497. YiZhuCheckData.calculateDrugAmount(data, feiYongXinXi);
  498. }
  499. /**
  500. * 删除单条医嘱
  501. *
  502. * @param orderNo 医嘱号
  503. * @return 提示
  504. */
  505. public ResultVo<String> toDeleteAnOrder(String orderNo) {
  506. XinZhenYzActOrder oldData = dao.getActOrderNoOne(orderNo);
  507. String message = judgeWhetherItCanBeDeleted(oldData);
  508. if (StringUtil.notBlank(message)) {
  509. return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, message);
  510. }
  511. dao.toDeleteAnOrder(orderNo, oldData.getInpatientNo());
  512. dao.deleteGroup(orderNo);
  513. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
  514. }
  515. /**
  516. * 删除多条录入的医嘱
  517. *
  518. * @param param 参数
  519. * @return 返回提示
  520. */
  521. public ResultVo<Map<String, String>> deleteMultipleOrders(XinZhenYiZhu param) {
  522. QueryWrapper<?> qw = new QueryWrapper<>();
  523. List<BigDecimal> list = new ArrayList<>();
  524. param.getList().forEach(item -> {
  525. list.add(item.getActOrderNo());
  526. });
  527. qw.in("act_order_no", list);
  528. List<XinZhenYzActOrder> deleteOrderList = dao.getOrdersToDelete(qw);
  529. if (ListUtil.isBlank(deleteOrderList)) {
  530. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到原医嘱可能已经被删除了");
  531. }
  532. Map<String, String> map = new HashMap<>();
  533. deleteOrderList.forEach(item -> {
  534. String error = judgeWhetherItCanBeDeleted(item);
  535. if (StringUtil.notBlank(error)) {
  536. map.put(item.getActOrderNo().stripTrailingZeros().toPlainString(), error);
  537. }
  538. });
  539. log.info("数据:{}", deleteOrderList);
  540. if (map.isEmpty()) {
  541. dao.deleteParentChildRelationship(param.getInpatientNo(), param.getAdmissTimes(), list);
  542. dao.deleteMultipleOrders(qw);
  543. return ResultVoUtil.fail(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
  544. }
  545. return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "删除失败", map);
  546. }
  547. private String judgeWhetherItCanBeDeleted(XinZhenYzActOrder oldData) {
  548. StringBuilder str = new StringBuilder();
  549. if (oldData == null) {
  550. return "没有找到原医嘱可能已经被删除了";
  551. }
  552. if (!("1".equals(oldData.getStatusFlag()) || "2".equals(oldData.getStatusFlag()))) {
  553. str.append("该医嘱不是录入或确认状态,无法删除");
  554. }
  555. if (!oldData.getEnterOper().equals(TokenUtil.getTokenUserId())) {
  556. str.append("该医嘱录入人不是您,无法删除.");
  557. }
  558. return str.toString();
  559. }
  560. public ResultVo<Map<BigDecimal, String>> stopOrder(XinZhenYiZhu param) {
  561. if (ListUtil.isBlank(param.getList())) {
  562. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请先选择数据");
  563. }
  564. Map<BigDecimal, String> map = new HashMap<>();
  565. param.getList().forEach(item -> {
  566. if (item.getEndTime() == null) {
  567. map.put(item.getActOrderNo(), "停止时间不能为空。");
  568. } else {
  569. if (DateUtil.shiJianDaXiao(item.getEndTime(), item.getStartTime(), "<")) {
  570. map.put(item.getActOrderNo(), "停止时间不能小于医嘱的开始时间。");
  571. }
  572. }
  573. });
  574. if (map.isEmpty()) {
  575. dao.setStopTime(param.getList(), TokenUtil.getTokenUserId(), param.getInpatientNo(), param.getAdmissTimes());
  576. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
  577. }
  578. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "存在医嘱时间为空的医嘱请检查。", map);
  579. }
  580. @Transactional(rollbackFor = Exception.class)
  581. public ResultVo<String> voidOrders(String orderNo, String reasonForCancellation) {
  582. XinZhenYzActOrder yz = dao.getActOrderNoOne(orderNo);
  583. if (yz == null) {
  584. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "原医嘱找不到了。");
  585. }
  586. if ("-1".equals(yz.getStatusFlag())) {
  587. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医嘱已作废了。");
  588. }
  589. UserInfo userInfo = redisLikeService.getUserInfoByToken();
  590. if (!DateUtil.within24Hours(yz.getStartTime())) {
  591. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "只能对24小时内的医嘱进行作废处理");
  592. }
  593. List<String> list = dao.getTheDoctorSDepartment(userInfo.getDeptCode());
  594. list.add(userInfo.getDeptCode());
  595. if (publicServer.needRule(1)) {
  596. list.add(yz.getWardCode());
  597. }
  598. if (!list.contains(yz.getWardCode())) {
  599. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "非本科室开的医嘱不可作废");
  600. }
  601. // if (dao.getADoctorSOrderWithADefiniteFee(yz.getInpatientNo(), yz.getAdmissTimes(), orderNo) > 0) {
  602. // return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该医嘱已经执行,请对应的医技科室拒绝医嘱。");
  603. // }
  604. //
  605. // if (dao.getDetailChargeFee(yz.getInstruction(), yz.getAdmissTimes(), orderNo) > 0) {
  606. // return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该医嘱已经产生了医技费用,请对应的医技科室进行退费处理。");
  607. // }
  608. // 取消项目 医嘱确费表
  609. dao.cancelMedicalTechnologyAssuranceFee(TokenUtil.getTokenUserId(), orderNo, yz.getInpatientNo(), yz.getAdmissTimes());
  610. // 获取父子医嘱同时退费
  611. List<String> parentNoList = dao.getParentChildOrders(orderNo);
  612. parentNoList.add(orderNo);
  613. List<ZyDetailCharge> feeList = dao.getExpenseData(yz.getInpatientNo(), yz.getAdmissTimes(), parentNoList);
  614. if (ListUtil.notBlank(feeList)) {
  615. List<ZyDetailCharge> refundArray = new ArrayList<>(feeList.size());
  616. for (ZyDetailCharge item : feeList) {
  617. // 取负数的费用
  618. item.setChargeFee(item.getChargeFee().negate());
  619. item.setChargeAmount(item.getChargeAmount().negate());
  620. item.setOpIdCode(userInfo.getCode());
  621. item.setOriDetailSn(item.getDetailSn());
  622. item.setNewOrderNo(item.getOrderNo());
  623. refundArray.add(item);
  624. }
  625. List<List<ZyDetailCharge>> fenGe = ListUtils.partition(refundArray, 20);
  626. fenGe.forEach(xiangMuLuRuDao::xiangMuTuiFei);
  627. // 更新住院表费用
  628. dao.updateItemFlag(yz.getInpatientNo(), yz.getAdmissTimes(), parentNoList);
  629. }
  630. // 取消发药表的数据 父子医嘱
  631. parentNoList.forEach(dao::refusalToDispenseMedication);
  632. // 作废医嘱状态更变
  633. dao.updateVoidedOrders(orderNo, userInfo.getCode(), reasonForCancellation);
  634. // 改变子医嘱
  635. dao.updateChildOrders(orderNo, userInfo.getCode(), reasonForCancellation);
  636. log.info("作废医嘱==》操作人:{},医嘱号:{}", userInfo.getCode(), orderNo);
  637. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "撤销成功。");
  638. }
  639. /**
  640. * 获取某一个费用的详细信息
  641. *
  642. * @param code 编码
  643. * @param serial 00-项目 01-小包装的药品 99-大包装
  644. * @return 返回该费用的一些详细信息,以及一些提示信息。
  645. */
  646. public ResultVo<Map<String, Object>> huoQuFeiYongXinXi(String code, String serial, String deptCode, String groupNo, String seniorDoctor) {
  647. Map<String, Object> map = new HashMap<>();
  648. // 一些提示
  649. List<String> prompt = new ArrayList<>();
  650. boolean permissionPrompt = false;
  651. // 加载项目信息
  652. if (ITEM.equals(serial.trim())) {
  653. List<XinZhenYzActOrder> xiangMu = dao.huoQuXiangMu(code);
  654. for (XinZhenYzActOrder item : xiangMu) {
  655. if (item.getDelFlag() == 1) {
  656. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("该医嘱下的【%s】,已经被停用了,请联系物价科。", item.getOrderName()));
  657. } else if (StringUtil.isBlank(item.getNationalCode())) {
  658. prompt.add(String.format("该医嘱下面的【%s】,没有医保编码,请注意。", item.getOrderName()));
  659. } else {
  660. prompt.add(String.format("该医嘱下【%s】,医保码为:【%s】。", item.getOrderName(), item.getNationalCode()));
  661. }
  662. }
  663. if (ListUtil.isBlank(xiangMu)) {
  664. Integer paiChiYiZhu = dao.shiFouPaiChiYiZhu(code);
  665. if (paiChiYiZhu != null) {
  666. switch (paiChiYiZhu) {
  667. case 1:
  668. prompt.add("全排斥医嘱");
  669. break;
  670. case 2:
  671. prompt.add("单组排斥医嘱");
  672. break;
  673. case 3:
  674. prompt.add("多组斥医嘱");
  675. break;
  676. default:
  677. break;
  678. }
  679. }
  680. }
  681. } else {
  682. YaoPinXinXi yp = dao.huoQuYaoPin(code.trim() + serial.trim(), groupNo);
  683. if (StringUtil.notBlank(deptCode)) {
  684. if (dao.restrictedUseInTheDepartment(code.trim(), deptCode) > 0) {
  685. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "该药品禁止在患者所在的科室使用。");
  686. }
  687. }
  688. if (yp == null) {
  689. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "该医嘱下的药品,可能已经被停用了,请联系药剂科。");
  690. }
  691. yp.setDrugFlag(getDrugFlagByLargeCategories(yp.getCategoriesFlag()));
  692. if (yp.getVisibleFlagZy() == 1) {
  693. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "该药品禁止住院使用。");
  694. }
  695. Integer yiShenDengJi = dao.huoQuYiShenDengJi(TokenUtil.getTokenUserId());
  696. int yiShen = yiShenDengJi == null ? 0 : yiShenDengJi;
  697. int superior = 0;
  698. if (seniorDoctor != null) {
  699. Integer superiorRank = dao.huoQuYiShenDengJi(seniorDoctor);
  700. superior = superiorRank == null ? 0 : superiorRank;
  701. }
  702. if (yp.getYpLevel() > yiShen && yp.getYpLevel() > superior) {
  703. permissionPrompt = true;
  704. }
  705. List<YaoPingJiLiang> yaoPingJiLiang = new ArrayList<>();
  706. if (StringUtil.notBlank(yp.getWeighUnit())) {
  707. yaoPingJiLiang.add(new YaoPingJiLiang(yp.getWeighUnit(), yp.getWeighUnitName(), yp.getWeight()));
  708. }
  709. if (StringUtil.notBlank(yp.getVolUnit())) {
  710. yaoPingJiLiang.add(new YaoPingJiLiang(yp.getVolUnit(), yp.getVolUnitName(), yp.getVolum()));
  711. }
  712. if (StringUtil.notBlank(yp.getPackUnit())) {
  713. yaoPingJiLiang.add(new YaoPingJiLiang(yp.getPackUnit(), yp.getPackUnitName(), yp.getPackSize()));
  714. }
  715. if (yp.getKjywFlag() == 1) {
  716. prompt.add("抗菌药物,需填写抗菌药物医嘱附注");
  717. }
  718. if (yp.getSelfFlagYb() == 1) {
  719. prompt.add("该药品医保自费药品,如符合条件请填写记账,不是请填写自费");
  720. }
  721. if (StringUtil.isBlank(yp.getNationalCode())) {
  722. prompt.add("该药品医保没有匹配医保码");
  723. } else {
  724. prompt.add(String.format("药品医保码为:【%s】", yp.getNationalCode()));
  725. }
  726. if (yp.getStockAmount() != null && BigUtils.bigXiaoYu(yp.getStockAmount(), 10)) {
  727. prompt.add(String.format("该药品剩余数量为:【%s】", yp.getStockAmount().stripTrailingZeros().toPlainString()));
  728. }
  729. if (yp.getPsFlag() == 1) {
  730. prompt.add("此药品为皮试药品");
  731. map.put("piShi", dao.piShiGeiYaoFangShi());
  732. }
  733. map.put("yaoPingJiLiang", yaoPingJiLiang);
  734. map.put("data", yp);
  735. }
  736. map.put("prompt", prompt);
  737. map.put("permissionPrompt", permissionPrompt);
  738. return ResultVoUtil.success(map);
  739. }
  740. private String getDrugFlagByLargeCategories(String val) {
  741. if (StringUtil.isBlank(val)) {
  742. return "z";
  743. }
  744. switch (val) {
  745. case "0":
  746. return "d";
  747. case "1":
  748. return "i";
  749. default:
  750. return "z";
  751. }
  752. }
  753. /**
  754. * 获取医嘱频率
  755. *
  756. * @return 返回频率
  757. */
  758. public ResultVo<List<GetDropdownBox>> getFrequency() {
  759. return ResultVoUtil.success(dao.selectFrequency());
  760. }
  761. /**
  762. * @return 给药方式
  763. */
  764. public ResultVo<List<SelectV2>> getSupplyType() {
  765. return ResultVoUtil.success(dao.selectSupplyType());
  766. }
  767. /**
  768. * 获取频率 准备不要了
  769. *
  770. * @param code 五笔,拼音,中文,编码
  771. * @return 返回对应的数据
  772. */
  773. @Deprecated
  774. public ResultVo<List<GetDropdownBox>> huoQuZhuYuanPinLv(String code) {
  775. return ResultVoUtil.success(dao.huoQuZhuYuanPinLv("%" + code.toUpperCase() + "%"));
  776. }
  777. /**
  778. * 获取执行科室
  779. *
  780. * @param code 五笔,拼音,中文,编码
  781. * @return 返回对应的数据
  782. */
  783. public ResultVo<List<GetDropdownBox>> huoQuZhiXinKeShi(String code) {
  784. return ResultVoUtil.success(dao.huoQuZhiXinKeShi(StringUtil.isContainChinese(code)));
  785. }
  786. /**
  787. * 这里是校验模板的数据
  788. *
  789. * @param param 模板数据
  790. * @return 返回提示信息
  791. */
  792. public ResultVo<Map<String, Object>> singleDataCheck(XinZhenYiZhu param) {
  793. param.getList().get(0).setActOrderNo(new BigDecimal(param.getList().get(0).getId()));
  794. YiZhuCheckData checkData = new YiZhuCheckData(dao);
  795. checkData.init(param.getList(), null);
  796. Map<String, Object> errorMessage = checkData.startCheck(null);
  797. Map<String, Object> returnMap = new HashMap<>();
  798. returnMap.put("data", param.getList().get(0));
  799. returnMap.put("message", errorMessage.get(param.getList().get(0).getId()));
  800. return ResultVoUtil.success(returnMap);
  801. }
  802. public ResultVo<String> doesTheTemplateExist(String name) {
  803. if (dao.duplicateTemplateName(name, TokenUtil.getTokenUserId()) == 0) {
  804. return ResultVoUtil.success();
  805. }
  806. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "模板名称重复");
  807. }
  808. /**
  809. * 保存模板数据
  810. *
  811. * @param param
  812. * @return
  813. */
  814. public ResultVo<String> saveTemplate(YzOrderPattern param) {
  815. // 如果名字重复了,那么就修改原来的模板
  816. YzOrderPattern yzOrderPattern = dao.yuanLaiDeMuBanBianMa(param.getPatternName(), TokenUtil.getTokenUserId());
  817. UserInfo userInfo = redisLikeService.getUserInfoByCode(TokenUtil.getTokenUserId());
  818. if (null == yzOrderPattern) {
  819. yzOrderPattern = new YzOrderPattern();
  820. }
  821. String patternCode = yzOrderPattern.getPatternCode();
  822. // 有原来的模板名称而且 还要是自己创建的才能删除,否则就只能创建新的模板了
  823. if (StringUtil.notBlank(patternCode) && userInfo.getCode().equals(yzOrderPattern.getInputId())) {
  824. // 更新的时候先删除模板 原来的模板
  825. dao.shanChuLaoMuBan(patternCode);
  826. param.setPatternCode(patternCode);
  827. } else {
  828. // 设置新的模板号
  829. param.setPatternCode(publicServer.getPatternCode());
  830. }
  831. String py = PingYinUtils.pyShouZiMuDaXie(param.getPatternName());
  832. String wb = PingYinUtils.getWBCode(param.getPatternName());
  833. param.setPyCode(py.length() > 9 ? py.substring(0, 9) : py);
  834. param.setDCode(wb.length() > 9 ? wb.substring(0, 9) : wb);
  835. param.setInputId(TokenUtil.getTokenUserId());
  836. param.setDeptCode(userInfo.getDeptCode());
  837. dao.chaRuMuBan(param);
  838. Map<String, XinZhenYzActOrder> map = param.getList().stream().collect(Collectors.toMap(XinZhenYzActOrder::getId, a -> a, (k1, k2) -> k1));
  839. for (XinZhenYzActOrder item : param.getList()) {
  840. // 设置模板号
  841. item.setActOrderNo(publicServer.getPatternOrderCode());
  842. if (item.getParentNo() != null && map.containsKey(item.getParentNo().stripTrailingZeros().toPlainString())) {
  843. item.setParentNo(map.get(item.getParentNo().stripTrailingZeros().toPlainString()).getActOrderNo());
  844. }
  845. }
  846. dao.chaRuMuBanShuJu(param.getList(), param.getPatternCode());
  847. return ResultVoUtil.success();
  848. }
  849. /***
  850. * 获取项目信息
  851. * @param xiangMuCode 项目编码
  852. * @return 返回数据
  853. */
  854. public Map<String, List<XinZhenYzActOrder>> getProjectInformation(Set<String> xiangMuCode) {
  855. if (!xiangMuCode.isEmpty()) {
  856. return dao.huoQuXiangMuXinXi(xiangMuCode).stream().collect(Collectors.groupingBy(item -> item.getOrderCode().trim()));
  857. }
  858. return new HashMap<>(0);
  859. }
  860. /**
  861. * 获取药品信息
  862. *
  863. * @param yaoPingCode 药品编码
  864. * @return 返回数据
  865. */
  866. public Map<String, XinZhenYzActOrder> getDrugInformation(Set<String> yaoPingCode, String dept) {
  867. if (!yaoPingCode.isEmpty()) {
  868. return dao.huoQuYaoPinXinXi(yaoPingCode, dept).stream().collect(Collectors.toMap(item -> item.getOrderCode().trim() + item.getSerial().trim() + item.getGroupNo(), a -> a, (k1, k2) -> k1));
  869. }
  870. return new HashMap<>(0);
  871. }
  872. /**
  873. * 获取医嘱录入的模板
  874. *
  875. * @param code 模板编码
  876. * @param deptCode 科室编码
  877. * @param muBanLeiXing 项目类型
  878. * @param currentPage 当前页
  879. * @param total 总数
  880. * @return 返回模板
  881. */
  882. public ResultVo<IPage<YzOrderPattern>> huoQuYiZhuMuBan(String code, String deptCode, Integer muBanLeiXing, long currentPage, long total) {
  883. IPage<YzOrderPattern> page = new Page<>();
  884. if (total == 0) {
  885. page.setTotal(dao.huoQuMuBanTotal(StringUtil.isContainChinese(code), TokenUtil.getTokenUserId(), deptCode, muBanLeiXing));
  886. }
  887. page.setRecords(dao.huoQuMuBan(StringUtil.isContainChinese(code), TokenUtil.getTokenUserId(), deptCode, muBanLeiXing, currentPage));
  888. return ResultVoUtil.success(page);
  889. }
  890. /**
  891. * 获取 我的医嘱模板的最大医嘱码
  892. *
  893. * @return 最大排序码
  894. */
  895. public ResultVo<Integer> getDoctorSOrderTemplateMaxSortNo() {
  896. Integer sortCode = dao.getMyTemplateMaxSortNo(TokenUtil.getTokenUserId());
  897. return ResultVoUtil.success(sortCode == null ? 0 : sortCode);
  898. }
  899. private String getActOrderNo() {
  900. Random random = new Random();
  901. String a = String.valueOf(random.nextInt(5) + 1);
  902. String b = String.valueOf(random.nextInt(99999));
  903. return a + b;
  904. }
  905. /**
  906. * 获取模板数据
  907. *
  908. * @param code 模板的编码
  909. * @return 返回数据
  910. */
  911. public ResultVo<List<YzActOrder>> huoQuMuBanShuJu(String code) {
  912. List<YzActOrder> muBanShuJu = dao.huoQuMuBanShuJu(code);
  913. Map<BigDecimal, YzActOrder> map = new HashMap<>(muBanShuJu.size());
  914. List<YzActOrder> tree = new ArrayList<>();
  915. for (YzActOrder item : muBanShuJu) {
  916. item.setId(getActOrderNo());
  917. if (item.getParentNo() == null) {
  918. tree.add(item);
  919. }
  920. map.put(item.getActOrderNo(), item);
  921. }
  922. for (YzActOrder item : muBanShuJu) {
  923. YzActOrder yzActOrder = map.get(item.getParentNo());
  924. if (yzActOrder != null) {
  925. item.setParentNo(new BigDecimal(yzActOrder.getId()));
  926. item.setIsChildren(true);
  927. if (yzActOrder.getChildren() == null) {
  928. yzActOrder.setChildren(new ArrayList<>());
  929. }
  930. yzActOrder.getChildren().add(item);
  931. // 没有副医嘱的就返回到最上层
  932. } else if (!tree.contains(item)) {
  933. item.setParentNo(null);
  934. tree.add(item);
  935. }
  936. }
  937. return ResultVoUtil.success(tree);
  938. }
  939. /**
  940. * 删除医嘱模板
  941. *
  942. * @param patternCode 模板的编码
  943. * @return 提示
  944. */
  945. public ResultVo<String> deleteADoctorSOrderTemplate(String patternCode) {
  946. if (StringUtil.isBlank(patternCode)) {
  947. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "模板编号为空。");
  948. }
  949. YzOrderPattern yzOrderPattern = dao.huoQuMuBanXinXi(patternCode);
  950. EntityStringTrim.beanAttributeValueTrim(yzOrderPattern);
  951. if (yzOrderPattern == null) {
  952. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有查询到对应的模板信息。");
  953. }
  954. String userId = TokenUtil.getTokenUserId();
  955. List<Integer> role = publicServer.getRoleCode().getData();
  956. if (publicServer.needRule(role, RoleCode.PHYSICIAN_S_ORDER_TEMPLATEEDIT)) {
  957. return startDeletingTemplates(patternCode);
  958. }
  959. if (userId.equals(yzOrderPattern.getInputId())) {
  960. return startDeletingTemplates(patternCode);
  961. }
  962. // 主任可以删除本科室的任意模板
  963. if (publicServer.needRule(role, RoleCode.DIRECTOR) && dao.userDeptCode(userId).equals(yzOrderPattern.getDeptCode())) {
  964. return startDeletingTemplates(patternCode);
  965. }
  966. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限删除这个模板。");
  967. }
  968. /**
  969. * 删除父模板以及下面的子模板 数据
  970. *
  971. * @param patternCode 模板编码
  972. */
  973. private ResultVo<String> startDeletingTemplates(String patternCode) {
  974. dao.shanChuMuBan(patternCode);
  975. log.info("删除医嘱模板==> 操作人:{},模板编码:{}", TokenUtil.getTokenUserId(), patternCode);
  976. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "删除成功。");
  977. }
  978. /**
  979. * 收藏医嘱模板或者取消收藏
  980. * 如果以及收藏了就删除,没有就收藏
  981. *
  982. * @param patternCode 模板号
  983. * @return 提示
  984. */
  985. public ResultVo<String> collectDoctorSOrderTemplate(String patternCode) {
  986. String userId = TokenUtil.getTokenUserId();
  987. String saveTheDoctorSOrderNumber = dao.whetherToSaveTheDoctorSOrderTemplate(patternCode, userId);
  988. if (StringUtil.notBlank(saveTheDoctorSOrderNumber)) {
  989. dao.shanChuMuBan(saveTheDoctorSOrderNumber);
  990. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "已取消删除。");
  991. } else {
  992. YzOrderPattern yzOrderPattern = dao.huoQuMuBanXinXi(patternCode);
  993. EntityStringTrim.beanAttributeValueTrim(yzOrderPattern);
  994. dao.chaRuShouCang(publicServer.getPatternCode(), yzOrderPattern.getPatternName() + "(收藏)", yzOrderPattern.getPyCode(), yzOrderPattern.getDCode(), dao.userDeptCode(userId), userId, yzOrderPattern.getPatternCode());
  995. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "收藏成功。");
  996. }
  997. }
  998. /**
  999. * 删除或修改模板
  1000. *
  1001. * @param patternCode 模板点吗
  1002. * @param patternName 模板名称
  1003. * @param sortNo 排序号
  1004. * @param flag 标志 1-修改 2- 删除 3-收藏和取消收藏
  1005. * @return 返回给前端提示
  1006. */
  1007. public ResultVo<String> muBanCaoZuo(String patternCode, String patternName, String deptCode, Integer sortNo, Integer flag) {
  1008. if (StringUtil.isBlank(patternCode)) {
  1009. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "模板编码为空。");
  1010. }
  1011. YzOrderPattern yzOrderPattern = dao.huoQuMuBanXinXi(patternCode);
  1012. if (yzOrderPattern == null) {
  1013. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有查询到对应的模板信息。");
  1014. }
  1015. EntityStringTrim.beanAttributeValueTrim(yzOrderPattern);
  1016. String inputId = TokenUtil.getTokenUserId();
  1017. List<Integer> role = publicServer.getRoleCode().getData();
  1018. // 管理员 和 医务部的无视 规则
  1019. if (!role.contains(1) && !role.contains(38) && flag != 3) {
  1020. // 只有模板在不等于 自己的时候触发
  1021. if (!inputId.equals(yzOrderPattern.getInputId())) {
  1022. if ("2".equals(yzOrderPattern.getInputType()) && !role.contains(11)) {
  1023. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该模板为科室模板您没有权限修改或删除,请联系科主任进行修改。");
  1024. } else if ("1".equals(yzOrderPattern.getInputType())) {
  1025. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该模板为全院模板,无法删除或修改。");
  1026. }
  1027. }
  1028. }
  1029. if (flag == 1) {
  1030. if (StringUtil.isBlank(patternName)) {
  1031. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "模板名称不能为空。");
  1032. }
  1033. if (patternName.trim().equals(yzOrderPattern.getPatternName().trim()) && sortNo.equals(yzOrderPattern.getSortNo())) {
  1034. return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "数据没有变化,请勿点击。");
  1035. }
  1036. dao.genXingMuBan(patternName.trim(), PingYinUtils.pyShouZiMuDaXie(patternName), PingYinUtils.getWBCode(patternName), yzOrderPattern.getPatternCode(), sortNo);
  1037. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "修改成功。");
  1038. } else if (flag == 2) {
  1039. // 删除父模板以及下面的子模板 数据
  1040. dao.shanChuMuBan(yzOrderPattern.getPatternCode());
  1041. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "删除成功。");
  1042. } else if (flag == 3) {
  1043. // 收藏模板
  1044. String collectCode = dao.chongFuShouCang(inputId, patternCode);
  1045. if (collectCode == null) {
  1046. dao.chaRuShouCang(publicServer.getPatternCode(), yzOrderPattern.getPatternName() + "(收藏)", yzOrderPattern.getPyCode(), yzOrderPattern.getDCode(), deptCode, inputId, yzOrderPattern.getPatternCode());
  1047. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "收藏成功。");
  1048. } else {
  1049. dao.shanChuMuBan(yzOrderPattern.getPatternCode());
  1050. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "已取消收藏。");
  1051. }
  1052. }
  1053. return ResultVoUtil.success();
  1054. }
  1055. /**
  1056. * 获取医嘱下面产生的费用
  1057. *
  1058. * @param patNo 住院号
  1059. * @param times 住院次数
  1060. * @return 返回
  1061. */
  1062. @Deprecated
  1063. public ResultVo<Map<String, Object>> expensesForGettingADoctorSOrder(String patNo, Integer times) {
  1064. List<DoctorSOrderFee> feeDate = dao.expensesForGettingADoctorSOrder(patNo, times);
  1065. // 这些编码的医嘱都是有问题的
  1066. List<String> problem = Arrays.asList("5", "6", "7", "9");
  1067. Map<String, String> problemDoctorSOrder = new HashMap<>();
  1068. Map<String, FeeSum> totalCost = new HashMap<>();
  1069. Map<String, List<DoctorSOrderFee>> map = new HashMap<>(feeDate.size());
  1070. for (DoctorSOrderFee fee : feeDate) {
  1071. // 如果这个没有就代表没有产生费用
  1072. if (fee.getOrderNoStr() == null) {
  1073. continue;
  1074. }
  1075. String chargeStatusName = ChargeStatus.getValue(fee.getChargeStatus());
  1076. String amount = fee.getChargeAmount().abs().stripTrailingZeros().toPlainString();
  1077. String money = fee.getChargeFee().stripTrailingZeros().toPlainString();
  1078. // 计算费用总和
  1079. if (totalCost.containsKey(fee.getOrderNoStr())) {
  1080. FeeSum sum = totalCost.get(fee.getOrderNoStr());
  1081. sum.setSum(DecimalUtil.add(money, sum.getSum()));
  1082. sum.setAmount(DecimalUtil.add(amount, sum.getAmount()));
  1083. totalCost.replace(fee.getOrderNoStr(), sum);
  1084. } else {
  1085. FeeSum sum = new FeeSum();
  1086. sum.setAmount(amount);
  1087. sum.setSum(money);
  1088. totalCost.put(fee.getOrderNoStr(), sum);
  1089. }
  1090. if (problem.contains(fee.getChargeStatus())) {
  1091. problemDoctorSOrder.put(fee.getOrderNoStr(), chargeStatusName);
  1092. }
  1093. fee.setChargeStatusName(chargeStatusName);
  1094. if (map.containsKey(fee.getOrderNoStr())) {
  1095. map.get(fee.getOrderNoStr()).add(fee);
  1096. } else {
  1097. List<DoctorSOrderFee> list = new ArrayList<>();
  1098. list.add(fee);
  1099. map.put(fee.getOrderNoStr(), list);
  1100. }
  1101. }
  1102. Map<String, Object> feeData = new HashMap<>(3);
  1103. feeData.put("data", map);
  1104. feeData.put("problem", problemDoctorSOrder);
  1105. feeData.put("totalCost", totalCost);
  1106. return ResultVoUtil.success(feeData);
  1107. }
  1108. /**
  1109. * 设置患者三级医生
  1110. *
  1111. * @param param 参数
  1112. * @return 返回值
  1113. */
  1114. public ResultVo<String> saveTheThirdLevelDoctor(Overview param) {
  1115. log.info("设置三级医生:==> 操作人{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONString(param));
  1116. dao.updateTheThirdLevelDoctor(param);
  1117. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
  1118. }
  1119. /**
  1120. * 设置父子医嘱
  1121. *
  1122. * @param param 主医嘱 和 多个子医嘱
  1123. * @return 返回数据
  1124. */
  1125. public ResultVo<String> associateOrders(XinZhenYiZhu param) {
  1126. log.info("数据:{}", JSON.toJSONString(param));
  1127. XinZhenYzActOrder order = dao.getActOrderNoOne(param.getActOrderNo());
  1128. if (order.getParentNo() != null) {
  1129. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "操作失败,父医嘱不能为子医嘱。");
  1130. }
  1131. param.getAssociatedGroup().forEach(item -> {
  1132. dao.associateOrders(item, order);
  1133. });
  1134. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "关联成功。");
  1135. }
  1136. /**
  1137. * 确认出院带药医嘱
  1138. *
  1139. * @param patNo 住院号
  1140. * @param times 住院次数
  1141. * @return
  1142. */
  1143. public ResultVo<Map<String, Object>> confirmTheDoctorSOrderWithMedicine(String patNo, Integer times) {
  1144. QueryWrapper<?> qw = new QueryWrapper<>();
  1145. qw.eq("a.inpatient_no", patNo)
  1146. .eq("a.admiss_times", times)
  1147. .eq("a.status_flag", "1")
  1148. .eq("a.enter_oper", TokenUtil.getTokenUserId())
  1149. .eq("isnull(a.supply_code,'0')", 出院带药);
  1150. XinZhenYiZhu patInfo = dao.queryPatientInfo(patNo, times);
  1151. patInfo.setList(dao.selectOrderNo(qw));
  1152. if (ListUtil.isBlank(patInfo.getList())) {
  1153. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查询到医嘱。");
  1154. }
  1155. String userCode = TokenUtil.getTokenUserId();
  1156. // 出院带药需要生成药单 key 是不同的药房。不同的药房就要
  1157. YiZhuCheckData checkData = new YiZhuCheckData(dao);
  1158. checkData.init(patInfo.getList(), patInfo);
  1159. Map<String, Object> map = checkData.startCheck(null);
  1160. if (checkData.getPassTheAudit()) {
  1161. sendAMessageToTheNurse(patInfo, userCode, patInfo, "出院带药");
  1162. return getThis().getMapResultVo(patInfo, userCode);
  1163. } else {
  1164. return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请修改有错误的医嘱。", map);
  1165. }
  1166. }
  1167. @NotNull
  1168. @Transactional(rollbackFor = Exception.class)
  1169. public ResultVo<Map<String, Object>> getMapResultVo(XinZhenYiZhu patInfo, String userCode) {
  1170. for (XinZhenYzActOrder order : patInfo.getList()) {
  1171. // 出院带药 确认了直接停止医嘱
  1172. dao.takeMedicineAfterDischargeStopOrder(order.getActOrderNo(), userCode, new Date());
  1173. }
  1174. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
  1175. }
  1176. @Transactional(rollbackFor = Exception.class)
  1177. public void insertATemplate(List<XinZhenYzActOrder> list, XinZhenYiZhu patInfo) {
  1178. String userCode = TokenUtil.getTokenUserId();
  1179. list.forEach(item -> {
  1180. dao.insertEntryOrder(patInfo, item, userCode);
  1181. });
  1182. }
  1183. private void revertToTheDefaultState(XinZhenYzActOrder param, UserInfo us, BigDecimal parentNo) {
  1184. param.setActOrderNo(publicServer.getActOrderNo());
  1185. param.setStatusFlag("1");
  1186. Date newDate = new Date();
  1187. param.setOrderTime(newDate);
  1188. param.setStartTime(newDate);
  1189. param.setEndTime(null);
  1190. param.setEnterOper(us.getCode());
  1191. param.setSigner("");
  1192. param.setModifier("");
  1193. param.setParentNo(parentNo);
  1194. }
  1195. public ResultVo<JSONObject> copyOrder(copyOrder copyOrder) {
  1196. log.info("数据:{}", JSON.toJSONString(copyOrder));
  1197. QueryWrapper<?> qw = new QueryWrapper<>();
  1198. qw.eq("a.act_order_no", copyOrder.getActOrderNo());
  1199. List<XinZhenYzActOrder> yiZhuList = dao.selectOrderNo(qw);
  1200. if (ListUtil.isBlank(yiZhuList)) {
  1201. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "原医嘱已经不存在了。");
  1202. }
  1203. // 个人信息
  1204. UserInfo us = redisLikeService.getUserInfoByToken();
  1205. // 存放生成的医嘱容器
  1206. List<BigDecimal> orderList = new ArrayList<>();
  1207. // 原来的医嘱
  1208. XinZhenYzActOrder fatherOrder = yiZhuList.get(0);
  1209. // 设置默认值
  1210. revertToTheDefaultState(fatherOrder, us, null);
  1211. fatherOrder.setExecUnit(copyOrder.getDeptCode());
  1212. fatherOrder.setFrequCode(copyOrder.getFrequCode());
  1213. orderList.add(fatherOrder.getActOrderNo());
  1214. // 查询子医嘱
  1215. QueryWrapper<?> childQw = new QueryWrapper<>();
  1216. // 根据父医嘱的住院号和住院次数查询医嘱
  1217. childQw.eq("a.parent_no", fatherOrder.getActOrderNo());
  1218. childQw.eq("a.inpatient_no", fatherOrder.getInpatientNo());
  1219. childQw.eq("a.admiss_times", fatherOrder.getAdmissTimes());
  1220. // 保存的子医嘱
  1221. List<XinZhenYzActOrder> childOrderList = dao.selectOrderNo(childQw);
  1222. // 存放医嘱容器
  1223. List<XinZhenYzActOrder> addOrderList = new ArrayList<>();
  1224. // 存放父医嘱
  1225. addOrderList.add(fatherOrder);
  1226. // 设置子医嘱默认值
  1227. if (ListUtil.notBlank(childOrderList)) {
  1228. childOrderList.forEach(item -> {
  1229. item.setExecUnit(copyOrder.getDeptCode());
  1230. item.setFrequCode(copyOrder.getFrequCode());
  1231. revertToTheDefaultState(item, us, fatherOrder.getActOrderNo());
  1232. orderList.add(item.getActOrderNo());
  1233. addOrderList.add(item);
  1234. });
  1235. }
  1236. // 获取患者信息
  1237. XinZhenYiZhu patInfo = dao.queryPatientInfo(copyOrder.getInpatientNo(), copyOrder.getAdmissTimes());
  1238. getThis().insertATemplate(addOrderList, patInfo);
  1239. JSONObject js = getNewOrderData(orderList);
  1240. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "复制成功。", js);
  1241. }
  1242. @NotNull
  1243. private JSONObject getNewOrderData(List<BigDecimal> orderList) {
  1244. QueryWrapper<?> newList = new QueryWrapper<>();
  1245. newList.in("a.act_order_no", orderList);
  1246. newList.orderByAsc("a.act_order_no");
  1247. List<XinZhenYzActOrder> newOrderList = getOrderList(dao.selectOrderNo(newList));
  1248. JSONObject js = new JSONObject();
  1249. js.put("list", orderList);
  1250. js.put("data", newOrderList);
  1251. return js;
  1252. }
  1253. public ResultVo<List<ZyDetailCharge>> queryFeeByOrderNo(BigDecimal actOrderNo) {
  1254. XinZhenYzActOrder yz = dao.getActOrderNoOne(actOrderNo.stripTrailingZeros().toPlainString());
  1255. List<ZyDetailCharge> feeList = dao.selectOrderFee(yz);
  1256. return ResultVoUtil.success(feeList);
  1257. }
  1258. public ResultVo<String> oneClickStopOrder(OneClickOrder param) {
  1259. param.setOrderNo(publicServer.getActOrderNo());
  1260. param.setNowDate(new Date());
  1261. param.setUserCode(TokenUtil.getTokenUserId());
  1262. return getThis().executeOneClickStopOrder(param);
  1263. }
  1264. @Transactional(rollbackFor = Exception.class)
  1265. public ResultVo<String> executeOneClickStopOrder(OneClickOrder param) {
  1266. // 10507 固定医嘱号
  1267. int count = dao.oneClickStopOrder(param, param.getUserCode());
  1268. if (count > 0) {
  1269. // 生成医嘱
  1270. XinZhenYiZhu patInfo = dao.queryPatientInfo(param.getPatNo(), param.getTimes());
  1271. dao.insertOneClickStopOrder(param, patInfo);
  1272. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "操作成功,正在执行的长期医嘱停止到了【" + param.getDateStr() + "】");
  1273. }
  1274. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有需要停止的长期医嘱操作失败。");
  1275. }
  1276. /**
  1277. * 上级医生登录
  1278. *
  1279. * @return 信息
  1280. */
  1281. public ResultVo<UserInfo> doctorAuthorizationLogin(UserInfo userInfo) {
  1282. UserInfo u = dao.doctorAuthorizationLogin(userInfo);
  1283. Integer drugLeven = dao.selectYpLevel(userInfo.getDrugCode());
  1284. if (u == null) {
  1285. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有查询到指定的医生。");
  1286. }
  1287. if (drugLeven > (u.getDoctorLevel() + 1)) {
  1288. return ResultVoUtil.success(ExceptionEnum.LOGICAL_ERROR, StrUtil.format("该医生等级不足,药品等级【{}】,医生等级:【{}】", drugLeven, u.getDoctorLevel()));
  1289. }
  1290. u.setPassword("");
  1291. return ResultVoUtil.success(u);
  1292. }
  1293. public ResultVo<String> updateOrderInstruction(BigDecimal orderNo, String str) {
  1294. log.info("修改医嘱嘱托:医嘱号:{},嘱托:{}", orderNo, str);
  1295. dao.updateOrderInstruction(orderNo, str);
  1296. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "更新成功。");
  1297. }
  1298. }