HuoQuMuBan.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div>
  3. <el-dialog draggable v-model="dialog" destroy-on-close title="模板" width="90%" @close="emit('close')">
  4. <el-container>
  5. <el-aside style="width: 350px">
  6. <el-radio-group v-model="muBanLeiXing" size="small" @change="dianJiChaXun">
  7. <el-radio-button :label="0">全部</el-radio-button>
  8. <el-radio-button :label="1">全院</el-radio-button>
  9. <el-radio-button :label="2">本科室</el-radio-button>
  10. <el-radio-button :label="3">个人</el-radio-button>
  11. <el-radio-button :label="4">收藏</el-radio-button>
  12. </el-radio-group>
  13. <el-input v-model="code" clearable style="width: 120px" @keyup.enter="dianJiChaXun"></el-input>
  14. <el-button @click="dianJiChaXun">查询</el-button>
  15. <el-table :data="fuJiMuBanShuJu.data" :height="windowSize.h / 1.6"
  16. highlight-current-row stripe
  17. @row-click="dianJiMuBanMing"
  18. style="width: 300px">
  19. <el-table-column label="操作" width="180">
  20. <template #default="scope">
  21. <el-button type="primary" icon="Edit" v-if="muBanLeiXing !== 4"
  22. @click.stop="clickToEditTemplate(scope.row)"/>
  23. <el-button type="warning"
  24. v-if="muBanLeiXing !== 4"
  25. @click.stop="clickToFavoriteTemplates(scope.row,scope.$index)"
  26. :icon="scope.row.yiBeiShouCang ? 'StarFilled' : 'Star'"/>
  27. <el-button type="danger"
  28. icon="Delete"
  29. @click.stop="clickDeleteTemplate(scope.row.patternCode,scope.$index)"/>
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="名称" prop="patternName" width="70"/>
  33. </el-table>
  34. <el-pagination
  35. :current-page="fuJiMuBanShuJu.currentPage"
  36. :page-size="fuJiMuBanShuJu.pageSize"
  37. :pager-count="5"
  38. :total="fuJiMuBanShuJu.total"
  39. layout="total, prev, pager, next"
  40. small
  41. @current-change="handleCurrentChange"
  42. >
  43. </el-pagination>
  44. </el-aside>
  45. <el-main>
  46. <el-button type="primary" @click="dianJiQueDing">确定</el-button>
  47. 开始时间:
  48. <el-date-picker
  49. v-model="startTime"
  50. :disabled-date="disabledDate"
  51. format="YYYY-MM-DD HH:mm:ss"
  52. style="width: 180px"
  53. type="datetime"
  54. value-format="YYYY-MM-DD HH:mm:ss"
  55. ></el-date-picker>
  56. 医嘱时间:
  57. <el-input v-model="orderTime" disabled style="width: 180px"></el-input>
  58. 频率:
  59. <el-select
  60. v-model="frequCode"
  61. :remote-method="pinLvRemoteMethod"
  62. clearable
  63. filterable
  64. remote
  65. size="small"
  66. style="width: 120px"
  67. @change="getFrequCodeName"
  68. @clear="frequCode = null"
  69. >
  70. <el-option v-for="item in yaoPinPingLvData" :key="item.code" :label="item.name"
  71. :value="{ label: item.name, value: item.code }">
  72. <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
  73. <el-divider direction="vertical"></el-divider>
  74. <span>{{ item.name }}</span>
  75. </el-option>
  76. </el-select>
  77. <xc-table ref="tableRef"
  78. row-key="id"
  79. :data="{'data':muBanShuJu}"
  80. :open-paging="false"
  81. :height="windowSize.h / 1.6">
  82. <el-table-column fixed="left" type="selection"/>
  83. <el-table-column fixed="left" label="uuid" prop="id"></el-table-column>
  84. <el-table-column label="医嘱名称" prop="orderName" show-overflow-tooltip width="135"></el-table-column>
  85. <el-table-column label="规格" prop="drugSpecification"></el-table-column>
  86. <el-table-column label="频率" prop="frequCodeName"></el-table-column>
  87. <el-table-column label="一次剂量" prop="dose">
  88. <template #default="scope"> {{ scope.row.dose }} {{ scope.row.doseUnitName }}</template>
  89. </el-table-column>
  90. <el-table-column label="领量" prop="drugQuan">
  91. <template #default="scope"> {{ scope.row.drugQuan }} {{ scope.row.miniUnitName }}</template>
  92. </el-table-column>
  93. <el-table-column label="给药方式" prop="supplyCodeName"></el-table-column>
  94. <el-table-column label="执行科室" prop="execUnitName"></el-table-column>
  95. <el-table-column label="父医嘱" prop="parentNo"></el-table-column>
  96. </xc-table>
  97. </el-main>
  98. </el-container>
  99. <bao-cun-mu-ban ref="baoCunMuBan"></bao-cun-mu-ban>
  100. </el-dialog>
  101. </div>
  102. </template>
  103. <script name="HuoQuMuBan" setup>
  104. import store from '../../../store'
  105. import {
  106. collectDoctorSOrderTemplate,
  107. deleteADoctorSOrderTemplate,
  108. huoQuMuBanShuJu,
  109. huoQuYiZhuMuBan,
  110. huoQuZhuYuanPinLv,
  111. } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
  112. import {muBanMing} from '@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng'
  113. import {computed, ref} from 'vue'
  114. import {listIsBlank, stringNotBlank} from '@/utils/blank-utils'
  115. import {ElMessage, ElMessageBox} from 'element-plus'
  116. import {clone} from '@/utils/clone'
  117. import BaoCunMuBan from './BaoCunMuBan.vue'
  118. import {getServerDateApi} from '@/api/public-api'
  119. import {BizException, ExceptionEnum} from "@/utils/BizException";
  120. import XcTable from "@/components/xc/xc-table/XcTable.vue";
  121. // 调用父组件的方法
  122. const emit = defineEmits(['mu-ban-shu-ju', 'close'])
  123. const windowSize = computed(() => {
  124. return store.state.app.windowSize
  125. })
  126. const user = computed(() => {
  127. return store.state.user.info
  128. })
  129. const code = ref('')
  130. const dialog = ref(true)
  131. const muBanShuJu = ref([])
  132. const tableRef = ref(null)
  133. const muBanLeiXing = ref(3)
  134. let startTime = $ref('')
  135. const orderTime = ref('')
  136. const frequCode = ref('')
  137. const frequCodeName = ref('')
  138. const yaoPinPingLvData = ref([])
  139. const dianJiFuJiXinXi = ref('')
  140. // 修改模板
  141. const baoCunMuBan = ref(null)
  142. const fuJiMuBanShuJu = ref({
  143. currentPage: 1,
  144. pageSize: 20,
  145. total: 0,
  146. data: [],
  147. })
  148. // 获取医嘱
  149. const dianJiChaXun = () => {
  150. huoQuYiZhuMuBan(code.value, user.value.deptCode, muBanLeiXing.value, fuJiMuBanShuJu.value.currentPage, 0).then((res) => {
  151. fuJiMuBanShuJu.value.data = res.records
  152. fuJiMuBanShuJu.value.total = res.total
  153. })
  154. }
  155. const dianJiMuBanMing = async (row) => {
  156. dianJiFuJiXinXi.value = row
  157. muBanShuJu.value = await huoQuMuBanShuJu(row.inputType === '4' ? row.collectCode : row.patternCode)
  158. let serverDate = await getServerDateApi()
  159. orderTime.value = serverDate
  160. startTime = serverDate
  161. }
  162. // 分页
  163. const handleCurrentChange = (val) => {
  164. fuJiMuBanShuJu.value.currentPage = val
  165. huoQuYiZhuMuBan(code.value, user.value.deptCode, muBanLeiXing.value, fuJiMuBanShuJu.value.currentPage, fuJiMuBanShuJu.value.total).then((res) => {
  166. fuJiMuBanShuJu.value.data = res.records
  167. })
  168. }
  169. // 删除模板
  170. const clickDeleteTemplate = (patternCode, index) => {
  171. ElMessageBox.confirm('确定要删除该模板吗?', '提示', {
  172. type: 'error',
  173. }).then(() => {
  174. deleteADoctorSOrderTemplate(patternCode).then((res) => {
  175. fuJiMuBanShuJu.value.data.splice(index, 1)
  176. muBanShuJu.value = []
  177. })
  178. }).catch((e) => {
  179. })
  180. }
  181. // 收藏模板
  182. const clickToFavoriteTemplates = ({inputId, patternCode}, index) => {
  183. if (inputId === store.state.user.info.code) {
  184. BizException(ExceptionEnum.MESSAGE_ERROR, "无法收藏自己创建的模板。")
  185. }
  186. collectDoctorSOrderTemplate(patternCode).then((res) => {
  187. fuJiMuBanShuJu.value.data[index].yiBeiShouCang = !fuJiMuBanShuJu.value.data[index].yiBeiShouCang
  188. });
  189. }
  190. // 点击编辑模板
  191. const clickToEditTemplate = async (row) => {
  192. await dianJiMuBanMing(row)
  193. for (let i = muBanShuJu.value.length - 1; i >= 0; i--) {
  194. let item = muBanShuJu.value[i];
  195. item.startTime = startTime
  196. item.orderTime = orderTime
  197. if (stringNotBlank(frequCode.value)) {
  198. item.frequCode = frequCode.value
  199. item.frequCodeName = frequCodeName.value
  200. }
  201. }
  202. emit('mu-ban-shu-ju', clone(muBanShuJu.value))
  203. muBanMing.value = dianJiFuJiXinXi.value
  204. }
  205. // 获取选中的 医嘱数据
  206. const xuanZhongShuJu = ref([])
  207. const dianJiQueDing = () => {
  208. xuanZhongShuJu.value = tableRef.value.getSelectionRows()
  209. xuanZhongShuJu.value.forEach((item) => {
  210. item.startTime = startTime
  211. item.orderTime = orderTime
  212. if (stringNotBlank(frequCode.value)) {
  213. item.frequCode = frequCode.value
  214. item.frequCodeName = frequCodeName.value
  215. }
  216. })
  217. emit('mu-ban-shu-ju', clone(xuanZhongShuJu.value))
  218. }
  219. // 时间限制
  220. // 医嘱限制时间不能在之前
  221. const disabledDate = (time) => {
  222. return time.getTime() < Date.now() - 8.64e7
  223. }
  224. // 获取评率
  225. const getFrequCodeName = ({label, value}) => {
  226. frequCodeName.value = label
  227. frequCode.value = value
  228. }
  229. const pinLvRemoteMethod = (val) => {
  230. if (val.length > 1) {
  231. huoQuZhuYuanPinLv(val).then((res) => {
  232. yaoPinPingLvData.value = res
  233. })
  234. }
  235. }
  236. onMounted(() => {
  237. dianJiChaXun()
  238. })
  239. </script>
  240. <style scoped>
  241. :deep(.el-table .children-row) {
  242. background: rgba(145, 247, 145, 0.5);
  243. }
  244. :deep(.el-table) {
  245. --el-table-row-hover-background-color: #85dbfd7a;
  246. }
  247. </style>