YzEditor.vue 26 KB

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