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.

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