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.

437 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
  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
  110. prop="auditDoctorName"
  111. label="医生"
  112. ></el-table-column>
  113. <el-table-column
  114. prop="auditCount"
  115. label="人数"
  116. ></el-table-column>
  117. <el-table-column prop="percentage" label="占登记总人数百分比">
  118. </el-table-column>
  119. </el-table-column>
  120. </el-table-column>
  121. </el-table>
  122. </div>
  123. <div
  124. :style="
  125. 'width: 47.7%;overflow: hidden;height:' +
  126. (window.pageHeight < 600 ? 415 : window.pageHeight - 185 - 20) +
  127. 'px;background-color: #fff; padding: 15px; border-radius: 8px;'
  128. "
  129. >
  130. <div style=" font-size: 20px;
  131. font-weight: 700;
  132. color: #232748;
  133. font-family: 'NotoSansSC-Bold';
  134. text-align: center;">审核医生工作量统计</div>
  135. <div :style="
  136. 'height:' +(window.pageHeight < 600 ? 387 : window.pageHeight - 185 - 48) +'px;'
  137. ">
  138. <ChartBlock ref="chart2"></ChartBlock>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </template>
  146. <script>
  147. import { mapState, mapActions } from "vuex";
  148. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  149. import ChartBlock from "../../components/workload/chartsBlock";
  150. import { exportToExcel } from "../../utlis/Export2Excel";
  151. import html2canvas from "html2canvas";
  152. import printJs from "print-js";
  153. export default {
  154. components: {
  155. ChartBlock,
  156. },
  157. data() {
  158. return {
  159. registrardata: [],
  160. username: [],
  161. startDate: "",
  162. endDate: "",
  163. tableData: [],
  164. seriesData: [],
  165. yAxisData: [],
  166. flag: true,
  167. pieData: [],
  168. pages: {
  169. SkipCount: 0,
  170. MaxResultCount: 1000,
  171. },
  172. };
  173. },
  174. created() {
  175. this.getList();
  176. },
  177. mounted() {
  178. this.getNowTime();
  179. },
  180. methods: {
  181. headerStyle({ row, column, rowIndex, columnIndex }) {
  182. if (rowIndex === 1) {
  183. return "left-align";
  184. }
  185. },
  186. summarizeRegisterCount(param) {
  187. const { columns, data } = param;
  188. const sums = [];
  189. columns.forEach((column, index) => {
  190. if (index === 0) {
  191. sums[index] = "合计";
  192. return;
  193. }
  194. const values = data.map((item) => Number(item[column.property]));
  195. if (index === 1) {
  196. sums[index] = values.reduce((prev, curr) => {
  197. const value = Number(curr);
  198. if (!isNaN(value)) {
  199. return prev + curr;
  200. } else {
  201. return prev;
  202. }
  203. }, 0);
  204. sums[index] = "共" + sums[index] + "人";
  205. } else {
  206. sums[index] = "";
  207. }
  208. });
  209. return sums;
  210. },
  211. onPrint() {
  212. this.flag = false;
  213. this.$nextTick(() => {
  214. let width = this.$refs.imageDom.style.width;
  215. let cloneDom = this.$refs.imageDom.cloneNode(true);
  216. let imageDom = this.$refs.imageDom;
  217. cloneDom.style.position = "absolute";
  218. cloneDom.style.top = "0px";
  219. cloneDom.style.zIndex = "-1";
  220. cloneDom.style.width = width;
  221. imageDom.appendChild(cloneDom);
  222. html2canvas(cloneDom).then((canvas) => {
  223. // 转成图片,生成图片地址
  224. const url = canvas.toDataURL("image/png");
  225. printJs({
  226. printable: url,
  227. type: "image",
  228. documentTitle: "", // 标题
  229. style: "@page{size:auto;margin: 0cm 1cm 0cm 1cm;}", // 去除页眉页脚
  230. });
  231. });
  232. cloneDom.style.display = "none";
  233. this.flag = true;
  234. });
  235. },
  236. columnarChart() {
  237. let option2 = {
  238. // title: {
  239. // text: "审核医生工作量统计",
  240. // left: "center",
  241. // },
  242. tooltip: {
  243. trigger: "axis",
  244. confine: true,
  245. },
  246. legend: {
  247. type: "scroll",
  248. orient: "horizontal", // 垂直
  249. right: "3%", // 左对齐
  250. top: "0%", // 位于顶部
  251. },
  252. grid: {
  253. show: false,
  254. left: "0%",
  255. right: "0%",
  256. top: "0%",
  257. bottom: "0%",
  258. containLabel: true,
  259. },
  260. xAxis: {
  261. type: "value",
  262. axisLabel: {
  263. textStyle: {
  264. fontSize: "14",
  265. },
  266. },
  267. axisLine: {
  268. show: true,
  269. },
  270. },
  271. yAxis: {
  272. type: "category",
  273. data: this.yAxisData,
  274. axisLabel: {
  275. textStyle: {
  276. fontSize: "14",
  277. },
  278. },
  279. },
  280. series: [
  281. {
  282. name: "人数",
  283. type: "bar",
  284. data: this.seriesData,
  285. },
  286. ],
  287. };
  288. this.$refs.chart2.setOption(option2);
  289. },
  290. peiChart() {
  291. let option2 = {
  292. // title: {
  293. // text: "审核医生工作量统计",
  294. // left: "center",
  295. // },
  296. tooltip: {
  297. trigger: "item",
  298. confine: true,
  299. },
  300. legend: {
  301. data: this.yAxisData,
  302. orient: "horizontal",
  303. right: "3%",
  304. top: "0%",
  305. },
  306. grid: {
  307. show: false,
  308. left: "0%",
  309. right: "0%",
  310. top: "0%",
  311. bottom: "0%",
  312. containLabel: true,
  313. },
  314. series: [
  315. {
  316. type: "pie",
  317. label: {
  318. show: true,
  319. formatter: "{b} : {c}人 ({d}%)", // b代表名称,c代表对应值,d代表百分比
  320. },
  321. data: this.pieData,
  322. },
  323. ],
  324. };
  325. this.$refs.chart2.setOption(option2);
  326. },
  327. onSubmit() {
  328. let that = this;
  329. if (this.startDate == "") {
  330. return this.$message({
  331. message: "请先选择开始日期",
  332. type: "error",
  333. });
  334. }
  335. if (this.endDate == "") {
  336. return this.$message({
  337. message: "请先选择结束日期",
  338. type: "error",
  339. });
  340. }
  341. postapi(
  342. "/api/app/internalreport/getauditdoctorworkloadreport",
  343. {
  344. userIds: that.username,
  345. startDate: that.startDate,
  346. endDate: that.endDate,
  347. }
  348. ).then((res) => {
  349. if (res.code != -1) {
  350. that.tableData = [...res.data];
  351. this.yAxisData = [];
  352. this.seriesData = [];
  353. this.pieData=[]
  354. let pies = {
  355. name: "",
  356. value: 0,
  357. };
  358. for (let i = 0; i < res.data.length; i++) {
  359. let pie = JSON.parse(JSON.stringify(pies));
  360. this.yAxisData.push(res.data[i].auditDoctorName);
  361. this.seriesData.push(res.data[i].auditCount);
  362. pie.name=res.data[i].auditDoctorName
  363. pie.value=res.data[i].auditCount
  364. this.pieData.push(pie)
  365. }
  366. this.columnarChart();
  367. }
  368. });
  369. },
  370. getList() {
  371. getapi("/api/identity/users/getlist",this.pages).then((res) => {
  372. if (res.code != -1) {
  373. this.registrardata = [...res.data.items];
  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-size: 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>