YiZhuLuRu.vue 14 KB

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