nurse.vue 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. <template>
  2. <div>
  3. <div class="cell clearfix">
  4. <el-select v-model="query.admin_user_id" placeholder="请选择" style="width:120px;margin-right:10px" @change="changeNurse"
  5. >
  6. <el-option
  7. v-for="item in nurse_options"
  8. :key="item.id"
  9. :label="item.user_name"
  10. :value="item.admin_user_id"
  11. ></el-option>
  12. </el-select>
  13. <el-select
  14. v-model="query.statistics_type"
  15. placeholder="请选择"
  16. @change="changeProject"
  17. style="width:120px;margin-right:10px"
  18. >
  19. <el-option
  20. v-for="item in project_options"
  21. :key="item.value"
  22. :label="item.name"
  23. :value="item.value"
  24. ></el-option>
  25. </el-select>
  26. <label class="title">
  27. <span class="name">月份查询</span> :
  28. </label>
  29. <el-date-picker
  30. @change='changeMonth'
  31. v-model="monthValue"
  32. type="month"
  33. placeholder="选择月">
  34. </el-date-picker>
  35. <label class="title">
  36. <span class="name">日期查询</span> :
  37. </label>
  38. <el-date-picker
  39. v-model="start_time"
  40. prefix-icon="el-icon-date"
  41. @change="changeTime"
  42. :editable="false"
  43. style="width: 150px;"
  44. type="date"
  45. :picker-options="pickerOptions"
  46. placeholder="选择日期时间"
  47. align="right"
  48. format="yyyy-MM-dd"
  49. value-format="yyyy-MM-dd"
  50. ></el-date-picker>
  51. <span class>-</span>
  52. <el-date-picker
  53. v-model="end_time"
  54. prefix-icon="el-icon-date"
  55. @change="changeEndTime"
  56. :editable="false"
  57. :picker-options="pickerOptions"
  58. style="width: 150px;"
  59. type="date"
  60. placeholder="选择日期时间"
  61. align="right"
  62. format="yyyy-MM-dd"
  63. value-format="yyyy-MM-dd"
  64. ></el-date-picker>
  65. </div>
  66. <div class="tableTitle">统计图</div>
  67. <div>
  68. <line-chart :options="bar"></line-chart>
  69. </div>
  70. <div class="tableTitle">统计表</div>
  71. <div>
  72. <!--<el-table :data="tableData" style="width: 100%" :height="tableHeight">-->
  73. <!--<el-table-column fixed label="姓名" align="center">-->
  74. <!--<template slot-scope="scope">-->
  75. <!--{{scope.row.user_name}}-->
  76. <!--</template>-->
  77. <!--</el-table-column>-->
  78. <!--<el-table-column label="治疗人次" align="center">-->
  79. <!--<template slot-scope="scope">-->
  80. <!--{{scope.row.p_count?scope.row.p_count:''}}-->
  81. <!--</template>-->
  82. <!--</el-table-column>-->
  83. <!--<el-table-column label="病程记录" align="center">-->
  84. <!--<template slot-scope="scope">-->
  85. <!--{{scope.row.course_count?scope.row.course_count:''}}-->
  86. <!--&lt;!&ndash;{{// scope.row.patient.lapseto == 1 ? '留治':'转出'}}&ndash;&gt;-->
  87. <!--</template>-->
  88. <!--</el-table-column>-->
  89. <!--<el-table-column label="抢救记录" align="center">-->
  90. <!--<template slot-scope="scope">-->
  91. <!--{{scope.row.rescue_count?scope.row.rescue_count:''}}-->
  92. <!--&lt;!&ndash;{{scope.row.last_after_weight?scope.row.last_after_weight:''}}&ndash;&gt;-->
  93. <!--&lt;!&ndash;<div v-if="scope.row.before.systolic_blood_pressure">{{scope.row.before.systolic_blood_pressure}} / {{scope.row.before.diastolic_blood_pressure}}</div>&ndash;&gt;-->
  94. <!--</template>-->
  95. <!--</el-table-column>-->
  96. <!--<el-table-column label="合计" align="center">-->
  97. <!--<template slot-scope="scope">-->
  98. <!--{{scope.row.p_count + scope.row.course_count + scope.row.rescue_count?scope.row.p_count + scope.row.course_count + scope.row.rescue_count:''}}-->
  99. <!--&lt;!&ndash;<div v-if="scope.row.min_monitor.systolic_blood_pressure">{{ scope.row.min_monitor.systolic_blood_pressure}} /{{ scope.row.min_monitor.diastolic_blood_pressure}}</div>&ndash;&gt;-->
  100. <!--</template>-->
  101. <!--</el-table-column>-->
  102. <!--</el-table>-->
  103. <el-table :data="tableData" style="width: 100%" border :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
  104. <el-table-column fixed label="姓名" align="center">
  105. <template slot-scope="scope">
  106. {{scope.row.user_name}}
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="穿刺" align="center">
  110. <template slot-scope="scope">
  111. {{scope.row.puncture_count?scope.row.puncture_count:''}}
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="治疗" align="center">
  115. <template slot-scope="scope">
  116. {{scope.row.cure_count?scope.row.cure_count:''}}
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="换药" align="center">
  120. <template slot-scope="scope">
  121. {{scope.row.change_nuser_count?scope.row.change_nuser_count:''}}
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="疑难穿刺" align="center">
  125. <template slot-scope="scope">
  126. {{scope.row.difficult_nuser_count?scope.row.difficult_nuser_count:''}}
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="开瘘" align="center">
  130. <template slot-scope="scope">
  131. {{scope.row.new_nuser_count?scope.row.new_nuser_count:''}}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="上机" align="center" width="300">
  135. <template slot-scope="scope">
  136. {{scope.row.start_nuser_count?scope.row.start_nuser_count:''}}
  137. <span v-if="getTotalCount(scope.row.admin_user_id)!=''">({{getTotalCount(scope.row.admin_user_id)}})</span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="宣教/小结" align="center">
  141. <template slot-scope="scope">
  142. {{scope.row.mission_count?scope.row.mission_count:''}}
  143. </template>
  144. </el-table-column>
  145. <!-- change_nurse_count:total_change_nurse,
  146. diffcult_nurse_count:total_diffcult_nurse,
  147. new_fistula_nurse_count:total_new_fistula_nurse,
  148. start_nurse_count:total_start_nurse, -->
  149. <el-table-column label="合计" align="center">
  150. <template slot-scope="scope">
  151. {{scope.row.puncture_count + scope.row.cure_count + scope.row.mission_count + scope.row.change_nuser_count+scope.row.difficult_nuser_count+scope.row.new_nuser_count +scope.row.start_nuser_count ?scope.row.puncture_count + scope.row.cure_count + scope.row.mission_count+scope.row.change_nuser_count+scope.row.difficult_nuser_count+scope.row.new_nuser_count+scope.row.start_nuser_count:''}}
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. </div>
  156. </div>
  157. </template>
  158. <script>
  159. const moment = require('moment')
  160. import echarts from "echarts";
  161. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  162. import LineChart from "../../qcd/components/LineChart";
  163. import {GetNurseWorkloadChartData,GetNurseWorkloadTableData,GetAllAdminUser} from "@/api/common/statistics";
  164. export default {
  165. components: {
  166. BreadCrumb,
  167. LineChart
  168. },
  169. data() {
  170. return {
  171. percent:[],
  172. pickerOptions: {
  173. disabledDate(time) {
  174. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  175. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  176. }
  177. },
  178. tableData: [
  179. ],
  180. loading: false,
  181. total: '',
  182. query: {
  183. admin_user_id: 0,
  184. statistics_type: 1,
  185. start_time: "",
  186. end_time: "",
  187. limit:20,
  188. page:1,
  189. },
  190. start_time:'',
  191. end_time:'',
  192. monthValue:'',
  193. nurse_options:[
  194. {id:0,user_name:"全部",admin_user_id:0}
  195. ],
  196. project_options:[
  197. {value:1, name:"治疗"},
  198. {value:2, name:"穿刺"},
  199. {value:3, name:"宣教/小结"},
  200. {value:4, name:"换药"},
  201. {value:5, name:"疑难穿刺"},
  202. {value:6, name:"开瘘"},
  203. {value:7, name:"上机"},
  204. ],
  205. crumbs: [
  206. { path: false, name: "质控管理" },
  207. { path: false, name: "工作量分析统计" },
  208. { path: false, name: "护士" }
  209. ],
  210. activeName: "second",
  211. listQuery: {
  212. start_time: "",
  213. end_time: "",
  214. page: 1,
  215. limit: 10
  216. },
  217. value: "请选项",
  218. bar: {
  219. title: {
  220. text: "ECharts 入门示例"
  221. },
  222. tooltip: {},
  223. legend: {
  224. data: [],
  225. left: 0
  226. },
  227. xAxis: {
  228. data: []
  229. },
  230. yAxis: {
  231. axisLabel: {
  232. formatter: "{value} %"
  233. },
  234. show: false
  235. },
  236. series: [
  237. {
  238. name: "",
  239. type: "bar",
  240. data: [],
  241. barWidth: 30,
  242. label: {
  243. normal: {
  244. show: true,
  245. position: "top",
  246. formatter: (params) => {
  247. if(this.percent.length > 0){
  248. let str = ''
  249. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  250. return str
  251. }else{
  252. let str = ''
  253. str = params.data
  254. return str
  255. }
  256. }
  257. }
  258. },
  259. //配置样式
  260. itemStyle: {
  261. //通常情况下:
  262. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  263. normal: {
  264. color: function(params) {
  265. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  266. var colorList = [
  267. ["#A9E0F3", "#9FBDFC"],
  268. ["#FFD7C0", "#FF9994"]
  269. ];
  270. var index = params.dataIndex;
  271. if (params.dataIndex >= colorList.length) {
  272. index = params.dataIndex % colorList.length;
  273. }
  274. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  275. { offset: 0, color: colorList[index][0] },
  276. // { offset: 0.5, color: colorList[index][1] },
  277. { offset: 1, color: colorList[index][1] }
  278. ]);
  279. },
  280. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  281. },
  282. //鼠标悬停时:
  283. emphasis: {
  284. shadowBlur: 10,
  285. shadowOffsetX: 0,
  286. shadowColor: "rgba(0, 0, 0, 0.2)"
  287. }
  288. }
  289. }
  290. ],
  291. dataZoom: [
  292. {
  293. // Y轴固定,让内容滚动
  294. type: 'slider',
  295. show: false,
  296. xAxisIndex: [0],
  297. start: 1,
  298. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  299. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  300. },
  301. {
  302. type: 'inside',
  303. xAxisIndex: [0],
  304. start: 1,
  305. end: 20,
  306. zoomLock: true // 锁定区域禁止缩放
  307. }
  308. ]
  309. },
  310. modeList:[],
  311. };
  312. },
  313. methods: {
  314. changeNurse(val){
  315. this.query.admin_user_id = val
  316. this.query.page = 1
  317. this.GetNurseWorkloadChartData(this.query)
  318. this.GetNurseWorkloadTableData(this.query)
  319. },
  320. GetAllNurse(){
  321. GetAllAdminUser().then(response => {
  322. if (response.data.state == 1) {
  323. var adminUser = response.data.data.admin
  324. this.admin_user = adminUser
  325. for (let i = 0; i < adminUser.length; i++){
  326. if(adminUser[i].user_type == 3){
  327. this.nurse_options.push(adminUser[i])
  328. }
  329. }
  330. } else {
  331. this.$message.error('请求数据失败')
  332. return false
  333. }
  334. })
  335. },
  336. changeProject(val){
  337. this.query.statistics_type = val
  338. this.query.page = 1
  339. this.GetNurseWorkloadChartData(this.query)
  340. // this.GetDialysisProcessIndexTableData(this.query)
  341. },
  342. handleSizeChange(limit) {
  343. this.query.limit = limit;
  344. this.GetNurseWorkloadTableData(this.query)
  345. },
  346. handleCurrentChange(page) {
  347. this.query.page = page;
  348. this.GetNurseWorkloadTableData(this.query)
  349. },
  350. GetNurseWorkloadTableData(params) {
  351. this.loading = true
  352. this.tableData = []
  353. this.modeList = []
  354. // console.log("params",params)
  355. GetNurseWorkloadTableData(params)
  356. .then(rs => {
  357. var resp = rs.data
  358. if (resp.state == 1) {
  359. let total_cure = 0
  360. let total_puncture = 0
  361. let total_mission = 0
  362. let total_change_nurse = 0
  363. let total_diffcult_nurse = 0
  364. let total_new_fistula_nurse = 0
  365. let total_start_nurse = 0
  366. this.loading = false
  367. for (let i = 0; i < resp.data.data.length; i++) {
  368. total_cure = total_cure + resp.data.data[i].cure_count
  369. total_puncture = total_puncture + resp.data.data[i].puncture_count
  370. total_mission = total_mission + resp.data.data[i].mission_count
  371. total_change_nurse = total_change_nurse + resp.data.data[i].change_nuser_count
  372. total_diffcult_nurse = total_diffcult_nurse + resp.data.data[i].difficult_nuser_count
  373. total_new_fistula_nurse = total_new_fistula_nurse + resp.data.data[i].new_nuser_count
  374. total_start_nurse = total_start_nurse + resp.data.data[i].start_nuser_count
  375. this.tableData.push(resp.data.data[i])
  376. }
  377. this.tableData.push( {
  378. user_name:"合计",
  379. cure_count:total_cure,
  380. puncture_count:total_puncture,
  381. mission_count:total_mission,
  382. change_nuser_count:total_change_nurse,
  383. difficult_nuser_count:total_diffcult_nurse,
  384. new_nuser_count:total_new_fistula_nurse,
  385. start_nuser_count:total_start_nurse,
  386. })
  387. var dialysisCount = resp.data.dialysisCount
  388. console.log("dialysisCount",dialysisCount)
  389. for(let i=0;i<dialysisCount.length;i++){
  390. if(dialysisCount[i].mode_id == 1){
  391. dialysisCount[i].mode_id = "HD"
  392. }
  393. if(dialysisCount[i].mode_id == 2){
  394. dialysisCount[i].mode_id = "HDF"
  395. }
  396. if(dialysisCount[i].mode_id == 3){
  397. dialysisCount[i].mode_id = "HD+HP"
  398. }
  399. if(dialysisCount[i].mode_id == 4){
  400. dialysisCount[i].mode_id = "HP"
  401. }
  402. if(dialysisCount[i].mode_id == 5){
  403. dialysisCount[i].mode_id = "HF"
  404. }
  405. if(dialysisCount[i].mode_id == 6){
  406. dialysisCount[i].mode_id = "SCUF"
  407. }
  408. if(dialysisCount[i].mode_id == 7){
  409. dialysisCount[i].mode_id = "IUF"
  410. }
  411. if(dialysisCount[i].mode_id == 8){
  412. dialysisCount[i].mode_id = "HFHD"
  413. }
  414. if(dialysisCount[i].mode_id == 9){
  415. dialysisCount[i].mode_id = "HFHD+HP"
  416. }
  417. if(dialysisCount[i].mode_id == 10){
  418. dialysisCount[i].mode_id = "PHF"
  419. }
  420. if(dialysisCount[i].mode_id == 11){
  421. dialysisCount[i].mode_id = "HFR"
  422. }
  423. if(dialysisCount[i].mode_id == 12){
  424. dialysisCount[i].mode_id = "HDF+HP"
  425. }
  426. if(dialysisCount[i].mode_id == 13){
  427. dialysisCount[i].mode_id = "CRRT"
  428. }
  429. if(dialysisCount[i].mode_id == 14){
  430. dialysisCount[i].mode_id = "腹水回输"
  431. }
  432. }
  433. let dataInfo = {}
  434. dialysisCount.forEach((item, index) => {
  435. let { start_nurse } = item
  436. if (!dataInfo[start_nurse]) {
  437. dataInfo[start_nurse] = {
  438. child: [],
  439. start_nurse: item.start_nurse,
  440. }
  441. }
  442. })
  443. let list = Object.values(dataInfo)
  444. console.log("list222222",list)
  445. list.map(item=>{
  446. for(let i=0;i<dialysisCount.length;i++){
  447. if(item.start_nurse == dialysisCount[i].start_nurse){
  448. item.child.push(dialysisCount[i])
  449. }
  450. }
  451. })
  452. console.log("listq23333",list)
  453. this.modeList.push(...list)
  454. } else {
  455. this.loading = false
  456. }
  457. })
  458. .catch(error => {
  459. })
  460. },
  461. getTimestamp(time) {
  462. // 把时间日期转成时间戳
  463. return new Date(time).getTime() / 1000;
  464. },
  465. changeTime(val) {
  466. this.query.end_time = ''
  467. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time);
  468. if (time > 0) {
  469. this.$message.error("结束时间不能小于开始时间");
  470. this.query.start_time = "";
  471. } else {
  472. // this.getDialysisList()
  473. console.log(val)
  474. this.query.page = 1;
  475. this.query.start_time = val
  476. this.query.end_time = this.end_time
  477. this.monthValue = ''
  478. sessionStorage.setItem("nurse_start_time", val)
  479. sessionStorage.removeItem("nurseMonth");
  480. this.GetNurseWorkloadChartData(this.query)
  481. this.GetNurseWorkloadTableData(this.query)
  482. }
  483. },
  484. GetNurseWorkloadChartData(params) {
  485. this.bar.xAxis.data = []
  486. this.bar.series[0].data = []
  487. this.percent = []
  488. console.log("parasm",params)
  489. GetNurseWorkloadChartData(params)
  490. .then(rs => {
  491. var resp = rs.data
  492. console.log("图标数据",resp)
  493. if (resp.state == 1) {
  494. for (let i = 0; i < resp.data.data.length;i++){
  495. this.bar.xAxis.data.push(resp.data.data[i].user_name)
  496. if(this.query.statistics_type == 2){
  497. this.bar.series[0].data.push(resp.data.data[i].puncture_count)
  498. this.percent.push(resp.data.data[i].puncture_ratio)
  499. }else if(this.query.statistics_type == 1){
  500. this.bar.series[0].data.push(resp.data.data[i].cure_count)
  501. this.percent.push(resp.data.data[i].cure_ratio)
  502. }else if(this.query.statistics_type == 3){
  503. this.bar.series[0].data.push(resp.data.data[i].mission_count)
  504. this.percent.push(resp.data.data[i].mission_ratio)
  505. }else if(this.query.statistics_type == 4){
  506. this.bar.series[0].data.push(resp.data.data[i].change_nuser_count)
  507. this.percent.push(resp.data.data[i].change_nurse_ratio)
  508. }else if(this.query.statistics_type == 5){
  509. this.bar.series[0].data.push(resp.data.data[i].difficult_nuser_count)
  510. this.percent.push(resp.data.data[i].difficult_nurse_ratio)
  511. }else if(this.query.statistics_type == 6){
  512. this.bar.series[0].data.push(resp.data.data[i].new_nuser_count)
  513. this.percent.push(resp.data.data[i].new_nurse_ratio)
  514. }else if(this.query.statistics_type == 7){
  515. this.bar.series[0].data.push(resp.data.data[i].start_nuser_count)
  516. this.percent.push(resp.data.data[i].start_nurse_ratio)
  517. }
  518. }
  519. this.getArrLength(this.bar.xAxis.data)
  520. } else {
  521. }
  522. })
  523. .catch(error => {
  524. })
  525. },
  526. changeEndTime(val) {
  527. var time =
  528. this.getTimestamp(val) - this.getTimestamp(this.query.start_time);
  529. if (time < 0) {
  530. this.$message.error("结束时间不能小于开始时间");
  531. this.query.end_time = "";
  532. } else {
  533. this.query.start_time = this.start_time
  534. this.query.end_time = val
  535. this.monthValue = ''
  536. this.query.page = 1;
  537. sessionStorage.setItem("nurse_end_time", val)
  538. sessionStorage.removeItem("nurseMonth");
  539. this.GetNurseWorkloadChartData(this.query)
  540. this.GetNurseWorkloadTableData(this.query)
  541. }
  542. },
  543. handleClick() {
  544. if (this.activeName == "first") {
  545. this.$router.push({ path: "/qcd/workAnalysis/doctor" });
  546. }
  547. },
  548. getArrLength(result){
  549. if(result.length > 10){
  550. var dataZoom_end = (10/result.length)*100;
  551. this.bar.dataZoom[0].end = dataZoom_end
  552. }else{
  553. var dataZoom_end = 100;
  554. this.bar.dataZoom[0].end = dataZoom_end
  555. }
  556. },
  557. changeMonth(value){
  558. // console.log('monthStartTime',value.getTime() / 1000)
  559. sessionStorage.removeItem("nurse_start_time");
  560. sessionStorage.removeItem("nurse_end_time");
  561. let monthStartTime = value.getTime() / 1000
  562. var nowDate = new Date(value);
  563. var cloneNowDate = new Date(value);
  564. var fullYear = nowDate.getFullYear();
  565. var month = nowDate.getMonth() + 1; // getMonth 方法返回 0-11,代表1-12月
  566. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  567. let monthEndTime = this.getFullDate(cloneNowDate.setDate(endOfMonth))
  568. this.query.start_time = moment(new Date(monthStartTime * 1000)).format('YYYY-MM-DD')
  569. this.query.end_time = moment(new Date(monthEndTime)).format('YYYY-MM-DD')
  570. this.end_time = ''
  571. this.start_time = ''
  572. sessionStorage.setItem("nurseMonth", monthStartTime);
  573. this.GetNurseWorkloadChartData(this.query)
  574. this.GetNurseWorkloadTableData(this.query)
  575. },
  576. getFullDate(targetDate) {
  577. var D, y, m, d;
  578. if (targetDate) {
  579. D = new Date(targetDate);
  580. y = D.getFullYear();
  581. m = D.getMonth() + 1;
  582. d = D.getDate();
  583. } else {
  584. y = fullYear;
  585. m = month;
  586. d = date;
  587. }
  588. m = m > 9 ? m : '0' + m;
  589. d = d > 9 ? d : '0' + d;
  590. return y + '-' + m + '-' + d;
  591. },
  592. getTotalCount(adminuserid){
  593. console.log("adminuserid",adminuserid)
  594. console.log("333333",this.modeList)
  595. var name = ""
  596. for(let i=0;i<this.modeList.length;i++){
  597. for(let j=0;j<this.modeList[i].child.length;j++){
  598. if(adminuserid == this.modeList[i].child[j].start_nurse){
  599. name += (this.modeList[i].child[j].mode_id+"-"+this.modeList[i].child[j].Count) + "次"+"、"
  600. }
  601. }
  602. }
  603. console.log("name22222",name)
  604. return name.substr(0,name.length-1)
  605. }
  606. },
  607. created(){
  608. var date = new Date()
  609. var year = date.getFullYear() //获取完整的年份(4位)
  610. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  611. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  612. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  613. this.query.patient_id = 0
  614. this.query.end_time = year + '-' + month + '-' + day
  615. this.query.start_time = year + '-' + last_month + '-' + day
  616. this.query.statistics_type = 1
  617. this.start_time = year + '-' + last_month + '-' + day
  618. this.end_time = year + '-' + month + '-' + day
  619. if(sessionStorage.getItem("nurse_start_time") == null){
  620. sessionStorage.setItem("nurse_start_time", this.start_time);
  621. }else{
  622. this.start_time = sessionStorage.getItem("nurse_start_time")
  623. this.query.start_time = sessionStorage.getItem("nurse_start_time")
  624. }
  625. if(sessionStorage.getItem("nurse_end_time") == null){
  626. sessionStorage.setItem("nurse_end_time", this.end_time);
  627. }else{
  628. this.end_time = sessionStorage.getItem("nurse_end_time")
  629. this.query.end_time = sessionStorage.getItem("nurse_end_time")
  630. }
  631. if(sessionStorage.getItem("nurseMonth") != null){
  632. console.log("tjos")
  633. let value = parseInt(sessionStorage.getItem("nurseMonth")) * 1000
  634. let monthStartTime = new Date(value)
  635. this.monthValue = monthStartTime
  636. var nowDate = new Date(value);
  637. var cloneNowDate = new Date(value);
  638. var fullYear = nowDate.getFullYear();
  639. var month = nowDate.getMonth() + 1; // getMonth 方法返回 0-11,代表1-12月
  640. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  641. let monthEndTime = this.getFullDate(cloneNowDate.setDate(endOfMonth))
  642. this.query.start_time = moment(new Date(monthStartTime)).format('YYYY-MM-DD')
  643. this.query.end_time = moment(new Date(monthEndTime)).format('YYYY-MM-DD')
  644. this.start_time = ''
  645. this.end_time = ''
  646. }
  647. // console.log('this.query2',this.query)
  648. this.GetAllNurse()
  649. this.GetNurseWorkloadChartData(this.query)
  650. this.GetNurseWorkloadTableData(this.query)
  651. }
  652. };
  653. </script>
  654. <style lang="scss" scoped>
  655. .tableTitle {
  656. font-size: 16px;
  657. color: #000;
  658. font-weight: bold;
  659. margin-bottom: 10px;
  660. }
  661. </style>