weight.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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_process">
  8. <new-nav activeName="weight"></new-nav>
  9. <div class="cell clearfix">
  10. <el-form :inline="true">
  11. <el-form-item label>
  12. <el-autocomplete
  13. class="checkSearch"
  14. popper-class="my-autocomplete"
  15. v-model="search_value"
  16. :fetch-suggestions="querySearchAsync"
  17. :trigger-on-focus="false"
  18. placeholder="请输入病人名字"
  19. @select="handleSelect"
  20. style="width:160px;"
  21. >
  22. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  23. <template slot-scope="{ item }">
  24. <div class="name">{{ item.name }}</div>
  25. </template>
  26. </el-autocomplete>
  27. </el-form-item>
  28. </el-form>
  29. <el-select v-model="query.statistics_type" placeholder="请选择" style="width:110px;margin-right:10px" @change="changeProject">
  30. <el-option
  31. v-for="item in options"
  32. :key="item.value"
  33. :label="item.name"
  34. :value="item.value"
  35. ></el-option>
  36. </el-select>
  37. <label class="title">
  38. <span class="name">日期查询</span> :
  39. </label>
  40. <el-date-picker
  41. v-model="query.start_time"
  42. prefix-icon="el-icon-date"
  43. @change="changeTime"
  44. :editable="false"
  45. style="width: 150px;"
  46. type="date"
  47. :picker-options="pickerOptions"
  48. placeholder="选择日期时间"
  49. align="right"
  50. format="yyyy-MM-dd"
  51. value-format="yyyy-MM-dd"
  52. ></el-date-picker>
  53. <span class>-</span>
  54. <el-date-picker
  55. v-model="query.end_time"
  56. prefix-icon="el-icon-date"
  57. @change="changeEndTime"
  58. :editable="false"
  59. :picker-options="pickerOptions"
  60. style="width: 150px;"
  61. type="date"
  62. placeholder="选择日期时间"
  63. align="right"
  64. format="yyyy-MM-dd"
  65. value-format="yyyy-MM-dd"
  66. ></el-date-picker>
  67. </div>
  68. <el-container>
  69. <div style="width:160px">
  70. <div class="tableTitle">患者列表</div>
  71. <el-table ref="table" :data="patientsData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }"
  72. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  73. highlight-current-row
  74. @current-change="handleChange">
  75. <el-table-column prop="dialysis_no" label="透析号" width="70">
  76. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  77. </el-table-column>
  78. <el-table-column prop="name" label="姓名" width="90">
  79. <template slot-scope="scope">{{ scope.row.name }}</template>
  80. </el-table-column>
  81. </el-table>
  82. </div>
  83. <div style="padding-left:10px;flex:1">
  84. <div class="tableTitle">指标趋势<span style="font-weight:normal">&nbsp;&nbsp;(当前患者: {{patient_name}})</span></div>
  85. <div>
  86. <line-chart :options="bar"></line-chart>
  87. </div>
  88. <div class="tableTitle">统计表</div>
  89. <div>
  90. <el-table :data="tableData" style="width: 100%" border :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
  91. <el-table-column fixed label="日期" align="center">
  92. <template slot-scope="scope">
  93. {{scope.row.assessment_date | parseTime("{y}-{m}-{d}") }}
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="姓名" align="center">
  97. <template slot-scope="scope">
  98. {{scope.row.patient.name}}
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="干体重" align="center">
  102. <template slot-scope="scope">
  103. {{scope.row.dry_weight?scope.row.dry_weight:''}}
  104. <!--{{// scope.row.patient.lapseto == 1 ? '留治':'转出'}}-->
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="前次透后体重" align="center">
  108. <template slot-scope="scope">
  109. {{scope.row.last_after_weight?scope.row.last_after_weight:''}}
  110. <!--<div v-if="scope.row.before.systolic_blood_pressure">{{scope.row.before.systolic_blood_pressure}} / {{scope.row.before.diastolic_blood_pressure}}</div>-->
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="透前体重" align="center">
  114. <template slot-scope="scope">
  115. {{scope.row.weight_before?scope.row.weight_before:''}}
  116. <!--<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>-->
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="透后体重" align="center">
  120. <template slot-scope="scope">
  121. <!--<div v-if="scope.row.max_monitor.systolic_blood_pressure">{{ scope.row.max_monitor.systolic_blood_pressure}} /{{ scope.row.max_monitor.diastolic_blood_pressure}}</div>-->
  122. {{scope.row.after.weight_after?scope.row.after.weight_after:''}}
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="体重增加" align="center">
  126. <template slot-scope="scope">
  127. <div v-if="scope.row.weight_before && scope.row.last_after_weight">{{(scope.row.weight_before - scope.row.last_after_weight).toFixed(1)}}</div>
  128. <!--{{scope.row.weight_before - scope.row.last_after_weight}}-->
  129. <!--<div v-if="scope.row.after.systolic_blood_pressure"> {{ scope.row.after.systolic_blood_pressure}} /{{scope.row.after.diastolic_blood_pressure}}</div>-->
  130. </template>
  131. </el-table-column>
  132. <el-table-column fixed="right" label="趋势" align="center">
  133. <template slot-scope="scope">
  134. <el-button
  135. @click.native.prevent="jumpDetail(scope.row.patient_id)"
  136. type="text"
  137. size="small"
  138. style="font-size:14px;"
  139. >详情</el-button>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. <el-pagination
  144. align="right"
  145. @size-change="handleSizeChange"
  146. @current-change="handleCurrentChange"
  147. :current-page="query.page"
  148. :page-sizes="[10, 20, 50, 100]"
  149. :page-size="10"
  150. background
  151. style="margin-top:20px;"
  152. layout="total, sizes, prev, pager, next, jumper"
  153. :total="total"
  154. ></el-pagination>
  155. </div>
  156. </div>
  157. </el-container>
  158. </div>
  159. </div>
  160. </div>
  161. </template>
  162. <script>
  163. import echarts from 'echarts'
  164. import NewNav from '../indicatorControlAnalysis/components/NewNav'
  165. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  166. import LineChart from '../../qcd/components/LineChart'
  167. import { getCurrentOrgPatients } from "@/api/common/common";
  168. import {GetDialysisWeightChartData,GetDialysisWeightTableData,GetDefalutPatient} from "@/api/common/statistics"
  169. import {
  170. PostSearch
  171. } from '@/api/patient'
  172. import { uParseTime } from "@/utils/tools";
  173. import { getDataConfig } from "@/utils/data";
  174. export default {
  175. components: {
  176. LineChart,
  177. BreadCrumb,
  178. NewNav
  179. },
  180. data() {
  181. return {
  182. percent:[],
  183. pickerOptions: {
  184. disabledDate(time) {
  185. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  186. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  187. }
  188. },
  189. patientsData:[],
  190. tableData: [
  191. ],
  192. loading: false,
  193. search_value: '',
  194. total: 0,
  195. patient_name:'',
  196. query: {
  197. patient_id: '',
  198. statistics_type: 1,
  199. start_time: '',
  200. end_time: '',
  201. limit: 10,
  202. page: 1
  203. },
  204. options: [
  205. { value: 1, name: '干体重' },
  206. { value: 2, name: '透前体重' },
  207. { value: 3, name: '体重增加' },
  208. { value: 4, name: '透后体重' },
  209. ],
  210. crumbs: [
  211. { path: false, name: '质控管理' },
  212. { path: false, name: '指标评估统计' },
  213. { path: false, name: '透析过程指标统计' }
  214. ],
  215. tableData1: [],
  216. chart: {
  217. title: {
  218. text: 'ECharts 入门示例'
  219. },
  220. tooltip: {},
  221. legend: {
  222. data: [],
  223. left: 0
  224. },
  225. xAxis: {
  226. data: []
  227. },
  228. yAxis: {
  229. axisLabel: {
  230. formatter: '{value} %'
  231. },
  232. show: false
  233. },
  234. series: [
  235. {
  236. name: '',
  237. type: 'line',
  238. data: [],
  239. barWidth: 30,
  240. label: {
  241. normal: {
  242. show: true,
  243. position: 'top',
  244. formatter: (params) => {
  245. if(this.percent.length > 0){
  246. let str = ''
  247. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  248. return str
  249. }else{
  250. let str = ''
  251. str = params.data
  252. return str
  253. }
  254. }
  255. }
  256. },
  257. //配置样式
  258. itemStyle: {
  259. //通常情况下:
  260. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  261. normal: {
  262. color: function(params) {
  263. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  264. var colorList = [
  265. ['#A9E0F3', '#9FBDFC'],
  266. ['#FFD7C0', '#FF9994']
  267. ]
  268. var index = params.dataIndex
  269. if (params.dataIndex >= colorList.length) {
  270. index = params.dataIndex % colorList.length
  271. }
  272. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  273. { offset: 0, color: colorList[index][0] },
  274. // { offset: 0.5, color: colorList[index][1] },
  275. { offset: 1, color: colorList[index][1] }
  276. ])
  277. },
  278. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  279. },
  280. //鼠标悬停时:
  281. emphasis: {
  282. shadowBlur: 10,
  283. shadowOffsetX: 0,
  284. shadowColor: 'rgba(0, 0, 0, 0.2)'
  285. }
  286. }
  287. }
  288. ]
  289. },
  290. bar: {
  291. title: {
  292. text: 'ECharts 入门示例'
  293. },
  294. tooltip: {},
  295. legend: {
  296. data: [],
  297. left: 0
  298. },
  299. xAxis: {
  300. data: []
  301. },
  302. yAxis: {
  303. axisLabel: {
  304. formatter: '{value} %'
  305. },
  306. show: false
  307. },
  308. series: [
  309. {
  310. name: '',
  311. type: 'bar',
  312. data: [],
  313. barWidth: 30,
  314. label: {
  315. normal: {
  316. show: true,
  317. position: 'top',
  318. formatter: (params) => {
  319. if(this.percent.length > 0){
  320. let str = ''
  321. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  322. return str
  323. }else{
  324. let str = ''
  325. str = params.data
  326. return str
  327. }
  328. }
  329. }
  330. },
  331. //配置样式
  332. itemStyle: {
  333. //通常情况下:
  334. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  335. normal: {
  336. color: function(params) {
  337. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  338. var colorList = [
  339. ['#A9E0F3', '#9FBDFC'],
  340. ['#FFD7C0', '#FF9994']
  341. ]
  342. var index = params.dataIndex
  343. if (params.dataIndex >= colorList.length) {
  344. index = params.dataIndex % colorList.length
  345. }
  346. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  347. { offset: 0, color: colorList[index][0] },
  348. // { offset: 0.5, color: colorList[index][1] },
  349. { offset: 1, color: colorList[index][1] }
  350. ])
  351. },
  352. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  353. },
  354. //鼠标悬停时:
  355. emphasis: {
  356. shadowBlur: 10,
  357. shadowOffsetX: 0,
  358. shadowColor: 'rgba(0, 0, 0, 0.2)'
  359. }
  360. }
  361. }
  362. ]
  363. }
  364. }
  365. },
  366. methods: {
  367. jumpDetail(patient_id){
  368. this.$router.push("/qcd/indicatorControlAnalysis/weightDetails?id="+patient_id)
  369. },
  370. changeProject(val){
  371. this.query.statistics_type = val
  372. this.query.page = 1
  373. this.GetDialysisWeightChartData(this.query)
  374. },
  375. handleChange(val){
  376. this.query.patient_id = val.id
  377. this.query.page = 1
  378. this.patient_name = val.name
  379. this.GetDialysisWeightTableData(this.query)
  380. // this.GetDialysisWeightChartData(this.query)
  381. },
  382. handleSizeChange(limit) {
  383. this.query.limit = limit;
  384. this.GetDialysisWeightTableData(this.query)
  385. },
  386. handleCurrentChange(page) {
  387. this.query.page = page;
  388. this.GetDialysisWeightTableData(this.query)
  389. },
  390. changeTime(val) {
  391. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time);
  392. if (time > 0) {
  393. this.$message.error("结束时间不能小于开始时间");
  394. this.query.start_time = "";
  395. } else {
  396. // this.getDialysisList()
  397. this.query.page = 1;
  398. this.GetDialysisWeightChartData(this.query)
  399. this.GetDialysisWeightTableData(this.query)
  400. }
  401. },
  402. changeEndTime(val) {
  403. var time =
  404. this.getTimestamp(val) - this.getTimestamp(this.query.start_time);
  405. if (time < 0) {
  406. this.$message.error("结束时间不能小于开始时间");
  407. this.query.end_time = "";
  408. } else {
  409. this.query.page = 1;
  410. this.GetDialysisWeightChartData(this.query)
  411. this.GetDialysisWeightTableData(this.query)
  412. }
  413. },
  414. getTimestamp(time) {
  415. // 把时间日期转成时间戳
  416. return new Date(time).getTime() / 1000;
  417. },
  418. QueryOperaById: function(val) {
  419. let vascular_access_desc_name = "";
  420. let vascular_access_desc = getDataConfig(
  421. "hemodialysis",
  422. "vascular_access_desc"
  423. );
  424. for (let i = 0; i < vascular_access_desc.length; i++) {
  425. if (vascular_access_desc[i].id == val) {
  426. vascular_access_desc_name = vascular_access_desc[i].name;
  427. }
  428. }
  429. return vascular_access_desc_name;
  430. },
  431. GetAnticoagulantById: function (val) {
  432. let anticoagulan_name = ''
  433. var anticoagulantsConfitTwo = this.$store.getters.anticoagulants_confit
  434. let anticoagulant = anticoagulantsConfitTwo
  435. for (let keys in anticoagulant) {
  436. if (anticoagulant[keys].id == val) {
  437. anticoagulan_name = anticoagulant[keys].name
  438. }
  439. }
  440. return anticoagulan_name
  441. },
  442. getModeName(mode_id){
  443. return this.$store.getters.treatment_mode[mode_id] != undefined ? this.$store.getters.treatment_mode[mode_id].name: ""
  444. }, GetDialysisWeightTableData(params) {
  445. this.loading = true
  446. this.tableData = []
  447. GetDialysisWeightTableData(params)
  448. .then(rs => {
  449. var resp = rs.data
  450. if (resp.state == 1) {
  451. this.loading = false
  452. for (let i = 0; i < resp.data.data.length; i++) {
  453. this.tableData.push(resp.data.data[i])
  454. }
  455. this.total = resp.data.total
  456. } else {
  457. this.loading = false
  458. }
  459. })
  460. .catch(error => {
  461. })
  462. },
  463. GetDialysisWeightChartData(params) {
  464. // this.bar.xAxis.data = []
  465. // this.bar.series[0].data = []
  466. // this.percent = []
  467. GetDialysisWeightChartData(params)
  468. .then(rs => {
  469. var resp = rs.data
  470. if (resp.state == 1) {
  471. this.bar.xAxis.data = []
  472. this.bar.series[0].data = []
  473. this.percent = []
  474. for (let i = 0; i < resp.data.data.length; i++) {
  475. this.bar.xAxis.data.push(resp.data.data[i].name)
  476. this.bar.series[0].data.push(resp.data.data[i].total)
  477. this.percent.push(resp.data.data[i].ratio)
  478. }
  479. } else {
  480. }
  481. })
  482. .catch(error => {
  483. })
  484. },
  485. handleSelect(val) {
  486. this.query.patient_id = val.id
  487. this.query.page = 1
  488. // this.GetDialysisWeightChartData(this.query)
  489. // this.GetDialysisWeightTableData(this.query)
  490. for (let i = 0;i < this.patientsData.length; i++){
  491. if (this.patientsData[i].id == val.id){
  492. this.patient_name = this.patientsData[i].name
  493. this.$refs.table.setCurrentRow(this.patientsData[i])
  494. }
  495. }
  496. },
  497. querySearchAsync(keyword, cb) {
  498. let key = ''
  499. if (keyword != undefined) {
  500. key = keyword
  501. }
  502. let searchArray = []
  503. PostSearch(key).then(response => {
  504. if (response.data.state == 1) {
  505. searchArray = response.data.data.patient
  506. cb(searchArray)
  507. } else {
  508. cb([])
  509. }
  510. })
  511. },
  512. chooseWay(way) {
  513. this.wayType = way
  514. }, getCurrentOrgPatients(){
  515. getCurrentOrgPatients().then(response=>{
  516. if(response.data.state == 1){
  517. var patients = response.data.data.patients
  518. this.patientsData = patients
  519. // this.GetDefaultPatient()
  520. }
  521. })
  522. },GetDefaultPatient() {
  523. GetDefalutPatient().then(response => {
  524. if (response.data.state == 1) {
  525. var patient = response.data.data.patient
  526. this.patient_name = this.patientsData[i].name
  527. }
  528. })
  529. }
  530. }, created() {
  531. var date = new Date()
  532. var year = date.getFullYear() //获取完整的年份(4位)
  533. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  534. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  535. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  536. this.query.patient_id = 0
  537. this.query.end_time = year + '-' + month + '-' + day
  538. this.query.start_time = year + '-' + last_month + '-' + day
  539. this.query.statistics_type = 1
  540. this.GetDialysisWeightChartData(this.query)
  541. this.GetDialysisWeightTableData(this.query)
  542. this.getCurrentOrgPatients()
  543. }
  544. }
  545. </script>
  546. <style lang="scss" scoped>
  547. .tableTitle {
  548. font-size: 16px;
  549. color: #000;
  550. font-weight: bold;
  551. margin-bottom: 10px;
  552. }
  553. </style>
  554. <style lang="scss">
  555. .page_process {
  556. .el-button--medium {
  557. padding: 10px 8px;
  558. }
  559. .el-form-item {
  560. margin-bottom: 0;
  561. }
  562. ::-webkit-scrollbar{
  563. height: 15px !important;
  564. }
  565. }
  566. </style>