YzEditor.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. <template>
  2. <div ref="editorMainRef" style="border: 1px solid">
  3. <div v-if="tiShiBiaoTi?.length > 0" class="editor__title">
  4. <span v-for="item in tiShiBiaoTi">
  5. {{ item }}
  6. </span>
  7. </div>
  8. <div class="ribbon">
  9. <button @click="qingKong">清空工作台</button>
  10. <button @click="toAddAnOrder">录入医嘱</button>
  11. <button @click="duplicateAndPaste">复制并粘贴</button>
  12. <button @click="openTheOrderPopUpWindow">打开医嘱弹窗</button>
  13. </div>
  14. <div class="editing_area" ref="editingAreaRef"
  15. :style="{color: isEdit ? '#0014fc' : ''}">
  16. <div class="yz_editor__disable" v-if="isEdit"></div>
  17. <div class="yz_input__box">
  18. <div>
  19. 医嘱名称:
  20. <xc-combo-grid
  21. style="width: 240px"
  22. ref="searchRef"
  23. v-model="yiZhuData.orderName"
  24. :table-header="tableHeader"
  25. :query-data-func="huoQuXiangMu"
  26. :current-key="yiZhuData.orderCode + yiZhuData.orderName"
  27. @rowClick="xuanZhongFeiYong">
  28. <el-table-column label="说明书">
  29. <template #default="{row}">
  30. <el-button @click.stop="drugManual.open(row.orderCode,row.serial)"
  31. :disabled="row.groupNo === '00'">
  32. 说明书
  33. </el-button>
  34. </template>
  35. </el-table-column>
  36. </xc-combo-grid>
  37. </div>
  38. <div class="input__style">
  39. {{ yiZhuData.drugSpecification }}
  40. </div>
  41. <div>
  42. 频率:
  43. <xc-select-v3 style="width: 120px"
  44. :disabled="queryParam.frequCode === 1"
  45. v-model="yiZhuData"
  46. :data="yaoPinPingLvData"
  47. code="frequCode"
  48. name="frequCodeName"
  49. :remote-method="pinLvRemoteMethod"
  50. id="yz_frequCode"
  51. ref="pingLv"/>
  52. </div>
  53. <div>
  54. 一次剂量:
  55. <el-input-number v-model="yiZhuData.dose"
  56. :min="0"
  57. ref="doseRef"
  58. id="yz_dose"
  59. :precision="yiZhuData.doseUnitName === yiZhuData.miniUnitName ? 0 : 2"
  60. style="width: 110px"
  61. @change="jiSuanLingLiang"/>
  62. <XcSelect v-model="yiZhuData"
  63. :data="yaoPinJiLiangData"
  64. :name="['doseUnit', 'doseUnitName']"
  65. :width="80"
  66. @change="xuanZheJiLiang">
  67. <XcOption label="value"/>
  68. <XcOption label="name"/>
  69. </XcSelect>
  70. </div>
  71. <div>
  72. 领量:
  73. {{ yiZhuData.drugQuan }}
  74. {{ yiZhuData.miniUnitName }}
  75. </div>
  76. </div>
  77. <div class="yz_input__box">
  78. <div>
  79. 给药方式:
  80. <xc-select-v3
  81. :disabled="yiZhuData.serial === '00'"
  82. style="width: 120px"
  83. v-model="yiZhuData"
  84. :data="geiYaoFangShiData"
  85. id="yz_supplyCode"
  86. code="supplyCode"
  87. name="supplyCodeName"
  88. :remote-method="geiYaoFangShiRemoteMethod"
  89. clearable/>
  90. </div>
  91. <div>
  92. 开始时间:
  93. <el-date-picker
  94. style="width: 160px"
  95. v-model="yiZhuData.startTime"
  96. :disabled-date="disabledDate"
  97. id="yz_startTime"
  98. format="YYYY-MM-DD HH:mm:ss"
  99. type="datetime"
  100. value-format="YYYY-MM-DD HH:mm:ss"
  101. ></el-date-picker>
  102. </div>
  103. <div>
  104. 停止时间:
  105. <el-date-picker
  106. style="width: 160px"
  107. v-model="yiZhuData.endTime"
  108. id="yz_endTime"
  109. :disabled="yiZhuData.frequCode === 'ONCE'"
  110. :disabled-date="disabledDate"
  111. format="YYYY-MM-DD HH:mm:ss"
  112. type="datetime"
  113. value-format="YYYY-MM-DD HH:mm:ss"
  114. ></el-date-picker>
  115. </div>
  116. <div class="input__style" style="width: 120px">
  117. 医生: {{ yiZhuData.enterOperName ? yiZhuData.enterOperName : store.state.user.info.name }}
  118. </div>
  119. <div>
  120. 执行科室:
  121. <xc-select-v3
  122. style="width: 120px"
  123. v-model="yiZhuData"
  124. :data="zhiXingKeShiData"
  125. id="yz_execUnit"
  126. code="execUnit"
  127. name="execUnitName"
  128. :remote-method="metZhiXingKeShi"/>
  129. </div>
  130. </div>
  131. <div class="yz_input__box">
  132. <div class="div_center__box">
  133. 医嘱时间:
  134. <div class="input__style"> {{ yiZhuData.orderTime }}</div>
  135. </div>
  136. <div>
  137. 父医嘱:
  138. <select v-model="yiZhuData.parentNo"
  139. style="width: 120px"
  140. @focus="fuYiZhuClick"
  141. @change="modifyDosingMethod"
  142. :disabled="yiZhuData.serial === '00'">
  143. <option :value="null"/>
  144. <template v-for="item in fuYiZhuData">
  145. <option :value="item.actOrderNo"
  146. :title="item.actOrderNo + '|' +item.orderName"
  147. v-if="yiZhuData?.actOrderNo !== item?.actOrderNo">
  148. {{ item.orderName }}
  149. </option>
  150. </template>
  151. </select>
  152. </div>
  153. <div :title="yiZhuData.discription" class="div_center__box">
  154. 描述:
  155. <div class="input__style" style="overflow: auto;width: 240px">
  156. {{ yiZhuData.discription }}
  157. </div>
  158. </div>
  159. <div>
  160. <!-- 皮试药品 -->
  161. </div>
  162. </div>
  163. <div class="yz_input__box">
  164. <div class="div_center__box" :title="yiZhuData.instruction">
  165. <div style="width: 87px">
  166. 医生嘱托:
  167. </div>
  168. <el-input v-model="yiZhuData.instruction"
  169. clearable
  170. maxlength="50"
  171. show-word-limit></el-input>
  172. </div>
  173. <div class="div_center__box">
  174. <el-select
  175. v-model="yiZhuData.kfFlag"
  176. id="yz_kfFlag"
  177. clearable
  178. style="width: 80px"
  179. @clear="yiZhuData.kfFlag = null">
  180. <el-option key="1" label="饭前" value="1"></el-option>
  181. <el-option key="2" label="饭后" value="2"></el-option>
  182. </el-select>
  183. </div>
  184. <div>
  185. 费用标志:
  186. <el-select v-model="yiZhuData.selfBuy"
  187. :disabled="yiZhuData.serial === '00' || currentPage === 'takeMedicine'"
  188. clearable style="width: 120px"
  189. @clear="yiZhuData.selfBuy = null">
  190. <el-option label="自备" value="1"/>
  191. <el-option label="嘱托" value="2"/>
  192. <el-option label="基数药" value="3"/>
  193. <el-option :disabled="currentPage !== 'takeMedicine'" label="出院带药" value="4"/>
  194. </el-select>
  195. </div>
  196. <div class="div_center__box">
  197. <xc-checkbox
  198. label="医保自费"
  199. v-model="yiZhuData.ybSelfFlag"
  200. inactive-value="0"
  201. active-value="1"/>
  202. &nbsp;&nbsp;&nbsp;
  203. <xc-checkbox
  204. label="紧急"
  205. v-model="yiZhuData.emergencyFlag"
  206. @keydown.tab="toAddAnOrder"
  207. active-value="1"
  208. inactive-value="0"/>
  209. </div>
  210. <div>
  211. 录入/确认/停止
  212. <div style="display: inline-block">
  213. <span style="background-color:#05ff00;padding: 2px;">
  214. {{ yiZhuData.enterOperName }}
  215. </span>
  216. /
  217. <span style="background-color:#0000fa;padding: 2px;color: white ">
  218. {{ yiZhuData.signerName }}
  219. </span>
  220. /
  221. <span style="background-color:red;padding: 2px;">
  222. {{ yiZhuData.modifierName }}
  223. </span>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. <!-- 报错信息 -->
  229. <bao-cun-xin-xi @clickError="clickError"
  230. :data="errorMessageData"
  231. :currentKey="yiZhuData.actOrderNo"
  232. ref="baoCunXinXiRef"/>
  233. <!-- 弹窗医嘱 -->
  234. <yz-dialog :yz-data="yiZhuData" ref="yzDialogRef"/>
  235. </div>
  236. </template>
  237. <script setup name='YzEditor'>
  238. import {
  239. confirmOrders,
  240. enterOrders, getCostFreeDosing,
  241. getOrderNo,
  242. getParentOrders,
  243. huoQuFeiYongXinXi,
  244. huoQuGeiYaoFangShi,
  245. huoQuXiangMu,
  246. huoQuZhiXinKeShi,
  247. huoQuZhuYuanPinLv,
  248. toDeleteAnOrder
  249. } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
  250. import {listNotBlank, stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
  251. import {getServerDateApi} from '@/api/public-api'
  252. import Sleep from '@/utils/sleep'
  253. import XcComboGrid from "@/components/xiao-chan/combo-grid/XcComboGrid";
  254. import XcSelectV3 from "@/components/xiao-chan/select-v3/XcSelectV3";
  255. import XcOption from "@/components/xiao-chan/select/XcOption";
  256. import XcSelect from "@/components/xiao-chan/select/XcSelect";
  257. import store from "@/store"
  258. import XcCheckbox from "@/components/xiao-chan/checkbox/XcCheckbox";
  259. import {BizException, ExceptionEnum} from "@/utils/BizException";
  260. import BaoCunXinXi from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/BaoCunXinXi";
  261. import {clone} from "@/utils/clone";
  262. import {
  263. winsize,
  264. queryParam,
  265. yiZhuData,
  266. yzData,
  267. currentPage,
  268. isCydy,
  269. drugManual
  270. } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
  271. import {ElMessageBox} from "element-plus";
  272. import YzDialog from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/dialog/YzDialog";
  273. import {logoutShortcut, xcHotKey} from "@/utils/xckeydown";
  274. const props = defineProps({
  275. patientInfo: {
  276. type: Object,
  277. default: null
  278. },
  279. successfullyEntered: Function,
  280. openGroupOrderTemplate: Function,
  281. })
  282. let tableHeader = [
  283. {label: '编码', prop: 'orderCode'},
  284. {label: '名称', prop: 'orderName', width: 220},
  285. {label: '规格', prop: 'drugSpecification'},
  286. {label: '描述', prop: 'discription'},
  287. {label: '库存', prop: 'stockAmount'},
  288. {label: '大包装', prop: 'specPack'},
  289. {label: '医保类型', prop: 'ybFlagNew'},
  290. {label: '医保编码', prop: 'nationalCode'},
  291. {label: '医保名称', prop: 'nationalName'},
  292. {label: '医保备注', prop: 'ybComment'},
  293. {label: '大输液', prop: 'infusionFlagName'},
  294. {label: '厂家', prop: 'manuName'},
  295. {label: '类型', prop: 'orderType'},
  296. {label: '毒麻类型', prop: 'drugFlagName'}
  297. ]
  298. /*提示信息*/
  299. const tiShiBiaoTi = ref([])
  300. // 搜索医嘱
  301. const xuanZhongFeiYong = async (row, laiyuan = 1) => {
  302. if (row.serial === '0000' && row.groupNo === '0000') {
  303. props.openGroupOrderTemplate(row.orderCode)
  304. return
  305. }
  306. if (row.serial === '00' && isCydy()) {
  307. qingKong()
  308. return BizException(ExceptionEnum.LOGICAL_ERROR, '出院带药不能开项目')
  309. }
  310. if (yiZhuData.value.actOrderNo === 'tempOrderNo') {
  311. yiZhuData.value.actOrderNo = await getOrderNo()
  312. }
  313. let tempOrderNo = null
  314. // 查询医嘱是不会有医嘱号的,医生会在原来的医嘱上面修改成项目或者药品
  315. // 保留一下医嘱号 不然 yiZhuData.value = row 这个会把医嘱号给干掉
  316. if (laiyuan === 1) {
  317. tempOrderNo = yiZhuData.value.actOrderNo
  318. }
  319. await fuYiZhuClick()
  320. qingKong()
  321. await Sleep(300)
  322. yiZhuData.value = row
  323. if (tempOrderNo !== null) {
  324. yiZhuData.value.actOrderNo = tempOrderNo;
  325. yiZhuData.value.statusFlag = '1'
  326. }
  327. let newData = yiZhuData.value.statusFlag === '1'
  328. if (row.serial === '01' || row.serial === '99') {
  329. try {
  330. let res = await huoQuFeiYongXinXi(row.orderCode, row.serial, props.patientInfo.zkWard)
  331. // 加载药品计量
  332. yaoPinJiLiangData.value = res.yaoPingJiLiang
  333. if (newData) {
  334. yiZhuData.value.drugFlag = row.drugFlag ? row.drugFlag : row.orderType
  335. // 判断是否 是皮试的药 如果是就只能有这些 给药方式
  336. geiYaoFangShiData.value = res.piShi
  337. // 是否是 抗菌药物
  338. yiZhuData.value.kjywFlag = res.data.kjywFlag
  339. // 提示信息
  340. tiShiBiaoTi.value = res.prompt
  341. // 最小单位名称
  342. yiZhuData.value.miniUnit = res.data.miniUnit
  343. yiZhuData.value.miniUnitName = res.data.miniUnitName
  344. yiZhuData.value.drugVolume = res.data.volum
  345. yiZhuData.value.drugVolUnit = res.data.volUnit
  346. // 加载 剂量单位
  347. if (stringNotBlank(yiZhuData.value.doseUnit)) {
  348. yaoPinJiLiangData.value.forEach((item) => {
  349. if (item.code === yiZhuData.value.doseUnit) {
  350. jiLiangValue.value = item.value
  351. }
  352. })
  353. } else if (listNotBlank(yaoPinJiLiangData.value)) {
  354. // 没有剂量单位的时候默认加载第一个计量单位 并且计算
  355. yiZhuData.value.doseUnit = yaoPinJiLiangData.value[0].code
  356. yiZhuData.value.dose = yaoPinJiLiangData.value[0].value
  357. jiLiangValue.value = yaoPinJiLiangData.value[0].value
  358. }
  359. jiSuanLingLiang(yiZhuData.value.dose)
  360. // 加载默认频率 如果已经填写了 就用有的
  361. if (stringIsBlank(row.frequCode)) {
  362. // 如果药品中自带了 频率就用药品表的频率
  363. if (stringNotBlank(res.data.frequCode)) {
  364. yiZhuData.value.frequCode = res.data.frequCode
  365. yiZhuData.value.frequCodeName = res.data.frequCodeName
  366. } else {
  367. yiZhuData.value.frequCode = 'ONCE'
  368. yiZhuData.value.frequCodeName = '一次'
  369. }
  370. }
  371. // 加载给药方式 如果已经有了就没事了
  372. if (stringIsBlank(yiZhuData.value.supplyCode)) {
  373. if (stringNotBlank(res.data.supplyCode)) {
  374. yiZhuData.value.supplyCode = res.data.supplyCode
  375. yiZhuData.value.supplyCodeName = res.data.supplyCodeName
  376. }
  377. }
  378. }
  379. openTheOrderPopUpWindow()
  380. } catch (e) {
  381. if (yiZhuData.value.statusFlag === '1') {
  382. await Sleep(200)
  383. qingKong()
  384. }
  385. }
  386. } else {
  387. yiZhuData.value.kjywFlag = 0
  388. try {
  389. let res = await huoQuFeiYongXinXi(row.orderCode, '00', props.patientInfo.zkWard)
  390. if (newData) {
  391. openTheOrderPopUpWindow('请输入处置医嘱名')
  392. yiZhuData.value.drugFlag = row.drugFlag ? row.drugFlag : row.orderType
  393. if (stringNotBlank(res.prompt)) {
  394. tiShiBiaoTi.value = res.prompt
  395. }
  396. if (!res.dose) {
  397. yiZhuData.value.dose = 1
  398. }
  399. }
  400. } catch (e) {
  401. if (yiZhuData.value.statusFlag === '1') {
  402. await Sleep(200)
  403. qingKong()
  404. }
  405. }
  406. }
  407. if (newData) {
  408. // 判断这个是不是 新添加的数据 如果是空的就是 新数据
  409. let serverDate = await getServerDateApi()
  410. // 如果是项目就不需要给药方式
  411. yiZhuData.value.supplyCode = null
  412. yiZhuData.value.supplyCodeName = ''
  413. if (!yiZhuData.value.orderTime) {
  414. yiZhuData.value.orderTime = serverDate
  415. }
  416. if (!yiZhuData.value.startTime) {
  417. yiZhuData.value.startTime = serverDate
  418. }
  419. // 用来加载默认的执行科室
  420. if (stringIsBlank(row.execUnit)) {
  421. if (stringNotBlank(props.patientInfo.zkWard)) {
  422. yiZhuData.value.execUnit = props.patientInfo.zkWard
  423. yiZhuData.value.execUnitName = props.patientInfo.zkWardName
  424. }
  425. } else if (props.patientInfo.zkWard && row.execUnit.startsWith("8")) {
  426. yiZhuData.value.execUnit = props.patientInfo.zkWard
  427. yiZhuData.value.execUnitName = props.patientInfo.zkWardName
  428. }
  429. if (!yiZhuData.value.frequCode) {
  430. yiZhuData.value.frequCode = 'ONCE'
  431. yiZhuData.value.frequCodeName = '一次'
  432. }
  433. try {
  434. pingLv.value.focus()
  435. } catch (e) {
  436. console.log(e)
  437. }
  438. if (queryParam.frequCode === 1) {
  439. yiZhuData.value.frequCode = 'ONCE'
  440. yiZhuData.value.frequCodeName = '一次'
  441. }
  442. }
  443. if (currentPage.value === 'takeMedicine') {
  444. yiZhuData.value.selfBuy = '4'
  445. }
  446. // 显示父医嘱的名称
  447. if (yiZhuData.value.statusFlag !== '1' && yiZhuData.value.parentNo) {
  448. fuYiZhuData.value = []
  449. fuYiZhuData.value.push({
  450. actOrderNo: yiZhuData.value.parentNo,
  451. orderName: yiZhuData.value.parentNoName,
  452. })
  453. }
  454. // 如果搜索了医嘱那么 这里就需要 重新赋值,不认表格就没办法变化了,把原来的换掉
  455. for (let i = 0, len = yzData.value.length; i < len; i++) {
  456. let item = yzData.value[i];
  457. if (yiZhuData.value.actOrderNo === item.actOrderNo) {
  458. yzData.value[i] = yiZhuData.value
  459. return
  460. }
  461. }
  462. }
  463. /* 频率 */
  464. const pingLv = ref()
  465. const yaoPinPingLvData = ref([])
  466. // 获取药品频率
  467. const pinLvRemoteMethod = (val) => {
  468. huoQuZhuYuanPinLv(val).then((res) => {
  469. yaoPinPingLvData.value = res
  470. })
  471. }
  472. /*计算领量*/
  473. const jiSuanLingLiang = (val) => {
  474. if (jiLiangValue.value <= 0) return
  475. yiZhuData.value.drugQuan = Math.ceil(val / jiLiangValue.value)
  476. }
  477. /* 选择剂量 */
  478. const yaoPinJiLiangData = ref([])
  479. const jiLiangValue = ref(0)
  480. const xuanZheJiLiang = (val) => {
  481. jiLiangValue.value = val.value
  482. yiZhuData.value.dose = val.value
  483. jiSuanLingLiang(yiZhuData.value.dose)
  484. }
  485. /* 给药方式 */
  486. const geiYaoFangShiData = ref([])
  487. const geiYaoFangShiRemoteMethod = (val) => {
  488. if (isCydy()) {
  489. getCostFreeDosing(val).then((res) => {
  490. geiYaoFangShiData.value = res
  491. });
  492. } else {
  493. huoQuGeiYaoFangShi(val).then((res) => {
  494. geiYaoFangShiData.value = res
  495. });
  496. }
  497. }
  498. // 医嘱限制时间不能在之前
  499. const disabledDate = (time) => {
  500. if (props.patientInfo?.admissDate) {
  501. return time.getTime() < new Date(props.patientInfo?.admissDate).getTime() - 8.64e7
  502. }
  503. return true
  504. }
  505. /* 获取执行科室 */
  506. const zhiXingKeShiData = ref([])
  507. const metZhiXingKeShi = (val) => {
  508. huoQuZhiXinKeShi(val).then((res) => {
  509. zhiXingKeShiData.value = res
  510. })
  511. }
  512. /* 父医嘱 */
  513. const fuYiZhuData = ref([])
  514. const fuYiZhuClick = async () => {
  515. fuYiZhuData.value = []
  516. fuYiZhuData.value = await getParentOrders(props.patientInfo.inpatientNo, props.patientInfo.admissTimes)
  517. }
  518. const modifyDosingMethod = () => {
  519. if (yiZhuData.value.parentNo) {
  520. yiZhuData.value.supplyCode = '044'
  521. yiZhuData.value.supplyCodeName = '副药'
  522. }
  523. }
  524. /**
  525. * 添加医嘱
  526. * @returns {Promise<void>}
  527. */
  528. const addOrderNo = async () => {
  529. if (stringIsBlank(props.patientInfo.inpatientNo)) {
  530. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择患者')
  531. }
  532. // 如果有录入数据的话就需要保存一下
  533. if (stringNotBlank(yiZhuData.value.actOrderNo) && yiZhuData.value.statusFlag === '1' && yiZhuData.value.actOrderNo !== 'tempOrderNo') {
  534. let param = {
  535. inpatientNo: props.patientInfo.inpatientNo,
  536. admissTimes: props.patientInfo.admissTimes,
  537. actOrderNo: yiZhuData.value.actOrderNo,
  538. groupNo: queryParam.value.groupNo,
  539. data: yiZhuData.value
  540. }
  541. try {
  542. let res = await enterOrders(param)
  543. // 如果有错误信息 就 提示
  544. if (res !== null && res.error) {
  545. baoCunXinXiRef.value.openOrClose()
  546. errorMessageData.value = res.data
  547. return
  548. }
  549. props.successfullyEntered(yiZhuData.value)
  550. // 医嘱保存超过了 就删除错误提示
  551. if (errorMessageData.value) {
  552. for (let key in errorMessageData.value) {
  553. if (key === yiZhuData.value.actOrderNo.toString()) {
  554. delete errorMessageData.value[key]
  555. break
  556. }
  557. }
  558. }
  559. // 如果没有了错误信息 就关闭
  560. if (!!errorMessageData.value) {
  561. baoCunXinXiRef.value.openOrClose(false)
  562. }
  563. qingKong()
  564. yiZhuData.value.actOrderNo = 'tempOrderNo'
  565. openSearch()
  566. } catch (e) {
  567. console.log(e)
  568. }
  569. } else {
  570. qingKong()
  571. yiZhuData.value.actOrderNo = 'tempOrderNo'
  572. openSearch()
  573. }
  574. }
  575. const qingKong = () => {
  576. yaoPinJiLiangData.value = []
  577. jiLiangValue.value = 0
  578. tiShiBiaoTi.value = []
  579. tempData = null
  580. yiZhuData.value = {
  581. id: '',
  582. actOrderNo: null,
  583. orderName: '',
  584. orderCode: '',
  585. // 频率
  586. frequCode: '',
  587. frequCodeName: '',
  588. drugSpecification: '',
  589. dose: 0,
  590. // 领量
  591. doseUnit: '',
  592. doseUnitName: '',
  593. supplyCode: '',
  594. supplyCodeName: '',
  595. startTime: '',
  596. endTime: '',
  597. orderTime: '',
  598. doctorName: '',
  599. drugFlag: '',
  600. execUnit: '',
  601. execUnitName: '',
  602. parentNo: '',
  603. parentNoName: '',
  604. physicianName: '',
  605. discription: '',
  606. instruction: null,
  607. kfFlag: null,
  608. selfBuy: null,
  609. ybSelfFlag: '0',
  610. emergencyFlag: '0',
  611. drugQuan: 0,
  612. miniUnitName: '',
  613. serial: '',
  614. miniUnit: '',
  615. psFlag: false,
  616. kjywFlag: 0,
  617. yyfs: null,
  618. ssqk: null,
  619. yysj: null,
  620. zkObj: '',
  621. zkWardCode: '',
  622. zkDeptCode: '',
  623. statusFlag: '1'
  624. }
  625. }
  626. // 判断是否可以编辑
  627. const isEdit = computed(() => {
  628. return !!(stringIsBlank(yiZhuData.value.actOrderNo)
  629. || yiZhuData.value.statusFlag !== '1'
  630. || stringIsBlank(props.patientInfo.inpatientNo));
  631. })
  632. let baoCunXinXiRef = ref(null)
  633. const toAddAnOrder = async () => {
  634. if (stringIsBlank(props.patientInfo.inpatientNo)) {
  635. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择患者')
  636. }
  637. if (stringIsBlank(yiZhuData.value.actOrderNo) || yiZhuData.value.actOrderNo === 'tempOrderNo') {
  638. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择一个医嘱')
  639. }
  640. // 有 医嘱 不是 录入就说明在看医嘱 直接清空就可以了
  641. if (stringNotBlank(yiZhuData.value.orderCode) && yiZhuData.value.statusFlag !== '1') {
  642. qingKong()
  643. return
  644. }
  645. let param = {
  646. inpatientNo: props.patientInfo.inpatientNo,
  647. admissTimes: props.patientInfo.admissTimes,
  648. actOrderNo: yiZhuData.value.actOrderNo,
  649. groupNo: queryParam.value.groupNo,
  650. data: yiZhuData.value
  651. }
  652. try {
  653. let res = await enterOrders(param)
  654. if (res !== null && res.error) {
  655. baoCunXinXiRef.value.openOrClose()
  656. errorMessageData.value = res.data
  657. return
  658. }
  659. if (errorMessageData.value) {
  660. for (let key in errorMessageData.value) {
  661. if (key === yiZhuData.value.actOrderNo.toString()) {
  662. delete errorMessageData.value[key]
  663. break
  664. }
  665. }
  666. }
  667. // 如果错误信息是空的就关闭
  668. if (Object.keys(errorMessageData.value).length === 0) {
  669. baoCunXinXiRef.value.openOrClose(false)
  670. }
  671. qingKong()
  672. props.successfullyEntered(yiZhuData.value)
  673. } catch (e) {
  674. console.log(e)
  675. }
  676. }
  677. /**
  678. * 点击了确认医嘱
  679. */
  680. const confirmOrdersClick = async () => {
  681. try {
  682. let res = await confirmOrders(props.patientInfo)
  683. if (res !== null && res.error) {
  684. baoCunXinXiRef.value.openOrClose()
  685. errorMessageData.value = res.data
  686. }
  687. } catch (e) {
  688. }
  689. }
  690. const yzDialogRef = ref(null)
  691. const openTheOrderPopUpWindow = () => {
  692. if (!isEdit.value) {
  693. yzDialogRef.value.openOrClose(true)
  694. }
  695. }
  696. // 错误信息
  697. const errorMessageData = ref({})
  698. /**
  699. * 点击了查看错误信息
  700. * @param val 数据
  701. */
  702. const clickError = (val) => {
  703. if (yiZhuData.value.actOrderNo === 'tempOrderNo') {
  704. qingKong()
  705. }
  706. if (stringNotBlank(yiZhuData.value.actOrderNo)) {
  707. let param = {
  708. inpatientNo: props.patientInfo.inpatientNo,
  709. admissTimes: props.patientInfo.admissTimes,
  710. actOrderNo: yiZhuData.value.actOrderNo,
  711. data: yiZhuData.value
  712. }
  713. enterOrders(param).then((res) => {
  714. if (res !== null && res.error) {
  715. errorMessageData.value[yiZhuData.value.actOrderNo] = res.data[yiZhuData.value.actOrderNo]
  716. return
  717. }
  718. delete errorMessageData.value[yiZhuData.value.actOrderNo]
  719. xuanZhongFeiYong(val.data, 2)
  720. }).catch(e => {
  721. })
  722. } else {
  723. xuanZhongFeiYong(val.data, 2)
  724. }
  725. }
  726. /**
  727. * 填充 数据
  728. * @param data
  729. */
  730. let tempData = null
  731. const fillData = async (data) => {
  732. await fuYiZhuClick()
  733. await xuanZhongFeiYong(data, 2)
  734. tempData = JSON.stringify(yiZhuData.value)
  735. }
  736. /**
  737. * 复制粘贴医嘱
  738. * @returns {Promise<void>}
  739. */
  740. const duplicateAndPaste = async () => {
  741. if (stringIsBlank(yiZhuData.value.actOrderNo)) {
  742. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择医嘱')
  743. }
  744. let temp = clone(yiZhuData.value)
  745. qingKong()
  746. temp.actOrderNo = await getOrderNo()
  747. temp.statusFlag = '1'
  748. let newDate = await getServerDateApi()
  749. temp.orderTime = newDate
  750. temp.startTime = newDate
  751. temp.endTime = null
  752. temp.enterOper = store.getters['user/info'].code
  753. temp.enterOperName = store.getters['user/info'].name
  754. temp.signerName = ''
  755. temp.signer = ''
  756. temp.modifierName = ''
  757. temp.modifier = ''
  758. await xuanZhongFeiYong(temp, 2)
  759. }
  760. // 删除医嘱
  761. const toDeleteAnOrderClick = () => {
  762. if (stringIsBlank(yiZhuData.value.actOrderNo)) {
  763. BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择要删除的医嘱')
  764. }
  765. ElMessageBox.confirm(`确认是否要删除<span style="color: red"> ${yiZhuData.value.orderName} </span>`, '提示', {
  766. type: 'warning',
  767. dangerouslyUseHTMLString: true
  768. }).then(() => {
  769. toDeleteAnOrder(yiZhuData.value.actOrderNo).then(() => {
  770. qingKong()
  771. props.successfullyEntered(yiZhuData.value)
  772. })
  773. })
  774. }
  775. const editorMainRef = ref()
  776. const searchRef = ref(null)
  777. const openSearch = () => {
  778. if (isEdit.value) return
  779. searchRef.value.focus()
  780. }
  781. let shortcutKeyRegistration = {
  782. ctrl: {s: toAddAnOrder, f: openSearch},
  783. alt: {a: addOrderNo}
  784. }
  785. onDeactivated(() => {
  786. logoutShortcut()
  787. })
  788. onActivated(() => {
  789. xcHotKey(shortcutKeyRegistration)
  790. })
  791. const editingAreaRef = ref()
  792. onMounted(async () => {
  793. await nextTick()
  794. await Sleep(100)
  795. if (winsize.value.editor === 0) {
  796. // 获取编辑器的宽度
  797. winsize.value.editor = editingAreaRef.value.clientWidth
  798. }
  799. })
  800. defineExpose({
  801. addOrderNo,
  802. fillData,
  803. toDeleteAnOrderClick,
  804. confirmOrdersClick,
  805. isEdit
  806. })
  807. </script>
  808. <style scoped lang="scss">
  809. .editing_area {
  810. position: relative;
  811. width: max-content;
  812. }
  813. .editor__title {
  814. background-color: #ffdb04;
  815. padding: 5px;
  816. width: 100%;
  817. overflow-x: auto;
  818. }
  819. .yz_editor__disable {
  820. position: absolute;
  821. height: 100%;
  822. width: 100%;
  823. z-index: 89;
  824. &::before {
  825. position: absolute;
  826. content: '禁止编辑';
  827. right: 0;
  828. color: red;
  829. }
  830. }
  831. .yz_input__box {
  832. display: flex;
  833. margin-top: 6px;
  834. flex-wrap: wrap;
  835. div {
  836. margin-left: 3px;
  837. }
  838. .div_center__box {
  839. display: flex;
  840. justify-content: center;
  841. align-items: center;
  842. }
  843. .input__style {
  844. width: 125px;
  845. line-height: 22px;
  846. height: 22px;
  847. border: 1px solid
  848. }
  849. }
  850. </style>