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.

588 lines
23 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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 style="
  12. background-color: #fff;
  13. padding: 15px;
  14. border-radius: 8px;
  15. display: flex;
  16. flex-wrap: wrap;
  17. margin-bottom: 10px;
  18. height: 35px;
  19. margin-top: 7px;
  20. ">
  21. <div class="query">
  22. <span>体检单位</span>
  23. <el-input placeholder="请选择体检单位" v-model="patientRegister.query.cusOrgOCX" style="width: 300px" size="small"
  24. disabled>
  25. <el-button slot="append" icon="el-icon-search" @click="report.dialogCusOrgOCX = true"
  26. style="font-size: 20px"></el-button>
  27. </el-input>
  28. </div>
  29. <div class="query">
  30. <span>报表格式</span>
  31. <el-select v-model="format" placeholder="请选择" style="width: 80px" @change="changeValue" size="small">
  32. <el-option label="标准格式" value="0" />
  33. <el-option label="精简格式" value="1" />
  34. <el-option label="Word格式" value="2" />
  35. </el-select>
  36. </div>
  37. <div class="query">
  38. <el-button @click="btnQuery" size="small" class="commonbutton">查询</el-button>
  39. </div>
  40. <div class="query">
  41. <el-button size="small" class="commonbutton" :disabled="format == 2" @click="handleExport">导出excel</el-button>
  42. </div>
  43. <div class="query">
  44. <el-button size="small" class="commonbutton" :disabled="format == 2" @click="onPrint">打印</el-button>
  45. </div>
  46. </div>
  47. <div v-show="format == 0" ref="imageDom0">
  48. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  49. <el-table border :height="flag
  50. ? window.pageHeight < 600
  51. ? 415
  52. : window.pageHeight - 185 - 20
  53. : ''
  54. " :data="tableData" id="standardTableData" ref="standardTableData" style="width: 100%"
  55. :header-cell-class-name="headerStyle">
  56. <el-table-column :label="reportTitle">
  57. <el-table-column :label="`单位: ${customerOrgName||''} 体检次数 ${medicalTimes||''} 开始月份: ${startMonth||''} 结束月份: ${endMonth||''}`">
  58. <template slot-scope="scope">
  59. <el-table :data="scope.row.patientRegisterPositiveReports" border show-summary
  60. :summary-method="summarizeRegisterCounts" :header-cell-class-name="headerStyle">
  61. <el-table-column label="人员阳性结果清单">
  62. <el-table-column :label="startDate +
  63. '至' +
  64. endDate +
  65. '体检人员共计:' +
  66. sumMedicalNumber +
  67. '其中男:' +
  68. maleMedicalNumber +
  69. '女:' +
  70. femaleMedicalNumber +
  71. '其他:' +
  72. otherMedicalNumber
  73. ">
  74. <el-table-column prop="patientNo" label="档案号" width="120" />
  75. <el-table-column prop="patientName" label="姓名" width="120" />
  76. <el-table-column prop="sexName" label="性别" width="50" />
  77. <el-table-column prop="age" label="年龄" width="80" />
  78. <el-table-column prop="medicalTimes" label="次数" width="50" />
  79. <el-table-column prop="mobileTelephone" label="手机号码" width="120" />
  80. <el-table-column prop="diagnosisNames" label="诊断名称" />
  81. </el-table-column>
  82. </el-table-column>
  83. </el-table>
  84. <el-table :data="scope.row.positivePatientRegisterReportStandards" border
  85. :header-cell-class-name="headerStyle" style="margin-top: 15px">
  86. <el-table-column label="阳性结果人员清单">
  87. <el-table-column :label="startDate +
  88. '至' +
  89. endDate +
  90. '体检人员共计:' +
  91. sumMedicalNumber +
  92. '其中男:' +
  93. maleMedicalNumber +
  94. '女:' +
  95. femaleMedicalNumber +
  96. '其他:' +
  97. otherMedicalNumber
  98. ">
  99. <template slot-scope="scopes">
  100. <el-table :data="scopes.row.patientRegisters" border show-summary
  101. :summary-method="summarizeRegisterCounts">
  102. <el-table-column :label="scopes.row.diagnosisName">
  103. <el-table-column label="部门名称" prop="departmentName"></el-table-column>
  104. <el-table-column label="姓名" prop="patientName"></el-table-column>
  105. <el-table-column label="性别" prop="sexName"></el-table-column>
  106. <el-table-column prop="age" label="年龄">
  107. </el-table-column>
  108. <el-table-column prop="patientRegisterNo" label="条码号">
  109. </el-table-column>
  110. <el-table-column prop="patientNo" label="档案号">
  111. </el-table-column>
  112. <el-table-column prop="medicalTimes" label="体检次数">
  113. </el-table-column>
  114. <el-table-column prop="telephone" label="电话">
  115. </el-table-column>
  116. <el-table-column prop="mobileTelephone" label="手机号">
  117. </el-table-column>
  118. </el-table-column>
  119. </el-table>
  120. </template>
  121. </el-table-column>
  122. </el-table-column>
  123. </el-table>
  124. <el-table :data="scope.row.diseaseCountStatisticsReports" border :header-cell-class-name="headerStyle"
  125. show-summary :summary-method="summarizeRegisterCount" style="margin-top: 15px">
  126. <el-table-column label="疾病人数统计">
  127. <el-table-column :label="startDate +
  128. '至' +
  129. endDate +
  130. '体检人员共计:' +
  131. sumMedicalNumber +
  132. '其中男:' +
  133. maleMedicalNumber +
  134. '女:' +
  135. femaleMedicalNumber +
  136. '其他:' +
  137. otherMedicalNumber
  138. ">
  139. <el-table-column label="序号" type="index">
  140. </el-table-column>
  141. <el-table-column prop="diagnosisName" label="疾病" />
  142. <el-table-column prop="patientCount" label="人数" />
  143. <el-table-column prop="percentage" label="占总检人员百分比" />
  144. </el-table-column>
  145. </el-table-column>
  146. </el-table>
  147. </template>
  148. </el-table-column>
  149. </el-table-column>
  150. </el-table>
  151. </div>
  152. </div>
  153. <div v-show="format == 1" ref="imageDom1">
  154. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  155. <el-table border :height="flag
  156. ? window.pageHeight < 600
  157. ? 415
  158. : window.pageHeight - 185 - 20
  159. : ''
  160. " :data="reducetableData" id="reducetableData" ref="reducetableData" style="width: 100%"
  161. :header-cell-class-name="headerStyle">
  162. <el-table-column :label="reducereportTitle">
  163. <el-table-column :label="'单位' +
  164. reducecustomerOrgName +
  165. '体检次数' +
  166. reducemedicalTimes +
  167. '开始月份:' +
  168. reducestartMonth +
  169. '结束月份:' +
  170. reduceendMonth
  171. ">
  172. <template slot-scope="scope">
  173. <el-table :data="scope.row.patientRegisterPositiveReports" border show-summary
  174. :summary-method="summarizeRegisterCounts" :header-cell-class-name="headerStyle">
  175. <el-table-column label="人员阳性结果清单">
  176. <el-table-column :label="reducestartDate +
  177. '至' +
  178. reduceendDate +
  179. '体检人员共计:' +
  180. reducesumMedicalNumber +
  181. '其中男:' +
  182. reducemaleMedicalNumber +
  183. '女:' +
  184. reducefemaleMedicalNumber +
  185. '其他:' +
  186. reduceotherMedicalNumber
  187. ">
  188. <el-table-column prop="patientNo" label="档案号" width="120" />
  189. <el-table-column prop="patientName" label="姓名" width="120" />
  190. <el-table-column prop="sexName" label="性别" width="50" />
  191. <el-table-column prop="age" label="年龄" width="80" />
  192. <el-table-column prop="medicalTimes" label="次数" width="50" />
  193. <el-table-column prop="mobileTelephone" label="手机号码" width="120" />
  194. <el-table-column prop="diagnosisNames" label="诊断名称" />
  195. </el-table-column>
  196. </el-table-column>
  197. </el-table>
  198. <el-table :data="scope.row.positivePatientRegisterReportReduces" border
  199. :header-cell-class-name="headerStyle" show-summary :summary-method="summarizeRegisterCount"
  200. style="margin-top: 15px">
  201. <el-table-column label="阳性结果人员清单">
  202. <el-table-column :label="reducestartDate +
  203. '至' +
  204. reduceendDate +
  205. '体检人员共计:' +
  206. reducesumMedicalNumber +
  207. '其中男:' +
  208. reducemaleMedicalNumber +
  209. '女:' +
  210. reducefemaleMedicalNumber +
  211. '其他:' +
  212. reduceotherMedicalNumber
  213. ">
  214. <el-table-column label="序号" type="index">
  215. </el-table-column>
  216. <el-table-column prop="diagnosisName" label="诊断" />
  217. <el-table-column prop="patientCount" label="人数" />
  218. <el-table-column prop="percentage" label="占总检人员百分比" />
  219. </el-table-column>
  220. </el-table-column>
  221. </el-table>
  222. <el-table :data="scope.row.diseaseCountStatisticsReports" border :header-cell-class-name="headerStyle"
  223. show-summary :summary-method="summarizeRegisterCount" style="margin-top: 15px">
  224. <el-table-column label="疾病人数统计">
  225. <el-table-column :label="reducestartDate +
  226. '至' +
  227. reduceendDate +
  228. '体检人员共计:' +
  229. reducesumMedicalNumber +
  230. '其中男:' +
  231. reducemaleMedicalNumber +
  232. '女:' +
  233. reducefemaleMedicalNumber +
  234. '其他:' +
  235. reduceotherMedicalNumber
  236. ">
  237. <el-table-column label="序号" type="index">
  238. </el-table-column>
  239. <el-table-column prop="diagnosisName" label="疾病" />
  240. <el-table-column prop="patientCount" label="人数" />
  241. <el-table-column prop="percentage" label="占总检人员百分比" />
  242. </el-table-column>
  243. </el-table-column>
  244. </el-table>
  245. </template>
  246. </el-table-column>
  247. </el-table-column>
  248. </el-table>
  249. </div>
  250. </div>
  251. <div v-show="format == 2" ref="imageDom2">
  252. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  253. <div :style="'display: flex;justify-content: center;align-items: center;height:' +
  254. (window.pageHeight < 600 ? 415 : window.pageHeight - 185 - 20) +
  255. 'px;'
  256. ">
  257. <div v-show="reportUrl == ''">无数据</div>
  258. <a :href="reportUrl" v-show="reportUrl != ''">
  259. <el-button>下载Word报表</el-button>
  260. </a>
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. <!--通用选单位体检次数分组的控件-->
  267. <el-dialog title="体检单位选择" :visible.sync="report.dialogCusOrgOCX" :close-on-click-modal="false" width="840px"
  268. height="600px">
  269. <CusOrgOCX :useCustomerOrg="true" :initDateType="'creationTime'" :isUnit="true" />
  270. </el-dialog>
  271. </div>
  272. </template>
  273. <script>
  274. import moment from "moment";
  275. import { mapState, mapActions } from "vuex";
  276. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  277. import {
  278. dddw,
  279. objCopy,
  280. arrayReduce,
  281. arrayExistObj,
  282. tcdate,
  283. } from "@/utlis/proFunc";
  284. import CusOrgOCX from "../../components/report/CusOrgOCX.vue";
  285. import { exportToExcel } from "../../utlis/Export2Excel";
  286. import html2canvas from "html2canvas";
  287. import printJs from "print-js";
  288. export default {
  289. components: {
  290. CusOrgOCX,
  291. },
  292. data() {
  293. return {
  294. format: "0",
  295. flag: true,
  296. tableData: [],
  297. reducetableData: [],
  298. reportTitle: "",
  299. customerOrgName: "",
  300. medicalTimes: null,
  301. startMonth: "",
  302. endMonth: "",
  303. startDate: "",
  304. endDate: "",
  305. sumMedicalNumber: null,
  306. maleMedicalNumber: null,
  307. femaleMedicalNumber: null,
  308. otherMedicalNumber: null,
  309. reducereportTitle: "",
  310. reducecustomerOrgName: "",
  311. reducemedicalTimes: null,
  312. reducestartMonth: "",
  313. reduceendMonth: "",
  314. reducestartDate: "",
  315. reduceendDate: "",
  316. reducesumMedicalNumber: null,
  317. reducemaleMedicalNumber: null,
  318. reducefemaleMedicalNumber: null,
  319. reduceotherMedicalNumber: null,
  320. reportUrl: "",
  321. };
  322. },
  323. created() {
  324. // this.dictInit();
  325. },
  326. //挂载完成
  327. mounted() {
  328. // this.btnQuery();
  329. },
  330. computed: {
  331. ...mapState(["window", "dict", "patientRegister", "report"]),
  332. },
  333. methods: {
  334. btnQuery() {
  335. let body = {},
  336. customerOrgs = [];
  337. if (this.report.dataCusOrgOCX.length > 0) {
  338. this.report.dataCusOrgOCX.forEach((e) => {
  339. let rd = {
  340. startDate: moment(e.startDate).format("yyyy-MM-DD"),
  341. endDate: moment(e.endDate).format("yyyy-MM-DD"),
  342. dateType:
  343. e.dateType == "summaryDate"
  344. ? "3"
  345. : e.dateType == "medicalStartDate"
  346. ? "2"
  347. : "1",
  348. };
  349. if (e.customerOrgId) {
  350. rd.customerOrgId = e.customerOrgId;
  351. if (e.customerOrgId == this.dict.personOrgId) {
  352. rd.customerOrgRegisterId = null;
  353. rd.customerOrgGroupId = [];
  354. } else {
  355. rd.customerOrgRegisterId = e.customerOrgRegister.id;
  356. rd.customerOrgGroupId = e.customerOrgGroupIds;
  357. }
  358. }
  359. customerOrgs.push(rd);
  360. });
  361. }
  362. body.customerOrgs = customerOrgs;
  363. if (this.completeFlag) body.completeFlag = this.completeFlag;
  364. body.isAudit = this.classification;
  365. if (this.format == 0) {
  366. postapi(
  367. "/api/customerreport/getunitphysicalexaminationreportstandard",
  368. body
  369. ).then((res) => {
  370. if (res.code != -1) {
  371. this.tableData = [];
  372. this.tableData.push(res.data);
  373. this.reportTitle = res.data.reportTitle;
  374. this.customerOrgName = res.data.customerOrgName;
  375. this.medicalTimes = res.data.medicalTimes;
  376. this.startMonth = res.data.startMonth;
  377. this.endMonth = res.data.endMonth;
  378. this.startDate = res.data.startDate;
  379. this.endDate = res.data.endDate;
  380. this.sumMedicalNumber = res.data.sumMedicalNumber;
  381. this.maleMedicalNumber = res.data.maleMedicalNumber;
  382. this.femaleMedicalNumber = res.data.femaleMedicalNumber;
  383. this.otherMedicalNumber = res.data.otherMedicalNumber;
  384. }
  385. });
  386. } else if (this.format == 1) {
  387. postapi(
  388. "/api/customerreport/getunitphysicalexaminationreportreduce",
  389. body
  390. ).then((res) => {
  391. if (res.code != -1) {
  392. this.reducetableData = [];
  393. this.reducetableData.push(res.data);
  394. this.reducereportTitle = res.data.reportTitle;
  395. this.reducecustomerOrgName = res.data.customerOrgName;
  396. this.reducemedicalTimes = res.data.medicalTimes;
  397. this.reducestartMonth = res.data.startMonth;
  398. this.reduceendMonth = res.data.endMonth;
  399. this.reducestartDate = res.data.startDate;
  400. this.reduceendDate = res.data.endDate;
  401. this.reducesumMedicalNumber = res.data.sumMedicalNumber;
  402. this.reducemaleMedicalNumber = res.data.maleMedicalNumber;
  403. this.reducefemaleMedicalNumber = res.data.femaleMedicalNumber;
  404. this.reduceotherMedicalNumber = res.data.otherMedicalNumber;
  405. }
  406. });
  407. } else {
  408. postapi(
  409. "/api/customerreport/getunitphysicalexaminationreportexportword",
  410. body
  411. ).then((res) => {
  412. if (res.code != -1) {
  413. const sysConfig = JSON.parse(window.sessionStorage.getItem('sysConfig'))
  414. this.reportUrl = sysConfig.apiurl + res.data.reportUrl;
  415. }
  416. });
  417. }
  418. },
  419. summarizeRegisterCounts(param) {
  420. const { columns, data } = param;
  421. const sums = [];
  422. columns.forEach((column, index) => {
  423. if (index === 0) {
  424. sums[index] = "合计";
  425. return;
  426. }
  427. if (index === 1) {
  428. sums[index] = data.length + "人";
  429. return;
  430. }
  431. });
  432. return sums;
  433. },
  434. summarizeRegisterCount(param) {
  435. const { columns, data } = param;
  436. const sums = [];
  437. columns.forEach((column, index) => {
  438. if (index === 0) {
  439. sums[index] = "合计";
  440. return;
  441. }
  442. const values = data.map((item) => Number(item[column.property]));
  443. if (index === 2) {
  444. sums[index] = values.reduce((prev, curr) => {
  445. const value = Number(curr);
  446. if (!isNaN(value)) {
  447. return prev + curr;
  448. } else {
  449. return prev;
  450. }
  451. }, 0);
  452. sums[index] += " 人";
  453. }
  454. });
  455. return sums;
  456. },
  457. headerStyle({ row, column, rowIndex, columnIndex }) {
  458. if (rowIndex === 1) {
  459. return "left-align";
  460. }
  461. },
  462. changeValue(value) {
  463. if (value == 0) {
  464. this.$nextTick(() => {
  465. this.$refs.standardTableData.doLayout();
  466. });
  467. } else if (value == 1) {
  468. this.$nextTick(() => {
  469. this.$refs.reducetableData.doLayout();
  470. });
  471. }
  472. },
  473. handleExport() {
  474. if (this.format == 0) {
  475. let name = "北京神豚软件开发有限公司体检报告";
  476. if (this.reportTitle != "") {
  477. name = this.reportTitle;
  478. }
  479. let index = 3;
  480. let list = [];
  481. list.push(index);
  482. index += this.tableData[0].patientRegisterPositiveReports.length + 7;
  483. list.push(index);
  484. for (
  485. let i = 0;
  486. i <
  487. this.tableData[0].positivePatientRegisterReportStandards.length - 1;
  488. i++
  489. ) {
  490. index +=
  491. this.tableData[0].positivePatientRegisterReportStandards[i]
  492. .patientRegisters.length + 4;
  493. list.push(index);
  494. }
  495. exportToExcel("#standardTableData", name, true, list);
  496. } else if (this.format == 1) {
  497. let name = "北京神豚软件开发有限公司体检报告";
  498. if (this.reducereportTitle != "") {
  499. name = this.reducereportTitle;
  500. }
  501. let index = 3;
  502. let list = [];
  503. list.push(index);
  504. exportToExcel("#reducetableData", name, true, list);
  505. }
  506. },
  507. onPrint() {
  508. this.flag = false;
  509. let index = "";
  510. if (this.format == 0) {
  511. index = "imageDom0";
  512. } else if (this.format == 1) {
  513. index = "imageDom1";
  514. } else {
  515. index = "imageDom2";
  516. }
  517. this.$nextTick(() => {
  518. let width = this.$refs[index].style.width;
  519. let cloneDom = this.$refs[index].cloneNode(true);
  520. let imageDom = this.$refs[index];
  521. cloneDom.style.position = "absolute";
  522. cloneDom.style.top = "0px";
  523. cloneDom.style.zIndex = "-1";
  524. cloneDom.style.width = width;
  525. imageDom.appendChild(cloneDom);
  526. html2canvas(cloneDom).then((canvas) => {
  527. // 转成图片,生成图片地址
  528. const url = canvas.toDataURL("image/png");
  529. printJs({
  530. printable: url,
  531. type: "image",
  532. documentTitle: "", // 标题
  533. style: `@media print { @page {size: auto; margin: 0 0 0 0; } body{margin:0 5px}canvas{page-break-after: always;page-break-inside: avoid;
  534. page-break-after: avoid;
  535. page-break-before: avoid;}}`, // 去除页眉页脚
  536. });
  537. });
  538. cloneDom.style.display = "none";
  539. this.flag = true;
  540. });
  541. },
  542. },
  543. };
  544. </script>
  545. <style scoped>
  546. @import "../../assets/css/global_button.css";
  547. @import "../../assets/css/global_dialog.css";
  548. @import "../../assets/css/global_table.css";
  549. @import "../../assets/css/global_form.css";
  550. @import "../../assets/css/global_input.css";
  551. @import "../../assets/css/global.css";
  552. .query {
  553. margin-right: 15px;
  554. display: flex;
  555. justify-content: center;
  556. align-items: center;
  557. font-size: 14px;
  558. color: #232748;
  559. font-size: 400;
  560. font-family: "NotoSansSC-Regular";
  561. }
  562. .box {
  563. display: flex;
  564. flex-direction: column;
  565. }
  566. ::v-deep .el-table__header-wrapper th.backcolor {
  567. background-color: #f5f7fa;
  568. }
  569. :deep .left-align .cell {
  570. text-align: left !important;
  571. }
  572. </style>