right-panel.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. (function(){
  2. Vue.component('right-panel', {
  3. template: '<div class="right-panel">\
  4. <div class="panel-box panel-box5">\
  5. <h4 v-show="typeLength==1" class="c-b5e1fc c-f16 c-t-center">{{diseaseTitle}}</h4>\
  6. <div v-show="typeLength > 1" class="ui-grid tab-box">\
  7. <div class="ui-col-1 c-t-center">\
  8. <span class="data-tab c-f14" :class="{active: selectedType==2}" @click="chooseTab(2)">高血压</span>\
  9. </div>\
  10. <div class="ui-col-1 c-t-center">\
  11. <span class="data-tab c-f14" :class="{active: selectedType==1}" @click="chooseTab(1)">糖尿病</span>\
  12. </div>\
  13. </div>\
  14. <div class="c-row mt10">\
  15. <div class="c-33 bg-icon">\
  16. <img src="../images/xiaokuang_img.png">\
  17. <div class="absolute-content">\
  18. <p class="c-b5e1fc c-f12"><span class="c-ff3803 c-f16">{{data.statistics ? data.statistics.year : 0}}</span>年</p>\
  19. <span class="c-b5e1fc c-f12">患病年数</span>\
  20. </div>\
  21. </div>\
  22. <div class="c-33 bg-icon">\
  23. <img src="../images/xiaokuang_img.png">\
  24. <div class="absolute-content">\
  25. <p class="c-b5e1fc c-f12"><span class="c-03d95d c-f16">{{data.statistics ? data.statistics.eventSize : 0}}</span>次</p>\
  26. <span class="c-b5e1fc c-f12">就诊次数</span>\
  27. </div>\
  28. </div>\
  29. <div class="c-33 bg-icon">\
  30. <img src="../images/xiaokuang_img.png">\
  31. <div class="absolute-content">\
  32. <p class="c-b5e1fc c-f12"><span class="c-fd9c0d c-f16">{{data.statistics ? data.statistics.times : 0}}</span>次</p>\
  33. <span class="c-b5e1fc c-f12">住院次数</span>\
  34. </div>\
  35. </div>\
  36. </div>\
  37. <p class="c-f12 c-b5e1fc c-nowrap-multi-4 mtb20">{{data.drugs || "无"}}</p>\
  38. <p class="c-t-center c-0fa5f2 c-f12">常用药物</p>\
  39. </div>\
  40. <div class="panel-box panel-box6">\
  41. <h4 class="c-b5e1fc c-f16 c-t-center">就诊事件</h4>\
  42. <div v-show="hasEventList" class="record-panel">\
  43. <div class="c-position-r" v-for="(event, index) in eventList">\
  44. <div class="straight-line"></div>\
  45. <div class="year c-f14 c-b5e1fc">{{event.year}}</div>\
  46. <div v-for="(item, index2) in event.list" class="ui-grid ui-grid-middle record c-f14" :class="{active: index==0 && index2==0}">\
  47. <div class="ui-col-0 date">{{item.date}}</div>\
  48. <div class="ui-col-0 mr20"><span class="c-f10 fa fa-circle"></span></div>\
  49. <div class="ui-col-1">\
  50. <span class="info c-f12">{{item.eventType | getEventTypeName}}{{item.orgName}}</span>\
  51. </div>\
  52. </div>\
  53. </div>\
  54. </div>\
  55. <div v-show="!hasEventList" class="no-result-panel">\
  56. <div class="no-result-img">\
  57. <img src="../images/wushuju_icon.png">\
  58. </div>\
  59. <div class="no-result-text">暂无相关就诊数据</div>\
  60. </div>\
  61. </div>\
  62. <div class="panel-box panel-box7">\
  63. <h4 class="c-b5e1fc c-f16 c-t-center">指标分析</h4>\
  64. <p class="c-f12 c-b5e1fc c-nowrap-multi-4 mt10">{{content}}</p>\
  65. </div>\
  66. </div>',
  67. props: ['patient'],
  68. data: function() {
  69. return {
  70. data: {},
  71. eventList: [],
  72. hasEventList: true,
  73. diseaseTitle: "",
  74. typeLength: 1,
  75. selectedType: 1, // 1-糖尿病, 2-高血压
  76. content: ""
  77. }
  78. },
  79. mounted: function() {
  80. var vm = this;
  81. initEventOnBus(vm);
  82. },
  83. methods: {
  84. chooseTab: function(type){
  85. var vm = this;
  86. this.selectedType = type;
  87. getEventList(vm);
  88. //控制左下角区域的数据显示
  89. EventBus.$emit('show-disease-zhibiao', {type: type});
  90. //控制图标数据显示
  91. EventBus.$emit("get-chart-data", {
  92. type: type,
  93. // dateType: 1, //初始时值为1
  94. gi_type: type == 2 ? 0 : 1 //血糖默认获取1周的时间
  95. });
  96. }
  97. },
  98. filters:{
  99. getEventTypeName: function(val){
  100. switch(parseInt(val)){
  101. case 1:
  102. return "门诊 | ";
  103. break;
  104. case 2:
  105. return "住院 | ";
  106. break;
  107. case 3:
  108. return "体检 | ";
  109. break;
  110. }
  111. }
  112. }
  113. });
  114. function initEventOnBus(vm){
  115. EventBus.$on('get-disease-info', function (arg) {
  116. vm.typeLength = arg.length;
  117. var type = arg.type;
  118. vm.selectedType = type;
  119. if(type == 2){
  120. vm.diseaseTitle = "高血压";
  121. }else if(type == 1){
  122. vm.diseaseTitle = "糖尿病";
  123. }
  124. getEventList(vm);
  125. });
  126. //指标分析数据显示
  127. EventBus.$on("get-zhibiao-analysis", function(arg){
  128. vm.content = arg.content;
  129. });
  130. }
  131. function getEventList(vm){
  132. var params = {
  133. patient: vm.patient,
  134. type: vm.selectedType,
  135. page: 1,
  136. pageSize: 1000
  137. };
  138. patientAPI.getZYinfo(params).then(function(res){
  139. if(res.status == 200){
  140. vm.data = res.data;
  141. if(res.data.list.length > 0){
  142. vm.hasEventList = true;
  143. }else{
  144. vm.hasEventList = false;
  145. }
  146. var list = _.map(res.data.list, function(o){
  147. var year = o.eventDate.substr(0,4);
  148. o.year = parseInt(year);
  149. var date = o.eventDate.substr(5,5);
  150. o.date = date;
  151. return o;
  152. });
  153. var list2 = _.groupBy(list, "year");
  154. var list3 = [];
  155. for(year in list2){
  156. var item = list2[year];
  157. list3.push({
  158. year: year,
  159. list: item
  160. });
  161. }
  162. list3.reverse();
  163. vm.eventList = list3;
  164. }else{
  165. vm.hasEventList = false;
  166. console.log(res.msg);
  167. }
  168. })
  169. }
  170. })()