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.

439 lines
12 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
  1. <template>
  2. <div class="box">
  3. <div>
  4. <div class="middlebox">
  5. <div class="contenttitle">
  6. 工作量统计 /
  7. <span class="contenttitleBold"
  8. >总检医生工作量统计</span
  9. >
  10. </div>
  11. </div>
  12. <div :style="'display: block;'">
  13. <div style="background-color: #fff; padding: 15px; border-radius: 8px;display: flex;flex-wrap: wrap; margin-bottom: 10px;height:35px;margin-top: 7px;">
  14. <div class="query">
  15. <span>医生</span>
  16. <el-select
  17. v-model="username"
  18. placeholder="请选择"
  19. size="small"
  20. multiple
  21. filterable
  22. :multiple-limit=2
  23. >
  24. <el-option
  25. v-for="item in registrardata"
  26. :key="item.id"
  27. :label="item.surname"
  28. :value="item.id"
  29. >
  30. </el-option>
  31. </el-select>
  32. </div>
  33. <div class="query">
  34. <span>开始日期</span>
  35. <el-date-picker
  36. type="date"
  37. placeholder="选择开始日期"
  38. size="small"
  39. v-model="startDate"
  40. value-format="yyyy-MM-dd"
  41. editable
  42. style="width: 177px;"
  43. >
  44. </el-date-picker>
  45. </div>
  46. <div class="query">
  47. <span>结束日期</span>
  48. <el-date-picker
  49. type="date"
  50. placeholder="选择结束日期"
  51. size="small"
  52. v-model="endDate"
  53. value-format="yyyy-MM-dd"
  54. editable
  55. style="width: 177px;"
  56. >
  57. </el-date-picker>
  58. </div>
  59. <div class="query">
  60. <el-button size="small" @click="onSubmit" class="commonbutton">查询</el-button>
  61. </div>
  62. <div class="query">
  63. <el-button size="small" @click="handleExport" class="commonbutton">导出excel</el-button>
  64. </div>
  65. <div class="query">
  66. <el-button size="small" @click="onPrint" class="commonbutton">打印</el-button>
  67. </div>
  68. <div class="query">
  69. <el-button size="small" @click="columnarChart" class="commonbutton">柱状图</el-button>
  70. </div>
  71. <div class="query">
  72. <el-button size="small" @click="peiChart" class="commonbutton">饼图</el-button>
  73. </div>
  74. </div>
  75. <div
  76. style="
  77. display: flex;
  78. justify-content: space-between;
  79. position: relative;
  80. "
  81. id="domTable"
  82. >
  83. <div style="width: 47.7%;background-color: #fff; padding: 15px; border-radius: 8px;" ref="imageDom">
  84. <!-- <h3 align="center">登记员工作量统计</h3>
  85. - 53-18
  86. <h5 align="right" style="margin-bottom: 5px;">
  87. 时间<span>{{ startDate }}</span
  88. ><span>{{ endDate }}</span>
  89. </h5> -->
  90. <el-table
  91. border
  92. show-summary
  93. :summary-method="summarizeRegisterCount"
  94. :height="
  95. flag
  96. ? window.pageHeight < 600
  97. ? 415
  98. : window.pageHeight - 185- 20
  99. : ''
  100. "
  101. :data="tableData"
  102. id="table"
  103. ref="table"
  104. style="width: 100%"
  105. :header-cell-class-name="headerStyle"
  106. >
  107. <el-table-column label="总检医生工作量统计">
  108. <el-table-column :label="'时间:'+startDate+'至'+endDate">
  109. <el-table-column prop="sumCheckDoctorName" label="医生"></el-table-column>
  110. <el-table-column prop="sumCheckCount" label="人数"></el-table-column>
  111. <el-table-column prop="percentage" label="占总检总人数百分比">
  112. </el-table-column>
  113. </el-table-column>
  114. </el-table-column>
  115. </el-table>
  116. </div>
  117. <div
  118. :style="
  119. 'width: 47.7%;overflow: hidden;height:' +
  120. (window.pageHeight < 600 ? 415 : window.pageHeight - 185 - 20) +
  121. 'px;background-color: #fff; padding: 15px; border-radius: 8px;'
  122. "
  123. >
  124. <div style=" font-size: 20px;
  125. font-weight: 700;
  126. color: #232748;
  127. font-family: 'NotoSansSC-Bold';
  128. text-align: center;">总检医生工作量统计</div>
  129. <div :style="
  130. 'height:' +(window.pageHeight < 600 ? 387 : window.pageHeight - 185 - 48) +'px;'
  131. ">
  132. <ChartBlock ref="chart2"></ChartBlock>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import { mapState, mapActions } from "vuex";
  142. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  143. import ChartBlock from "../../components/workload/chartsBlock";
  144. import { exportToExcel } from "../../utlis/Export2Excel";
  145. import html2canvas from "html2canvas";
  146. import printJs from "print-js";
  147. export default {
  148. components: {
  149. ChartBlock,
  150. },
  151. data() {
  152. return {
  153. registrardata: [],
  154. username: [],
  155. startDate: "",
  156. endDate: "",
  157. tableData: [],
  158. seriesData: [],
  159. yAxisData: [],
  160. flag: true,
  161. pieData: [],
  162. pages: {
  163. SkipCount: 0,
  164. MaxResultCount: 1000,
  165. },
  166. };
  167. },
  168. created() {
  169. this.getList();
  170. },
  171. mounted() {
  172. this.getNowTime();
  173. },
  174. methods: {
  175. columnarChart() {
  176. let option2 = {
  177. // title: {
  178. // text: "总检医生工作量统计",
  179. // left: "center",
  180. // },
  181. tooltip: {
  182. trigger: "axis",
  183. confine: true,
  184. },
  185. legend: {
  186. type: "scroll",
  187. orient: "horizontal", // 垂直
  188. right: "3%", // 左对齐
  189. top: "0%", // 位于顶部
  190. },
  191. grid: {
  192. show: false,
  193. left: "0%",
  194. right: "0%",
  195. top: "0%",
  196. bottom: "0%",
  197. containLabel: true,
  198. },
  199. xAxis: {
  200. type: "value",
  201. axisLabel: {
  202. textStyle: {
  203. fontSize: "14",
  204. },
  205. },
  206. axisLine: {
  207. show: true,
  208. },
  209. },
  210. yAxis: {
  211. type: "category",
  212. data: this.yAxisData,
  213. axisLabel: {
  214. textStyle: {
  215. fontSize: "14",
  216. },
  217. },
  218. },
  219. series: [
  220. {
  221. name: "人数",
  222. type: "bar",
  223. data: this.seriesData,
  224. },
  225. ],
  226. };
  227. this.$refs.chart2.setOption(option2);
  228. },
  229. peiChart() {
  230. let option2 = {
  231. // title: {
  232. // text: "总检医生工作量统计",
  233. // left: "center",
  234. // },
  235. tooltip: {
  236. trigger: "item",
  237. confine: true,
  238. },
  239. legend: {
  240. data: this.yAxisData,
  241. orient: "horizontal",
  242. right: "3%",
  243. top: "0%",
  244. },
  245. grid: {
  246. show: false,
  247. left: "0%",
  248. right: "0%",
  249. top: "0%",
  250. bottom: "0%",
  251. containLabel: true,
  252. },
  253. series: [
  254. {
  255. type: "pie",
  256. label: {
  257. show: true,
  258. formatter: "{b} : {c}人 ({d}%)", // b代表名称,c代表对应值,d代表百分比
  259. },
  260. data: this.pieData,
  261. },
  262. ],
  263. };
  264. this.$refs.chart2.setOption(option2);
  265. },
  266. headerStyle({ row, column, rowIndex, columnIndex }) {
  267. if(rowIndex===1){
  268. return 'left-align'
  269. }
  270. },
  271. summarizeRegisterCount(param){
  272. const { columns, data } = param;
  273. const sums = [];
  274. columns.forEach((column, index) => {
  275. if (index === 0) {
  276. sums[index] = '合计';
  277. return;
  278. }
  279. const values = data.map(item => Number(item[column.property]));
  280. if (index===1) {
  281. sums[index] = values.reduce((prev, curr) => {
  282. const value = Number(curr);
  283. if (!isNaN(value)) {
  284. return prev + curr;
  285. } else {
  286. return prev;
  287. }
  288. }, 0);
  289. sums[index] = '共'+sums[index]+'人';
  290. } else {
  291. sums[index] = '';
  292. }
  293. });
  294. return sums;
  295. },
  296. onPrint() {
  297. this.flag = false;
  298. this.$nextTick(() => {
  299. let width = this.$refs.imageDom.style.width;
  300. let cloneDom = this.$refs.imageDom.cloneNode(true);
  301. let imageDom = this.$refs.imageDom;
  302. cloneDom.style.position = "absolute";
  303. cloneDom.style.top = "0px";
  304. cloneDom.style.zIndex = "-1";
  305. cloneDom.style.width = width;
  306. imageDom.appendChild(cloneDom);
  307. html2canvas(cloneDom).then((canvas) => {
  308. // 转成图片,生成图片地址
  309. const url = canvas.toDataURL("image/png");
  310. printJs({
  311. printable: url,
  312. type: "image",
  313. documentTitle: "", // 标题
  314. style: "@page{size:auto;margin: 0cm 1cm 0cm 1cm;}", // 去除页眉页脚
  315. });
  316. });
  317. cloneDom.style.display = "none";
  318. this.flag = true;
  319. });
  320. },
  321. onSubmit() {
  322. let that = this;
  323. if (this.startDate == "") {
  324. return this.$message({
  325. message: "请先选择开始日期",
  326. type: "error",
  327. });
  328. }
  329. if (this.endDate == "") {
  330. return this.$message({
  331. message: "请先选择结束日期",
  332. type: "error",
  333. });
  334. }
  335. postapi(
  336. "/api/app/internalreport/getsumcheckdoctorworkloadreport",
  337. {
  338. userIds: that.username,
  339. startDate: that.startDate,
  340. endDate: that.endDate,
  341. }
  342. ).then((res) => {
  343. if (res.code != -1) {
  344. that.tableData = [...res.data];
  345. this.yAxisData = [];
  346. this.seriesData = [];
  347. this.pieData=[]
  348. let pies = {
  349. name: "",
  350. value: 0,
  351. };
  352. for (let i = 0; i < res.data.length; i++) {
  353. let pie = JSON.parse(JSON.stringify(pies));
  354. this.yAxisData.push(res.data[i].sumCheckDoctorName);
  355. this.seriesData.push(res.data[i].sumCheckCount);
  356. pie.name=res.data[i].sumCheckDoctorName
  357. pie.value=res.data[i].sumCheckCount
  358. this.pieData.push(pie)
  359. }
  360. this.columnarChart();
  361. }
  362. });
  363. },
  364. getList() {
  365. // getapi("/api/identity/users/getlist",this.pages).then((res) => {
  366. // if (res.code != -1) {
  367. // this.registrardata = [...res.data.items];
  368. // }
  369. // });
  370. postapi('/api/identity/users/GetListByOperatorType', { operatorTypes: ["2", "3"] })
  371. .then(res => {
  372. if (res.code > -1) {
  373. this.registrardata = res.data
  374. }
  375. })
  376. },
  377. getNowTime() {
  378. var now = new Date();
  379. var year = now.getFullYear(); // 得到年份
  380. var month = now.getMonth(); // 得到月份
  381. var date = now.getDate(); // 得到日期
  382. month = month + 1;
  383. month = month.toString().padStart(2, "0");
  384. date = date.toString().padStart(2, "0");
  385. var defaultDate = `${year}-${month}-${date}`;
  386. this.startDate = defaultDate;
  387. this.endDate = defaultDate;
  388. },
  389. handleExport() {
  390. exportToExcel("#table", "总检医生工作量统计",false);
  391. },
  392. },
  393. computed: {
  394. ...mapState(["window", "dict", "patientRegister", "report"]),
  395. },
  396. updated() {
  397. this.$nextTick(() => {
  398. this.$refs.table.doLayout();
  399. });
  400. },
  401. };
  402. </script>
  403. <style scoped>
  404. @import "../../assets/css/global_button.css";
  405. @import "../../assets/css/global_dialog.css";
  406. @import "../../assets/css/global_table.css";
  407. @import "../../assets/css/global_form.css";
  408. @import "../../assets/css/global_input.css";
  409. @import "../../assets/css/global.css";
  410. .query{
  411. margin-right: 10px;
  412. display: flex;
  413. justify-content: center;
  414. align-items: center;
  415. font-size: 14px;
  416. color: #232748;
  417. font-weight: 400;
  418. font-family: "NotoSansSC-Regular";
  419. }
  420. .box {
  421. display: flex;
  422. flex-direction: column;
  423. }
  424. :deep .left-align .cell {
  425. text-align: left !important;
  426. }
  427. .query:last-child{
  428. margin-right: 0;
  429. }
  430. :deep .el-input--suffix .el-input__inner{
  431. height: 32px !important;
  432. }
  433. :deep .el-select__tags{
  434. flex-wrap: nowrap;
  435. }
  436. </style>