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

office.vue 17KB

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