YiZhuLuRu.vue 17 KB

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