MedicinePageSubmit.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <template>
  2. <div class="layout_container">
  3. <header>
  4. <!-- :shortcuts="shortcuts"
  5. size="small"
  6. style="width: 300px"
  7. -->
  8. <el-date-picker
  9. v-model="dateRange"
  10. type="datetimerange"
  11. range-separator="至"
  12. start-placeholder="开始日期"
  13. end-placeholder="结束日期"
  14. :clearable="false"
  15. @change="formatDateRange"
  16. ></el-date-picker
  17. >&nbsp;&nbsp;
  18. <el-select v-model="medicineType" style="width: 80px">
  19. <el-option value="1" label="全部" key="med-type-1"></el-option>
  20. <el-option value="2" label="毒麻" key="med-type-2"></el-option>
  21. <el-option value="3" label="非毒麻" key="med-type-3"></el-option>
  22. <el-option
  23. value="4"
  24. label="大输液"
  25. key="med-type-4"
  26. ></el-option> </el-select
  27. >&nbsp;&nbsp;
  28. <el-button type="primary" icon="Search" @click="getMedicinePages"
  29. >检索</el-button
  30. >
  31. <el-button type="success" icon="Upload" @click="uploadMedicinePages"
  32. >提交药单</el-button
  33. >
  34. <el-divider direction="vertical"></el-divider>
  35. <el-button type="primary" icon="FirstAidKit" @click="getUsedMedicines"
  36. >药品查询</el-button
  37. >
  38. <el-button type="danger" icon="DataLine" @click="getPoisonousAnesthetics"
  39. >麻、精药品使用查询</el-button
  40. >
  41. </header>
  42. <div class="layout_main">
  43. <div id="normalMedicinePagesArea" style="position: relative">
  44. <div
  45. style="
  46. width: 100%;
  47. text-align: center;
  48. font-size: 18px;
  49. font-weight: bold;
  50. "
  51. >
  52. 医技科室领药单
  53. </div>
  54. <div style="display: flex; margin-top: 12px">
  55. <div style="width: 50%; text-align: center">
  56. 统计基准:{{ dateRange[0] }} 至 {{ dateRange[1] }}
  57. </div>
  58. <div style="width: 30%">领药科室:{{ userInfo.deptName }}</div>
  59. <div style="width: 30%">药品库房:住院药房</div>
  60. </div>
  61. <div style="position: absolute; top: 55px; left: 2%">
  62. <el-button
  63. plain
  64. type="primary"
  65. icon="Switch"
  66. circle
  67. title="反选"
  68. @click="switchCheck"
  69. ></el-button>
  70. </div>
  71. <div
  72. style="
  73. margin-top: 8px;
  74. width: 90%;
  75. margin-left: 5%;
  76. color: black;
  77. font-size: 14px;
  78. "
  79. >
  80. <div
  81. style="display: flex; width: 100%; height: 28px; overflow-y: scroll"
  82. >
  83. <div
  84. style="
  85. height: 26px;
  86. line-height: 26px;
  87. width: 10%;
  88. text-align: center;
  89. border: 1px solid #333;
  90. "
  91. >
  92. 提交标志
  93. </div>
  94. <div
  95. style="
  96. height: 26px;
  97. line-height: 26px;
  98. width: 10%;
  99. text-align: center;
  100. border: 1px solid #333;
  101. "
  102. >
  103. 药品编码
  104. </div>
  105. <div
  106. style="
  107. height: 26px;
  108. line-height: 26px;
  109. width: 30%;
  110. text-align: center;
  111. border: 1px solid #333;
  112. "
  113. >
  114. 药品名
  115. </div>
  116. <div
  117. style="
  118. height: 26px;
  119. line-height: 26px;
  120. width: 30%;
  121. text-align: center;
  122. border: 1px solid #333;
  123. "
  124. >
  125. 规格
  126. </div>
  127. <div
  128. style="
  129. height: 26px;
  130. line-height: 26px;
  131. width: 10%;
  132. text-align: center;
  133. border: 1px solid #333;
  134. "
  135. >
  136. 数量
  137. </div>
  138. <div
  139. style="
  140. height: 26px;
  141. line-height: 26px;
  142. width: 10%;
  143. text-align: center;
  144. border: 1px solid #333;
  145. "
  146. >
  147. 单价
  148. </div>
  149. <div
  150. style="
  151. height: 26px;
  152. line-height: 26px;
  153. width: 10%;
  154. text-align: center;
  155. border: 1px solid #333;
  156. "
  157. >
  158. 金额
  159. </div>
  160. </div>
  161. <div
  162. style="
  163. height: 530px;
  164. overflow-y: scroll;
  165. border-bottom: 1px solid #333;
  166. "
  167. >
  168. <div
  169. v-for="item in cptMedicines"
  170. style="display: flex; width: 100%; text-align: center"
  171. :key="item.chargeCode"
  172. >
  173. <div
  174. style="
  175. height: 26px;
  176. line-height: 26px;
  177. width: 10%;
  178. text-align: center;
  179. border: 1px solid #333;
  180. "
  181. >
  182. <input type="checkbox" v-model="item.checked" />
  183. </div>
  184. <div
  185. style="
  186. height: 26px;
  187. line-height: 26px;
  188. width: 10%;
  189. text-align: center;
  190. border: 1px solid #333;
  191. "
  192. >
  193. {{ item.chargeCode }}
  194. </div>
  195. <div
  196. style="
  197. height: 26px;
  198. line-height: 26px;
  199. width: 30%;
  200. text-align: center;
  201. border: 1px solid #333;
  202. "
  203. >
  204. {{ item.drugName }}
  205. </div>
  206. <div
  207. style="
  208. height: 26px;
  209. line-height: 26px;
  210. width: 30%;
  211. text-align: center;
  212. border: 1px solid #333;
  213. "
  214. >
  215. {{ item.spec }}
  216. </div>
  217. <div
  218. style="
  219. height: 26px;
  220. line-height: 26px;
  221. width: 10%;
  222. text-align: center;
  223. border: 1px solid #333;
  224. "
  225. >
  226. {{ item.amount }}
  227. </div>
  228. <div
  229. style="
  230. height: 26px;
  231. line-height: 26px;
  232. width: 10%;
  233. text-align: center;
  234. border: 1px solid #333;
  235. "
  236. >
  237. {{ item.price }}
  238. </div>
  239. <div
  240. style="
  241. height: 26px;
  242. line-height: 26px;
  243. width: 10%;
  244. text-align: center;
  245. border: 1px solid #333;
  246. "
  247. >
  248. {{ item.chargeFee }}
  249. </div>
  250. </div>
  251. </div>
  252. <div style="display: flex; margin-top: 10px">
  253. <div style="width: 50%">总行数:{{ cptMedicines.length }}</div>
  254. <div style="width: 50%; text-align: right">
  255. 合计金额:{{ cptTotalCharge }}
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. <el-dialog v-model="showUsedMedicines" width="820px" title="药品查询">
  263. <el-table :data="usedMedicines" stripe height="500">
  264. <el-table-column
  265. prop="chargeCode"
  266. label="药品编码"
  267. width="80"
  268. ></el-table-column>
  269. <el-table-column
  270. prop="drugName"
  271. label="药品名"
  272. width="120"
  273. ></el-table-column>
  274. <el-table-column prop="spec" label="规格" width="100"></el-table-column>
  275. <el-table-column prop="amount" label="数量" width="60"></el-table-column>
  276. <el-table-column prop="price" label="单价" width="60"></el-table-column>
  277. <el-table-column
  278. prop="chargeFee"
  279. label="金额"
  280. width="60"
  281. ></el-table-column>
  282. <el-table-column
  283. prop="patName"
  284. label="患者姓名"
  285. width="80"
  286. ></el-table-column>
  287. <el-table-column prop="patNo" label="住院号" width="80"></el-table-column>
  288. <el-table-column
  289. prop="chargeDate"
  290. label="录入时间"
  291. width="130"
  292. ></el-table-column>
  293. </el-table>
  294. </el-dialog>
  295. <div class="dialog-no-header">
  296. <el-dialog fullscreen v-model="showUsedPoisonousAnesthetics">
  297. <div style="position: fixed; top: 10px; right: 60px">
  298. <el-button
  299. type="primary"
  300. icon="Printer"
  301. @click="printUsedPoisonousAnesthetics"
  302. >打印</el-button
  303. >
  304. <el-button
  305. type="danger"
  306. icon="Close"
  307. @click="showUsedPoisonousAnesthetics = false"
  308. >关闭</el-button
  309. >
  310. </div>
  311. <div id="poisonousAnestheticsArea">
  312. <table id="jmtable" style="width: 100%; color: black">
  313. <thead>
  314. <tr>
  315. <td
  316. colspan="14"
  317. style="
  318. border: none;
  319. text-align: center;
  320. font-size: 18px;
  321. font-weight: bold;
  322. "
  323. >
  324. {{ userInfo.deptName }}精、麻药品使用登记表
  325. </td>
  326. </tr>
  327. <tr>
  328. <td colspan="7" style="border: none; text-align: left">
  329. &nbsp;&nbsp;统计基准:{{ dateRange[0] }} 至 {{ dateRange[1] }}
  330. </td>
  331. <td colspan="7" style="border: none; text-align: right">
  332. 打印日期:{{ today }}&nbsp;&nbsp;
  333. </td>
  334. </tr>
  335. <tr>
  336. <td>时间</td>
  337. <td>药品名称</td>
  338. <td>患者姓名</td>
  339. <td>性别</td>
  340. <td>身份证号</td>
  341. <td>住院号</td>
  342. <td>住院诊断</td>
  343. <td>药品规格</td>
  344. <td>数量</td>
  345. <td>实际用量</td>
  346. <td>余量处理</td>
  347. <td>发药人</td>
  348. <td>复核人</td>
  349. <td>药品批号</td>
  350. </tr>
  351. <tr>
  352. <td style="border: none"></td>
  353. </tr>
  354. </thead>
  355. <tbody v-for="(val, key) in usedPoisonousAnesthetics">
  356. <tr
  357. v-for="(item, index) in val"
  358. :key="'usedPoisonousAnesthetics-' + key + '-' + index"
  359. >
  360. <td>{{ item.chargeDate }}</td>
  361. <td>{{ item.chargeName }}</td>
  362. <td>{{ item.patName }}</td>
  363. <td>{{ item.patGender }}</td>
  364. <td>{{ item.socialNo }}</td>
  365. <td>{{ item.patNo }}</td>
  366. <td>{{ item.admdiag }}</td>
  367. <td>{{ item.spec }}</td>
  368. <td>{{ item.chargeAmount }}</td>
  369. <td></td>
  370. <td></td>
  371. <td></td>
  372. <td></td>
  373. <td>
  374. <span v-if="index === 0">
  375. <span v-if="printMode">
  376. {{ medBatchNos[key] }}
  377. </span>
  378. <input
  379. v-else
  380. type="text"
  381. v-model="medBatchNos[key]"
  382. style="border: none; text-align: center"
  383. />
  384. </span>
  385. <span v-else>{{ medBatchNos[key] }}</span>
  386. </td>
  387. </tr>
  388. <tr>
  389. <td style="border: none" colspan="8"></td>
  390. <td style="border: none; color: #0a84fd">
  391. 总计:{{ poisonousAnestheticsCounts[key] }}
  392. </td>
  393. <td style="border: none" colspan="5"></td>
  394. </tr>
  395. </tbody>
  396. </table>
  397. </div>
  398. </el-dialog>
  399. </div>
  400. </template>
  401. <script setup>
  402. import { shortcuts } from "@/data/shortcuts";
  403. import { getFormatDatetime } from "@/utils/date";
  404. import { computed } from "vue";
  405. import {
  406. fetchMedicinePages,
  407. submitMedicinePages,
  408. fetchUsedMedicines,
  409. fetchPoisonousAnesthetics,
  410. } from "@/api/medicine-management/index.js";
  411. import { ElMessage } from "element-plus";
  412. import { initLodop, getLodop } from "@/utils/c-lodop";
  413. import { useUserStore } from "@/pinia/user-store";
  414. const poisonousAnestheticsFlag = ["3", "4"];
  415. const dateRange = ref([]);
  416. const medicineType = ref("1");
  417. const cptMedicines = computed(() => {
  418. return allMedicines.value.filter(item => {
  419. if (medicineType.value === "1") {
  420. return true;
  421. }
  422. if (medicineType.value === "2") {
  423. return poisonousAnestheticsFlag.indexOf(item.drugFlag) !== -1;
  424. }
  425. return poisonousAnestheticsFlag.indexOf(item.drugFlag) === -1;
  426. });
  427. });
  428. const cptTotalCharge = computed(() => {
  429. let sum = 0;
  430. cptMedicines.value.forEach(item => {
  431. sum += item.chargeFee;
  432. });
  433. return sum;
  434. });
  435. const allMedicines = ref([]);
  436. const usedMedicines = ref([]);
  437. const showUsedMedicines = ref(false);
  438. const usedPoisonousAnesthetics = ref({});
  439. const poisonousAnestheticsCounts = ref({});
  440. const showUsedPoisonousAnesthetics = ref(false);
  441. const medBatchNos = ref({});
  442. const today = getFormatDatetime(new Date(), "YYYY-MM-DD hh:mm:ss");
  443. const formatDateRange = () => {
  444. // console.log("dateRange.value1", dateRange.value);
  445. dateRange.value[0] = getFormatDatetime(
  446. dateRange.value[0],
  447. "YYYY-MM-DD hh:mm:ss"
  448. );
  449. dateRange.value[1] = getFormatDatetime(
  450. dateRange.value[1],
  451. "YYYY-MM-DD hh:mm:ss"
  452. );
  453. // console.log("dateRange.value2", dateRange.value);
  454. };
  455. const userInfo = useUserStore().userInfo;
  456. const getMedicinePages = () => {
  457. // console.log(medicineType.value);
  458. const params = {
  459. start: dateRange.value[0],
  460. end: dateRange.value[1],
  461. dept: userInfo.deptCode,
  462. chargeCodes: medicineType.value,
  463. };
  464. // console.log("getMedicinePages", params);
  465. fetchMedicinePages(params).then(res => {
  466. allMedicines.value = res;
  467. });
  468. };
  469. const switchCheck = () => {
  470. cptMedicines.value.forEach(item => {
  471. item.checked = !item.checked;
  472. });
  473. };
  474. const uploadMedicinePages = () => {
  475. const params = {
  476. start: dateRange.value[0],
  477. end: dateRange.value[1],
  478. dept: userInfo.deptCode,
  479. chargeList: pickedCheckedItem(),
  480. };
  481. submitMedicinePages(params).then(res => {
  482. allMedicines.value = res;
  483. ElMessage({
  484. message: "提交成功",
  485. type: "success",
  486. duration: 2500,
  487. showClose: true,
  488. });
  489. });
  490. };
  491. const pickedCheckedItem = () => {
  492. let arr = [];
  493. cptMedicines.value.forEach(item => {
  494. if (item.checked) {
  495. arr.push(item);
  496. }
  497. });
  498. return arr;
  499. };
  500. const getUsedMedicines = () => {
  501. const params = {
  502. start: dateRange.value[0],
  503. end: dateRange.value[1],
  504. dept: userInfo.deptCode,
  505. };
  506. fetchUsedMedicines(params).then(res => {
  507. usedMedicines.value = res;
  508. showUsedMedicines.value = true;
  509. });
  510. };
  511. const getPoisonousAnesthetics = () => {
  512. printMode.value = false;
  513. medBatchNos.value = {};
  514. const params = {
  515. start: dateRange.value[0],
  516. end: dateRange.value[1],
  517. dept: userInfo.deptCode,
  518. };
  519. fetchPoisonousAnesthetics(params).then(res => {
  520. usedPoisonousAnesthetics.value = res.medicines;
  521. poisonousAnestheticsCounts.value = res.amounts;
  522. showUsedPoisonousAnesthetics.value = true;
  523. });
  524. };
  525. const printMode = ref(false);
  526. const printUsedPoisonousAnesthetics = () => {
  527. printMode.value = true;
  528. setTimeout(() => {
  529. const styleContent =
  530. "<style>#jmtable tr td, #jmtable tr th {border: 1px solid black;text-align: center;font-size: 12px} #jmtable {border-collapse: collapse;}</style>";
  531. const strFormHtml =
  532. styleContent +
  533. "<body>" +
  534. document.getElementById("poisonousAnestheticsArea").innerHTML +
  535. "</body>";
  536. let LODOP = getLodop();
  537. LODOP.PRINT_INIT("poisonousAnestheticsArea");
  538. LODOP.SET_PRINT_PAGESIZE(2, "210mm", "297mm", "");
  539. LODOP.SET_PRINT_MODE("RESELECT_PRINTER", true);
  540. LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT", "Full-Width");
  541. LODOP.ADD_PRINT_TABLE("2mm", "2mm", "292mm", "195mm", strFormHtml);
  542. LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1);
  543. LODOP.SET_PRINT_STYLE("ItemType", 3);
  544. LODOP.ADD_PRINT_TEXT("4mm", "267mm", "20mm", "7mm", "第#页/共&页");
  545. LODOP.PREVIEW();
  546. printMode.value = false;
  547. }, 300);
  548. };
  549. onMounted(() => {
  550. dateRange.value[0] = today;
  551. dateRange.value[1] = today;
  552. initLodop();
  553. });
  554. </script>
  555. <style scoped>
  556. :deep(.dialog-no-header .el-dialog__header) {
  557. display: none;
  558. }
  559. #jmtable tr td,
  560. #jmtable tr th {
  561. border: 1px solid black;
  562. text-align: center;
  563. font-size: 12px;
  564. }
  565. #jmtable {
  566. border-collapse: collapse;
  567. }
  568. </style>