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

patientInspectionDetail.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button type="primary" @click="$router.back(-1)">返回</el-button>
  6. </div>
  7. <div class="app-container">
  8. <div class="cell clearfix">
  9. <label class="title">
  10. <span class="name">日期</span> :
  11. </label>
  12. <div class="time">
  13. <ul class>
  14. <li
  15. :class="item.state == stateType ? 'active' : ''"
  16. @click="selectStateType(item.state)"
  17. v-for="item in month"
  18. :key="item.value"
  19. >{{ item.label }}
  20. </li>
  21. </ul>
  22. </div>
  23. <el-date-picker
  24. v-if="stateType == 5"
  25. v-model="query.start_time"
  26. prefix-icon="el-icon-date"
  27. @change="changeTime"
  28. :editable="false"
  29. style="width: 196px;"
  30. type="date"
  31. placeholder="选择日期时间"
  32. align="right"
  33. format="yyyy-MM-dd"
  34. value-format="yyyy-MM-dd"
  35. :picker-options="pickerOptions"
  36. ></el-date-picker>
  37. <span v-if="stateType == 5"
  38. class>-</span>
  39. <el-date-picker
  40. v-if="stateType == 5"
  41. v-model="query.end_time"
  42. prefix-icon="el-icon-date"
  43. @change="changeEndTime"
  44. :editable="false"
  45. style="width: 196px;"
  46. type="date"
  47. placeholder="选择日期时间"
  48. align="right"
  49. format="yyyy-MM-dd"
  50. value-format="yyyy-MM-dd"
  51. :picker-options="pickerOptions"
  52. ></el-date-picker>
  53. </div>
  54. <el-container>
  55. <div style="width:150px">
  56. <div class="tableTitle">患者列表</div>
  57. <div class="tableTitle">当前患者: {{patient_name}}</div>
  58. <el-table ref="table" :data="patientsData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }"
  59. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  60. highlight-current-row
  61. @current-change="handleChange">
  62. <el-table-column prop="dialysis_no" label="透析号" width="80">
  63. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  64. </el-table-column>
  65. <el-table-column prop="name" label="姓名" width="80">
  66. <template slot-scope="scope">{{ scope.row.name }}</template>
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. <div style="padding-left:10px;flex:1">
  71. <div class="tableTitle">统计图</div>
  72. <div>
  73. <!--<line-chart :options="options2"></line-chart>-->
  74. <line-chart :options="options2"></line-chart>
  75. </div>
  76. </div>
  77. </el-container>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. const moment = require('moment')
  83. import echarts from 'echarts'
  84. import LineChart from '../../qcd/components/LineChart'
  85. import { uParseTime } from '@/utils/tools'
  86. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  87. import { getCurrentOrgPatients } from '@/api/common/common'
  88. import {
  89. GetDefalutPatient,
  90. GetInspectionIndexChart,
  91. GetInspectionIndexInit,
  92. GetInspectionIndexTable,
  93. GetPatientInspectionIndexBarChart,
  94. GetPatientInspectionIndexChart,
  95. GetRangeValue
  96. } from '@/api/common/statistics'
  97. export default {
  98. name: 'dialysisTotal',
  99. components: {
  100. LineChart,
  101. BreadCrumb
  102. },
  103. data() {
  104. return {
  105. custom_chart_data_color: [],
  106. patient_name:"",
  107. options2: {
  108. title: {
  109. text: 'ECharts 入门示例'
  110. },
  111. tooltip: {},
  112. legend: {
  113. data: ['次数'],
  114. left: 0
  115. },
  116. xAxis: {
  117. data: [],
  118. axisLine: {
  119. lineStyle: {
  120. color: '#FF0000',
  121. width: 8 //这里是为了突出显示加上的
  122. }
  123. },
  124. axisLabel: {
  125. interval: 0,
  126. formatter: function(value) {
  127. var ret = '' //拼接加\n返回的类目项
  128. var maxLength = 8 //每项显示文字个数
  129. var valLength = value.length //X轴类目项的文字个数
  130. var rowN = Math.ceil(valLength / maxLength) //类目项需要换行的行数
  131. if (rowN > 1) {
  132. //如果类目项的文字大于3,
  133. for (var i = 0; i < rowN; i++) {
  134. var temp = '' //每次截取的字符串
  135. var start = i * maxLength //开始截取的位置
  136. var end = start + maxLength //结束截取的位置
  137. //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
  138. temp = value.substring(start, end) + '\n'
  139. ret += temp //凭借最终的字符串
  140. }
  141. return ret
  142. } else {
  143. return value
  144. }
  145. }
  146. }
  147. },
  148. yAxis: {
  149. axisLabel: {
  150. formatter: '{value} %'
  151. },
  152. show: false,
  153. axisLine: {
  154. lineStyle: {
  155. color: '#00FF00',
  156. width: 8 //这里是为了突出显示加上的
  157. }
  158. }
  159. },
  160. series: [
  161. {
  162. name: '',
  163. type: 'line',
  164. data: [],
  165. barWidth: 30,
  166. label: {
  167. normal: {
  168. show: true,
  169. position: 'top',
  170. formatter: '{c}'
  171. }
  172. },
  173. //配置样式
  174. itemStyle: {
  175. //通常情况下:
  176. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  177. normal: {
  178. color: function(params) {
  179. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  180. var colorList = [
  181. ['#A9E0F3', '#9FBDFC'],
  182. ['#FFD7C0', '#FF9994']
  183. ]
  184. var index = params.dataIndex
  185. if (params.dataIndex >= colorList.length) {
  186. index = params.dataIndex % colorList.length
  187. }
  188. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  189. { offset: 0, color: colorList[index][0] },
  190. // { offset: 0.5, color: colorList[index][1] },
  191. { offset: 1, color: colorList[index][1] }
  192. ])
  193. },
  194. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  195. },
  196. //鼠标悬停时:
  197. emphasis: {
  198. shadowBlur: 10,
  199. shadowOffsetX: 0,
  200. shadowColor: 'rgba(0, 0, 0, 0.5)'
  201. }
  202. }
  203. }
  204. ]
  205. },
  206. query: {
  207. patient_id: this.$route.query.patient_id,
  208. start_time: '',
  209. end_time: '',
  210. limit: 20,
  211. page: 1,
  212. project_id: this.$route.query.project_id,
  213. item_id: this.$route.query.item_id,
  214. range_type: this.$route.query.range_type,
  215. range_value: ''
  216. },
  217. patientsData: [],
  218. pickerOptions: {
  219. disabledDate(time) {
  220. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  221. return time.getTime() > Date.now() || time.getTime() < threeMonths
  222. }
  223. },
  224. crumbs: [
  225. { path: false, name: '质控管理' },
  226. { path: false, name: '基本信息统计' }
  227. ],
  228. listQuery: {
  229. start_time: '',
  230. end_time: '',
  231. page: 1,
  232. limit: 10
  233. },
  234. stateType: 1,
  235. month: [
  236. { value: 1, label: '近一个月', state: 1 },
  237. { value: 2, label: '近三个月', state: 2 },
  238. { value: 3, label: '近半年', state: 3 },
  239. { value: 4, label: '近一年', state: 4 },
  240. { value: 5, label: '自定义', state: 5 }
  241. ]
  242. }
  243. },
  244. methods: {
  245. selectStateType(val) {
  246. this.stateType = val
  247. switch (val) {
  248. case 1: //本月
  249. this.query.start_time = moment().subtract('month', 1).format('YYYY-MM-DD')
  250. // 本月的结束时间
  251. this.query.end_time = moment(new Date()).format('YYYY-MM-DD')
  252. this.query.patient_id = this.$route.query.patient_id
  253. this.query.project_id = this.$route.query.project_id
  254. this.query.item_id = this.$route.query.item_id
  255. this.query.range_type = this.$route.query.range_type
  256. this.GetPatientInspectionIndexChart(this.query)
  257. break
  258. case 2: //近3个月
  259. const startDate = moment().subtract('month', 3).format('YYYY-MM-DD')
  260. this.query.start_time = startDate
  261. const endDate = moment(new Date()).format('YYYY-MM-DD')
  262. this.query.patient_id = this.$route.query.patient_id
  263. this.query.project_id = this.$route.query.project_id
  264. this.query.item_id = this.$route.query.item_id
  265. this.query.range_type = this.$route.query.range_type
  266. this.GetPatientInspectionIndexChart(this.query)
  267. break
  268. case 3: //近半年
  269. this.query.start_time = moment().subtract('month', 6).format('YYYY-MM-DD')
  270. this.query.end_time = moment(new Date()).format('YYYY-MM-DD')
  271. this.query.patient_id = this.$route.query.patient_id
  272. this.query.project_id = this.$route.query.project_id
  273. this.query.item_id = this.$route.query.item_id
  274. this.query.range_type = this.$route.query.range_type
  275. this.GetPatientInspectionIndexChart(this.query)
  276. break
  277. case 4: //近一年
  278. this.query.start_time = moment().subtract('month', 12).format('YYYY-MM-DD')
  279. this.query.end_time = moment(new Date()).format('YYYY-MM-DD')
  280. this.query.patient_id = this.$route.query.patient_id
  281. this.query.project_id = this.$route.query.project_id
  282. this.query.item_id = this.$route.query.item_id
  283. this.query.range_type = this.$route.query.range_type
  284. this.GetPatientInspectionIndexChart(this.query)
  285. break
  286. case 5: //自定义
  287. this.query.start_time = moment().subtract('month', 1).format('YYYY-MM-DD')
  288. // 本月的结束时间
  289. this.query.end_time = moment(new Date()).format('YYYY-MM-DD')
  290. this.query.patient_id = this.$route.query.patient_id
  291. this.query.project_id = this.$route.query.project_id
  292. this.query.item_id = this.$route.query.item_id
  293. this.query.range_type = this.$route.query.range_type
  294. this.GetPatientInspectionIndexChart(this.query)
  295. break
  296. }
  297. },
  298. getCurrentOrgPatients() {
  299. getCurrentOrgPatients().then(response => {
  300. if (response.data.state == 1) {
  301. var patients = response.data.data.patients
  302. this.patientsData = patients
  303. for (let i = 0;i < this.patientsData.length; i++){
  304. if (this.patientsData[i].id == this.query.patient_id){
  305. this.patient_name = this.patientsData[i].name
  306. this.$refs.table.setCurrentRow(this.patientsData[i])
  307. }
  308. }
  309. }
  310. })
  311. }, handleChange(val) {
  312. this.query.patient_id = val.id
  313. this.query.page = 1
  314. this.patient_name = val.name
  315. this.GetPatientInspectionIndexChart(this.query)
  316. }, changeTime(val) {
  317. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time)
  318. if (time > 0) {
  319. this.$message.error('结束时间不能小于开始时间')
  320. } else {
  321. console.log(this.query)
  322. this.GetPatientInspectionIndexChart(this.query)
  323. }
  324. },
  325. changeEndTime(val) {
  326. var time =
  327. this.getTimestamp(val) - this.getTimestamp(this.query.start_time)
  328. if (time < 0) {
  329. this.$message.error('结束时间不能小于开始时间')
  330. } else {
  331. console.log(this.query)
  332. this.GetPatientInspectionIndexChart(this.query)
  333. }
  334. },
  335. GetPatientInspectionIndexChart(params) {
  336. this.options2.xAxis.data = []
  337. this.options2.series[0].data = []
  338. GetPatientInspectionIndexChart(params)
  339. .then(rs => {
  340. var resp = rs.data
  341. if (resp.state == 1) {
  342. let tempData = []
  343. let otherData = []
  344. for (let i = 0; i < resp.data.data.length; i++) {
  345. this.options2.xAxis.data.push(resp.data.data[i].date)
  346. if (this.query.range_type == 1) {
  347. this.options2.series[0].data.push(resp.data.data[i].value)
  348. } else {
  349. this.options2.series[0].data.push('1')
  350. tempData.push(resp.data.data[i].value)
  351. otherData.push(resp.data.data[i].value)
  352. }
  353. }
  354. //获取无法确定选项的颜色
  355. if (this.query.range_type == 2) {
  356. //去重复
  357. let obj = {}
  358. tempData = tempData.reduce((cur, next) => {
  359. obj[next] ? '' : (obj[next] = true && cur.push(next))
  360. return cur
  361. }, [])
  362. //随机获取颜色值
  363. let newObj = {}
  364. for (let i = 0; i < tempData.length; i++) {
  365. newObj[tempData[i]] = this.getColor()
  366. }
  367. //匹配对应的颜色值
  368. for (let i = 0; i < otherData.length; i++) {
  369. for (let key in newObj) {
  370. if (otherData[i] === key) {
  371. this.custom_chart_data_color.push(newObj[key])
  372. }
  373. }
  374. }
  375. }
  376. } else {
  377. }
  378. })
  379. .catch(error => {
  380. })
  381. }, getTimestamp(time) {
  382. // 把时间日期转成时间戳
  383. return new Date(time).getTime() / 1000;
  384. },
  385. },
  386. created() {
  387. this.getCurrentOrgPatients()
  388. this.query.start_time = moment().subtract('month', 1).format('YYYY-MM-DD')
  389. this.query.end_time = moment(new Date()).format('YYYY-MM-DD')
  390. this.query.patient_id = this.$route.query.patient_id
  391. this.query.project_id = this.$route.query.project_id
  392. this.query.item_id = this.$route.query.item_id
  393. this.query.range_type = this.$route.query.range_type
  394. this.GetPatientInspectionIndexChart(this.query)
  395. }
  396. }
  397. </script>
  398. <style rel="stylesheet/scss" lang="scss" scoped>
  399. .tableTitle {
  400. font-size: 16px;
  401. color: #000;
  402. font-weight: bold;
  403. margin-bottom: 10px;
  404. }
  405. .infoBox {
  406. display: flex;
  407. flex-wrap: wrap;
  408. .infoOne {
  409. margin-right: 30px;
  410. margin-top: 30px;
  411. .titleBox {
  412. display: flex;
  413. align-items: center;
  414. }
  415. .point {
  416. display: inline-block;
  417. width: 7px;
  418. height: 7px;
  419. background: linear-gradient(
  420. 90deg,
  421. rgba(169, 224, 243, 1),
  422. rgba(159, 189, 252, 1)
  423. );
  424. border-radius: 50%;
  425. }
  426. .point1 {
  427. width: 7px;
  428. height: 7px;
  429. background: linear-gradient(
  430. 90deg,
  431. rgba(255, 215, 192, 1),
  432. rgba(255, 153, 148, 1)
  433. );
  434. border-radius: 50%;
  435. }
  436. .point2 {
  437. width: 7px;
  438. height: 7px;
  439. background: linear-gradient(
  440. 90deg,
  441. rgba(215, 195, 253, 1),
  442. rgba(179, 168, 247, 1)
  443. );
  444. border-radius: 50%;
  445. }
  446. .infoTitle {
  447. font-size: 16px;
  448. font-weight: bold;
  449. margin-left: 5px;
  450. color: #000;
  451. }
  452. .borderBox {
  453. width: 340px;
  454. min-height: 140px;
  455. background: rgba(255, 255, 255, 1);
  456. border: 1px solid rgba(229, 229, 229, 1);
  457. border-radius: 10px;
  458. padding: 0 14px 20px;
  459. margin-top: 10px;
  460. p {
  461. font-size: 14px;
  462. color: #000;
  463. margin: 10px 0 3px;
  464. }
  465. }
  466. .borderBox1 {
  467. width: 340px;
  468. min-height: 140px;
  469. background: rgba(255, 255, 255, 1);
  470. border: 1px solid rgba(229, 229, 229, 1);
  471. border-radius: 10px;
  472. padding: 0 14px 20px;
  473. margin-top: 10px;
  474. p {
  475. font-size: 14px;
  476. color: #000;
  477. margin: 10px 0 3px;
  478. }
  479. }
  480. .borderBox2 {
  481. width: 340px;
  482. min-height: 140px;
  483. background: rgba(255, 255, 255, 1);
  484. border: 1px solid rgba(229, 229, 229, 1);
  485. border-radius: 10px;
  486. padding: 0 14px 20px;
  487. margin-top: 10px;
  488. p {
  489. font-size: 14px;
  490. color: #000;
  491. margin: 10px 0 3px;
  492. }
  493. }
  494. }
  495. }
  496. </style>
  497. <style lang="scss">
  498. .infoBox {
  499. .infoOne {
  500. .borderBox {
  501. .el-progress-bar__inner {
  502. background: linear-gradient(
  503. 90deg,
  504. rgba(169, 224, 243, 1),
  505. rgba(159, 189, 252, 1)
  506. );
  507. }
  508. .el-progress-bar {
  509. margin-right: -59px;
  510. padding-right: 60px;
  511. }
  512. }
  513. .borderBox1 {
  514. .el-progress-bar__inner {
  515. background: linear-gradient(
  516. 90deg,
  517. rgba(255, 215, 192, 1),
  518. rgba(255, 153, 148, 1)
  519. );
  520. }
  521. .el-progress-bar {
  522. margin-right: -59px;
  523. padding-right: 60px;
  524. }
  525. }
  526. .borderBox2 {
  527. .el-progress-bar__inner {
  528. background: linear-gradient(
  529. 90deg,
  530. rgba(215, 195, 253, 1),
  531. rgba(179, 168, 247, 1)
  532. );
  533. }
  534. .el-progress-bar {
  535. margin-right: -59px;
  536. padding-right: 60px;
  537. }
  538. }
  539. }
  540. }
  541. </style>