bloodPressureDetails.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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="page_bloodPressureDetails">
  9. <div class="cell clearfix" style="margin:0">
  10. <el-form :inline="true" :model="listQuery">
  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. >
  21. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  22. <template slot-scope="{ item }">
  23. <div class="name">{{ item.name }}</div>
  24. </template>
  25. </el-autocomplete>
  26. </el-form-item>
  27. </el-form>
  28. </div>
  29. <el-container>
  30. <div style="width:150px">
  31. <div class="tableTitle">患者列表</div>
  32. <el-table ref="table" :data="patientsData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }"
  33. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  34. highlight-current-row
  35. @current-change="handleChange">
  36. <el-table-column prop="dialysis_no" label="透析号" width="80">
  37. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  38. </el-table-column>
  39. <el-table-column prop="name" label="姓名" width="80">
  40. <template slot-scope="scope">{{ scope.row.name }}</template>
  41. </el-table-column>
  42. </el-table>
  43. </div>
  44. <div class="containerRight" style="flex:1;overflow: hidden">
  45. <div class="cell clearfix">
  46. <label class="title" style="text-align:left">
  47. <span class="name">血压阶段</span> :
  48. </label>
  49. <el-select v-model="query.statistics_type" placeholder="请选择" style="width:110px;margin-right:10px" @change="changeProject">
  50. <el-option
  51. v-for="item in options"
  52. :key="item.value"
  53. :label="item.name"
  54. :value="item.value"
  55. ></el-option>
  56. </el-select>
  57. <label class="title">
  58. <span class="name">日期查询</span> :
  59. </label>
  60. <el-date-picker
  61. v-model="query.start_time"
  62. prefix-icon="el-icon-date"
  63. @change="changeTime"
  64. :editable="false"
  65. style="width: 150px;"
  66. type="date"
  67. :picker-options="pickerOptions"
  68. placeholder="选择日期时间"
  69. align="right"
  70. format="yyyy-MM-dd"
  71. value-format="yyyy-MM-dd"
  72. ></el-date-picker>
  73. <span class>-</span>
  74. <el-date-picker
  75. v-model="query.end_time"
  76. prefix-icon="el-icon-date"
  77. @change="changeEndTime"
  78. :editable="false"
  79. :picker-options="pickerOptions"
  80. style="width: 150px;"
  81. type="date"
  82. placeholder="选择日期时间"
  83. align="right"
  84. format="yyyy-MM-dd"
  85. value-format="yyyy-MM-dd"
  86. ></el-date-picker>
  87. </div>
  88. <div class="tableTitle">指标趋势</div>
  89. <div>
  90. <line-chart :options="chart"></line-chart>
  91. </div>
  92. <div class="tableTitle">统计表</div>
  93. <div>
  94. <el-table :data="tableData" style="width: 100%" border :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
  95. <el-table-column fixed label="日期" align="center">
  96. <template slot-scope="scope">
  97. {{scope.row.schedule_date | parseTime("{y}-{m}-{d}") }}
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="透前血压" align="center">
  101. <template slot-scope="scope">
  102. <div v-if="scope.row.before.systolic_blood_pressure">{{scope.row.before.systolic_blood_pressure}} / {{scope.row.before.diastolic_blood_pressure}}</div>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="透析中最低血压" align="center">
  106. <template slot-scope="scope">
  107. <div v-if="scope.row.min_monitor.diastolic_blood_pressure">{{ scope.row.min_monitor.diastolic_blood_pressure}}</div>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="透析中最高血压" align="center">
  111. <template slot-scope="scope">
  112. <div v-if="scope.row.max_monitor.systolic_blood_pressure">{{ scope.row.max_monitor.systolic_blood_pressure}}</div>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="透后血压" align="center">
  116. <template slot-scope="scope">
  117. <div v-if="scope.row.after.systolic_blood_pressure"> {{ scope.row.after.systolic_blood_pressure}} /{{scope.row.after.diastolic_blood_pressure}}</div>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <el-pagination
  122. align="right"
  123. @size-change="handleSizeChange"
  124. @current-change="handleCurrentChange"
  125. :current-page="query.page"
  126. :page-sizes="[10, 20, 50, 100]"
  127. :page-size="10"
  128. background
  129. style="margin-top:20px;"
  130. layout="total, sizes, prev, pager, next, jumper"
  131. :total="total"
  132. ></el-pagination>
  133. </div>
  134. </div>
  135. </el-container>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import echarts from "echarts";
  142. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  143. import LineChart from "../../qcd/components/LineChart";
  144. import { getCurrentOrgPatients } from "@/api/common/common";
  145. import {GetDialysisPatientBloodPressureChartData,GetDialysisBloodPressureTableData} from "@/api/common/statistics"
  146. import { PostSearch } from '@/api/patient'
  147. import { uParseTime } from "@/utils/tools";
  148. export default {
  149. components: {
  150. LineChart,
  151. BreadCrumb
  152. },
  153. data() {
  154. return {
  155. pickerOptions: {
  156. disabledDate(time) {
  157. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  158. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  159. }
  160. },
  161. patientsData:[],
  162. tableData: [
  163. ],
  164. loading: false,
  165. search_value: '',
  166. total: 0,
  167. query: {
  168. patient_id: '',
  169. statistics_type: 1,
  170. start_time: '',
  171. end_time: '',
  172. limit: 10,
  173. page: 1
  174. },
  175. options: [
  176. { value: 1, name: '透前血压' },
  177. { value: 2, name: '透后血压' },
  178. ],
  179. crumbs: [
  180. { path: false, name: "质控管理" },
  181. { path: false, name: "患者血压详情" }
  182. ],
  183. chart: {
  184. title: {
  185. text: "ECharts 入门示例"
  186. },
  187. tooltip: {},
  188. legend: {
  189. data: [],
  190. left: 0
  191. },
  192. xAxis: {
  193. data: []
  194. },
  195. yAxis: {
  196. axisLabel: {
  197. formatter: "{value} %"
  198. },
  199. show: false
  200. },
  201. series: [
  202. {
  203. name: "收缩压",
  204. type: "line",
  205. data: [
  206. ],
  207. barWidth: 30,
  208. label: {
  209. normal: {
  210. show: true,
  211. position: "top",
  212. formatter: "{c}"
  213. }
  214. },
  215. //配置样式
  216. itemStyle: {
  217. normal: {
  218. color: "#5b98ff", //折点颜色
  219. lineStyle: {
  220. color: "#5b98ff" //折线颜色
  221. }
  222. }
  223. }
  224. },
  225. {
  226. name: "舒张压",
  227. type: "line",
  228. data: [],
  229. barWidth: 30,
  230. label: {
  231. normal: {
  232. show: true,
  233. position: "top",
  234. formatter: "{c}"
  235. }
  236. },
  237. //配置样式
  238. itemStyle: {
  239. normal: {
  240. color: "#f56c6c", //折点颜色
  241. lineStyle: {
  242. color: "#f56c6c" //折线颜色
  243. }
  244. }
  245. }
  246. }
  247. ],
  248. dataZoom: [
  249. {
  250. // Y轴固定,让内容滚动
  251. type: 'slider',
  252. show: false,
  253. xAxisIndex: [0],
  254. start: 1,
  255. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  256. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  257. },
  258. {
  259. type: 'inside',
  260. xAxisIndex: [0],
  261. start: 1,
  262. end: 20,
  263. zoomLock: true // 锁定区域禁止缩放
  264. }
  265. ]
  266. },
  267. };
  268. },
  269. methods: {
  270. GetDialysisBloodPressureTableData(params) {
  271. this.loading = true
  272. this.tableData = []
  273. GetDialysisBloodPressureTableData(params)
  274. .then(rs => {
  275. var resp = rs.data
  276. if (resp.state == 1) {
  277. this.loading = false
  278. for (let i = 0; i < resp.data.data.length; i++) {
  279. this.tableData.push(resp.data.data[i])
  280. }
  281. this.total = resp.data.total
  282. } else {
  283. this.loading = false
  284. }
  285. })
  286. .catch(error => {
  287. })
  288. },
  289. changeProject(val){
  290. this.query.statistics_type = val
  291. this.query.page = 1
  292. this.GetDialysisPatientBloodPressureChartData(this.query)
  293. },
  294. handleChange(val){
  295. this.query.patient_id = val.id
  296. this.query.page = 1
  297. this.GetDialysisBloodPressureTableData(this.query)
  298. this.GetDialysisPatientBloodPressureChartData(this.query)
  299. },
  300. handleSizeChange(limit) {
  301. this.query.limit = limit;
  302. this.GetDialysisBloodPressureTableData(this.query)
  303. },
  304. handleCurrentChange(page) {
  305. this.query.page = page;
  306. this.GetDialysisBloodPressureTableData(this.query)
  307. },changeTime(val) {
  308. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time);
  309. if (time > 0) {
  310. this.$message.error("结束时间不能小于开始时间");
  311. this.query.start_time = "";
  312. } else {
  313. // this.getDialysisList()
  314. this.query.page = 1;
  315. this.GetDialysisBloodPressureChartData(this.query)
  316. this.GetDialysisBloodPressureTableData(this.query)
  317. }
  318. },
  319. changeEndTime(val) {
  320. var time =
  321. this.getTimestamp(val) - this.getTimestamp(this.query.start_time);
  322. if (time < 0) {
  323. this.$message.error("结束时间不能小于开始时间");
  324. this.query.end_time = "";
  325. } else {
  326. this.query.page = 1;
  327. this.GetDialysisBloodPressureChartData(this.query)
  328. this.GetDialysisBloodPressureTableData(this.query)
  329. }
  330. }, getTimestamp(time) {
  331. // 把时间日期转成时间戳
  332. return new Date(time).getTime() / 1000;
  333. },GetDialysisPatientBloodPressureChartData(params) {
  334. this.chart.xAxis.data = []
  335. this.chart.series[0].data = []
  336. this.chart.series[1].data = []
  337. GetDialysisPatientBloodPressureChartData(params)
  338. .then(rs => {
  339. var resp = rs.data
  340. if (resp.state == 1) {
  341. for (let i = 0; i < resp.data.data.length; i++) {
  342. this.chart.xAxis.data.push(resp.data.data[i].date)
  343. this.chart.series[0].data.push(resp.data.data[i].systolic_blood_pressure)
  344. this.chart.series[1].data.push(resp.data.data[i].diastolic_blood_pressure)
  345. }
  346. this.getArrLength(this.chart.xAxis.data)
  347. } else {
  348. }
  349. })
  350. .catch(error => {
  351. })
  352. }, handleSelect(val) {
  353. this.query.patient_id = val.id
  354. this.query.page = 1
  355. this.GetDialysisPatientBloodPressureChartData(this.query)
  356. this.GetDialysisBloodPressureTableData(this.query)
  357. for (let i = 0;i < this.patientsData.length; i++){
  358. if (this.patientsData[i].id == val.id){
  359. this.$refs.table.setCurrentRow(this.patientsData[i])
  360. }
  361. }
  362. }, querySearchAsync(keyword, cb) {
  363. let key = ''
  364. if (keyword != undefined) {
  365. key = keyword
  366. }
  367. let searchArray = []
  368. PostSearch(key).then(response => {
  369. if (response.data.state == 1) {
  370. searchArray = response.data.data.patient
  371. cb(searchArray)
  372. } else {
  373. cb([])
  374. }
  375. })
  376. },getCurrentOrgPatients(){
  377. getCurrentOrgPatients().then(response=>{
  378. if(response.data.state == 1){
  379. var patients = response.data.data.patients
  380. this.patientsData = patients
  381. for (let i = 0;i < this.patientsData.length; i++){
  382. if (this.patientsData[i].id == this.query.patient_id){
  383. this.$refs.table.setCurrentRow(this.patientsData[i])
  384. }
  385. }
  386. }
  387. })
  388. },
  389. chooseMonth(month) {
  390. this.monthType = month;
  391. },
  392. clickQuality(index) {
  393. this.quality = index;
  394. },
  395. getArrLength(result){
  396. if(result.length > 10){
  397. var dataZoom_end = (10/result.length)*100;
  398. this.chart.dataZoom[0].end = dataZoom_end
  399. }else{
  400. var dataZoom_end = 100;
  401. this.chart.dataZoom[0].end = dataZoom_end
  402. }
  403. }
  404. },created() {
  405. var date = new Date()
  406. var year = date.getFullYear() //获取完整的年份(4位)
  407. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  408. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  409. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  410. this.query.patient_id = this.$route.query.id
  411. this.query.end_time = year + '-' + month + '-' + day
  412. this.query.start_time = year + '-' + last_month + '-' + day
  413. this.query.statistics_type = 1
  414. this.GetDialysisPatientBloodPressureChartData(this.query)
  415. this.GetDialysisBloodPressureTableData(this.query)
  416. this.getCurrentOrgPatients()
  417. }
  418. };
  419. </script>
  420. <style lang="scss" scoped>
  421. .containerRight {
  422. padding-left: 10px;
  423. }
  424. .tableTitle {
  425. font-size: 16px;
  426. color: #000;
  427. font-weight: bold;
  428. margin-bottom: 10px;
  429. margin-top: 8px;
  430. }
  431. </style>
  432. <style lang="scss">
  433. .page_bloodPressureDetails {
  434. .cell {
  435. text-align: center;
  436. }
  437. .el-form-item {
  438. margin-bottom: 0;
  439. }
  440. ::-webkit-scrollbar{
  441. height: 15px !important;
  442. }
  443. }
  444. </style>