Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

schedulingStatistics.vue 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div style="display:flex;align-items:center">
  6. <el-button type="primary" icon="el-icon-printer" @click='toPrint'>打印</el-button>
  7. </div>
  8. </div>
  9. <div class="app-container">
  10. <div class="cell clearfix">
  11. <el-input
  12. size="small"
  13. style="width: 150px;"
  14. class="filter-item"
  15. v-model.trim="keywords"
  16. placeholder="请输入医护人员姓名"
  17. @keyup.enter.native='toSearch'
  18. />
  19. <el-button
  20. size="small"
  21. class="filter-item"
  22. type="primary"
  23. icon="el-icon-search"
  24. @click="toSearch"
  25. >搜索</el-button
  26. >
  27. <el-select style="margin-left:10px;width:150px;margin-right:10px;" v-model="typeValue" placeholder="请选择" @change="changeOption">
  28. <el-option
  29. v-for="item in options"
  30. :key="item.value"
  31. :label="item.label"
  32. :value="item.value">
  33. </el-option>
  34. </el-select>
  35. <el-radio v-model="timeSlot" label="1">周</el-radio>
  36. <el-radio v-model="timeSlot" label="2">月</el-radio>
  37. <el-radio v-model="timeSlot" label="3">自定义</el-radio>
  38. <div style="display:flex;" v-if="timeSlot == '1'">
  39. <el-button @click="lastclick" type="text" style="margin:0 10px;">&lt;上一周({{ weekNum - 1 }})</el-button>
  40. <div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
  41. <el-button @click="nextclick" type="text" style="margin:0 10px;">下一周({{ weekNum + 1 }})&gt;</el-button>
  42. </div>
  43. <div style="display:flex;" v-if="timeSlot == '2'">
  44. <!-- <el-button @click="lastclick" type="text" style="margin:0 10px;">&lt;上个月({{ }})</el-button>
  45. <div class="dateBox">{{ }}-{{ }}({{ }})</div>
  46. <el-button @click="nextclick" type="text" style="margin:0 10px;">下个月({{ }})&gt;</el-button> -->
  47. <el-date-picker
  48. @change='changeMonth'
  49. v-model="monthTime"
  50. type="month"
  51. placeholder="选择月">
  52. </el-date-picker>
  53. </div>
  54. <div style="display:flex;align-items: center;" v-if="timeSlot == '3'">
  55. <el-date-picker
  56. style="width:140px;"
  57. v-model="customTime1"
  58. type="date"
  59. placeholder="选择日期"
  60. :picker-options="pickerOptions"
  61. @change="changeTime">
  62. </el-date-picker>-
  63. <el-date-picker
  64. style="width:140px;"
  65. v-model="customTime2"
  66. type="date"
  67. placeholder="选择日期"
  68. :picker-options="pickerOptions"
  69. @change="changeTimeTwo">
  70. </el-date-picker>
  71. </div>
  72. </div>
  73. <div class="tableTitle">统计图</div>
  74. <div class="cell clearfix" style="margin:0;">
  75. <p class="point"></p>
  76. <p class="pointTitle">工时/小时</p>
  77. </div>
  78. <div>
  79. <line-chart :options="chart"></line-chart>
  80. </div>
  81. <div class="tableTitle">统计表</div>
  82. <el-table class='statisticsTable' :data="tableData" height="250" border>
  83. <el-table-column fixed align="center" prop="date" label="医护姓名" width="100">
  84. <template slot-scope="scope">
  85. <span>{{scope.row.user_name}}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column :label="modeItem.class_name" property="number" align="center" min-width="100" v-for="(modeItem, index) in scheduleList" :key="index">
  89. <template slot-scope="scope">
  90. <span>{{ getCount(scope.row.doctor_id,modeItem.class_name) }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column align="center" prop="address" label="总工时/小时">
  94. <template slot-scope="scope">
  95. <span v-if="scope.row.totalminute">{{ scope.row.totalminute / 60 }}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align="center" prop="attendance" label="出勤/天">
  99. <!-- <span v-if='scope.row.attendance'>{{ scope.row.attendance ? scope.row.attendance : '' }}</span> -->
  100. </el-table-column>
  101. <el-table-column align="center" prop="absence" label="缺勤/天">
  102. <!-- <span v-if="scope.row.absence">{{ scope.row.absence ? scope.row.absence : '' }}</span> -->
  103. </el-table-column>
  104. </el-table>
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import echarts from "echarts";
  110. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  111. import LineChart from "../qcd/components/LineChart";
  112. import {getDoctorList,getScheduleList,getScheduleListTotal,toSearchTotal,changeOption,getchartlist } from '@/api/doctorSchedule'
  113. export default {
  114. components:{
  115. BreadCrumb,
  116. LineChart
  117. },
  118. data(){
  119. return{
  120. pickerOptions: {
  121. disabledDate(time) {
  122. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  123. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  124. }
  125. },
  126. crumbs: [
  127. { path: false, name: '医护排班' },
  128. { path: '/medicalScheduling/index', name: '排班统计' }
  129. ],
  130. keywords:'',
  131. options: [{
  132. value: '0',
  133. label: '全部'
  134. }, {
  135. value: '2',
  136. label: '医生'
  137. }, {
  138. value: '3',
  139. label: '护士'
  140. }],
  141. typeValue:'0',
  142. weekNum:'',
  143. weekDayArr:[],
  144. todayDate:'',
  145. clen:7,
  146. nowYear: new Date().getFullYear(),
  147. timeSlot:'1',
  148. monthTime:'',
  149. customTime1:'',
  150. customTime2:'',
  151. chart: {
  152. title: {
  153. text: "ECharts 入门示例"
  154. },
  155. tooltip: {},
  156. legend: {
  157. data: [],
  158. left: 0
  159. },
  160. xAxis: {
  161. data: []
  162. },
  163. yAxis: {
  164. axisLabel: {
  165. formatter: "{value} %"
  166. },
  167. show: false
  168. },
  169. series: [
  170. {
  171. name: "",
  172. type: "bar",
  173. data: [],
  174. barWidth: 30,
  175. label: {
  176. normal: {
  177. show: true,
  178. position: "top",
  179. }
  180. },
  181. //配置样式
  182. itemStyle: {
  183. //通常情况下:
  184. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  185. normal: {
  186. color: function(params) {
  187. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  188. var colorList = [
  189. ["#A9E0F3", "#9FBDFC"],
  190. ["#FFD7C0", "#FF9994"]
  191. ];
  192. var index = params.dataIndex;
  193. if (params.dataIndex >= colorList.length) {
  194. index = params.dataIndex % colorList.length;
  195. }
  196. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  197. { offset: 0, color: colorList[index][0] },
  198. // { offset: 0.5, color: colorList[index][1] },
  199. { offset: 1, color: colorList[index][1] }
  200. ]);
  201. },
  202. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  203. },
  204. //鼠标悬停时:
  205. emphasis: {
  206. shadowBlur: 10,
  207. shadowOffsetX: 0,
  208. shadowColor: "rgba(0, 0, 0, 0.2)"
  209. }
  210. }
  211. }
  212. ],
  213. dataZoom: [
  214. {
  215. // Y轴固定,让内容滚动
  216. type: 'slider',
  217. show: false,
  218. xAxisIndex: [0],
  219. start: 1,
  220. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  221. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  222. },
  223. {
  224. type: 'inside',
  225. xAxisIndex: [0],
  226. start: 1,
  227. end: 20,
  228. zoomLock: true // 锁定区域禁止缩放
  229. }
  230. ]
  231. },
  232. tableData: [],
  233. scheduleList:[],
  234. start_time:0,
  235. end_time:0,
  236. doctorlist:[],
  237. doctorArr:[],
  238. nurseArr:[]
  239. }
  240. },
  241. created(){
  242. let year = new Date().getFullYear()
  243. let month = new Date().getMonth() + 1
  244. let date = new Date().getDate()
  245. this.weekNum = this.getYearWeek(year,month,date)
  246. this.todayDate=this.formatDate(new Date())
  247. this.setDate(new Date())
  248. //获取所以医护人员
  249. this.getDoctorList()
  250. //获取所有排班种
  251. this.getScheduleList()
  252. // 获取统计表的数据
  253. this.getlist()
  254. },
  255. methods:{
  256. getDoctorList(){
  257. getDoctorList().then(response=>{
  258. if(response.data.state == 1){
  259. var list = response.data.data.list
  260. var doctorlist = response.data.data.doctorlist
  261. var nurselist = response.data.data.nurselist
  262. this.doctorArr = doctorlist
  263. this.nurseArr = nurselist
  264. this.doctorlist.push(...nurselist)
  265. this.doctorlist.push(...doctorlist)
  266. console.log("医护列表",this.doctorlist)
  267. //获取统计图数据
  268. this.getchartlist()
  269. }
  270. })
  271. },
  272. //搜索
  273. toSearch(){
  274. if(this.timeSlot == 1){
  275. this.start_time = this.getTimestamp(this.weekDayArr[0]),
  276. this.end_time = this.getTimestamp(this.weekDayArr[6])
  277. }
  278. const params = {
  279. keyword:this.keywords,
  280. }
  281. console.log("params",params)
  282. toSearchTotal(params).then(response=>{
  283. if(response.data.state == 1){
  284. var scheudleTotal = response.data.data.scheduletotal
  285. console.log("scheduletotal",scheudleTotal)
  286. var list = response.data.data.list
  287. console.log("list",list)
  288. var workday = response.data.data.workDay
  289. console.log("workday",workday)
  290. var noWorkDay = response.data.data.noWorkDay
  291. console.log("noworkday",noWorkDay)
  292. let tempArr = [], newArr = []
  293. for (let i = 0; i < scheudleTotal.length; i++) {
  294. if (tempArr.indexOf(scheudleTotal[i].user_name) === -1) {
  295. newArr.push({
  296. user_name: scheudleTotal[i].user_name,
  297. doctor_id:scheudleTotal[i].doctor_id,
  298. list: [{class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count}]
  299. })
  300. tempArr.push(scheudleTotal[i].user_name);
  301. } else {
  302. for (let j = 0; j < newArr.length; j++) {
  303. if (newArr[j].user_name == scheudleTotal[i].user_name) {
  304. newArr[j].list.push({class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count})
  305. }
  306. }
  307. }
  308. }
  309. newArr.map(item => {
  310. list.map(it => {
  311. if(item.doctor_id == it.doctor_id){
  312. item.totalminute = it.totalminute
  313. }
  314. })
  315. })
  316. newArr.map(item => {
  317. workday.map(it => {
  318. if(item.doctor_id == it.doctor_id){
  319. item.attendance = it.Count
  320. }
  321. })
  322. })
  323. newArr.map(item => {
  324. noWorkDay.map(it => {
  325. if(item.doctor_id == it.doctor_id){
  326. item.absence = it.Count
  327. }
  328. })
  329. })
  330. let arr = [...newArr]
  331. if(this.keywords != ''){
  332. this.tableData = arr
  333. }else {
  334. arr.sort(this.compare('doctor_id'))
  335. this.doctorlist.sort(this.compare('admin_user_id'))
  336. this.doctorlist.forEach((item, index) => {
  337.   if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
  338.   }else{
  339.     arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
  340.   }
  341. })
  342. console.log('newArr',arr)
  343. this.tableData = arr
  344. }
  345. }
  346. })
  347. },
  348. formatDate(date){
  349. var year = date.getFullYear()+'.'
  350. var month = (date.getMonth()+1)+'.';
  351. var day = date.getDate();
  352. return year+month+day
  353. },
  354. addDate(date,n){
  355. date.setDate(date.getDate()+n);
  356. return date;
  357. },
  358. setDate(date){
  359. var week = date.getDay()-1;
  360. date = this.addDate(date,week*-1);
  361. this.currentFirstDate = new Date(date);
  362. this.currentDate = new Date(date)
  363. for(var i = 0;i<this.clen; i++){
  364. this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
  365. }
  366. },
  367. //上一周
  368. lastclick(){
  369. this.weekDayArr=[]
  370. this.setDate(this.addDate(this.currentFirstDate,-7));
  371. if (this.weekNum == 1) {
  372. let year = this.nowYear - 1
  373. let month = 12
  374. let date = 31
  375. this.weekNum = this.getYearWeek(year, month, date)
  376. this.nowYear = this.nowYear - 1
  377. }
  378. this.weekNum = this.weekNum - 1
  379. },
  380. //下一周
  381. nextclick(){
  382. this.weekDayArr=[]
  383. this.setDate(this.addDate(this.currentFirstDate,7));
  384. this.weekNum = this.weekNum + 1
  385. if (this.weekNum == 53) {
  386. let year = this.nowYear + 1
  387. let month = 1
  388. let date = 1
  389. this.weekNum = this.getYearWeek(year, month, date)
  390. this.nowYear = this.nowYear + 1
  391. }
  392. },
  393. getYearWeek(year,month,date){
  394. /*
  395. dateNow是当前日期
  396. dateFirst是当年第一天
  397. dataNumber是当前日期是今年第多少天
  398. 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
  399. */
  400. let dateNow = new Date(year, parseInt(month) - 1, date);
  401. let dateFirst = new Date(year, 0, 1);
  402. let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
  403. return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
  404. },
  405. getTimestamp(time) { //把时间日期转成时间戳
  406. return (new Date(time)).getTime() / 1000
  407. },
  408. changeMonth(value){
  409. console.log(value)
  410. console.log('monthStartTime',value.getTime() / 1000)
  411. let monthStartTime = value.getTime() / 1000
  412. var nowDate = new Date(value);
  413. var cloneNowDate = new Date(value);
  414. var fullYear = nowDate.getFullYear();
  415. var month = nowDate.getMonth() + 1; // getMonth 方法返回 0-11,代表1-12月
  416. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  417. let monthEndTime = this.getFullDate(cloneNowDate.setDate(endOfMonth))
  418. this.start_time = monthStartTime
  419. this.end_time = this.getTimestamp(monthEndTime)
  420. console.log('monthEndTime',this.getTimestamp(monthEndTime))
  421. this.getlist()
  422. },
  423. getFullDate(targetDate) {
  424. var D, y, m, d;
  425. if (targetDate) {
  426. D = new Date(targetDate);
  427. y = D.getFullYear();
  428. m = D.getMonth() + 1;
  429. d = D.getDate();
  430. } else {
  431. y = fullYear;
  432. m = month;
  433. d = date;
  434. }
  435. m = m > 9 ? m : '0' + m;
  436. d = d > 9 ? d : '0' + d;
  437. return y + '-' + m + '-' + d;
  438. },
  439. getTimestamp(time) { //把时间日期转成时间戳
  440. return (new Date(time)).getTime() / 1000
  441. },
  442. //获取所有班种
  443. getScheduleList(){
  444. getScheduleList().then(response=>{
  445. if(response.data.state == 1){
  446. var schedulelist = response.data.data.scheduleList
  447. console.log("schedulelist",schedulelist)
  448. this.scheduleList = schedulelist
  449. }
  450. })
  451. },
  452. //获取统计表数据
  453. getlist(){
  454. if(this.timeSlot == 1){
  455. this.start_time = this.getTimestamp(this.weekDayArr[0]),
  456. this.end_time = this.getTimestamp(this.weekDayArr[6])
  457. }
  458. const params = {
  459. start_time:this.start_time,
  460. end_time:this.end_time,
  461. }
  462. console.log("params",params)
  463. getScheduleListTotal(params).then(response=>{
  464. if(response.data.state == 1){
  465. //获取每个班次对应的次数
  466. var scheudleTotal = response.data.data.scheudletotal
  467. console.log("scheudletotal",scheudleTotal)
  468. //获取总分钟数
  469. var list = response.data.data.list
  470. console.log("list",list)
  471. var workday = response.data.data.workDay
  472. console.log("workday",workday)
  473. var noWorkDay = response.data.data.noWorkDay
  474. console.log("noWorkDay",noWorkDay)
  475. let tempArr = [], newArr = []
  476. for (let i = 0; i < scheudleTotal.length; i++) {
  477. if (tempArr.indexOf(scheudleTotal[i].user_name) === -1) {
  478. newArr.push({
  479. user_name: scheudleTotal[i].user_name,
  480. doctor_id:scheudleTotal[i].doctor_id,
  481. list: [{class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count}]
  482. })
  483. tempArr.push(scheudleTotal[i].user_name);
  484. } else {
  485. for (let j = 0; j < newArr.length; j++) {
  486. if (newArr[j].user_name == scheudleTotal[i].user_name) {
  487. newArr[j].list.push({class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count})
  488. }
  489. }
  490. }
  491. }
  492. newArr.map(item => {
  493. list.map(it => {
  494. if(item.doctor_id == it.doctor_id){
  495. item.totalminute = it.totalminute
  496. }
  497. })
  498. })
  499. newArr.map(item => {
  500. workday.map(it => {
  501. if(item.doctor_id == it.doctor_id){
  502. item.attendance = it.Count
  503. }
  504. })
  505. })
  506. newArr.map(item => {
  507. noWorkDay.map(it => {
  508. if(item.doctor_id == it.doctor_id){
  509. item.absence = it.Count
  510. }
  511. })
  512. })
  513. let arr = [...newArr]
  514. arr.sort(this.compare('doctor_id'))
  515. this.doctorlist.sort(this.compare('admin_user_id'))
  516. this.doctorlist.forEach((item, index) => {
  517.   if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
  518.   }else{
  519.     arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
  520.   }
  521. })
  522. console.log('newArr',arr)
  523. this.tableData = arr
  524. }
  525. })
  526. },
  527. changeOption(val){
  528. if(this.timeSlot == 1){
  529. this.start_time = this.getTimestamp(this.weekDayArr[0]),
  530. this.end_time = this.getTimestamp(this.weekDayArr[6])
  531. }
  532. const params = {
  533. doctor_type: parseInt(val),
  534. }
  535. console.log("params",params)
  536. changeOption(params).then(response=>{
  537. if(response.data.state == 1){
  538. var scheudleTotal = response.data.data.scheduletotal
  539. console.log("scheduletotal",scheudleTotal)
  540. var list = response.data.data.list
  541. console.log("list",list)
  542. var workday = response.data.data.workday
  543. console.log("workday",workday)
  544. var noWorkDay = response.data.data.workday
  545. console.log("worknoday",noWorkDay)
  546. let tempArr = [], newArr = []
  547. for (let i = 0; i < scheudleTotal.length; i++) {
  548. if (tempArr.indexOf(scheudleTotal[i].user_name) === -1) {
  549. newArr.push({
  550. user_name: scheudleTotal[i].user_name,
  551. doctor_id:scheudleTotal[i].doctor_id,
  552. list: [{class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count}]
  553. })
  554. tempArr.push(scheudleTotal[i].user_name);
  555. } else {
  556. for (let j = 0; j < newArr.length; j++) {
  557. if (newArr[j].user_name == scheudleTotal[i].user_name) {
  558. newArr[j].list.push({class_name:scheudleTotal[i].class_name,doctor_id:scheudleTotal[i].doctor_id,Count:scheudleTotal[i].Count})
  559. }
  560. }
  561. }
  562. }
  563. newArr.map(item => {
  564. list.map(it => {
  565. if(item.doctor_id == it.doctor_id){
  566. item.totalminute = it.totalminute
  567. }
  568. })
  569. })
  570. newArr.map(item => {
  571. workday.map(it => {
  572. if(item.doctor_id == it.doctor_id){
  573. item.attendance = it.Count
  574. }
  575. })
  576. })
  577. newArr.map(item => {
  578. noWorkDay.map(it => {
  579. if(item.doctor_id == it.doctor_id){
  580. item.absence = it.Count
  581. }
  582. })
  583. })
  584. let arr = [...newArr]
  585. if(val == 0){
  586. arr.sort(this.compare('doctor_id'))
  587. this.doctorlist.sort(this.compare('admin_user_id'))
  588. this.doctorlist.forEach((item, index) => {
  589.   if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
  590.   }else{
  591.     arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
  592.   }
  593. })
  594. console.log('newArr',arr)
  595. this.tableData = arr
  596. }else if(val == 2){
  597. arr.sort(this.compare('doctor_id'))
  598. this.doctorArr.sort(this.compare('admin_user_id'))
  599. this.doctorArr.forEach((item, index) => {
  600.   if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
  601.   }else{
  602.     arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
  603.   }
  604. })
  605. console.log('newArr',arr)
  606. this.tableData = arr
  607. }else if(val == 3){
  608. arr.sort(this.compare('doctor_id'))
  609. this.nurseArr.sort(this.compare('admin_user_id'))
  610. this.nurseArr.forEach((item, index) => {
  611.   if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
  612.   }else{
  613.     arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id, list: []})
  614.   }
  615. })
  616. console.log('newArr',arr)
  617. this.tableData = arr
  618. }
  619. }
  620. })
  621. },
  622. changeTime(val){
  623. this.start_time = val.getTime()/1000
  624. this.getlist()
  625. },
  626. changeTimeTwo(val){
  627. this.end_time = val.getTime()/1000
  628. this.getlist()
  629. },
  630. compare(property){
  631. return function(a,b){
  632. var value1 = a[property];
  633. var value2 = b[property];
  634. return value2 - value1;
  635. }
  636. },
  637. getCount(id,name){
  638. if(id != undefined){
  639. let Count = '';
  640. this.tableData.map(item => {
  641. if(item.doctor_id == id){
  642. if(item.list){
  643. item.list.map(it => {
  644. if(it.class_name == name){
  645. Count = it.Count
  646. }
  647. })
  648. }
  649. }
  650. })
  651. return Count
  652. }
  653. },
  654. toPrint(){
  655. this.$router.push({
  656. path: '/medicalScheduling/statistics/print',
  657. // query: { date: date }
  658. })
  659. },
  660. //获取统计图数据
  661. getchartlist(){
  662. getchartlist().then(response=>{
  663. if(response.data.state == 1){
  664. var workdaylist = response.data.data.workDaylist
  665. console.log("早年公共",workdaylist)
  666. let arr = [...workdaylist]
  667. arr.sort(this.compare('doctor_id'))
  668. this.doctorlist.sort(this.compare('admin_user_id'))
  669. this.doctorlist.forEach((item, index) => {
  670. if (arr[index] && item.admin_user_id == arr[index].doctor_id) {
  671. }else{
  672.   arr.splice(index, 0, {user_name: item.user_name, doctor_id: item.admin_user_id,workminute: 0})
  673. }
  674. })
  675. console.log('arrrrrrrrrrrrrrr',arr)
  676. let chartX = []
  677. let chartY = []
  678. arr.map(item => {
  679. chartX.push(item.user_name)
  680. chartY.push(item.workminute / 60)
  681. })
  682. this.chart.xAxis.data = chartX
  683. this.chart.series[0].data = chartY
  684. this.getArrLength(this.chart.xAxis.data)
  685. }
  686. })
  687. },
  688. getArrLength(result){
  689. if(result.length > 10){
  690. var dataZoom_end = (10/result.length)*100;
  691. this.chart.dataZoom[0].end = dataZoom_end
  692. }else{
  693. var dataZoom_end = 100;
  694. this.chart.dataZoom[0].end = dataZoom_end
  695. }
  696. }
  697. }
  698. }
  699. </script>
  700. <style lang="scss" scoped>
  701. .dateBox{
  702. border: 1px solid #DCDFE6;
  703. height: 36px;
  704. line-height: 36px;
  705. text-align: center;
  706. padding: 0 10px;
  707. border-radius: 4px;
  708. }
  709. .tableTitle {
  710. font-size: 16px;
  711. color: #000;
  712. font-weight: bold;
  713. margin-bottom: 10px;
  714. }
  715. .point {
  716. width: 13px;
  717. height: 13px;
  718. background: linear-gradient(
  719. 0deg,
  720. rgba(169, 224, 243, 1),
  721. rgba(159, 189, 252, 1)
  722. );
  723. border-radius: 7px;
  724. margin-right: 8px;
  725. }
  726. .pointTitle {
  727. font-size: 13px;
  728. }
  729. .statisticsTable{
  730. ::-webkit-scrollbar{
  731. height:15px !important;
  732. }
  733. }
  734. </style>