nurse.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <div class="page_workAnalysis">
  8. <el-tabs v-model="activeName" @tab-click="handleClick">
  9. <el-tab-pane label="医生" name="first"></el-tab-pane>
  10. <el-tab-pane label="护士" name="second"></el-tab-pane>
  11. </el-tabs>
  12. <div class="cell clearfix">
  13. <el-select v-model="query.admin_user_id" placeholder="请选择" style="width:120px;margin-right:20px" @change="changeNurse"
  14. >
  15. <el-option
  16. v-for="item in nurse_options"
  17. :key="item.id"
  18. :label="item.user_name"
  19. :value="item.admin_user_id"
  20. ></el-option>
  21. </el-select>
  22. <el-select
  23. v-model="query.statistics_type"
  24. placeholder="请选择"
  25. @change="changeProject"
  26. style="width:120px;margin-right:20px"
  27. >
  28. <el-option
  29. v-for="item in project_options"
  30. :key="item.value"
  31. :label="item.name"
  32. :value="item.value"
  33. ></el-option>
  34. </el-select>
  35. <label class="title">
  36. <span class="name">日期查询</span> :
  37. </label>
  38. <el-date-picker
  39. v-model="query.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="query.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. </div>
  133. </div>
  134. </template>
  135. <script>
  136. import echarts from "echarts";
  137. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  138. import LineChart from "../../qcd/components/LineChart";
  139. import {GetNurseWorkloadChartData,GetNurseWorkloadTableData,GetAllAdminUser} from "@/api/common/statistics";
  140. export default {
  141. components: {
  142. BreadCrumb,
  143. LineChart
  144. },
  145. data() {
  146. return {
  147. percent:[],
  148. pickerOptions: {
  149. disabledDate(time) {
  150. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  151. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  152. }
  153. },
  154. tableData: [
  155. ],
  156. loading: false,
  157. total: '',
  158. query: {
  159. admin_user_id: 0,
  160. statistics_type: 1,
  161. start_time: "",
  162. end_time: "",
  163. limit:20,
  164. page:1,
  165. },
  166. nurse_options:[
  167. {id:0,user_name:"全部",admin_user_id:0}
  168. ],
  169. project_options:[
  170. {value:1, name:"治疗"},
  171. {value:2, name:"穿刺"},
  172. {value:3, name:"宣教/小结"},
  173. ],
  174. crumbs: [
  175. { path: false, name: "质控管理" },
  176. { path: false, name: "工作量分析统计" },
  177. { path: false, name: "医生" }
  178. ],
  179. activeName: "second",
  180. listQuery: {
  181. start_time: "",
  182. end_time: "",
  183. page: 1,
  184. limit: 10
  185. },
  186. value: "请选项",
  187. bar: {
  188. title: {
  189. text: "ECharts 入门示例"
  190. },
  191. tooltip: {},
  192. legend: {
  193. data: [],
  194. left: 0
  195. },
  196. xAxis: {
  197. data: []
  198. },
  199. yAxis: {
  200. axisLabel: {
  201. formatter: "{value} %"
  202. },
  203. show: false
  204. },
  205. series: [
  206. {
  207. name: "",
  208. type: "bar",
  209. data: [],
  210. barWidth: 30,
  211. label: {
  212. normal: {
  213. show: true,
  214. position: "top",
  215. formatter: (params) => {
  216. if(this.percent.length > 0){
  217. let str = ''
  218. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  219. return str
  220. }else{
  221. let str = ''
  222. str = params.data
  223. return str
  224. }
  225. }
  226. }
  227. },
  228. //配置样式
  229. itemStyle: {
  230. //通常情况下:
  231. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  232. normal: {
  233. color: function(params) {
  234. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  235. var colorList = [
  236. ["#A9E0F3", "#9FBDFC"],
  237. ["#FFD7C0", "#FF9994"]
  238. ];
  239. var index = params.dataIndex;
  240. if (params.dataIndex >= colorList.length) {
  241. index = params.dataIndex % colorList.length;
  242. }
  243. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  244. { offset: 0, color: colorList[index][0] },
  245. // { offset: 0.5, color: colorList[index][1] },
  246. { offset: 1, color: colorList[index][1] }
  247. ]);
  248. },
  249. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  250. },
  251. //鼠标悬停时:
  252. emphasis: {
  253. shadowBlur: 10,
  254. shadowOffsetX: 0,
  255. shadowColor: "rgba(0, 0, 0, 0.5)"
  256. }
  257. }
  258. }
  259. ],
  260. dataZoom: [
  261. {
  262. // Y轴固定,让内容滚动
  263. type: 'slider',
  264. show: false,
  265. xAxisIndex: [0],
  266. start: 1,
  267. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  268. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  269. },
  270. {
  271. type: 'inside',
  272. xAxisIndex: [0],
  273. start: 1,
  274. end: 20,
  275. zoomLock: true // 锁定区域禁止缩放
  276. }
  277. ]
  278. }
  279. };
  280. },
  281. methods: {
  282. changeNurse(val){
  283. this.query.admin_user_id = val
  284. this.query.page = 1
  285. this.GetNurseWorkloadChartData(this.query)
  286. this.GetNurseWorkloadTableData(this.query)
  287. },
  288. GetAllNurse(){
  289. GetAllAdminUser().then(response => {
  290. if (response.data.state == 1) {
  291. var adminUser = response.data.data.admin
  292. this.admin_user = adminUser
  293. for (let i = 0; i < adminUser.length; i++){
  294. if(adminUser[i].user_type == 3){
  295. this.nurse_options.push(adminUser[i])
  296. }
  297. }
  298. } else {
  299. this.$message.error('请求数据失败')
  300. return false
  301. }
  302. })
  303. },
  304. changeProject(val){
  305. this.query.statistics_type = val
  306. this.query.page = 1
  307. this.GetNurseWorkloadChartData(this.query)
  308. // this.GetDialysisProcessIndexTableData(this.query)
  309. },
  310. handleSizeChange(limit) {
  311. this.query.limit = limit;
  312. this.GetNurseWorkloadTableData(this.query)
  313. },
  314. handleCurrentChange(page) {
  315. this.query.page = page;
  316. this.GetNurseWorkloadTableData(this.query)
  317. },GetNurseWorkloadTableData(params) {
  318. this.loading = true
  319. this.tableData = []
  320. GetNurseWorkloadTableData(params)
  321. .then(rs => {
  322. var resp = rs.data
  323. if (resp.state == 1) {
  324. let total_cure = 0
  325. let total_puncture = 0
  326. let total_mission = 0
  327. this.loading = false
  328. for (let i = 0; i < resp.data.data.length; i++) {
  329. total_cure = total_cure + resp.data.data[i].cure_count
  330. total_puncture = total_puncture + resp.data.data[i].puncture_count
  331. total_mission = total_mission + resp.data.data[i].mission_count
  332. this.tableData.push(resp.data.data[i])
  333. }
  334. this.tableData.push( {
  335. user_name:"合计",
  336. cure_count:total_cure,
  337. puncture_count:total_puncture,
  338. mission_count:total_mission
  339. })
  340. } else {
  341. this.loading = false
  342. }
  343. })
  344. .catch(error => {
  345. })
  346. },
  347. getTimestamp(time) {
  348. // 把时间日期转成时间戳
  349. return new Date(time).getTime() / 1000;
  350. },
  351. changeTime(val) {
  352. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time);
  353. if (time > 0) {
  354. this.$message.error("结束时间不能小于开始时间");
  355. this.query.start_time = "";
  356. } else {
  357. // this.getDialysisList()
  358. this.query.page = 1;
  359. this.GetNurseWorkloadChartData(this.query)
  360. this.GetNurseWorkloadTableData(this.query)
  361. }
  362. }, GetNurseWorkloadChartData(params) {
  363. this.bar.xAxis.data = []
  364. this.bar.series[0].data = []
  365. this.percent = []
  366. GetNurseWorkloadChartData(params)
  367. .then(rs => {
  368. var resp = rs.data
  369. if (resp.state == 1) {
  370. for (let i = 0; i < resp.data.data.length;i++){
  371. this.bar.xAxis.data.push(resp.data.data[i].user_name)
  372. if(this.query.statistics_type == 2){
  373. this.bar.series[0].data.push(resp.data.data[i].puncture_count)
  374. this.percent.push(resp.data.data[i].puncture_ratio)
  375. }else if(this.query.statistics_type == 1){
  376. this.bar.series[0].data.push(resp.data.data[i].cure_count)
  377. this.percent.push(resp.data.data[i].cure_ratio)
  378. }else if(this.query.statistics_type == 3){
  379. this.bar.series[0].data.push(resp.data.data[i].mission_count)
  380. this.percent.push(resp.data.data[i].mission_ratio)
  381. }
  382. }
  383. this.getArrLength(this.bar.xAxis.data)
  384. } else {
  385. }
  386. })
  387. .catch(error => {
  388. })
  389. },
  390. changeEndTime(val) {
  391. var time =
  392. this.getTimestamp(val) - this.getTimestamp(this.query.start_time);
  393. if (time < 0) {
  394. this.$message.error("结束时间不能小于开始时间");
  395. this.query.end_time = "";
  396. } else {
  397. this.query.page = 1;
  398. this.GetNurseWorkloadChartData(this.query)
  399. this.GetNurseWorkloadTableData(this.query)
  400. }
  401. },
  402. handleClick() {
  403. if (this.activeName == "first") {
  404. this.$router.push({ path: "/qcd/workAnalysis/doctor" });
  405. }
  406. },
  407. getArrLength(result){
  408. if(result.length > 10){
  409. var dataZoom_end = (10/result.length)*100;
  410. this.bar.dataZoom[0].end = dataZoom_end
  411. }else{
  412. var dataZoom_end = 100;
  413. this.bar.dataZoom[0].end = dataZoom_end
  414. }
  415. }
  416. },created(){
  417. var date = new Date()
  418. var year = date.getFullYear() //获取完整的年份(4位)
  419. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  420. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  421. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  422. this.query.patient_id = 0
  423. this.query.end_time = year + '-' + month + '-' + day
  424. this.query.start_time = year + '-' + last_month + '-' + day
  425. this.query.statistics_type = 1
  426. this.GetAllNurse()
  427. this.GetNurseWorkloadChartData(this.query)
  428. this.GetNurseWorkloadTableData(this.query)
  429. }
  430. };
  431. </script>
  432. <style lang="scss" scoped>
  433. .tableTitle {
  434. font-size: 16px;
  435. color: #000;
  436. font-weight: bold;
  437. margin-bottom: 10px;
  438. }
  439. </style>