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

schedulingStatistics.vue 34KB

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