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

office.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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.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. placeholder="选择日期时间"
  46. align="right"
  47. format="yyyy-MM-dd"
  48. value-format="yyyy-MM-dd"
  49. ></el-date-picker>
  50. <span class>-</span>
  51. <el-date-picker
  52. v-model="query.end_time"
  53. prefix-icon="el-icon-date"
  54. @change="changeEndTime"
  55. :editable="false"
  56. style="width: 150px;"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. ></el-date-picker>
  63. </div>
  64. <div class="tableTitle">统计图</div>
  65. <div>
  66. <line-chart :options="options"></line-chart>
  67. </div>
  68. <div class="tableTitle">统计表</div>
  69. <div>
  70. <el-table :data="tableData" style="width: 100%" border :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
  71. <el-table-column label="姓名" align="center">
  72. <template slot-scope="scope">
  73. {{scope.row.patient.name}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="检查日期" align="center">
  77. <template slot-scope="scope">
  78. <!--{{getTime(scope.row.inspect_date)}}-->
  79. {{scope.row.inspect_date | parseTime('{y}-{m}-{d}') }}
  80. </template>
  81. </el-table-column>
  82. <el-table-column :label="item_name" align="center">
  83. <template slot-scope="scope">
  84. <span v-html="getValue(scope.row)"></span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="趋势" align="center">
  88. <template slot-scope="scope">
  89. <el-button
  90. @click.native.prevent="jumpDetail(scope.row)"
  91. type="text"
  92. size="small"
  93. style="font-size:14px;"
  94. >详情
  95. </el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <el-pagination
  100. align="right"
  101. @size-change="handleSizeChange"
  102. @current-change="handleCurrentChange"
  103. :current-page="query.page"
  104. :page-sizes="[10, 20, 50, 100]"
  105. :page-size="10"
  106. background
  107. style="margin-top:20px;"
  108. layout="total, sizes, prev, pager, next, jumper"
  109. :total="total"
  110. ></el-pagination>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import echarts from 'echarts'
  116. import LineChart from '../../components/LineChart'
  117. import {
  118. GetInspectionIndexChart,
  119. GetInspectionIndexInit,
  120. GetInspectionIndexTable,
  121. GetPatientInspectionIndexBarChart,
  122. GetPatientInspectionIndexChart,
  123. GetRangeValue
  124. } from '@/api/common/statistics'
  125. import { uParseTime } from '@/utils/tools'
  126. export default {
  127. components: {
  128. LineChart
  129. },
  130. data() {
  131. return {
  132. percent:[],
  133. pickerOptions: {
  134. disabledDate(time) {
  135. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 2)).getTime() - 24 * 3600 * 1000
  136. return time.getTime() > Date.now() || time.getTime() < threeMonths
  137. }
  138. },
  139. range_type:'',
  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: [],
  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 = [
  208. ["#A9E0F3", "#9FBDFC"],
  209. ["#FFD7C0", "#FF9994"],
  210. ["#D7C3FD", "#B3A8F7"],
  211. ];
  212. var index = params.dataIndex;
  213. if (params.dataIndex >= colorList.length) {
  214. index = params.dataIndex % colorList.length;
  215. }
  216. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  217. {offset: 0, color: colorList[index][0]},
  218. // { offset: 0.5, color: colorList[index][1] },
  219. {offset: 1, color: colorList[index][1]}
  220. ])
  221. },
  222. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  223. },
  224. //鼠标悬停时:
  225. emphasis: {
  226. shadowBlur: 10,
  227. shadowOffsetX: 0,
  228. shadowColor: 'rgba(0, 0, 0, 0.5)'
  229. }
  230. }
  231. }
  232. ]
  233. }
  234. }
  235. },
  236. methods: {
  237. getValue(row) {
  238. if (this.query.range_type == 1 ) {
  239. if(row.inspect_value != "") {
  240. let min_range_value = this.range_value_columns[2]
  241. let arr = min_range_value.split("~")
  242. if (parseFloat(row.inspect_value) > arr[1]) {
  243. return row.inspect_value + "<span style='color:#F56C6C;margin-left:5px;'>↑</span>"
  244. } else if (parseFloat(row.inspect_value) < arr[0]) {
  245. return row.inspect_value + "<span style='color:#5B98FF;margin-left:5px;'>↓</span>"
  246. } else {
  247. return row.inspect_value
  248. }
  249. }else{
  250. return row.inspect_value
  251. }
  252. } else if (this.query.range_type == 2) {
  253. return row.inspect_value
  254. }
  255. },
  256. getTimestamp(time) {
  257. // 把时间日期转成时间戳
  258. return new Date(time).getTime() / 1000;
  259. },
  260. jumpDetail(row){
  261. // this.$router.push("/qcd/indicatorControlAnalysis/bloodPressureDetails?id="+patient_id)
  262. 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)
  263. },
  264. handleSizeChange(limit) {
  265. this.query.limit = limit
  266. this.GetInspectionIndexTable(this.query)
  267. },
  268. handleCurrentChange(page) {
  269. this.query.page = page
  270. this.GetInspectionIndexTable(this.query)
  271. },
  272. changeProject(val) {
  273. console.log("Val222222",val)
  274. this.query.page = 1
  275. let item_inspection_reference = []
  276. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  277. if (this.all_inspection_reference[i].project_id == val) {
  278. item_inspection_reference.push(this.all_inspection_reference[i])
  279. }
  280. }
  281. this.item_columns = item_inspection_reference
  282. var projectInfo = this.getPojectInfo(this.item_columns[0].project_id, this.item_columns[0].item_id)
  283. console.log("projectInfo",projectInfo)
  284. this.query.project_id = projectInfo.project_id
  285. this.query.item_id = projectInfo.item_id
  286. this.item_name = projectInfo.item_name
  287. this.query.range_type = projectInfo.range_type
  288. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.item_id)
  289. }, changeItem(val) {
  290. this.query.page = 1
  291. this.query.item_id = val
  292. var projectInfo = this.getPojectInfo(this.query.project_id, val)
  293. console.log(projectInfo)
  294. this.item_name = projectInfo.item_name
  295. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.item_id)
  296. }, changeRangeValue(val) {
  297. this.query.range_value = val
  298. this.query.page = 1
  299. this.GetInspectionIndexTable(this.query)
  300. },
  301. GetInspectionIndexInit() {
  302. GetInspectionIndexInit()
  303. .then(rs => {
  304. var resp = rs.data
  305. if (resp.state == 1) {
  306. let project = []
  307. let item = []
  308. this.all_inspection_reference = resp.data.references
  309. for(let i = 0; i < this.all_inspection_reference.length; i++){
  310. if(this.all_inspection_reference[i].org_id == 0){
  311. this.all_inspection_reference[i].item_id = this.all_inspection_reference[i].id
  312. }
  313. }
  314. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  315. project.push(this.all_inspection_reference[i])
  316. }
  317. var obj = {}
  318. //去重复
  319. project = project.reduce((cur, next) => {
  320. obj[next.project_id] ? '' : (obj[next.project_id] = true && cur.push(next))
  321. return cur
  322. }, [])
  323. this.project_columns = project
  324. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  325. if (this.all_inspection_reference[i].project_id == this.project_columns[0].project_id) {
  326. item.push(this.all_inspection_reference[i])
  327. }
  328. }
  329. console.log("item9999888888",item)
  330. this.item_columns = item
  331. this.item_name = item[0].item_name
  332. var projectInfo = this.getPojectInfo(this.project_columns[0].project_id, this.item_columns[0].item_id)
  333. this.query.project_id = projectInfo.project_id
  334. this.query.item_id = projectInfo.item_id
  335. this.query.range_type = projectInfo.range_type
  336. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.item_id)
  337. } else {
  338. this.$message.error(resp.msg)
  339. }
  340. })
  341. .catch(error => {
  342. })
  343. },
  344. getPojectInfo(project_id, item_id) {
  345. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  346. if (this.all_inspection_reference[i].project_id == project_id && this.all_inspection_reference[i].item_id == item_id) {
  347. return this.all_inspection_reference[i]
  348. }
  349. }
  350. return null
  351. },
  352. changeTime(val) {
  353. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time)
  354. if (time > 0) {
  355. this.$message.error('结束时间不能小于开始时间')
  356. } else {
  357. // this.getDialysisList()
  358. this.query.page = 1
  359. this.GetInspectionIndexChart(this.query)
  360. this.GetInspectionIndexTable(this.query)
  361. }
  362. },
  363. changeEndTime(val) {
  364. var time =
  365. this.getTimestamp(val) - this.getTimestamp(this.query.start_time)
  366. if (time < 0) {
  367. this.$message.error('结束时间不能小于开始时间')
  368. } else {
  369. this.query.page = 1
  370. this.GetInspectionIndexChart(this.query)
  371. this.GetInspectionIndexTable(this.query)
  372. }
  373. },
  374. handleClick(row) {
  375. console.log(row)
  376. this.$router.push({ path: '/qcd/analysisDetails' })
  377. },
  378. GetRangeValue(range_type, project_id, id) {
  379. let params = {
  380. range_type: range_type,
  381. project_id: project_id,
  382. item_id: id
  383. }
  384. GetRangeValue(params)
  385. .then(rs => {
  386. var resp = rs.data
  387. if (resp.state == 1) {
  388. if (range_type == 1) {
  389. this.range_value_columns = []
  390. this.range_value_columns.push('全部')
  391. this.range_value_columns.push('小于' + resp.data.range_vaule[0])
  392. this.range_value_columns.push(resp.data.range_vaule[0] + '~' + resp.data.range_vaule[1])
  393. this.range_value_columns.push('大于' + resp.data.range_vaule[1])
  394. this.query.range_value = '全部'
  395. } else {
  396. this.range_value_columns = []
  397. this.range_value_columns.push('全部')
  398. for (let i = 0; i < resp.data.range_vaule.length; i++) {
  399. this.range_value_columns.push(resp.data.range_vaule[i])
  400. }
  401. this.query.range_value = '全部'
  402. }
  403. this.GetInspectionIndexChart(this.query)
  404. this.GetInspectionIndexTable(this.query)
  405. } else {
  406. this.$message.error(resp.msg)
  407. }
  408. }
  409. )
  410. .catch(error => {
  411. })
  412. },
  413. GetInspectionIndexChart(params) {
  414. this.options.xAxis.data = []
  415. this.options.series[0].data = []
  416. this.percent = []
  417. GetInspectionIndexChart(params)
  418. .then(rs => {
  419. var resp = rs.data
  420. if (resp.state == 1) {
  421. for (let i = 0; i < resp.data.data.length; i++) {
  422. this.options.xAxis.data.push(resp.data.data[i].name)
  423. this.options.series[0].data.push(resp.data.data[i].total)
  424. this.percent.push(resp.data.data[i].ratio)
  425. }
  426. } else {
  427. this.$message.error(resp.msg)
  428. }
  429. })
  430. .catch(error => {
  431. })
  432. },
  433. GetInspectionIndexTable(params) {
  434. GetInspectionIndexTable(params)
  435. .then(rs => {
  436. var resp = rs.data
  437. console.log("resp22222",resp)
  438. if (resp.state == 1) {
  439. this.tableData = []
  440. for (let i = 0; i < resp.data.data.length; i++) {
  441. this.tableData.push(resp.data.data[i])
  442. }
  443. this.total = resp.data.total
  444. } else {
  445. this.$toast({
  446. message: resp.msg
  447. })
  448. }
  449. })
  450. .catch(error => {
  451. })
  452. }
  453. },
  454. created() {
  455. var date = new Date()
  456. var year = date.getFullYear() //获取完整的年份(4位)
  457. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  458. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  459. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  460. this.query.end_time = year + '-' + month + '-' + day
  461. this.query.start_time = year + '-' + last_month + '-' + day
  462. this.GetInspectionIndexInit()
  463. // this.GetDialysisBloodPressureTableData(this.query)
  464. }
  465. }
  466. </script>
  467. <style lang="scss" scoped>
  468. .tableTitle {
  469. font-size: 16px;
  470. color: #000;
  471. font-weight: bold;
  472. margin-bottom: 10px;
  473. }
  474. </style>
  475. <style lang="scss">
  476. .page_office {
  477. .cell {
  478. text-align: center;
  479. }
  480. }
  481. </style>