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.

610 lines
23 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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-select>
  35. </div>
  36. <div class="query">
  37. <el-button @click="btnQuery(true)" size="small" class="commonbutton">预览</el-button>
  38. <el-button @click="btnQuery(false)" size="small" class="commonbutton">打印</el-button>
  39. </div>
  40. <!--
  41. <div class="query">
  42. <el-button size="small" class="commonbutton" :disabled="format == 2" @click="handleExport">导出excel</el-button>
  43. </div>
  44. <div class="query">
  45. <el-button size="small" class="commonbutton" :disabled="format == 2" @click="onPrint">打印</el-button>
  46. </div>
  47. -->
  48. </div>
  49. <div v-show="format == 3" ref="imageDom0">
  50. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  51. <el-table border :height="flag
  52. ? window.pageHeight < 600
  53. ? 415
  54. : window.pageHeight - 185 - 20
  55. : ''
  56. " :data="tableData" id="standardTableData" ref="standardTableData" style="width: 100%"
  57. :header-cell-class-name="headerStyle">
  58. <el-table-column :label="reportTitle">
  59. <el-table-column
  60. :label="`单位: ${customerOrgName || ''} 体检次数 ${medicalTimes || ''} 开始月份: ${startMonth || ''} 结束月份: ${endMonth || ''}`">
  61. <template slot-scope="scope">
  62. <el-table :data="scope.row.patientRegisterPositiveReports" border show-summary
  63. :summary-method="summarizeRegisterCounts" :header-cell-class-name="headerStyle">
  64. <el-table-column label="人员阳性结果清单">
  65. <el-table-column :label="`${startDate || ''}
  66. ${endDate || ''}
  67. 体检人员共计
  68. ${sumMedicalNumber || ''}
  69. 其中男
  70. ${maleMedicalNumber || ''}
  71. ${femaleMedicalNumber || ''}
  72. 其他
  73. ${otherMedicalNumber || ''}
  74. `">
  75. <el-table-column prop="patientNo" label="档案号" width="120" />
  76. <el-table-column prop="patientName" label="姓名" width="120" />
  77. <el-table-column prop="sexName" label="性别" width="50" />
  78. <el-table-column prop="age" label="年龄" width="80" />
  79. <el-table-column prop="medicalTimes" label="次数" width="50" />
  80. <el-table-column prop="mobileTelephone" label="手机号码" width="120" />
  81. <el-table-column prop="diagnosisNames" label="诊断名称" />
  82. </el-table-column>
  83. </el-table-column>
  84. </el-table>
  85. <el-table :data="scope.row.positivePatientRegisterReportStandards" border
  86. :header-cell-class-name="headerStyle" style="margin-top: 15px">
  87. <el-table-column label="阳性结果人员清单">
  88. <el-table-column :label="`${startDate || ''}
  89. ${endDate || ''}
  90. 体检人员共计
  91. ${sumMedicalNumber || ''}
  92. 其中男
  93. ${maleMedicalNumber || ''}
  94. ${femaleMedicalNumber || ''}
  95. 其他
  96. ${otherMedicalNumber || ''}
  97. `">
  98. <template slot-scope="scopes">
  99. <el-table :data="scopes.row.patientRegisters" border show-summary
  100. :summary-method="summarizeRegisterCounts">
  101. <el-table-column :label="scopes.row.diagnosisName">
  102. <el-table-column label="部门名称" prop="departmentName"></el-table-column>
  103. <el-table-column label="姓名" prop="patientName"></el-table-column>
  104. <el-table-column label="性别" prop="sexName"></el-table-column>
  105. <el-table-column prop="age" label="年龄">
  106. </el-table-column>
  107. <el-table-column prop="patientRegisterNo" label="条码号">
  108. </el-table-column>
  109. <el-table-column prop="patientNo" label="档案号">
  110. </el-table-column>
  111. <el-table-column prop="medicalTimes" label="体检次数">
  112. </el-table-column>
  113. <el-table-column prop="telephone" label="电话">
  114. </el-table-column>
  115. <el-table-column prop="mobileTelephone" label="手机号">
  116. </el-table-column>
  117. </el-table-column>
  118. </el-table>
  119. </template>
  120. </el-table-column>
  121. </el-table-column>
  122. </el-table>
  123. <el-table :data="scope.row.diseaseCountStatisticsReports" border
  124. :header-cell-class-name="headerStyle" show-summary :summary-method="summarizeRegisterCount"
  125. style="margin-top: 15px">
  126. <el-table-column label="疾病人数统计">
  127. <el-table-column :label="`${startDate || ''}
  128. ${endDate || ''}
  129. 体检人员共计
  130. ${sumMedicalNumber || ''}
  131. 其中男
  132. ${maleMedicalNumber || ''}
  133. ${femaleMedicalNumber || ''}
  134. 其他
  135. ${otherMedicalNumber || ''}
  136. `">
  137. <el-table-column label="序号" type="index">
  138. </el-table-column>
  139. <el-table-column prop="diagnosisName" label="疾病" />
  140. <el-table-column prop="patientCount" label="人数" />
  141. <el-table-column prop="percentage" label="占总检人员百分比" />
  142. </el-table-column>
  143. </el-table-column>
  144. </el-table>
  145. </template>
  146. </el-table-column>
  147. </el-table-column>
  148. </el-table>
  149. </div>
  150. </div>
  151. <div v-show="format == 4" ref="imageDom1">
  152. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  153. <el-table border :height="flag
  154. ? window.pageHeight < 600
  155. ? 415
  156. : window.pageHeight - 185 - 20
  157. : ''
  158. " :data="reducetableData" id="reducetableData" ref="reducetableData" style="width: 100%"
  159. :header-cell-class-name="headerStyle">
  160. <el-table-column :label="reducereportTitle">
  161. <el-table-column
  162. :label="`单位: ${customerOrgName || ''} 体检次数 ${medicalTimes || ''} 开始月份: ${startMonth || ''} 结束月份: ${endMonth || ''}`">
  163. <template slot-scope="scope">
  164. <el-table :data="scope.row.patientRegisterPositiveReports" border show-summary
  165. :summary-method="summarizeRegisterCounts" :header-cell-class-name="headerStyle">
  166. <el-table-column label="人员阳性结果清单">
  167. <el-table-column :label="`${reducestartDate || ''}
  168. ${reduceendDate || ''}
  169. 体检人员共计
  170. ${reducesumMedicalNumber || ''}
  171. 其中男
  172. ${reducemaleMedicalNumber || ''}
  173. ${reducefemaleMedicalNumber || ''}
  174. 其他
  175. ${reduceotherMedicalNumber || ''}
  176. `">
  177. <el-table-column prop="patientNo" label="档案号" width="120" />
  178. <el-table-column prop="patientName" label="姓名" width="120" />
  179. <el-table-column prop="sexName" label="性别" width="50" />
  180. <el-table-column prop="age" label="年龄" width="80" />
  181. <el-table-column prop="medicalTimes" label="次数" width="50" />
  182. <el-table-column prop="mobileTelephone" label="手机号码" width="120" />
  183. <el-table-column prop="diagnosisNames" label="诊断名称" />
  184. </el-table-column>
  185. </el-table-column>
  186. </el-table>
  187. <el-table :data="scope.row.positivePatientRegisterReportReduces" border
  188. :header-cell-class-name="headerStyle" show-summary :summary-method="summarizeRegisterCount"
  189. style="margin-top: 15px">
  190. <el-table-column label="阳性结果人员清单">
  191. <el-table-column :label="`${reducestartDate || ''}
  192. ${reduceendDate || ''}
  193. 体检人员共计
  194. ${reducesumMedicalNumber || ''}
  195. 其中男
  196. ${reducemaleMedicalNumber || ''}
  197. ${reducefemaleMedicalNumber || ''}
  198. 其他
  199. ${reduceotherMedicalNumber || ''}
  200. `">
  201. <el-table-column label="序号" type="index">
  202. </el-table-column>
  203. <el-table-column prop="diagnosisName" label="诊断" />
  204. <el-table-column prop="patientCount" label="人数" />
  205. <el-table-column prop="percentage" label="占总检人员百分比" />
  206. </el-table-column>
  207. </el-table-column>
  208. </el-table>
  209. <el-table :data="scope.row.diseaseCountStatisticsReports" border
  210. :header-cell-class-name="headerStyle" show-summary :summary-method="summarizeRegisterCount"
  211. style="margin-top: 15px">
  212. <el-table-column label="疾病人数统计">
  213. <el-table-column :label="`${reducestartDate || ''}
  214. ${reduceendDate || ''}
  215. 体检人员共计
  216. ${reducesumMedicalNumber || ''}
  217. 其中男
  218. ${reducemaleMedicalNumber || ''}
  219. ${reducefemaleMedicalNumber || ''}
  220. 其他
  221. ${reduceotherMedicalNumber || ''}
  222. `">
  223. <el-table-column label="序号" type="index">
  224. </el-table-column>
  225. <el-table-column prop="diagnosisName" label="疾病" />
  226. <el-table-column prop="patientCount" label="人数" />
  227. <el-table-column prop="percentage" label="占总检人员百分比" />
  228. </el-table-column>
  229. </el-table-column>
  230. </el-table>
  231. </template>
  232. </el-table-column>
  233. </el-table-column>
  234. </el-table>
  235. </div>
  236. </div>
  237. <div v-show="format == 0 || format == 1" ref="imageDom2">
  238. <div style="background-color: #fff; padding: 15px; border-radius: 8px">
  239. <div :style="'display: flex;justify-content: center;align-items: center;height:' +
  240. (window.pageHeight < 600 ? 415 : window.pageHeight - 185 - 20) +
  241. 'px;'
  242. ">
  243. <div v-show="reportUrl == ''">无数据</div>
  244. <a :href="reportUrl" v-show="reportUrl != ''">
  245. <el-button>下载Word报表</el-button>
  246. </a>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <!--通用选单位体检次数分组的控件-->
  253. <el-dialog title="体检单位选择" :visible.sync="report.dialogCusOrgOCX" :close-on-click-modal="false" width="880px"
  254. height="600px">
  255. <CusOrgOCX :useCustomerOrg="true" :initDateType="'creationTime'" :isUnit="true" />
  256. </el-dialog>
  257. </div>
  258. </template>
  259. <script>
  260. import moment from "moment";
  261. import { mapState, mapActions } from "vuex";
  262. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  263. import {
  264. dddw,
  265. objCopy,
  266. arrayReduce,
  267. arrayExistObj,
  268. tcdate,
  269. } from "@/utlis/proFunc";
  270. import CusOrgOCX from "../../components/report/CusOrgOCX.vue";
  271. import { exportToExcel } from "../../utlis/Export2Excel";
  272. import html2canvas from "html2canvas";
  273. import printJs from "print-js";
  274. export default {
  275. components: {
  276. CusOrgOCX,
  277. },
  278. data() {
  279. return {
  280. format: "0",
  281. flag: true,
  282. tableData: [],
  283. reducetableData: [],
  284. reportTitle: "",
  285. customerOrgName: "",
  286. medicalTimes: null,
  287. startMonth: "",
  288. endMonth: "",
  289. startDate: "",
  290. endDate: "",
  291. sumMedicalNumber: null,
  292. maleMedicalNumber: null,
  293. femaleMedicalNumber: null,
  294. otherMedicalNumber: null,
  295. reducereportTitle: "",
  296. reducecustomerOrgName: "",
  297. reducemedicalTimes: null,
  298. reducestartMonth: "",
  299. reduceendMonth: "",
  300. reducestartDate: "",
  301. reduceendDate: "",
  302. reducesumMedicalNumber: null,
  303. reducemaleMedicalNumber: null,
  304. reducefemaleMedicalNumber: null,
  305. reduceotherMedicalNumber: null,
  306. reportUrl: "",
  307. };
  308. },
  309. created() {
  310. // this.dictInit();
  311. },
  312. //挂载完成
  313. mounted() {
  314. // this.btnQuery();
  315. },
  316. computed: {
  317. ...mapState(["window", "dict", "patientRegister", "report"]),
  318. },
  319. methods: {
  320. btnQuery(isPreview) {
  321. let customerOrgs = [];
  322. if (this.report.dataCusOrgOCX.length > 0) {
  323. this.report.dataCusOrgOCX.forEach((e) => {
  324. let rd = {
  325. startDate: moment(e.startDate).format("yyyy-MM-DD"),
  326. endDate: moment(e.endDate).format("yyyy-MM-DD"),
  327. dateType:
  328. e.dateType == "summaryDate"
  329. ? "3"
  330. : e.dateType == "medicalStartDate"
  331. ? "2"
  332. : "1",
  333. };
  334. if (e.customerOrgId) {
  335. rd.customerOrgId = e.customerOrgId;
  336. if (e.customerOrgId == this.dict.personOrgId) {
  337. rd.customerOrgRegisterId = null;
  338. rd.customerOrgGroupId = [];
  339. } else {
  340. rd.customerOrgRegisterId = e.customerOrgRegister.id;
  341. rd.customerOrgGroupId = e.customerOrgGroupIds;
  342. }
  343. }
  344. customerOrgs.push(rd);
  345. });
  346. }
  347. if (customerOrgs.length == 0) {
  348. this.$message.warning({ showClose: true, message: "请选择单位" })
  349. return
  350. }
  351. if (!this.$peisAPI) {
  352. this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" })
  353. return
  354. }
  355. //暂时未区分格式
  356. // if (this.format == 0)
  357. let ReportCode = this.format == 0 ? '0009':'0010';
  358. let token = window.sessionStorage.getItem('token');
  359. let user = window.sessionStorage.getItem('user');
  360. let toOutShell = {
  361. ReportCode,
  362. token,
  363. isBuildImage: 'N',
  364. IsUploadPdf: 'N',
  365. preViewCanPrint: "Y",
  366. Parameters: [
  367. { Name: "printer", Value: user },
  368. { Name: "hisLog", Value: "pic/hisLog.jpg" },
  369. { Name: 'pageFooter', Value: 'pic/peisQrCode.jpg' },
  370. { Name: "picExtOne", Value: "pic/occGrant.jpg" },
  371. ],
  372. BusinessCode:JSON.stringify(customerOrgs)
  373. };
  374. console.log('toOutShell', toOutShell)
  375. if (isPreview) {
  376. this.$peisAPI.printPre(JSON.stringify(toOutShell))
  377. .then(res => {
  378. let lres = JSON.parse(res)
  379. if (lres.code < 0) {
  380. this.$message.error({ showClose: true, message: lres.message })
  381. }
  382. })
  383. .catch((err) => {
  384. this.$message.error({ showClose: true, message: err })
  385. });
  386. } else {
  387. this.$peisAPI.print(JSON.stringify(toOutShell))
  388. .then(res => {
  389. let lres = JSON.parse(res)
  390. if (lres.code < 0) {
  391. this.$message.error({ showClose: true, message: lres.message })
  392. }
  393. })
  394. .catch((err) => {
  395. this.$message.error({ showClose: true, message: err })
  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>