PrintExecuteDetail.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <page-layer>
  3. <template #header>
  4. <el-select filterable v-model="queryParam.wardCode" @change="initPatintBedNo"
  5. style="width: 130px;margin-right: 10px" size="small">
  6. <el-option v-for="item in ward" :key="item.code" :label="item.name" :value="item.code">
  7. <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
  8. <el-divider direction="vertical"></el-divider>
  9. <span>{{ item.name }}</span>
  10. </el-option>
  11. </el-select>
  12. 执行时间:
  13. <el-date-picker
  14. v-model="queryParam.executeTime"
  15. type="datetime"
  16. size="small"
  17. :clearable="false"
  18. format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
  19. style="width: 150px;margin-right: 10px"/>
  20. 床位范围:
  21. <el-select v-model="queryParam.startBedNo"
  22. clearable
  23. style="width: 70px">
  24. <el-option v-for="item in patintList"
  25. :key="item.bedNo"
  26. :label="item.bedNo"
  27. :value="item.bedNo">
  28. <span>{{ item.bedNo }}</span>
  29. <el-divider direction="vertical"></el-divider>
  30. <span>{{ item.inpatientNo }}</span>
  31. <el-divider direction="vertical"></el-divider>
  32. <span>{{ item.name }}</span>
  33. </el-option>
  34. </el-select>
  35. <el-select v-model="queryParam.endBedNo"
  36. style="width: 70px;margin-right: 10px"
  37. clearable>
  38. <el-option v-for="item in reverPatintList"
  39. :key="item.bedNo"
  40. :label="item.bedNo"
  41. :value="item.bedNo">
  42. <span>{{ item.bedNo }}</span>
  43. <el-divider direction="vertical"></el-divider>
  44. <span>{{ item.inpatientNo }}</span>
  45. <el-divider direction="vertical"></el-divider>
  46. <span>{{ item.name }}</span>
  47. </el-option>
  48. </el-select>
  49. 频率:
  50. <el-select v-model="queryParam.frequCodeFlag"
  51. style="width: 70px;margin-right: 10px"
  52. >
  53. <el-option label="全部" value="0"></el-option>
  54. <el-option label="临时" value="1"></el-option>
  55. <el-option label="长期" value="2"></el-option>
  56. </el-select>
  57. 打印范围:
  58. <el-select v-model="queryParam.printFlag"
  59. style="width: 70px;margin-right: 10px"
  60. >
  61. <el-option label="全部" value="0"></el-option>
  62. <el-option label="新增" value="1"></el-option>
  63. <el-option label="已打印" value="2"></el-option>
  64. </el-select>
  65. <el-radio-group v-model="queryParam.pageClass" size="small" @change="pageClassChange" style="margin-right: 20px">
  66. <el-radio @click="pageClassChange" label="0">选择分类</el-radio>
  67. <el-radio label="1">全部分类</el-radio>
  68. </el-radio-group>
  69. <el-button icon="Search" type="primary" @click="queryInfo">查询</el-button>
  70. <el-button icon="Printer" type="success" @click="printInfo">打印</el-button>
  71. </template>
  72. <template #main>
  73. <el-scrollbar class="scrollbar" :max-height="(getWindowSize.h/1.2-100)+'px'" noresize="true">
  74. <div id="printId">
  75. <table class="pageTable">
  76. <thead>
  77. <tr>
  78. <td colspan="10" style="width: 100%;border: none;text-align: center;font-size: 25px;font-weight:bold">
  79. 执行项目表
  80. </td>
  81. </tr>
  82. <tr>
  83. <td colspan="10" style="width: 753px;border: none;">
  84. <div style="float: left;width: 25%">
  85. 病房:{{ getWardName(queryParam.wardCode) }}
  86. </div>
  87. <div style="float: left;width: 50%">
  88. 日期:{{ queryParam.executeTime }}至
  89. {{ getDiffDays(queryParam.executeTime.split(" ")[0], 1) + " " + queryParam.executeTime.split(" ")[1] }}
  90. </div>
  91. <div style="float: left;width: 25%">
  92. 打印日期:{{ getFormatDatetime(new Date(), 'YYYY-MM-DD') }}
  93. </div>
  94. </td>
  95. </tr>
  96. <tr>
  97. <th style="height: 30px">床号</th>
  98. <th>姓名</th>
  99. <th>执行项目名称</th>
  100. <th>频率</th>
  101. <th>剂量</th>
  102. <th>给药方式</th>
  103. <th>执行时间</th>
  104. <th>嘱托</th>
  105. <th>执行</th>
  106. <th>核对</th>
  107. </tr>
  108. </thead>
  109. <tbody>
  110. <tr v-for="(item,index) in resData">
  111. <td style="width: 5%">{{ item.bedNo }}</td>
  112. <td style="width: 8%">{{ item.name }}</td>
  113. <td style="width: 25%">{{ item.orderName }}</td>
  114. <td style="width: 10%">{{ item.frequCode }}</td>
  115. <td style="width: 10%">&nbsp;{{ item.dose ? item.dose : item.drugQuan }} {{item.doseUnit}} &nbsp; {{item.unit}}</td>
  116. <td style="width: 10%;text-align: center">{{ item.supplyName }}</td>
  117. <td style="width: 10%">{{ item.occTimeStr }}</td>
  118. <td style="width: 10%">{{ item.instruction }}</td>
  119. <td style="width: 5%"></td>
  120. <td style="width: 5%"></td>
  121. </tr>
  122. </tbody>
  123. </table>
  124. </div>
  125. </el-scrollbar>
  126. <el-dialog
  127. v-model="dialogVisible"
  128. title="选择分类"
  129. width="50%"
  130. >
  131. <ItemClass ref="itemClassRef" :wardCode="queryParam.wardCode" @closeDiag="closeDiag"
  132. @selectionPageClass="selectionPageClass"></ItemClass>
  133. </el-dialog>
  134. </template>
  135. </page-layer>
  136. </template>
  137. <script setup lang="ts" name='PrintExecuteItem'>
  138. import {computed, onMounted, ref} from 'vue'
  139. import {useStore} from 'vuex'
  140. import {getFormatDatetime, getDiffDays} from "@/utils/date"
  141. import {ElMessage, ElMessageBox} from 'element-plus'
  142. import {getAllWards} from "@/api/zhu-yuan-yi-sheng/resident-doctor";
  143. import {queryYpZdGroupName, queryYzYpPageNo} from "@/api/medical-advice/medical-common";
  144. import {queryPatientInfo} from "@/api/medical-advice/medical-advice-management";
  145. import {stringNotBlank} from "@/utils/blank-utils"
  146. import {queryExecuteItemDetail, updateExecuteItemPrintFlag} from "@/api/medical-advice/excute-item";
  147. import PageLayer from "@/layout/PageLayer";
  148. import ItemClass from "@/components/medical-advice/ItemClass";
  149. import {getLodop, initLodop} from '@/utils/c-lodop'
  150. import {getWindowSize} from "@/utils/window-size";
  151. import {userInfoStore} from "@/utils/store-public";
  152. const queryParam = ref({
  153. wardCode: '',
  154. startBedNo: '',
  155. endBedNo: '',
  156. executeTime: getFormatDatetime(new Date(), 'YYYY-MM-DD' + ' 00:00:00'),
  157. frequCodeFlag: '0',
  158. printFlag: '1',
  159. executeFlag: '2',
  160. pageClass: '1',
  161. classCode: '',
  162. codes: [],
  163. itemCode: '',
  164. })
  165. //选择分类切换
  166. const pageClassChange = () => {
  167. if (queryParam.value.pageClass === '0') {
  168. dialogVisible.value = true
  169. } else {
  170. dialogVisible.value = false
  171. }
  172. }
  173. const selectionPageClass = (val) => {
  174. queryParam.value.codes = val.codes
  175. queryParam.value.classCode = val.classCode
  176. queryParam.value.itemCode = val.itemCode
  177. }
  178. const closeDiag = () => {
  179. dialogVisible.value = false
  180. }
  181. const dialogVisible = ref(false)
  182. const ward = ref([])
  183. const getWardName = (code) => {
  184. for (let i = 0; i < ward.value.length; i++) {
  185. if (code === ward.value[i].code) {
  186. return ward.value[i].name
  187. }
  188. }
  189. }
  190. onMounted(() => {
  191. initLodop()
  192. getAllWards().then((res: any) => {
  193. if (res) {
  194. ward.value = res
  195. queryParam.value.wardCode = res[0].code
  196. initPatintBedNo()
  197. }
  198. })
  199. })
  200. const patintList = ref([])
  201. const reverPatintList = computed(() => reverseArray(patintList.value))
  202. function reverseArray(arr) {
  203. let newArr = [];
  204. arr.forEach(element => {
  205. // unshift() 方法可向数组的开头添加一个或更多元素,并返回新的长度。
  206. newArr.unshift(element);
  207. });
  208. return newArr;
  209. }
  210. const itemClassRef = ref(null)
  211. const resData = ref([])
  212. const queryInfo = () => {
  213. queryExecuteItemDetail(queryParam.value).then((res: any) => {
  214. resData.value = res
  215. })
  216. }
  217. const printCss = `
  218. .pageTable tr th {
  219. border-bottom: 1px solid black;
  220. border-top: 1px solid black;
  221. text-align: left;
  222. font-size: 12px;
  223. padding: 0 0;
  224. }
  225. .pageTable tr td{
  226. border-bottom:1px dashed black;
  227. border-top:1px dashed black;
  228. text-align: left;
  229. font-size: 12px;
  230. padding: 0 0;
  231. }
  232. .pageTable tr td{
  233. height: 27px;
  234. }
  235. #printId{
  236. padding: 0 0;
  237. width: 753px;
  238. }
  239. .pageTable {
  240. border-collapse: collapse;
  241. }
  242. `
  243. const printInfo = () => {
  244. updateExecuteItemPrintFlag(resData.value).then((res: any) => {
  245. let LODOP = getLodop()
  246. LODOP.PRINT_INIT('执行项目表') // 初始化打印机 名字
  247. LODOP.SET_PRINT_PAGESIZE(1, '210mm', '297mm', '') // 设置纸张大小 A4
  248. LODOP.ADD_PRINT_TABLE('2mm', '5mm', '205mm', '220mm', '<style>' + printCss + '</style>' + '<body>' + document.getElementById('printId').innerHTML + '</body>') //要打印的内容
  249. LODOP.SET_PRINT_STYLE('ItemType', 3)
  250. LODOP.ADD_PRINT_TEXT('250mm', '100mm', '25mm', '10mm', '第#页/共&页')
  251. LODOP.PREVIEW() // 关闭
  252. })
  253. }
  254. const initPatintBedNo = () => {
  255. itemClassRef.value ? itemClassRef.value.setWardCode(queryParam.value.wardCode) : ''
  256. queryPatientInfo('', queryParam.value.wardCode, '').then((res: any) => {
  257. patintList.value = res
  258. })
  259. }
  260. </script>
  261. <style scoped lang="scss">
  262. .pageTable tr th {
  263. border-bottom: 1px solid black;
  264. border-top: 1px solid black;
  265. text-align: left;
  266. font-size: 12px;
  267. padding: 0 0;
  268. }
  269. #printId .pageTable tr td {
  270. border-bottom: 1px dashed black;
  271. border-top: 1px dashed black;
  272. text-align: left;
  273. font-size: 12px;
  274. padding: 0 0;
  275. }
  276. .pageTable tr td {
  277. height: 27px;
  278. }
  279. #smalPrintId {
  280. padding: 0 0;
  281. width: 470px;
  282. }
  283. #printId {
  284. padding: 0 0;
  285. width: 753px;
  286. }
  287. .pageTable {
  288. border-collapse: collapse;
  289. }
  290. </style>