YiZhuLuRu.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  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. reqRemark: value,
  248. patNo: val.inpatientNo,
  249. times: val.admissTimes
  250. })
  251. })
  252. }
  253. /**
  254. * 作废医嘱
  255. */
  256. const voidOrdersClick = (val) => {
  257. if (isDev) {
  258. orderQuash(val)
  259. return
  260. }
  261. ElMessageBox.prompt(`请问是否要撤销<br><span style="color: red">【${val.orderName}】</span>医嘱<br>
  262. 撤销父医嘱会自动撤销子医嘱。`, '提示', {
  263. type: 'warning',
  264. confirmButtonText: '确定',
  265. cancelButtonText: '取消',
  266. inputValidator: (val) => {
  267. val = val.trim()
  268. if (val === null || val.length < 1 || val.length > 50) {
  269. return false;
  270. }
  271. },
  272. dangerouslyUseHTMLString: true,
  273. inputErrorMessage: '作废原因,不能为空,最多可输入50个字符。',
  274. closeOnPressEscape: false,
  275. closeOnClickModal: false
  276. }).then(({value}) => {
  277. voidOrders(val.id, value).then(res => {
  278. yzMitt.emit('queryYz')
  279. })
  280. }).catch(() => {
  281. });
  282. }
  283. /**
  284. * 右键点击查看医嘱产生的费用
  285. * @param val
  286. */
  287. let doctorSOrderFee = $ref({
  288. data: {},
  289. problem: {},
  290. totalCost: {}
  291. })
  292. let chargeDetails = $ref({
  293. dialog: false,
  294. data: [],
  295. sum: {}
  296. })
  297. const clickToViewTheDoctorSOrderFee = (val) => {
  298. chargeDetails.data = doctorSOrderFee.data[val.actOrderNoStr]
  299. if (chargeDetails.data) {
  300. chargeDetails.sum = doctorSOrderFee.totalCost[val.actOrderNoStr]
  301. chargeDetails.dialog = true
  302. } else {
  303. BizException(ExceptionEnum.MESSAGE_ERROR, '该医嘱还没有产生费用')
  304. }
  305. }
  306. // 获取模板
  307. const mubanRef = ref(null)
  308. const clickOnTheOrderTemplate = () => {
  309. if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
  310. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择患者')
  311. }
  312. mubanRef.value.openOrCloseDialog(true)
  313. }
  314. /**
  315. * 把模板的数据插入到患者的医嘱表
  316. * @param val
  317. */
  318. const muBanShuJu = (val) => {
  319. let tempGroupNo = ['71', '73']
  320. if (queryParam.value.frequCode === 'takeMedicine') {
  321. val = val.filter((item) => {
  322. item.selfBuy = '4'
  323. if (stringIsBlank(item.instruction)) {
  324. item.instruction = item.frequCodeName;
  325. }
  326. item.supplyCode = '007'
  327. item.frequCode = 'ONCE'
  328. return item.serial !== '00'
  329. })
  330. if (val.length === 0) {
  331. BizException(ExceptionEnum.LOGICAL_ERROR, '项目无法出院带药。')
  332. }
  333. }
  334. val.forEach(item => {
  335. if (item.serial === '00') {
  336. item.groupNo = '00'
  337. } else {
  338. if (!tempGroupNo.includes(item.groupNo)) {
  339. item.groupNo = queryParam.value.groupNo;
  340. }
  341. }
  342. })
  343. let param = {
  344. inpatientNo: huanZheXinXi.value.inpatientNo,
  345. admissTimes: huanZheXinXi.value.admissTimes,
  346. groupNo: queryParam.value.groupNo,
  347. list: val
  348. }
  349. insertTemplateOrder(param).then(async (list) => {
  350. mubanRef.value.openOrCloseDialog(false)
  351. await successfullyEntered()
  352. let data = {}
  353. list.forEach(item => {
  354. data[item] = true
  355. })
  356. tableRef.value.callTemplate(data)
  357. })
  358. }
  359. /**
  360. * 打开模板的对话框
  361. * @param code
  362. * @returns {Promise<void>}
  363. */
  364. const openGroupOrderTemplate = async (code) => {
  365. mubanRef.value.openOrCloseDialog(true)
  366. await nextTick()
  367. mubanRef.value.openTemplateByCode(code)
  368. }
  369. /**
  370. * 添加模板
  371. */
  372. const orderTemplateClick = () => {
  373. router.push({
  374. name: 'orderTemplateMaintenance',
  375. })
  376. }
  377. const orderTemplateClickCopy = () => {
  378. let temp = clone(yzMitt.emit('getSelectedData'))
  379. if (listIsBlank(temp)) {
  380. xcMessage.error('请先选中医嘱。')
  381. return
  382. }
  383. let dept = {
  384. code: huanZheXinXi.value.zkWard,
  385. name: huanZheXinXi.value.zkWardName
  386. }
  387. router.push({
  388. name: 'orderTemplateMaintenance',
  389. params: {
  390. data: JSON.stringify(temp),
  391. dept: JSON.stringify(dept)
  392. }
  393. })
  394. }
  395. // 点击修改医嘱时间
  396. const clickToModifyTheDoctorSOrderTime = () => {
  397. router.push({
  398. name: 'yzActOrderModify',
  399. query: {
  400. patNo: huanZheXinXi.value.inpatientNo,
  401. },
  402. })
  403. }
  404. // 跳转到病案首页
  405. const jumpToMedicalRecord = () => {
  406. router.push({
  407. name: 'fillCaseFrontSheet',
  408. query: {
  409. patNo: huanZheXinXi.value.inpatientNo,
  410. deptCode: huanZheXinXi.value.smallDept,
  411. },
  412. })
  413. }
  414. // 点击关联
  415. const clickAssociate = async (data) => {
  416. if (stringNotBlank(data.parentNo)) {
  417. xcMessage.error('该医嘱已经有父医嘱了。');
  418. } else if (data.statusFlag !== '1') {
  419. xcMessage.error('不是录入状态的医嘱无法关联。');
  420. } else if (data.serial === '00') {
  421. xcMessage.error('项目无法关联。');
  422. } else {
  423. if (associateOrders.value.actOrderNo === null) {
  424. await yzMitt.emit('queryYz')
  425. associateOrders.value.actOrderNo = data.actOrderNo
  426. } else {
  427. xcMessage.error('请先确认当前关联医嘱。')
  428. }
  429. }
  430. }
  431. // 点击确认关联
  432. const confirmAssociationClick = () => {
  433. if (associateOrders.value.actOrderNo === null) {
  434. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择需要关联的父医嘱')
  435. }
  436. if (associateOrders.value.associatedGroup.length === 0) {
  437. BizException(ExceptionEnum.MESSAGE_ERROR, '至少选择一个子医嘱')
  438. }
  439. ElMessageBox.confirm('请确认是否要关联这些医嘱。', '提示', {
  440. type: 'warning'
  441. }).then(() => {
  442. associateOrdersApi(associateOrders.value).then((res) => {
  443. clearAssociate()
  444. yzMitt.emit('queryYz')
  445. })
  446. }).catch(() => {
  447. })
  448. }
  449. /**
  450. * 点击批量删除数据
  451. */
  452. const batchDeleteOrdersClick = () => {
  453. let tempData = yzMitt.emit('getSelectedData')
  454. if (tempData.length === 0) {
  455. BizException(ExceptionEnum.LOGICAL_ERROR, "请先选择要删除的数据");
  456. }
  457. ElMessageBox.confirm('是否要批量删除这些医嘱?', '提示', {
  458. type: 'warning'
  459. }).then(() => {
  460. let param = {
  461. inpatientNo: huanZheXinXi.value.inpatientNo,
  462. admissTimes: huanZheXinXi.value.admissTimes,
  463. list: tempData
  464. }
  465. deleteMultipleOrders(param).then((res) => {
  466. if (res !== null && res.error) {
  467. let errData = []
  468. for (const key in res.data) {
  469. let index = getYzIndex(key)
  470. let tempYzData = yzData.value[index]
  471. yzData.value[index].error = true
  472. errData.push({
  473. actOrderNo: key,
  474. orderName: tempYzData.orderName,
  475. errorMessage: res.data[key]
  476. })
  477. }
  478. errorMsg.value.dialog = true
  479. errorMsg.value.type = 2
  480. errorMsg.value.data = errData
  481. } else {
  482. yzMitt.emit('queryYz', false)
  483. }
  484. })
  485. }).catch(() => {
  486. })
  487. }
  488. onMounted(async () => {
  489. getSupplyType().then(res => {
  490. geiYaoFangShiData.value = res
  491. })
  492. getFrequency().then(res => {
  493. yaoPinPingLvData.value = res
  494. })
  495. await sleep(200)
  496. zkList.value = await getTheTransferList()
  497. })
  498. onActivated(async () => {
  499. if (router.currentRoute.value.params.inpatientNo) {
  500. await nextTick()
  501. await clickOnThePatient(router.currentRoute.value.params.inpatientNo);
  502. await yzMitt.emit('queryYz')
  503. }
  504. jsQueryYzData()
  505. })
  506. </script>
  507. <style scoped lang="scss">
  508. :deep(.el-table .children-row) {
  509. background: rgba(145, 247, 145, 0.93);
  510. }
  511. :deep(.el-table) {
  512. --el-table-row-hover-background-color: #85dbfd7a;
  513. }
  514. :deep(.el-dropdown-menu__item) {
  515. font-size: 14px !important;
  516. height: 26px;
  517. line-height: 26px;
  518. font-weight: bold;
  519. }
  520. </style>