MedicinePageSubmit.vue 17 KB

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