You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

771 lines
27 KiB

2 years ago
  1. <template>
  2. <div class="box">
  3. <div>
  4. <div class="middlebox">
  5. <div class="contenttitle">
  6. 客户报表 /
  7. <span class="contenttitleBold">单位体检报表</span>
  8. </div>
  9. </div>
  10. <div :style="'display: block;'">
  11. <div
  12. style="
  13. background-color: #fff;
  14. padding: 15px;
  15. border-radius: 8px;
  16. display: flex;
  17. flex-wrap: wrap;
  18. margin-bottom: 10px;
  19. height: 35px;
  20. margin-top: 7px;
  21. "
  22. >
  23. <div class="query">
  24. <span>体检单位</span>
  25. <el-input
  26. placeholder="请选择体检单位"
  27. v-model="patientRegister.query.cusOrgOCX"
  28. style="width: 300px"
  29. size="small"
  30. disabled
  31. >
  32. <el-button
  33. slot="append"
  34. icon="el-icon-search"
  35. @click="report.dialogCusOrgOCX = true"
  36. style="font-size: 20px"
  37. ></el-button>
  38. </el-input>
  39. </div>
  40. <div class="query">
  41. <span>报表格式</span>
  42. <el-select
  43. v-model="format"
  44. placeholder="请选择"
  45. clearable
  46. style="width: 80px"
  47. size="small"
  48. >
  49. <el-option label="标准格式" value="0" />
  50. <el-option label="精简格式" value="1" />
  51. <el-option label="Word格式" value="2" />
  52. </el-select>
  53. </div>
  54. <div class="query">
  55. <el-button @click="btnQuery" size="small" class="commonbutton"
  56. >查询</el-button
  57. >
  58. </div>
  59. <div class="query">
  60. <el-button
  61. size="small"
  62. class="commonbutton"
  63. :disabled="format == 2"
  64. @click="handleExport"
  65. >导出excel</el-button
  66. >
  67. </div>
  68. <div class="query">
  69. <el-button
  70. size="small"
  71. class="commonbutton"
  72. :disabled="format == 2"
  73. @click="onPrint"
  74. >打印</el-button
  75. >
  76. </div>
  77. </div>
  78. <div v-show="format == 0" ref="imageDom0">
  79. <div
  80. style="background-color: #fff; padding: 15px; border-radius: 8px"
  81. >
  82. <el-table
  83. border
  84. :height="
  85. flag
  86. ? window.pageHeight < 600
  87. ? 415
  88. : window.pageHeight - 185 - 20
  89. : ''
  90. "
  91. :data="tableData"
  92. id="standardTableData"
  93. ref="standardTableData"
  94. style="width: 100%"
  95. :header-cell-class-name="headerStyle"
  96. >
  97. <el-table-column :label="reportTitle">
  98. <el-table-column
  99. :label="
  100. '单位:' +
  101. customerOrgName +
  102. '体检次数' +
  103. medicalTimes +
  104. '开始月份:' +
  105. startMonth +
  106. '结束月份:' +
  107. endMonth
  108. "
  109. >
  110. <template slot-scope="scope">
  111. <el-table
  112. :data="scope.row.patientRegisterPositiveReports"
  113. border
  114. show-summary
  115. :summary-method="summarizeRegisterCounts"
  116. :header-cell-class-name="headerStyle"
  117. >
  118. <el-table-column label="人员阳性结果清单">
  119. <el-table-column
  120. :label="
  121. startDate +
  122. '至' +
  123. endDate +
  124. '体检人员共计:' +
  125. sumMedicalNumber +
  126. '其中男:' +
  127. maleMedicalNumber +
  128. '女:' +
  129. femaleMedicalNumber +
  130. '其他:' +
  131. otherMedicalNumber
  132. "
  133. >
  134. <el-table-column
  135. prop="patientNo"
  136. label="档案号"
  137. width="120"
  138. />
  139. <el-table-column
  140. prop="patientName"
  141. label="姓名"
  142. width="120"
  143. />
  144. <el-table-column
  145. prop="sexName"
  146. label="性别"
  147. width="50"
  148. />
  149. <el-table-column prop="age" label="年龄" width="80" />
  150. <el-table-column
  151. prop="medicalTimes"
  152. label="次数"
  153. width="50"
  154. />
  155. <el-table-column
  156. prop="mobileTelephone"
  157. label="手机号码"
  158. width="120"
  159. />
  160. <el-table-column
  161. prop="diagnosisNames"
  162. label="诊断名称"
  163. />
  164. </el-table-column>
  165. </el-table-column>
  166. </el-table>
  167. <el-table
  168. :data="scope.row.positivePatientRegisterReportStandards"
  169. border
  170. :header-cell-class-name="headerStyle"
  171. style="margin-top: 15px"
  172. >
  173. <el-table-column label="阳性结果人员清单">
  174. <el-table-column
  175. :label="
  176. startDate +
  177. '至' +
  178. endDate +
  179. '体检人员共计:' +
  180. sumMedicalNumber +
  181. '其中男:' +
  182. maleMedicalNumber +
  183. '女:' +
  184. femaleMedicalNumber +
  185. '其他:' +
  186. otherMedicalNumber
  187. "
  188. >
  189. <template slot-scope="scopes">
  190. <el-table
  191. :data="scopes.row.patientRegisters"
  192. border
  193. show-summary
  194. :summary-method="summarizeRegisterCounts"
  195. >
  196. <el-table-column
  197. :label="scopes.row.diagnosisName"
  198. >
  199. <el-table-column
  200. label="部门名称"
  201. prop="departmentName"
  202. ></el-table-column>
  203. <el-table-column
  204. label="姓名"
  205. prop="patientName"
  206. ></el-table-column>
  207. <el-table-column
  208. label="性别"
  209. prop="sexName"
  210. ></el-table-column>
  211. <el-table-column prop="age" label="年龄">
  212. </el-table-column>
  213. <el-table-column
  214. prop="patientRegisterNo"
  215. label="条码号"
  216. >
  217. </el-table-column>
  218. <el-table-column
  219. prop="patientNo"
  220. label="档案号"
  221. >
  222. </el-table-column>
  223. <el-table-column
  224. prop="medicalTimes"
  225. label="体检次数"
  226. >
  227. </el-table-column>
  228. <el-table-column prop="telephone" label="电话">
  229. </el-table-column>
  230. <el-table-column
  231. prop="mobileTelephone"
  232. label="手机号"
  233. >
  234. </el-table-column>
  235. </el-table-column>
  236. </el-table>
  237. </template>
  238. </el-table-column>
  239. </el-table-column>
  240. </el-table>
  241. <el-table
  242. :data="scope.row.diseaseCountStatisticsReports"
  243. border
  244. :header-cell-class-name="headerStyle"
  245. show-summary
  246. :summary-method="summarizeRegisterCount"
  247. style="margin-top: 15px"
  248. >
  249. <el-table-column label="疾病人数统计">
  250. <el-table-column
  251. :label="
  252. startDate +
  253. '至' +
  254. endDate +
  255. '体检人员共计:' +
  256. sumMedicalNumber +
  257. '其中男:' +
  258. maleMedicalNumber +
  259. '女:' +
  260. femaleMedicalNumber +
  261. '其他:' +
  262. otherMedicalNumber
  263. "
  264. >
  265. <el-table-column label="序号" type="index">
  266. </el-table-column>
  267. <el-table-column prop="diagnosisName" label="疾病" />
  268. <el-table-column prop="patientCount" label="人数" />
  269. <el-table-column
  270. prop="percentage"
  271. label="占总检人员百分比"
  272. />
  273. </el-table-column>
  274. </el-table-column>
  275. </el-table>
  276. </template>
  277. </el-table-column>
  278. </el-table-column>
  279. </el-table>
  280. </div>
  281. </div>
  282. <div v-show="format == 1" ref="imageDom1">
  283. <div
  284. style="background-color: #fff; padding: 15px; border-radius: 8px"
  285. >
  286. <el-table
  287. border
  288. :height="
  289. flag
  290. ? window.pageHeight < 600
  291. ? 415
  292. : window.pageHeight - 185 - 20
  293. : ''
  294. "
  295. :data="reducetableData"
  296. id="reducetableData"
  297. ref="reducetableData"
  298. style="width: 100%"
  299. :header-cell-class-name="headerStyle"
  300. >
  301. <el-table-column :label="reducereportTitle">
  302. <el-table-column
  303. :label="
  304. '单位:' +
  305. reducecustomerOrgName +
  306. '体检次数' +
  307. reducemedicalTimes +
  308. '开始月份:' +
  309. reducestartMonth +
  310. '结束月份:' +
  311. reduceendMonth
  312. "
  313. >
  314. <template slot-scope="scope">
  315. <el-table
  316. :data="scope.row.patientRegisterPositiveReports"
  317. border
  318. show-summary
  319. :summary-method="summarizeRegisterCounts"
  320. :header-cell-class-name="headerStyle"
  321. >
  322. <el-table-column label="人员阳性结果清单">
  323. <el-table-column
  324. :label="
  325. reducestartDate +
  326. '至' +
  327. reduceendDate +
  328. '体检人员共计:' +
  329. reducesumMedicalNumber +
  330. '其中男:' +
  331. reducemaleMedicalNumber +
  332. '女:' +
  333. reducefemaleMedicalNumber +
  334. '其他:' +
  335. reduceotherMedicalNumber
  336. "
  337. >
  338. <el-table-column
  339. prop="patientNo"
  340. label="档案号"
  341. width="120"
  342. />
  343. <el-table-column
  344. prop="patientName"
  345. label="姓名"
  346. width="120"
  347. />
  348. <el-table-column
  349. prop="sexName"
  350. label="性别"
  351. width="50"
  352. />
  353. <el-table-column prop="age" label="年龄" width="80" />
  354. <el-table-column
  355. prop="medicalTimes"
  356. label="次数"
  357. width="50"
  358. />
  359. <el-table-column
  360. prop="mobileTelephone"
  361. label="手机号码"
  362. width="120"
  363. />
  364. <el-table-column
  365. prop="diagnosisNames"
  366. label="诊断名称"
  367. />
  368. </el-table-column>
  369. </el-table-column>
  370. </el-table>
  371. <el-table
  372. :data="scope.row.positivePatientRegisterReportReduces"
  373. border
  374. :header-cell-class-name="headerStyle"
  375. show-summary
  376. :summary-method="summarizeRegisterCount"
  377. style="margin-top: 15px"
  378. >
  379. <el-table-column label="阳性结果人员清单">
  380. <el-table-column
  381. :label="
  382. reducestartDate +
  383. '至' +
  384. reduceendDate +
  385. '体检人员共计:' +
  386. reducesumMedicalNumber +
  387. '其中男:' +
  388. reducemaleMedicalNumber +
  389. '女:' +
  390. reducefemaleMedicalNumber +
  391. '其他:' +
  392. reduceotherMedicalNumber
  393. "
  394. >
  395. <el-table-column label="序号" type="index">
  396. </el-table-column>
  397. <el-table-column prop="diagnosisName" label="诊断" />
  398. <el-table-column prop="patientCount" label="人数" />
  399. <el-table-column
  400. prop="percentage"
  401. label="占总检人员百分比"
  402. />
  403. </el-table-column>
  404. </el-table-column>
  405. </el-table>
  406. <el-table
  407. :data="scope.row.diseaseCountStatisticsReports"
  408. border
  409. :header-cell-class-name="headerStyle"
  410. show-summary
  411. :summary-method="summarizeRegisterCount"
  412. style="margin-top: 15px"
  413. >
  414. <el-table-column label="疾病人数统计">
  415. <el-table-column
  416. :label="
  417. reducestartDate +
  418. '至' +
  419. reduceendDate +
  420. '体检人员共计:' +
  421. reducesumMedicalNumber +
  422. '其中男:' +
  423. reducemaleMedicalNumber +
  424. '女:' +
  425. reducefemaleMedicalNumber +
  426. '其他:' +
  427. reduceotherMedicalNumber
  428. "
  429. >
  430. <el-table-column label="序号" type="index">
  431. </el-table-column>
  432. <el-table-column prop="diagnosisName" label="疾病" />
  433. <el-table-column prop="patientCount" label="人数" />
  434. <el-table-column
  435. prop="percentage"
  436. label="占总检人员百分比"
  437. />
  438. </el-table-column>
  439. </el-table-column>
  440. </el-table>
  441. </template>
  442. </el-table-column>
  443. </el-table-column>
  444. </el-table>
  445. </div>
  446. </div>
  447. <div v-show="format == 2" ref="imageDom2">
  448. <div
  449. style="background-color: #fff; padding: 15px; border-radius: 8px"
  450. ></div>
  451. </div>
  452. </div>
  453. </div>
  454. <!--通用选单位体检次数分组的控件-->
  455. <el-dialog
  456. title="体检单位选择"
  457. :visible.sync="report.dialogCusOrgOCX"
  458. :close-on-click-modal="false"
  459. width="840px"
  460. height="600px"
  461. >
  462. <CusOrgOCX />
  463. </el-dialog>
  464. </div>
  465. </template>
  466. <script>
  467. import moment from "moment";
  468. import { mapState, mapActions } from "vuex";
  469. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  470. import {
  471. dddw,
  472. objCopy,
  473. arrayReduce,
  474. arrayExistObj,
  475. tcdate,
  476. } from "@/utlis/proFunc";
  477. import CusOrgOCX from "../../components/report/CusOrgOCX.vue";
  478. import { exportToExcel } from "../../utlis/Export2Excel";
  479. import html2canvas from "html2canvas";
  480. import printJs from "print-js";
  481. export default {
  482. components: {
  483. CusOrgOCX,
  484. },
  485. data() {
  486. return {
  487. format: "0",
  488. flag: true,
  489. tableData: [],
  490. reducetableData: [],
  491. reportTitle: "",
  492. customerOrgName: "",
  493. medicalTimes: null,
  494. startMonth: "",
  495. endMonth: "",
  496. startDate: "",
  497. endDate: "",
  498. sumMedicalNumber: null,
  499. maleMedicalNumber: null,
  500. femaleMedicalNumber: null,
  501. otherMedicalNumber: null,
  502. reducereportTitle: "",
  503. reducecustomerOrgName: "",
  504. reducemedicalTimes: null,
  505. reducestartMonth: "",
  506. reduceendMonth: "",
  507. reducestartDate: "",
  508. reduceendDate: "",
  509. reducesumMedicalNumber: null,
  510. reducemaleMedicalNumber: null,
  511. reducefemaleMedicalNumber: null,
  512. reduceotherMedicalNumber: null,
  513. };
  514. },
  515. created() {
  516. // this.dictInit();
  517. },
  518. //挂载完成
  519. mounted() {
  520. // this.btnQuery();
  521. },
  522. computed: {
  523. ...mapState(["window", "dict", "patientRegister", "report"]),
  524. },
  525. methods: {
  526. btnQuery() {
  527. let body = {},
  528. customerOrgs = [];
  529. if (this.report.dataCusOrgOCX.length > 0) {
  530. this.report.dataCusOrgOCX.forEach((e) => {
  531. let rd = {
  532. startDate: moment(e.startDate).format("yyyy-MM-DD"),
  533. endDate: moment(e.endDate).format("yyyy-MM-DD"),
  534. dateType:
  535. e.dateType == "summaryDate"
  536. ? "3"
  537. : e.dateType == "medicalStartDate"
  538. ? "2"
  539. : "1",
  540. };
  541. if (e.customerOrgId) {
  542. rd.customerOrgId = e.customerOrgId;
  543. if (e.customerOrgId == this.dict.personOrgId) {
  544. rd.customerOrgRegisterId = null;
  545. rd.customerOrgGroupId = [];
  546. } else {
  547. rd.customerOrgRegisterId = e.customerOrgRegister.id;
  548. rd.customerOrgGroupId = e.customerOrgGroupIds;
  549. }
  550. }
  551. customerOrgs.push(rd);
  552. });
  553. }
  554. body.customerOrgs = customerOrgs;
  555. if (this.completeFlag) body.completeFlag = this.completeFlag;
  556. body.isAudit = this.classification;
  557. if (this.format == 0) {
  558. postapi(
  559. "/api/customerreport/getunitphysicalexaminationreportstandard",
  560. body
  561. ).then((res) => {
  562. if (res.code != -1) {
  563. this.tableData = [];
  564. this.tableData.push(res.data);
  565. this.reportTitle = res.data.reportTitle;
  566. this.customerOrgName = res.data.customerOrgName;
  567. this.medicalTimes = res.data.medicalTimes;
  568. this.startMonth = res.data.startMonth;
  569. this.endMonth = res.data.endMonth;
  570. this.startDate = res.data.startDate;
  571. this.endDate = res.data.endDate;
  572. this.sumMedicalNumber = res.data.sumMedicalNumber;
  573. this.maleMedicalNumber = res.data.maleMedicalNumber;
  574. this.femaleMedicalNumber = res.data.femaleMedicalNumber;
  575. this.otherMedicalNumber = res.data.otherMedicalNumber;
  576. }
  577. });
  578. } else if (this.format == 1) {
  579. postapi(
  580. "/api/customerreport/getunitphysicalexaminationreportreduce",
  581. body
  582. ).then((res) => {
  583. if (res.code != -1) {
  584. this.reducetableData = [];
  585. this.reducetableData.push(res.data);
  586. this.reducereportTitle = res.data.reportTitle;
  587. this.reducecustomerOrgName = res.data.customerOrgName;
  588. this.reducemedicalTimes = res.data.medicalTimes;
  589. this.reducestartMonth = res.data.startMonth;
  590. this.reduceendMonth = res.data.endMonth;
  591. this.reducestartDate = res.data.startDate;
  592. this.reduceendDate = res.data.endDate;
  593. this.reducesumMedicalNumber = res.data.sumMedicalNumber;
  594. this.reducemaleMedicalNumber = res.data.maleMedicalNumber;
  595. this.reducefemaleMedicalNumber = res.data.femaleMedicalNumber;
  596. this.reduceotherMedicalNumber = res.data.otherMedicalNumber;
  597. }
  598. });
  599. }
  600. },
  601. summarizeRegisterCounts(param) {
  602. const { columns, data } = param;
  603. const sums = [];
  604. columns.forEach((column, index) => {
  605. if (index === 0) {
  606. sums[index] = "合计";
  607. return;
  608. }
  609. if (index === 1) {
  610. sums[index] = data.length + "人";
  611. return;
  612. }
  613. });
  614. return sums;
  615. },
  616. summarizeRegisterCount(param) {
  617. const { columns, data } = param;
  618. const sums = [];
  619. columns.forEach((column, index) => {
  620. if (index === 0) {
  621. sums[index] = "合计";
  622. return;
  623. }
  624. const values = data.map((item) => Number(item[column.property]));
  625. if(index===2){
  626. sums[index] = values.reduce((prev, curr) => {
  627. const value = Number(curr);
  628. if (!isNaN(value)) {
  629. return prev + curr;
  630. } else {
  631. return prev;
  632. }
  633. }, 0);
  634. sums[index] += " 人";
  635. }
  636. });
  637. return sums;
  638. },
  639. headerStyle({ row, column, rowIndex, columnIndex }) {
  640. if (rowIndex === 1) {
  641. return "left-align";
  642. }
  643. },
  644. handleExport() {
  645. if (this.format == 0) {
  646. let index = 3;
  647. let list = [];
  648. list.push(index);
  649. index += this.tableData[0].patientRegisterPositiveReports.length + 7;
  650. list.push(index);
  651. for (
  652. let i = 0;
  653. i <
  654. this.tableData[0].positivePatientRegisterReportStandards.length - 1;
  655. i++
  656. ) {
  657. index +=
  658. this.tableData[0].positivePatientRegisterReportStandards[i]
  659. .patientRegisters.length + 4;
  660. list.push(index);
  661. }
  662. exportToExcel(
  663. "#standardTableData",
  664. "收费员支付方式统计报表",
  665. true,
  666. list
  667. );
  668. } else if (this.format == 1) {
  669. let index = 4;
  670. let list = [];
  671. list.push(index);
  672. // for (let i = 0; i < this.tableData.length - 1; i++) {
  673. // index += this.tableData[i].children.length + 3;
  674. // list.push(index);
  675. // }
  676. exportToExcel("#tableData", "收费员发票类型统计报表", true, list);
  677. } else {
  678. let index = 3;
  679. let list = [];
  680. list.push(index);
  681. for (let i = 0; i < this.projectTableData.length - 1; i++) {
  682. index += this.projectTableData[i].details.length + 4;
  683. list.push(index);
  684. }
  685. exportToExcel(
  686. "#projectTableData",
  687. "收费员组合项目统计报表",
  688. true,
  689. list
  690. );
  691. }
  692. },
  693. onPrint() {
  694. this.flag = false;
  695. let index = "";
  696. if (this.format == 0) {
  697. index = "imageDom0";
  698. } else if (this.format == 1) {
  699. index = "imageDom1";
  700. } else {
  701. index = "imageDom2";
  702. }
  703. this.$nextTick(() => {
  704. let width = this.$refs[index].style.width;
  705. let cloneDom = this.$refs[index].cloneNode(true);
  706. let imageDom = this.$refs[index];
  707. cloneDom.style.position = "absolute";
  708. cloneDom.style.top = "0px";
  709. cloneDom.style.zIndex = "-1";
  710. cloneDom.style.width = width;
  711. console.log(cloneDom);
  712. imageDom.appendChild(cloneDom);
  713. html2canvas(cloneDom).then((canvas) => {
  714. // 转成图片,生成图片地址
  715. const url = canvas.toDataURL("image/png");
  716. printJs({
  717. printable: url,
  718. type: "image",
  719. documentTitle: "", // 标题
  720. style: `@media print { @page {size: auto; margin: 0 0 0 0; } body{margin:0 5px}canvas{page-break-after: always;page-break-inside: avoid;
  721. page-break-after: avoid;
  722. page-break-before: avoid;}}`, // 去除页眉页脚
  723. });
  724. });
  725. cloneDom.style.display = "none";
  726. this.flag = true;
  727. });
  728. },
  729. },
  730. };
  731. </script>
  732. <style scoped>
  733. @import "../../assets/css/global_button.css";
  734. @import "../../assets/css/global_dialog.css";
  735. @import "../../assets/css/global_table.css";
  736. @import "../../assets/css/global_form.css";
  737. @import "../../assets/css/global_input.css";
  738. @import "../../assets/css/global.css";
  739. .query {
  740. margin-right: 15px;
  741. display: flex;
  742. justify-content: center;
  743. align-items: center;
  744. font-size: 14px;
  745. color: #232748;
  746. font-size: 400;
  747. font-family: "NotoSansSC-Regular";
  748. }
  749. .box {
  750. display: flex;
  751. flex-direction: column;
  752. }
  753. ::v-deep .el-table__header-wrapper th.backcolor {
  754. background-color: #f5f7fa;
  755. }
  756. :deep .left-align .cell {
  757. text-align: left !important;
  758. }
  759. </style>