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

nurse.vue 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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.mission_count?scope.row.mission_count:''}}
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="合计" align="center">
  125. <template slot-scope="scope">
  126. {{scope.row.puncture_count + scope.row.cure_count + scope.row.mission_count ?scope.row.puncture_count + scope.row.cure_count + scope.row.mission_count:''}}
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. </div>
  131. </div>
  132. </template>
  133. <script>
  134. const moment = require('moment')
  135. import echarts from "echarts";
  136. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  137. import LineChart from "../../qcd/components/LineChart";
  138. import {GetNurseWorkloadChartData,GetNurseWorkloadTableData,GetAllAdminUser} from "@/api/common/statistics";
  139. export default {
  140. components: {
  141. BreadCrumb,
  142. LineChart
  143. },
  144. data() {
  145. return {
  146. percent:[],
  147. pickerOptions: {
  148. disabledDate(time) {
  149. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  150. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  151. }
  152. },
  153. tableData: [
  154. ],
  155. loading: false,
  156. total: '',
  157. query: {
  158. admin_user_id: 0,
  159. statistics_type: 1,
  160. start_time: "",
  161. end_time: "",
  162. limit:20,
  163. page:1,
  164. },
  165. start_time:'',
  166. end_time:'',
  167. monthValue:'',
  168. nurse_options:[
  169. {id:0,user_name:"全部",admin_user_id:0}
  170. ],
  171. project_options:[
  172. {value:1, name:"治疗"},
  173. {value:2, name:"穿刺"},
  174. {value:3, name:"宣教/小结"},
  175. ],
  176. crumbs: [
  177. { path: false, name: "质控管理" },
  178. { path: false, name: "工作量分析统计" },
  179. { path: false, name: "护士" }
  180. ],
  181. activeName: "second",
  182. listQuery: {
  183. start_time: "",
  184. end_time: "",
  185. page: 1,
  186. limit: 10
  187. },
  188. value: "请选项",
  189. bar: {
  190. title: {
  191. text: "ECharts 入门示例"
  192. },
  193. tooltip: {},
  194. legend: {
  195. data: [],
  196. left: 0
  197. },
  198. xAxis: {
  199. data: []
  200. },
  201. yAxis: {
  202. axisLabel: {
  203. formatter: "{value} %"
  204. },
  205. show: false
  206. },
  207. series: [
  208. {
  209. name: "",
  210. type: "bar",
  211. data: [],
  212. barWidth: 30,
  213. label: {
  214. normal: {
  215. show: true,
  216. position: "top",
  217. formatter: (params) => {
  218. if(this.percent.length > 0){
  219. let str = ''
  220. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  221. return str
  222. }else{
  223. let str = ''
  224. str = params.data
  225. return str
  226. }
  227. }
  228. }
  229. },
  230. //配置样式
  231. itemStyle: {
  232. //通常情况下:
  233. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  234. normal: {
  235. color: function(params) {
  236. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  237. var colorList = [
  238. ["#A9E0F3", "#9FBDFC"],
  239. ["#FFD7C0", "#FF9994"]
  240. ];
  241. var index = params.dataIndex;
  242. if (params.dataIndex >= colorList.length) {
  243. index = params.dataIndex % colorList.length;
  244. }
  245. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  246. { offset: 0, color: colorList[index][0] },
  247. // { offset: 0.5, color: colorList[index][1] },
  248. { offset: 1, color: colorList[index][1] }
  249. ]);
  250. },
  251. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  252. },
  253. //鼠标悬停时:
  254. emphasis: {
  255. shadowBlur: 10,
  256. shadowOffsetX: 0,
  257. shadowColor: "rgba(0, 0, 0, 0.2)"
  258. }
  259. }
  260. }
  261. ],
  262. dataZoom: [
  263. {
  264. // Y轴固定,让内容滚动
  265. type: 'slider',
  266. show: false,
  267. xAxisIndex: [0],
  268. start: 1,
  269. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  270. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  271. },
  272. {
  273. type: 'inside',
  274. xAxisIndex: [0],
  275. start: 1,
  276. end: 20,
  277. zoomLock: true // 锁定区域禁止缩放
  278. }
  279. ]
  280. }
  281. };
  282. },
  283. methods: {
  284. changeNurse(val){
  285. this.query.admin_user_id = val
  286. this.query.page = 1
  287. this.GetNurseWorkloadChartData(this.query)
  288. this.GetNurseWorkloadTableData(this.query)
  289. },
  290. GetAllNurse(){
  291. GetAllAdminUser().then(response => {
  292. if (response.data.state == 1) {
  293. var adminUser = response.data.data.admin
  294. this.admin_user = adminUser
  295. for (let i = 0; i < adminUser.length; i++){
  296. if(adminUser[i].user_type == 3){
  297. this.nurse_options.push(adminUser[i])
  298. }
  299. }
  300. } else {
  301. this.$message.error('请求数据失败')
  302. return false
  303. }
  304. })
  305. },
  306. changeProject(val){
  307. this.query.statistics_type = val
  308. this.query.page = 1
  309. this.GetNurseWorkloadChartData(this.query)
  310. // this.GetDialysisProcessIndexTableData(this.query)
  311. },
  312. handleSizeChange(limit) {
  313. this.query.limit = limit;
  314. this.GetNurseWorkloadTableData(this.query)
  315. },
  316. handleCurrentChange(page) {
  317. this.query.page = page;
  318. this.GetNurseWorkloadTableData(this.query)
  319. },GetNurseWorkloadTableData(params) {
  320. this.loading = true
  321. this.tableData = []
  322. GetNurseWorkloadTableData(params)
  323. .then(rs => {
  324. var resp = rs.data
  325. if (resp.state == 1) {
  326. let total_cure = 0
  327. let total_puncture = 0
  328. let total_mission = 0
  329. this.loading = false
  330. for (let i = 0; i < resp.data.data.length; i++) {
  331. total_cure = total_cure + resp.data.data[i].cure_count
  332. total_puncture = total_puncture + resp.data.data[i].puncture_count
  333. total_mission = total_mission + resp.data.data[i].mission_count
  334. this.tableData.push(resp.data.data[i])
  335. }
  336. this.tableData.push( {
  337. user_name:"合计",
  338. cure_count:total_cure,
  339. puncture_count:total_puncture,
  340. mission_count:total_mission
  341. })
  342. } else {
  343. this.loading = false
  344. }
  345. })
  346. .catch(error => {
  347. })
  348. },
  349. getTimestamp(time) {
  350. // 把时间日期转成时间戳
  351. return new Date(time).getTime() / 1000;
  352. },
  353. changeTime(val) {
  354. this.query.end_time = ''
  355. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time);
  356. if (time > 0) {
  357. this.$message.error("结束时间不能小于开始时间");
  358. this.query.start_time = "";
  359. } else {
  360. // this.getDialysisList()
  361. console.log(val)
  362. this.query.page = 1;
  363. this.query.start_time = val
  364. this.query.end_time = this.end_time
  365. this.monthValue = ''
  366. sessionStorage.setItem("nurse_start_time", val)
  367. sessionStorage.removeItem("nurseMonth");
  368. this.GetNurseWorkloadChartData(this.query)
  369. this.GetNurseWorkloadTableData(this.query)
  370. }
  371. }, GetNurseWorkloadChartData(params) {
  372. this.bar.xAxis.data = []
  373. this.bar.series[0].data = []
  374. this.percent = []
  375. GetNurseWorkloadChartData(params)
  376. .then(rs => {
  377. var resp = rs.data
  378. if (resp.state == 1) {
  379. for (let i = 0; i < resp.data.data.length;i++){
  380. this.bar.xAxis.data.push(resp.data.data[i].user_name)
  381. if(this.query.statistics_type == 2){
  382. this.bar.series[0].data.push(resp.data.data[i].puncture_count)
  383. this.percent.push(resp.data.data[i].puncture_ratio)
  384. }else if(this.query.statistics_type == 1){
  385. this.bar.series[0].data.push(resp.data.data[i].cure_count)
  386. this.percent.push(resp.data.data[i].cure_ratio)
  387. }else if(this.query.statistics_type == 3){
  388. this.bar.series[0].data.push(resp.data.data[i].mission_count)
  389. this.percent.push(resp.data.data[i].mission_ratio)
  390. }
  391. }
  392. this.getArrLength(this.bar.xAxis.data)
  393. } else {
  394. }
  395. })
  396. .catch(error => {
  397. })
  398. },
  399. changeEndTime(val) {
  400. var time =
  401. this.getTimestamp(val) - this.getTimestamp(this.query.start_time);
  402. if (time < 0) {
  403. this.$message.error("结束时间不能小于开始时间");
  404. this.query.end_time = "";
  405. } else {
  406. this.query.start_time = this.start_time
  407. this.query.end_time = val
  408. this.monthValue = ''
  409. this.query.page = 1;
  410. sessionStorage.setItem("nurse_end_time", val)
  411. sessionStorage.removeItem("nurseMonth");
  412. this.GetNurseWorkloadChartData(this.query)
  413. this.GetNurseWorkloadTableData(this.query)
  414. }
  415. },
  416. handleClick() {
  417. if (this.activeName == "first") {
  418. this.$router.push({ path: "/qcd/workAnalysis/doctor" });
  419. }
  420. },
  421. getArrLength(result){
  422. if(result.length > 10){
  423. var dataZoom_end = (10/result.length)*100;
  424. this.bar.dataZoom[0].end = dataZoom_end
  425. }else{
  426. var dataZoom_end = 100;
  427. this.bar.dataZoom[0].end = dataZoom_end
  428. }
  429. },
  430. changeMonth(value){
  431. // console.log('monthStartTime',value.getTime() / 1000)
  432. sessionStorage.removeItem("nurse_start_time");
  433. sessionStorage.removeItem("nurse_end_time");
  434. let monthStartTime = value.getTime() / 1000
  435. var nowDate = new Date(value);
  436. var cloneNowDate = new Date(value);
  437. var fullYear = nowDate.getFullYear();
  438. var month = nowDate.getMonth() + 1; // getMonth 方法返回 0-11,代表1-12月
  439. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  440. let monthEndTime = this.getFullDate(cloneNowDate.setDate(endOfMonth))
  441. this.query.start_time = moment(new Date(monthStartTime * 1000)).format('YYYY-MM-DD')
  442. this.query.end_time = moment(new Date(monthEndTime)).format('YYYY-MM-DD')
  443. this.end_time = ''
  444. this.start_time = ''
  445. sessionStorage.setItem("nurseMonth", monthStartTime);
  446. this.GetNurseWorkloadChartData(this.query)
  447. this.GetNurseWorkloadTableData(this.query)
  448. },
  449. getFullDate(targetDate) {
  450. var D, y, m, d;
  451. if (targetDate) {
  452. D = new Date(targetDate);
  453. y = D.getFullYear();
  454. m = D.getMonth() + 1;
  455. d = D.getDate();
  456. } else {
  457. y = fullYear;
  458. m = month;
  459. d = date;
  460. }
  461. m = m > 9 ? m : '0' + m;
  462. d = d > 9 ? d : '0' + d;
  463. return y + '-' + m + '-' + d;
  464. },
  465. },created(){
  466. var date = new Date()
  467. var year = date.getFullYear() //获取完整的年份(4位)
  468. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  469. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  470. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  471. this.query.patient_id = 0
  472. this.query.end_time = year + '-' + month + '-' + day
  473. this.query.start_time = year + '-' + last_month + '-' + day
  474. this.query.statistics_type = 1
  475. this.start_time = year + '-' + last_month + '-' + day
  476. this.end_time = year + '-' + month + '-' + day
  477. if(sessionStorage.getItem("nurse_start_time") == null){
  478. sessionStorage.setItem("nurse_start_time", this.start_time);
  479. }else{
  480. this.start_time = sessionStorage.getItem("nurse_start_time")
  481. this.query.start_time = sessionStorage.getItem("nurse_start_time")
  482. }
  483. if(sessionStorage.getItem("nurse_end_time") == null){
  484. sessionStorage.setItem("nurse_end_time", this.end_time);
  485. }else{
  486. this.end_time = sessionStorage.getItem("nurse_end_time")
  487. this.query.end_time = sessionStorage.getItem("nurse_end_time")
  488. }
  489. if(sessionStorage.getItem("nurseMonth") != null){
  490. console.log("tjos")
  491. let value = parseInt(sessionStorage.getItem("nurseMonth")) * 1000
  492. let monthStartTime = new Date(value)
  493. this.monthValue = monthStartTime
  494. var nowDate = new Date(value);
  495. var cloneNowDate = new Date(value);
  496. var fullYear = nowDate.getFullYear();
  497. var month = nowDate.getMonth() + 1; // getMonth 方法返回 0-11,代表1-12月
  498. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  499. let monthEndTime = this.getFullDate(cloneNowDate.setDate(endOfMonth))
  500. this.query.start_time = moment(new Date(monthStartTime)).format('YYYY-MM-DD')
  501. this.query.end_time = moment(new Date(monthEndTime)).format('YYYY-MM-DD')
  502. this.start_time = ''
  503. this.end_time = ''
  504. }
  505. // console.log('this.query2',this.query)
  506. this.GetAllNurse()
  507. this.GetNurseWorkloadChartData(this.query)
  508. this.GetNurseWorkloadTableData(this.query)
  509. }
  510. };
  511. </script>
  512. <style lang="scss" scoped>
  513. .tableTitle {
  514. font-size: 16px;
  515. color: #000;
  516. font-weight: bold;
  517. margin-bottom: 10px;
  518. }
  519. </style>