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.

573 lines
18 KiB

2 years ago
  1. <template>
  2. <div>
  3. <el-card>
  4. <div slot="header">组合项目检查状态</div>
  5. <div :style="'display: block; width:' + (window.pageWidth - 45) + 'px;'">
  6. <div style="display: flex; flex-wrap: wrap; height: 35px">
  7. <div class="query">
  8. <span>体检单位</span>
  9. <el-input
  10. placeholder="请选择体检单位"
  11. v-model="patientRegister.query.cusOrgOCX"
  12. style="width: 300px"
  13. size="small"
  14. disabled
  15. >
  16. <el-button
  17. slot="append"
  18. icon="el-icon-search"
  19. @click="report.dialogCusOrgOCX = true"
  20. style="font-size: 20px"
  21. ></el-button>
  22. </el-input>
  23. </div>
  24. <div class="query">
  25. <span>组合项目</span>
  26. <el-input
  27. placeholder="请选择组合项目"
  28. v-model="patientRegister.query.asbitemOCX"
  29. style="width: 240px"
  30. size="small"
  31. disabled
  32. >
  33. <el-button
  34. slot="append"
  35. icon="el-icon-search"
  36. @click="report.dialogAsbitemOCX = true"
  37. style="font-size: 20px"
  38. ></el-button>
  39. </el-input>
  40. </div>
  41. <!-- <div class="query">
  42. <span>检查状态</span>
  43. <el-select
  44. v-model="patientRegister.query.checkCompleteFlag"
  45. placeholder="请选择"
  46. clearable
  47. style="width: 80px"
  48. size="small"
  49. >
  50. <el-option
  51. v-for="item in dict.checkCompleteFlag"
  52. :key="item.id"
  53. :label="item.displayName"
  54. :value="item.id"
  55. >
  56. </el-option>
  57. </el-select>
  58. </div> -->
  59. <div class="query">
  60. <el-button @click="btnQuery" size="small"
  61. >查询</el-button
  62. >
  63. </div>
  64. <div class="query">
  65. <el-button @click="handleExport" size="small">导出excel</el-button>
  66. </div>
  67. <div class="query">
  68. <el-button @click="onPrint" size="small">打印</el-button>
  69. </div>
  70. </div>
  71. <div ref="imageDom">
  72. <el-table
  73. :data="dataList"
  74. border
  75. :height="window.pageHeight < 600 ? 415 : window.pageHeight - 185"
  76. row-key="id"
  77. highlight-current-row
  78. ref="dataList"
  79. :row-class-name="tableRowClassName"
  80. id="table"
  81. >
  82. <el-table-column prop="patientName" label="姓名"></el-table-column>
  83. <el-table-column prop="sexName" label="性别"></el-table-column>
  84. <el-table-column prop="age" label="年龄"></el-table-column>
  85. <el-table-column
  86. prop="medicalTimes"
  87. label="体检次数"
  88. ></el-table-column>
  89. <el-table-column
  90. v-for="(item, index) in columnData"
  91. :key="index"
  92. :prop="item.prop"
  93. :label="item.lable"
  94. align="left"
  95. >
  96. </el-table-column>
  97. </el-table>
  98. </div>
  99. </div>
  100. </el-card>
  101. <!--通用选单位体检次数分组的控件-->
  102. <el-dialog
  103. title="体检单位选择"
  104. :visible.sync="report.dialogCusOrgOCX"
  105. :close-on-click-modal="false"
  106. width="840px"
  107. height="600px"
  108. >
  109. <CusOrgOCX />
  110. </el-dialog>
  111. <!--通用选组合项目的控件-->
  112. <el-dialog
  113. title="组合项目选择"
  114. :visible.sync="report.dialogAsbitemOCX"
  115. :close-on-click-modal="false"
  116. width="700px"
  117. height="600px"
  118. >
  119. <AsbitemOCX />
  120. </el-dialog>
  121. </div>
  122. </template>
  123. <script>
  124. import moment from "moment";
  125. import { mapState, mapActions } from "vuex";
  126. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  127. import {
  128. dddw,
  129. objCopy,
  130. arrayReduce,
  131. arrayExistObj,
  132. tcdate,
  133. } from "@/utlis/proFunc";
  134. import CusOrgOCX from "../../components/report/CusOrgOCX.vue";
  135. import AsbitemOCX from "../../components/report/AsbitemOCX.vue";
  136. import { exportToExcel } from "../../utlis/Export2Excel";
  137. import html2canvas from "html2canvas";
  138. import printJs from "print-js";
  139. export default {
  140. components: {
  141. CusOrgOCX,
  142. AsbitemOCX,
  143. },
  144. data() {
  145. return {
  146. dataList: [], //列表数据
  147. columnData: [],
  148. flag: true,
  149. };
  150. },
  151. created() {
  152. this.dictInit();
  153. },
  154. //挂载完成
  155. mounted() {
  156. // this.btnQuery();
  157. },
  158. computed: {
  159. ...mapState(["window", "dict", "patientRegister", "report"]),
  160. },
  161. methods: {
  162. moment,
  163. dddw,
  164. //数据初始化
  165. dictInit() {
  166. //性别
  167. // getapi("/api/app/sex").then((res) => {
  168. // if (res.code == 1) {
  169. // this.dict.sex = res.data;
  170. // }
  171. // });
  172. //体检中心
  173. getapi("/api/app/organization-units/organization-unit-by-is-peis").then(
  174. (res) => {
  175. if (res.code == 1) {
  176. this.dict.organization = res.data;
  177. }
  178. }
  179. );
  180. //体检单位树
  181. getapi("/api/app/customerorg/getbycodeall").then((res) => {
  182. if (res.code == 1) {
  183. this.patientRegister.customerOrgTreeAll = res.data;
  184. tcdate(this.patientRegister.customerOrgTreeAll);
  185. }
  186. });
  187. // //体检类别
  188. getapi("/api/app/medical-type/in-filter").then((res) => {
  189. if (res.code == 1) {
  190. this.dict.medicalType = res.data.items;
  191. }
  192. });
  193. // //人员类别
  194. // getapi("/api/app/personnel-type/in-filter").then((res) => {
  195. // if (res.code == 1) {
  196. // this.dict.personnelType = res.data.items;
  197. // }
  198. // });
  199. // //婚姻状况
  200. // getapi("/api/app/marital-statuses").then((res) => {
  201. // if (res.code == 1) {
  202. // this.dict.maritalStatus = res.data.items;
  203. // }
  204. // });
  205. // //性激素期
  206. // getapi("/api/app/sex-hormone-term/in-filter").then((res) => {
  207. // if (res.code == 1) {
  208. // this.dict.sexHormoneTerm = res.data.items;
  209. // }
  210. // });
  211. // //民族
  212. // getapi("/api/app/nation/in-filter").then((res) => {
  213. // if (res.code == 1) {
  214. // this.dict.nation = res.data.items;
  215. // }
  216. // });
  217. // //籍惯 ,出生地
  218. // getapi("/api/app/birth-place/in-filter").then((res) => {
  219. // if (res.code == 1) {
  220. // this.dict.birthPlace = res.data.items;
  221. // }
  222. // });
  223. // //套餐
  224. // postapi("/api/app/medicalpackage/getmedicalpackagelist", {}).then(
  225. // (res) => {
  226. // if (res.code == 1) {
  227. // this.dict.medicalPackage = res.data;
  228. // }
  229. // }
  230. // );
  231. // //分组,所有分组,不限单位,不限次数
  232. // getapi("/api/app/customer-org-group").then((res) => {
  233. // if (res.code == 1) {
  234. // this.dict.customerOrgGroupAll = res.data.items;
  235. // }
  236. // });
  237. // //支付方式
  238. // getapi("/api/app/pay-mode").then((res) => {
  239. // if (res.code == 1) {
  240. // this.dict.payMode = res.data;
  241. // }
  242. // });
  243. // //体检类别 树结构
  244. getapi("/api/app/item-type/by-code-all").then((res) => {
  245. if (res.code == 1) {
  246. this.dict.itemTypeTree = res.data;
  247. tcdate(this.dict.itemTypeTree);
  248. }
  249. });
  250. // postapi("/api/app/asbitem/getasbitemlist", {}).then((res) => {
  251. // if (res.code == 1) {
  252. // this.dict.asbItemAll = res.data;
  253. // }
  254. // });
  255. console.log("dict", this.dict);
  256. },
  257. tableRowClassName({ row, rowIndex }) {
  258. switch (row.completeFlag) {
  259. case "0":
  260. return "danger";
  261. case "2":
  262. return "info";
  263. default:
  264. return "";
  265. }
  266. },
  267. onPrint() {
  268. this.flag = false;
  269. this.$nextTick(() => {
  270. let width = this.$refs.imageDom.style.width;
  271. let cloneDom = this.$refs.imageDom.cloneNode(true);
  272. let imageDom = this.$refs.imageDom;
  273. cloneDom.style.position = "absolute";
  274. cloneDom.style.top = "0px";
  275. cloneDom.style.zIndex = "-1";
  276. cloneDom.style.width = width;
  277. console.log(cloneDom);
  278. imageDom.appendChild(cloneDom);
  279. html2canvas(cloneDom).then((canvas) => {
  280. // 转成图片,生成图片地址
  281. const url = canvas.toDataURL("image/png");
  282. printJs({
  283. printable: url,
  284. type: "image",
  285. documentTitle: "", // 标题
  286. style: "@page{size:auto;margin: 0cm 1cm 0cm 1cm;}", // 去除页眉页脚
  287. });
  288. });
  289. cloneDom.style.display = "none";
  290. this.flag = true;
  291. });
  292. },
  293. handleExport() {
  294. exportToExcel("#table", "组合项目结果明细", false);
  295. },
  296. //查询
  297. btnQuery() {
  298. let body = {},
  299. customerOrgs = [],
  300. asbitemIds = [];
  301. // {
  302. // "customerOrgs": [
  303. // {
  304. // "customerOrgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  305. // "customerOrgRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  306. // "customerOrgGroupId": [
  307. // "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  308. // ],
  309. // "dateType": "string",
  310. // "startDate": "string",
  311. // "endDate": "string"
  312. // }
  313. // ],
  314. // "asbitemIds": [
  315. // "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  316. // ],
  317. // "completeFlag": "string"
  318. // }
  319. if (this.report.dataCusOrgOCX.length > 0) {
  320. this.report.dataCusOrgOCX.forEach((e) => {
  321. let rd = {
  322. startDate: moment(e.startDate).format("yyyy-MM-DD"),
  323. endDate: moment(e.endDate).format("yyyy-MM-DD"),
  324. dateType:
  325. e.dateType == "summaryDate"
  326. ? "3"
  327. : e.dateType == "medicalStartDate"
  328. ? "2"
  329. : "1",
  330. };
  331. if (e.customerOrgId) {
  332. rd.customerOrgId = e.customerOrgId;
  333. if (e.customerOrgId == this.dict.personOrgId) {
  334. rd.customerOrgRegisterId = null;
  335. rd.customerOrgGroupId = [];
  336. } else {
  337. rd.customerOrgRegisterId = e.customerOrgRegister.id;
  338. rd.customerOrgGroupId = e.customerOrgGroupIds;
  339. }
  340. }
  341. customerOrgs.push(rd);
  342. });
  343. }
  344. if (this.report.dataAsbitemOCX.length > 0) {
  345. this.report.dataAsbitemOCX.forEach((e) => {
  346. asbitemIds.push(e.id);
  347. });
  348. }
  349. body.customerOrgs = customerOrgs;
  350. body.asbitemId = asbitemIds;
  351. // if (this.patientRegister.query.checkCompleteFlag)
  352. // body.completeFlag = this.patientRegister.query.checkCompleteFlag;
  353. //console.log('/api/app/peisreport/getpatientregisterreport',body)
  354. postapi("/api/customerreport/getasbitemspecificresultreport", body).then(
  355. (res) => {
  356. if (res.code != -1) {
  357. let bodys= res.data
  358. // let bodys = [
  359. // {
  360. // medicalTimes: 0,
  361. // patientName: "小王",
  362. // sexName: "string",
  363. // age: 0,
  364. // registerChecks: [
  365. // {
  366. // registerCheckId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  367. // checkName: "血常规",
  368. // registerCheckItems: [
  369. // {
  370. // itemName: "血型",
  371. // result: "O",
  372. // },
  373. // {
  374. // itemName: "ct",
  375. // result: "良好",
  376. // },
  377. // ],
  378. // registerCheckSummarys: "血常规优秀",
  379. // },
  380. // {
  381. // registerCheckId: "3fa85f64-5717-4562-b3fc-2c963f66afa5",
  382. // checkName: "乙肝三项",
  383. // registerCheckItems: [
  384. // {
  385. // itemName: "乙肝",
  386. // result: "A",
  387. // },
  388. // {
  389. // itemName: "血液",
  390. // result: "B",
  391. // },
  392. // {
  393. // itemName: "ct",
  394. // result: "C",
  395. // },
  396. // ],
  397. // registerCheckSummarys: "乙肝三项良好",
  398. // },
  399. // ],
  400. // },
  401. // {
  402. // medicalTimes: 0,
  403. // patientName: "小李",
  404. // sexName: "string",
  405. // age: 0,
  406. // registerChecks: [
  407. // {
  408. // registerCheckId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  409. // checkName: "血常规",
  410. // registerCheckItems: [
  411. // {
  412. // itemName: "血型",
  413. // result: "A",
  414. // },
  415. // {
  416. // itemName: "ct",
  417. // result: "危险",
  418. // },
  419. // {
  420. // itemName: "核磁",
  421. // result: "有",
  422. // },
  423. // ],
  424. // registerCheckSummarys: "血常规危险",
  425. // },
  426. // {
  427. // registerCheckId: "3fa85f64-5717-4562-b3fc-2c963f66afa5",
  428. // checkName: "乙肝三项",
  429. // registerCheckItems: [
  430. // {
  431. // itemName: "乙肝",
  432. // result: "B",
  433. // },
  434. // {
  435. // itemName: "血液",
  436. // result: "A",
  437. // },
  438. // ],
  439. // registerCheckSummarys: "乙肝三项危险",
  440. // },
  441. // {
  442. // registerCheckId: "3fa85f64-5717-4562-b3fc-2c963f66afa4",
  443. // checkName: "血型鉴侧",
  444. // registerCheckItems: [
  445. // {
  446. // itemName: "a实验",
  447. // result: "7",
  448. // },
  449. // {
  450. // itemName: "b实验",
  451. // result: "8",
  452. // },
  453. // ],
  454. // registerCheckSummarys: "乙肝三项危险",
  455. // },
  456. // ],
  457. // },
  458. // ];
  459. let that = this;
  460. let template = {
  461. prop: "",
  462. lable: "",
  463. };
  464. for (let i = 0; i < bodys.length; i++) {
  465. for (let k = 0; k < bodys[i].registerChecks.length; k++) {
  466. for (
  467. let j = 0;
  468. j < bodys[i].registerChecks[k].registerCheckItems.length;
  469. j++
  470. ) {
  471. let templatess = JSON.parse(JSON.stringify(template));
  472. templatess.prop =
  473. // bodys[i].registerChecks[k].registerCheckId +
  474. bodys[i].registerChecks[k].checkName +
  475. bodys[i].registerChecks[k].registerCheckItems[j].itemName;
  476. templatess.lable =
  477. bodys[i].registerChecks[k].checkName +'/'+
  478. bodys[i].registerChecks[k].registerCheckItems[j].itemName;
  479. that.columnData.push(templatess);
  480. this.$set(
  481. bodys[i],
  482. // bodys[i].registerChecks[k].registerCheckId +
  483. bodys[i].registerChecks[k].checkName +
  484. bodys[i].registerChecks[k].registerCheckItems[j].itemName,
  485. bodys[i].registerChecks[k].registerCheckItems[j].result
  486. );
  487. }
  488. // if(bodys[i].registerChecks[k].registerCheckSummarys!=''&&bodys[i].registerChecks[k].registerCheckSummarys!=null){
  489. let templates = JSON.parse(JSON.stringify(template));
  490. templates.prop =
  491. // bodys[i].registerChecks[k].registerCheckId +
  492. bodys[i].registerChecks[k].checkName +
  493. "小结";
  494. templates.lable = bodys[i].registerChecks[k].checkName+'/' + "小结";
  495. that.columnData.push(templates);
  496. this.$set(
  497. bodys[i],
  498. // bodys[i].registerChecks[k].registerCheckId +
  499. bodys[i].registerChecks[k].checkName +
  500. "小结",
  501. bodys[i].registerChecks[k].registerCheckSummarys
  502. );
  503. // }
  504. }
  505. }
  506. this.$nextTick(()=>{
  507. this.$refs.dataList.doLayout()
  508. })
  509. let map = new Map();
  510. let qc = this.columnData.filter(
  511. (key) => !map.has(key.prop) && map.set(key.prop, 1)
  512. );
  513. qc.sort(function (a, b) {
  514. return a.lable < b.lable ? -1 : 1; //根据名称属性进行排序
  515. })
  516. this.columnData = qc;
  517. this.dataList = bodys;
  518. }
  519. }
  520. );
  521. },
  522. },
  523. //监听事件
  524. watch: {
  525. //触发查询事件
  526. // "patientRegister.query.times"(newVal, oldVal) {
  527. // if (newVal != oldVal) {
  528. // //alert('触发查询事件')
  529. // this.query();
  530. // }
  531. // },
  532. },
  533. };
  534. </script>
  535. <style scoped>
  536. @import "../../assets/css/global_button.css";
  537. @import "../../assets/css/global_card.css";
  538. @import "../../assets/css/global_input.css";
  539. @import "../../assets/css/global_table.css";
  540. @import "../../assets/css/global.css";
  541. .query {
  542. margin-left: 10px;
  543. }
  544. </style>