YiZhuLuRu.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <div :style="{width: winsize.editor + 40 + 'px'}" style="margin: 0">
  3. <yz-query-condition :patient-info="huanZheXinXi"
  4. ref="yzQueryRef"
  5. @clearSelect="clearSelect"
  6. @batchDeleteOrdersClick="batchDeleteOrdersClick"
  7. :to-delete-an-order="toDeleteAnOrder"
  8. :add-yi-zhu-click="addYiZhuClick"
  9. :click-on-the-order-template="clickOnTheOrderTemplate"
  10. :confirm-orders-click="confirmOrdersClick"/>
  11. <div>
  12. <div style="height: 5px"/>
  13. <button @click="orderTemplateClick" title="维护自己创建的模板">维护模板</button>
  14. <button @click="orderTemplateClickCopy" title="维护自己创建的模板">选中医嘱做模板</button>
  15. <el-divider direction="vertical"></el-divider>
  16. <button @click="clickToStopTheOrder" title="选择了停止时间后记得选中医嘱在点击">批量停止</button>
  17. <button :disabled="stringIsBlank(huanZheXinXi.inpatientNo)"
  18. @click="clickToModifyTheDoctorSOrderTime"
  19. title="跳转到修改医嘱时间的页面,可修改开始和停止时间">
  20. 修改医嘱时间
  21. </button>
  22. <button :disabled="stringIsBlank(huanZheXinXi.inpatientNo)"
  23. @click="jumpToMedicalRecord" title="跳转到患者的病案首页">
  24. 病案首页
  25. </button>
  26. <button @click="confirmAssociationClick" title="关联医嘱">关联</button>
  27. <button @click="openRationalDrugUse" title="进入到合理用药的页面">合理用药</button>
  28. <button @click="allergen.open()" title="患者过敏源信息维护">患者过敏源信息维护</button>
  29. <report-of-infectious-diseases :pat-no="huanZheXinXi.inpatientNo"
  30. :times="huanZheXinXi.admissTimes"
  31. :ward="huanZheXinXi.admissWard"/>
  32. </div>
  33. <div style="height: 5px"/>
  34. <yz-editor :patient-info="huanZheXinXi"
  35. ref="yzEditorRef"
  36. @duplicate-and-paste="duplicateAndPaste"
  37. :current-page="currentPage"
  38. :open-group-order-template="openGroupOrderTemplate"
  39. @successfullyEntered="successfullyEntered"/>
  40. <div style="overflow-x: auto; " :style="{width: winsize.main - 20 + 'px'}">
  41. <yz-table-v2 :data="tempYzData"
  42. ref="tableRef"
  43. @void-orders="voidOrdersClick"
  44. @clickAssociate="clickAssociate"
  45. @rowClick="rowClick"/>
  46. </div>
  47. <doctor-s-order-fee :data="chargeDetails.data"
  48. v-if="chargeDetails.dialog"
  49. :sum="chargeDetails.sum"
  50. @close="chargeDetails.dialog = false"/>
  51. <!-- 获取模板的数据 -->
  52. <huo-qu-mu-ban
  53. ref="mubanRef"
  54. :editor="false"
  55. @muBanShuJu="muBanShuJu"/>
  56. <xc-dialog v-model="stopOrderDialog.dialog" title="停止医嘱错误信息">
  57. <div v-for="(value,key) in stopOrderDialog.error">
  58. 医嘱号: {{ key }} 序号: {{ getYzIndex(key) + 1 }}
  59. <br>
  60. {{ value }}
  61. </div>
  62. </xc-dialog>
  63. <yao-ping-xiang-qing v-if="drugManual.dialog"
  64. :code="drugManual.code"
  65. @close="drugManual.dialog = false"/>
  66. <!-- 这个是过敏源的 -->
  67. <AllergenEntry v-if="allergen.dialog"
  68. :pat-no="huanZheXinXi.inpatientNo"
  69. @close="allergen.dialog = false"/>
  70. <order-progress ref="orderProgressRef"/>
  71. <!-- 合理用药窗口 -->
  72. <rational-drug-use-window ref="reasonableRef" @submit="confirmOrder"/>
  73. </div>
  74. </template>
  75. <script name="YiZhuLuRuZhuJian" setup>
  76. import {
  77. associateOrdersApi, deleteMultipleOrders, huoQuYiZhuShuJu,
  78. insertTemplateOrder,
  79. stopOrder, voidOrders,
  80. } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
  81. import {
  82. huanZheXinXi,
  83. getYzIndex,
  84. winsize,
  85. zkList,
  86. queryParam,
  87. currentPage,
  88. clickOnThePatient,
  89. drugManual,
  90. associateOrders,
  91. clearAssociate, youWuXuanZheHuanZhe, yzData, errorMsg
  92. } from '../public-js/zhu-yuan-yi-sheng'
  93. import store from '@/store'
  94. import {listIsBlank, stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
  95. import {getTheTransferList} from '@/api/public-api'
  96. import router from '@/router'
  97. import sleep from "@/utils/sleep";
  98. import DoctorSOrderFee from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/DoctorSOrderFee.vue";
  99. import {BizException, ExceptionEnum} from "@/utils/BizException";
  100. import {ElMessageBox} from "element-plus";
  101. import YzQueryCondition from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/yz-header/YzQueryCondition";
  102. import YzEditor from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/yz-edit/YzEditor.vue";
  103. import {tempYzData} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
  104. import HuoQuMuBan from '@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/HuoQuMuBan.vue'
  105. import {getFormatDatetime} from "@/utils/date";
  106. import XcDialog from "@/components/xiao-chan/dialog/XcDialog";
  107. import {xcMessage} from "@/utils/xiaochan-element-plus";
  108. import YaoPingXiangQing from "@/components/zhu-yuan-yi-sheng/he-li-yong-yao/YaoPingXiangQing.vue";
  109. import AllergenEntry from "@/components/zhu-yuan-yi-sheng/AllergenEntry.vue";
  110. import OrderProgress from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/OrderProgress.vue";
  111. import RationalDrugUseWindow from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/RationalDrugUseWindow.vue";
  112. import ReportOfInfectiousDiseases
  113. from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/report-of-infectious-diseases/ReportOfInfectiousDiseases.vue";
  114. import YzTableV2 from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/table/YzTableV2.vue";
  115. import {clone} from "@/utils/clone";
  116. const windowSize = computed(() => {
  117. return store.state.app.windowSize
  118. })
  119. const user = computed(() => {
  120. return store.state.user.info
  121. })
  122. let allergen = $ref({
  123. dialog: false,
  124. open: () => {
  125. if (youWuXuanZheHuanZhe()) return
  126. allergen.dialog = true
  127. }
  128. })
  129. // 医嘱查询
  130. const yzQueryRef = ref(null)
  131. // 医嘱进度
  132. const orderProgressRef = ref(null)
  133. // 医嘱编辑
  134. const yzEditorRef = ref(null)
  135. const successfullyEntered = async (data) => {
  136. queryParam.value.displayRange = 0
  137. queryParam.value.zhuangTai = 0
  138. yzData.value = await huoQuYiZhuShuJu({
  139. patNo: huanZheXinXi.value.inpatientNo,
  140. times: huanZheXinXi.value.admissTimes
  141. })
  142. clearSelect()
  143. if (data != null) {
  144. tableRef.value.scrollTo(parseInt(data.actOrderNo))
  145. }
  146. addYiZhuClick()
  147. }
  148. /**
  149. * 下面这里是添加医嘱了
  150. */
  151. const addYiZhuClick = () => {
  152. yzEditorRef.value.addOrderNo()
  153. }
  154. const reasonableRef = ref(null)
  155. /**
  156. * 确认医嘱 , 已经做过无患者的判断了
  157. */
  158. const confirmOrdersClick = async () => {
  159. // 如果没有问题就可以直接确认医嘱了。
  160. let temp = await reasonableRef.value.check(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes)
  161. if (temp) {
  162. await confirmOrder()
  163. }
  164. }
  165. // 真正的向后台确认医嘱
  166. const confirmOrder = async () => {
  167. // 确认医嘱
  168. await yzEditorRef.value.confirmOrdersClick()
  169. // 查询医嘱
  170. await yzQueryRef.value.queryYz();
  171. }
  172. /**
  173. * 删除医嘱
  174. */
  175. const toDeleteAnOrder = () => {
  176. yzEditorRef.value.toDeleteAnOrderClick()
  177. }
  178. const openRationalDrugUse = () => {
  179. window.open('http://172.16.32.121:9097/index.html')
  180. }
  181. // 表格
  182. const tableRef = ref(null)
  183. const rowClick = (val) => {
  184. orderProgressRef.value.fillOrder(val)
  185. if (associateOrders.value.actOrderNo) {
  186. let index = associateOrders.value.associatedGroup.indexOf(val.actOrderNo)
  187. if (associateOrders.value.actOrderNo === val.actOrderNo) {
  188. BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联自己');
  189. }
  190. if (val.serial === '00') {
  191. BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联项目');
  192. }
  193. if (val.statusFlag !== '1') {
  194. BizException(ExceptionEnum.MESSAGE_ERROR, '无法关联不是录入状态的医嘱。');
  195. }
  196. if (index > -1) {
  197. val.associationFlag = false;
  198. associateOrders.value.associatedGroup.splice(index, 1);
  199. } else {
  200. val.associationFlag = true;
  201. associateOrders.value.associatedGroup.push(val.actOrderNo);
  202. }
  203. } else {
  204. yzEditorRef.value.fillData(val)
  205. }
  206. }
  207. const stopOrderDialog = ref({
  208. dialog: false,
  209. error: ''
  210. })
  211. /**
  212. * 停止医嘱
  213. */
  214. const clickToStopTheOrder = () => {
  215. let tempData = tableRef.value.getSelectedData()
  216. tempData.forEach(item => {
  217. item.endTime = getFormatDatetime(item.endTimeTemp)
  218. })
  219. let param = {
  220. inpatientNo: huanZheXinXi.value.inpatientNo,
  221. admissTimes: huanZheXinXi.value.admissTimes,
  222. list: tempData
  223. }
  224. stopOrder(param).then(res => {
  225. if (res?.error) {
  226. stopOrderDialog.value.error = res.data
  227. stopOrderDialog.value.dialog = true
  228. for (let i = 0; i < tempData.length; i++) {
  229. let item = tempData[i]
  230. item.endTime = ''
  231. }
  232. } else {
  233. stopOrderDialog.value.error = {}
  234. yzQueryRef.value.queryYz()
  235. }
  236. })
  237. }
  238. /**
  239. * 作废医嘱
  240. */
  241. const voidOrdersClick = (val) => {
  242. ElMessageBox.prompt(`请问是否要撤销<br><span style="color: red">【${val.orderName}】</span>医嘱<br>
  243. 撤销父医嘱会自动撤销子医嘱。`, '提示', {
  244. type: 'warning',
  245. confirmButtonText: '确定',
  246. cancelButtonText: '取消',
  247. inputValidator: (val) => {
  248. if (val === null || val.length < 1 || val.length > 50) {
  249. return false;
  250. }
  251. },
  252. dangerouslyUseHTMLString: true,
  253. inputErrorMessage: '作废原因,不能为空,最多可输入50个字符。',
  254. closeOnPressEscape: false,
  255. closeOnClickModal: false
  256. }).then(({value}) => {
  257. voidOrders(val.id, value).then(res => {
  258. yzQueryRef.value.queryYz()
  259. })
  260. }).catch(() => {
  261. })
  262. }
  263. /**
  264. * 右键点击查看医嘱产生的费用
  265. * @param val
  266. */
  267. let doctorSOrderFee = $ref({
  268. data: {},
  269. problem: {},
  270. totalCost: {}
  271. })
  272. let chargeDetails = $ref({
  273. dialog: false,
  274. data: [],
  275. sum: {}
  276. })
  277. const clickToViewTheDoctorSOrderFee = (val) => {
  278. chargeDetails.data = doctorSOrderFee.data[val.actOrderNoStr]
  279. if (chargeDetails.data) {
  280. chargeDetails.sum = doctorSOrderFee.totalCost[val.actOrderNoStr]
  281. chargeDetails.dialog = true
  282. } else {
  283. BizException(ExceptionEnum.MESSAGE_ERROR, '该医嘱还没有产生费用')
  284. }
  285. }
  286. // 获取模板
  287. const mubanRef = ref(null)
  288. const clickOnTheOrderTemplate = () => {
  289. if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
  290. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择患者')
  291. }
  292. mubanRef.value.openOrCloseDialog(true)
  293. }
  294. /**
  295. * 把模板的数据插入到患者的医嘱表
  296. * @param val
  297. */
  298. const muBanShuJu = (val) => {
  299. let tempGroupNo = ['71', '73']
  300. if (currentPage.value === 'takeMedicine') {
  301. val = val.filter((item) => {
  302. item.selfBuy = '4'
  303. item.instruction = item.frequCodeName
  304. return item.serial !== '00'
  305. })
  306. if (val.length === 0) {
  307. BizException(ExceptionEnum.LOGICAL_ERROR, '项目无法出院带药。')
  308. }
  309. }
  310. val.forEach(item => {
  311. if (item.serial === '00') {
  312. item.groupNo = '00'
  313. } else {
  314. if (!tempGroupNo.includes(item.groupNo)) {
  315. item.groupNo = queryParam.value.groupNo;
  316. }
  317. }
  318. })
  319. let param = {
  320. inpatientNo: huanZheXinXi.value.inpatientNo,
  321. admissTimes: huanZheXinXi.value.admissTimes,
  322. groupNo: queryParam.value.groupNo,
  323. list: val
  324. }
  325. insertTemplateOrder(param).then(async (list) => {
  326. mubanRef.value.openOrCloseDialog(false)
  327. await successfullyEntered()
  328. tableRef.value.callTemplate(list)
  329. })
  330. }
  331. /**
  332. * 打开模板的对话框
  333. * @param code
  334. * @returns {Promise<void>}
  335. */
  336. const openGroupOrderTemplate = async (code) => {
  337. mubanRef.value.openOrCloseDialog(true)
  338. await nextTick()
  339. mubanRef.value.openTemplateByCode(code)
  340. }
  341. /**
  342. * 添加模板
  343. */
  344. const orderTemplateClick = () => {
  345. router.push({
  346. name: 'orderTemplateMaintenance',
  347. })
  348. }
  349. const orderTemplateClickCopy = () => {
  350. let temp = clone(tableRef.value.getSelectedData())
  351. if (listIsBlank(temp)) {
  352. xcMessage.error('请先选中医嘱。')
  353. return
  354. }
  355. let dept = {
  356. code: huanZheXinXi.value.zkWard,
  357. name: huanZheXinXi.value.zkWardName
  358. }
  359. router.push({
  360. name: 'orderTemplateMaintenance',
  361. params: {
  362. data: JSON.stringify(temp),
  363. dept: JSON.stringify(dept)
  364. }
  365. })
  366. }
  367. onMounted(async () => {
  368. await sleep(200)
  369. zkList.value = await getTheTransferList()
  370. })
  371. // 点击修改医嘱时间
  372. const clickToModifyTheDoctorSOrderTime = () => {
  373. router.push({
  374. name: 'yzActOrderModify',
  375. query: {
  376. patNo: huanZheXinXi.value.inpatientNo,
  377. },
  378. })
  379. }
  380. // 跳转到病案首页
  381. const jumpToMedicalRecord = () => {
  382. router.push({
  383. name: 'fillCaseFrontSheet',
  384. query: {
  385. patNo: huanZheXinXi.value.inpatientNo,
  386. deptCode: huanZheXinXi.value.smallDept,
  387. },
  388. })
  389. }
  390. // 点击关联
  391. const clickAssociate = async (data) => {
  392. if (stringNotBlank(data.parentNo)) {
  393. xcMessage.error('该医嘱已经有父医嘱了。');
  394. } else if (data.statusFlag !== '1') {
  395. xcMessage.error('不是录入状态的医嘱无法关联。');
  396. } else if (data.serial === '00') {
  397. xcMessage.error('项目无法关联。');
  398. } else {
  399. if (associateOrders.value.actOrderNo === null) {
  400. await yzQueryRef.value.queryYz()
  401. associateOrders.value.actOrderNo = data.actOrderNo
  402. } else {
  403. xcMessage.error('请先确认当前关联医嘱。')
  404. }
  405. }
  406. }
  407. // 点击确认关联
  408. const confirmAssociationClick = () => {
  409. if (associateOrders.value.actOrderNo === null) {
  410. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择需要关联的父医嘱')
  411. }
  412. if (associateOrders.value.associatedGroup.length === 0) {
  413. BizException(ExceptionEnum.MESSAGE_ERROR, '至少选择一个子医嘱')
  414. }
  415. ElMessageBox.confirm('请确认是否要关联这些医嘱。', '提示', {
  416. type: 'warning'
  417. }).then(() => {
  418. associateOrdersApi(associateOrders.value).then((res) => {
  419. clearAssociate()
  420. yzQueryRef.value.queryYz()
  421. })
  422. }).catch(() => {
  423. })
  424. }
  425. const duplicateAndPaste = async () => {
  426. await yzQueryRef.value.queryYz()
  427. tableRef.value.scrollToTheEnd()
  428. }
  429. const clearSelect = () => {
  430. tableRef.value.clearSelected()
  431. }
  432. /**
  433. * 点击批量删除数据
  434. */
  435. const batchDeleteOrdersClick = () => {
  436. let tempData = tableRef.value.getSelectedData()
  437. if (tempData.length === 0) {
  438. BizException(ExceptionEnum.LOGICAL_ERROR, "请先选择要删除的数据");
  439. }
  440. ElMessageBox.confirm('是否要批量删除这些医嘱?', '提示', {
  441. type: 'warning'
  442. }).then(() => {
  443. let param = {
  444. inpatientNo: huanZheXinXi.value.inpatientNo,
  445. admissTimes: huanZheXinXi.value.admissTimes,
  446. list: tempData
  447. }
  448. deleteMultipleOrders(param).then((res) => {
  449. if (res !== null && res.error) {
  450. let errData = []
  451. for (const key in res.data) {
  452. let index = getYzIndex(key)
  453. let tempYzData = yzData.value[index]
  454. yzData.value[index].error = true
  455. errData.push({
  456. actOrderNo: key,
  457. orderName: tempYzData.orderName,
  458. errorMessage: res.data[key]
  459. })
  460. }
  461. errorMsg.value.dialog = true
  462. errorMsg.value.type = 2
  463. errorMsg.value.data = errData
  464. } else {
  465. yzQueryRef.value.queryYz()
  466. }
  467. })
  468. }).catch(() => {
  469. })
  470. }
  471. watch(() => router.currentRoute.value, () => {
  472. currentPage.value = router.currentRoute.value.query.pattern
  473. queryParam.value.frequCode = currentPage.value
  474. if (router.currentRoute.value.path === '/inpatient/zhuYuanYiSheng/yiZhuLuRu' && !currentPage.value) {
  475. router.push('/inpatient/zhuYuanYiSheng/yiZhuLuRu?pattern=all')
  476. }
  477. }, {immediate: true})
  478. onActivated(async () => {
  479. if (router.currentRoute.value.params.inpatientNo) {
  480. await nextTick()
  481. clickOnThePatient(router.currentRoute.value.params.inpatientNo);
  482. await yzQueryRef.value.queryYz()
  483. }
  484. })
  485. </script>
  486. <style scoped lang="scss">
  487. :deep(.el-table .children-row) {
  488. background: rgba(145, 247, 145, 0.93);
  489. }
  490. :deep(.el-table) {
  491. --el-table-row-hover-background-color: #85dbfd7a;
  492. }
  493. :deep(.el-dropdown-menu__item) {
  494. font-size: 14px !important;
  495. height: 26px;
  496. line-height: 26px;
  497. font-weight: bold;
  498. }
  499. </style>