PatGjBleedCount.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="container">
  3. <div class="bgimg"></div>
  4. <div class="content">
  5. <div class="title">关节出血次数统计</div>
  6. <div v-if='id && name' class="title" style="font-size: 1rem;">姓名:{{name}}</div>
  7. <div class="injectionListForm baseInfo">
  8. <p>年化出血率:{{year_bleed_rate}}</p>
  9. <p>年化关节出血率:{{year_gj_bleed_rate}}</p>
  10. <ul class="tabs">
  11. <li @click="tabChange(1)" :class="tab==1?'act':''">近1个月</li>
  12. <li v-if='days>=90' @click="tabChange(3)" :class="tab==3?'act':''">近3个月</li>
  13. <li v-if='days>=180' @click="tabChange(6)" :class="tab==6?'act':''">近6个月</li>
  14. <li v-if='days>=360' @click="tabChange(12)" :class="tab==12?'act':''">近12个月</li>
  15. </ul>
  16. <v-chart :option="barOption" style="height: 350px">
  17. </v-chart>
  18. </div>
  19. <div class="footer">
  20. <div class="jbbtn" @click="goPage(-1)">返回</div>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import {
  27. Field,
  28. Picker,
  29. Search,
  30. Button
  31. } from 'mint-ui'
  32. export default {
  33. name: 'Index',
  34. components: {
  35. Field,
  36. Picker,
  37. Search,
  38. Button
  39. },
  40. data() {
  41. return {
  42. tab:1,
  43. form: {},
  44. patinfo:{},
  45. recordsList: [],
  46. barOption:{},
  47. id:'',
  48. name:'',
  49. year_bleed_rate:'',
  50. year_gj_bleed_rate:'',
  51. days:0
  52. }
  53. },
  54. methods: {
  55. goPage(path) {
  56. if(path==-1){
  57. this.$router.go(-1)
  58. }else{
  59. this.$router.push(path)
  60. }
  61. },
  62. tabChange(tab){
  63. this.tab=tab
  64. this.barOption={}
  65. this.getData()
  66. },
  67. getData() {
  68. let query_form={time_range:this.tab}
  69. let id = this.$route.query.id
  70. if(id){
  71. query_form.patient_id=id
  72. this.id=id
  73. this.$api.get_patient_info({id:id}).then(res=>{
  74. this.name=res.data.data.name
  75. })
  76. }
  77. this.$api.get_patient_bleed_statistics(query_form).then(res => {
  78. if (!res.data.code) {
  79. let data=res.data.data
  80. this.days=data.first_bleed_time_interval
  81. this.year_bleed_rate = data.year_bleed_rate;
  82. this.year_gj_bleed_rate = data.year_gj_bleed_rate;
  83. let x_data=[],y_data_zfx=[],y_data_wsx=[]
  84. data.gj_bleed_list.forEach(item=>{
  85. x_data.push(item.gj_name)
  86. y_data_zfx.push(item.gj_bleed_cnt_zfx)
  87. y_data_wsx.push(item.gj_bleed_cnt_wsx)
  88. })
  89. this.barOption={
  90. tooltip: {
  91. trigger: 'axis',
  92. axisPointer: {
  93. type: 'shadow'
  94. }
  95. },
  96. legend: {
  97. itemWidth:5,
  98. itemHeight:5,
  99. textStyle:{
  100. fontSize:10
  101. }
  102. },
  103. grid:{
  104. right:'5%'
  105. },
  106. xAxis: {
  107. type: 'category',
  108. data: x_data,
  109. axisLabel:{
  110. rotate:45,
  111. fontSize:8
  112. }
  113. },
  114. yAxis: {
  115. type: 'value',
  116. name:'(次)'
  117. },
  118. series: [
  119. {
  120. name:'自发性出血',
  121. data: y_data_zfx,
  122. itemStyle:{
  123. color:'#DEEBF7'
  124. },
  125. type: 'bar',
  126. stack: '1',
  127. label:{
  128. show:true,
  129. position:'inside'
  130. }
  131. },
  132. {
  133. name:'外伤性出血',
  134. data: y_data_wsx,
  135. itemStyle:{
  136. color:'#F8CBAD'
  137. },
  138. type: 'bar',
  139. stack: '1',
  140. label:{
  141. show:true,
  142. position:'inside'
  143. }
  144. }
  145. ]
  146. }
  147. }
  148. })
  149. }
  150. },
  151. created() {
  152. this.getData()
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .injectionListForm {
  158. width: 95%;
  159. margin: auto;
  160. margin-top: 1rem;
  161. background: #fff;
  162. padding: 1rem 0;
  163. border-radius: 8px;
  164. position: relative;
  165. .tabs{
  166. display: flex;
  167. padding: 0;
  168. li{
  169. width: 25%;
  170. text-align:center;
  171. list-style: none;
  172. font-size: 13px;
  173. line-height: 28px;
  174. &.act{
  175. background-color: #4472C4;
  176. color: #fff;
  177. }
  178. }
  179. }
  180. }
  181. .footer {
  182. display: flex;
  183. flex-wrap: wrap;
  184. // margin-top:2rem;
  185. .jbbtn {
  186. width: 42%;
  187. }
  188. }
  189. .listItemContainer {
  190. display: flex;
  191. .listItem {
  192. width: 33%;
  193. /* height: 3.2rem; */
  194. line-height: 3.2rem;
  195. flex-direction: row;
  196. justify-content: space-between;
  197. border-bottom: 1px solid #ccc;
  198. font-size:1.1rem;
  199. }
  200. .listHeader{
  201. font-size:1.2rem;
  202. }
  203. }
  204. </style>