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

office.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <div class="page_office">
  3. <div class="cell clearfix">
  4. <el-select v-model="query.project_id" placeholder="请选择" style="width:120px;margin-right:20px"
  5. @change="changeProject">
  6. <el-option
  7. v-for="item in project_columns"
  8. :key="item.project_id"
  9. :label="item.project_name"
  10. :value="item.project_id"
  11. ></el-option>
  12. </el-select>
  13. <el-select
  14. v-model="query.item_id"
  15. placeholder="请选择"
  16. style="width:120px;margin-right:20px"
  17. @change="changeItem"
  18. >
  19. <el-option
  20. v-for="item in item_columns"
  21. :key="item.id"
  22. :label="item.item_name"
  23. :value="item.id"
  24. ></el-option>
  25. </el-select>
  26. <el-select v-model="query.range_value" placeholder="请选择" style="width:120px;margin-right:20px"
  27. @change="changeRangeValue">
  28. <el-option
  29. v-for="item in range_value_columns"
  30. :key="item"
  31. :label="item"
  32. :value="item"
  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="options"></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.patient.name}}
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="检查日期" align="center">
  79. <template slot-scope="scope">
  80. <!--{{getTime(scope.row.inspect_date)}}-->
  81. {{scope.row.inspect_date | parseTime('{y}-{m}-{d}') }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column :label="item_name" align="center">
  85. <template slot-scope="scope">
  86. {{getValue(scope.row)}}
  87. </template>
  88. </el-table-column>
  89. <el-table-column fixed="right" label="趋势" align="center">
  90. <template slot-scope="scope">
  91. <el-button
  92. @click.native.prevent="jumpDetail(scope.row)"
  93. type="text"
  94. size="small"
  95. >详情
  96. </el-button>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <!--<el-pagination-->
  101. <!--align="right"-->
  102. <!--@size-change="handleSizeChange"-->
  103. <!--@current-change="handleCurrentChange"-->
  104. <!--:current-page="query.page"-->
  105. <!--:page-sizes="[10, 20, 50, 100]"-->
  106. <!--:page-size="10"-->
  107. <!--background-->
  108. <!--style="margin-top:20px;"-->
  109. <!--layout="total, sizes, prev, pager, next, jumper"-->
  110. <!--:total="total"-->
  111. <!--&gt;</el-pagination>-->
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import echarts from 'echarts'
  117. import LineChart from '../../components/LineChart'
  118. import {
  119. GetInspectionIndexChart,
  120. GetInspectionIndexInit,
  121. GetInspectionIndexTable,
  122. GetPatientInspectionIndexBarChart,
  123. GetPatientInspectionIndexChart,
  124. GetRangeValue
  125. } from '@/api/common/statistics'
  126. import { uParseTime } from '@/utils/tools'
  127. export default {
  128. components: {
  129. LineChart
  130. },
  131. data() {
  132. return {
  133. percent:[],
  134. pickerOptions: {
  135. disabledDate(time) {
  136. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  137. return time.getTime() > Date.now() || time.getTime() < threeMonths
  138. }
  139. },
  140. total:0,
  141. item_name: '',
  142. query: {
  143. patient_id: '',
  144. start_time: '',
  145. end_time: '',
  146. limit: 20,
  147. page: 1,
  148. project_id: '',
  149. item_id: '',
  150. range_type: '',
  151. range_value: ''
  152. },
  153. project_columns: [],
  154. item_columns: [],
  155. range_value_columns: [],
  156. all_inspection_reference: [],
  157. value: '请选项',
  158. tableData: [],
  159. options: {
  160. title: {
  161. text: 'ECharts 入门示例'
  162. },
  163. tooltip: {},
  164. legend: {
  165. data: [''],
  166. left: 0
  167. },
  168. xAxis: {
  169. data: ['达标', '未达标']
  170. },
  171. yAxis: {
  172. axisLabel: {
  173. formatter: '{value} %'
  174. },
  175. show: false
  176. },
  177. series: [
  178. {
  179. name: '',
  180. type: 'bar',
  181. data: ['78.57', '50'],
  182. barWidth: 30,
  183. label: {
  184. normal: {
  185. show: true,
  186. position: 'top',
  187. formatter: (params) => {
  188. if(this.percent.length > 0){
  189. let str = ''
  190. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  191. return str
  192. }else{
  193. let str = ''
  194. str = params.data
  195. return str
  196. }
  197. }
  198. }
  199. },
  200. //配置样式
  201. itemStyle: {
  202. //通常情况下:
  203. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  204. normal: {
  205. color: function(params) {
  206. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  207. var colorList = ['#A9E0F3', '#9FBDFC']
  208. // var index = params.dataIndex;
  209. // if (params.dataIndex >= colorList.length) {
  210. // index = params.dataIndex % colorList.length;
  211. // }
  212. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  213. { offset: 0, color: colorList[0] },
  214. // { offset: 0.5, color: colorList[index][1] },
  215. { offset: 1, color: colorList[1] }
  216. ])
  217. },
  218. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  219. },
  220. //鼠标悬停时:
  221. emphasis: {
  222. shadowBlur: 10,
  223. shadowOffsetX: 0,
  224. shadowColor: 'rgba(0, 0, 0, 0.5)'
  225. }
  226. }
  227. }
  228. ]
  229. }
  230. }
  231. },
  232. methods: {
  233. getValue(row) {
  234. if (this.query.range_type == 1 ) {
  235. if(row.inspect_value != "") {
  236. let min_range_value = this.range_value_columns[2]
  237. let arr = min_range_value.split("~")
  238. if (parseFloat(row.inspect_value) > arr[1]) {
  239. return row.inspect_value + "↑"
  240. } else if (parseFloat(row.inspect_value) < arr[0]) {
  241. return row.inspect_value + "↓"
  242. } else {
  243. return row.inspect_value
  244. }
  245. }else{
  246. return row.inspect_value
  247. }
  248. } else if (this.query.range_type == 2) {
  249. return row.inspect_value
  250. }
  251. },
  252. getTimestamp(time) {
  253. // 把时间日期转成时间戳
  254. return new Date(time).getTime() / 1000;
  255. },
  256. jumpDetail(row){
  257. // this.$router.push("/qcd/indicatorControlAnalysis/bloodPressureDetails?id="+patient_id)
  258. this.$router.push("/qcd/inspection/detail?project_id="+row.project_id+"&item_id="+row.item_id+"&range_type="+row.inspect_type+"&patient_id="+row.patient.id)
  259. },
  260. handleSizeChange(limit) {
  261. this.query.limit = limit
  262. this.GetInspectionIndexTable(this.query)
  263. },
  264. handleCurrentChange(page) {
  265. this.query.page = page
  266. this.GetInspectionIndexTable(this.query)
  267. },
  268. changeProject(val) {
  269. this.query.page = 1
  270. let item_inspection_reference = []
  271. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  272. if (this.all_inspection_reference[i].project_id == val) {
  273. item_inspection_reference.push(this.all_inspection_reference[i])
  274. }
  275. }
  276. this.item_columns = item_inspection_reference
  277. var projectInfo = this.getPojectInfo(this.item_columns[0].project_id, this.item_columns[0].id)
  278. this.query.project_id = projectInfo.project_id
  279. this.query.item_id = projectInfo.id
  280. this.item_name = projectInfo.item_name
  281. this.query.range_type = projectInfo.range_type
  282. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
  283. }, changeItem(val) {
  284. this.query.page = 1
  285. this.query.item_id = val
  286. var projectInfo = this.getPojectInfo(this.query.project_id, val)
  287. console.log(projectInfo)
  288. this.item_name = projectInfo.item_name
  289. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
  290. }, changeRangeValue(val) {
  291. this.query.range_value = val
  292. this.query.page = 1
  293. this.GetInspectionIndexTable(this.query)
  294. },
  295. GetInspectionIndexInit() {
  296. GetInspectionIndexInit()
  297. .then(rs => {
  298. var resp = rs.data
  299. if (resp.state == 1) {
  300. let project = []
  301. let item = []
  302. this.all_inspection_reference = resp.data.references
  303. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  304. project.push(this.all_inspection_reference[i])
  305. }
  306. var obj = {}
  307. //去重复
  308. project = project.reduce((cur, next) => {
  309. obj[next.project_id] ? '' : (obj[next.project_id] = true && cur.push(next))
  310. return cur
  311. }, [])
  312. this.project_columns = project
  313. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  314. if (this.all_inspection_reference[i].project_id == this.project_columns[0].project_id) {
  315. item.push(this.all_inspection_reference[i])
  316. }
  317. }
  318. this.item_columns = item
  319. this.item_name = item[0].item_name
  320. var projectInfo = this.getPojectInfo(this.project_columns[0].project_id, this.item_columns[0].id)
  321. this.query.project_id = projectInfo.project_id
  322. this.query.item_id = projectInfo.id
  323. this.query.range_type = projectInfo.range_type
  324. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.id)
  325. } else {
  326. this.$message.error(resp.msg)
  327. }
  328. })
  329. .catch(error => {
  330. })
  331. },
  332. getPojectInfo(project_id, item_id) {
  333. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  334. if (this.all_inspection_reference[i].project_id == project_id && this.all_inspection_reference[i].id == item_id) {
  335. return this.all_inspection_reference[i]
  336. }
  337. }
  338. return null
  339. },
  340. changeTime(val) {
  341. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time)
  342. if (time > 0) {
  343. this.$message.error('结束时间不能小于开始时间')
  344. } else {
  345. // this.getDialysisList()
  346. this.query.page = 1
  347. this.GetInspectionIndexChart(this.query)
  348. this.GetInspectionIndexTable(this.query)
  349. }
  350. },
  351. changeEndTime(val) {
  352. var time =
  353. this.getTimestamp(val) - this.getTimestamp(this.query.start_time)
  354. if (time < 0) {
  355. this.$message.error('结束时间不能小于开始时间')
  356. } else {
  357. this.query.page = 1
  358. this.GetInspectionIndexChart(this.query)
  359. this.GetInspectionIndexTable(this.query)
  360. }
  361. },
  362. handleClick(row) {
  363. console.log(row)
  364. this.$router.push({ path: '/qcd/analysisDetails' })
  365. },
  366. GetRangeValue(range_type, project_id, id) {
  367. let params = {
  368. range_type: range_type,
  369. project_id: project_id,
  370. item_id: id
  371. }
  372. GetRangeValue(params)
  373. .then(rs => {
  374. var resp = rs.data
  375. if (resp.state == 1) {
  376. if (range_type == 1) {
  377. this.range_value_columns = []
  378. this.range_value_columns.push('全部')
  379. this.range_value_columns.push('小于' + resp.data.range_vaule[0])
  380. this.range_value_columns.push(resp.data.range_vaule[0] + '~' + resp.data.range_vaule[1])
  381. this.range_value_columns.push('大于' + resp.data.range_vaule[1])
  382. this.query.range_value = '全部'
  383. } else {
  384. this.range_value_columns = []
  385. this.range_value_columns.push('全部')
  386. for (let i = 0; i < resp.data.range_vaule.length; i++) {
  387. this.range_value_columns.push(resp.data.range_vaule[i])
  388. }
  389. this.query.range_value = '全部'
  390. }
  391. this.GetInspectionIndexChart(this.query)
  392. this.GetInspectionIndexTable(this.query)
  393. } else {
  394. this.$message.error(resp.msg)
  395. }
  396. }
  397. )
  398. .catch(error => {
  399. })
  400. },
  401. GetInspectionIndexChart(params) {
  402. this.options.xAxis.data = []
  403. this.options.series[0].data = []
  404. this.percent = []
  405. GetInspectionIndexChart(params)
  406. .then(rs => {
  407. var resp = rs.data
  408. if (resp.state == 1) {
  409. for (let i = 0; i < resp.data.data.length; i++) {
  410. this.options.xAxis.data.push(resp.data.data[i].name)
  411. this.options.series[0].data.push(resp.data.data[i].total)
  412. this.percent.push(resp.data.data[i].ratio)
  413. }
  414. } else {
  415. this.$message.error(resp.msg)
  416. }
  417. })
  418. .catch(error => {
  419. })
  420. },
  421. GetInspectionIndexTable(params) {
  422. GetInspectionIndexTable(params)
  423. .then(rs => {
  424. var resp = rs.data
  425. if (resp.state == 1) {
  426. this.tableData = []
  427. for (let i = 0; i < resp.data.data.length; i++) {
  428. this.tableData.push(resp.data.data[i])
  429. }
  430. this.total = resp.data.total
  431. } else {
  432. this.$toast({
  433. message: resp.msg
  434. })
  435. }
  436. })
  437. .catch(error => {
  438. })
  439. }
  440. },
  441. created() {
  442. this.tableHeight = (document.documentElement.clientHeight - 44) + 'px'
  443. var date = new Date()
  444. var year = date.getFullYear() //获取完整的年份(4位)
  445. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  446. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  447. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  448. this.query.end_time = year + '-' + month + '-' + day
  449. this.query.start_time = year + '-' + last_month + '-' + day
  450. this.GetInspectionIndexInit()
  451. // this.GetDialysisBloodPressureTableData(this.query)
  452. }
  453. }
  454. </script>
  455. <style lang="scss" scoped>
  456. .tableTitle {
  457. font-size: 16px;
  458. color: #000;
  459. font-weight: bold;
  460. margin-bottom: 10px;
  461. }
  462. </style>
  463. <style lang="scss">
  464. .page_office {
  465. .cell {
  466. text-align: center;
  467. }
  468. }
  469. </style>