handleChangeViewD.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. Vue.component('comD', {
  2. template: ' <div class="tab4">\
  3. <template>\
  4. <span>就诊时间:</span> \
  5. <el-date-picker v-model="time1" type="date" placeholder="开始日期" :picker-options="pickerOptions0">\
  6. </el-date-picker>\
  7. <el-date-picker v-model="time2" type="date" placeholder="结束日期" :picker-options="pickerOptions1">\
  8. </el-date-picker>\
  9. <span>药品名称:</span> \
  10. <div class="modelSearch" >\
  11. <div class="m-form-control">\
  12. <input type="text" data-type="select" id="dataArr">\
  13. </div>\
  14. </div>\
  15. <a href="#" @click="handleZidian"> 查看药品字典 </a>\
  16. <span>就诊类型:</span> \
  17. <el-select v-model="eventType" class="inputbox" placeholder="请选择">\
  18. <el-option v-for="item in event_type" :key="item.code" :label="item.name" :value="item.code">\
  19. </el-option>\
  20. </el-select>\
  21. <div class="search" @click="searchClick">搜索</div>\
  22. </template>\
  23. <el-table :data="tableData" border style="width: 100%">\
  24. <el-table-column prop="event_date" label="就诊时间">\
  25. </el-table-column>\
  26. <el-table-column prop="patient_name" label="姓名">\
  27. </el-table-column>\
  28. <el-table-column label="就诊类型" width="140">\
  29. <template slot-scope="scope">\
  30. <span v-if="scope.row.every_type == 0">门急诊</span>\
  31. <span v-else>住院</span>\
  32. </template>\
  33. </el-table-column>\
  34. <el-table-column prop="HDSD00_04_021" label="规格">\
  35. </el-table-column>\
  36. <el-table-column prop="HDSD00_04_027" label="用法" >\
  37. </el-table-column>\
  38. <el-table-column prop="HDSD00_04_028" label="总量">\
  39. </el-table-column>\
  40. <el-table-column fixed="right" label="操作">\
  41. <template slot-scope="scope">\
  42. <el-button @click="handleClick(scope.row)" type="text" size="small">查看详情</el-button>\
  43. </template>\
  44. </el-table-column>\
  45. </el-table>\
  46. <div class="flex f_y_c f_x_e">\
  47. <el-pagination @size-change="handleSizeChange" background @current-change="handleCurrentChange" :current-page="currentPage"\
  48. :page-sizes=" pageSizeArr" :page-size="pageSize" layout="total,sizes,prev, pager, next, jumper"\
  49. :total="total">\
  50. </el-pagination>\
  51. </div>\
  52. </template>\
  53. </div>\
  54. </div> ',
  55. data: function () {
  56. vm=this;
  57. return {
  58. currentPage: 1, //初始页
  59. pageSize: 10, // 每页的数据
  60. tableData: [],
  61. pageSizeArr: [10, 20, 30, 50],
  62. total: 0,
  63. event_type: [{
  64. "code": '0',
  65. "name": '门急诊'
  66. }, {
  67. "code": '1',
  68. "name": '住院'
  69. }],
  70. time1: new Date(getLastMonthStartDate()),
  71. time2: new Date(getLastMonthEndDate()),
  72. pickerOptions0: {
  73. disabledDate: function (time) {
  74. if (vm.time2) {
  75. let currentTime = vm.time2;
  76. let threeMonths = currentTime.setMonth(currentTime.getMonth() - 1);
  77. currentTime.setMonth(currentTime.getMonth() + 1)
  78. return time.getTime() > vm.time2 || time.getTime() < threeMonths;
  79. } else {
  80. return time.getTime() > Date.now();
  81. }
  82. }
  83. },
  84. pickerOptions1: {
  85. disabledDate: function (time) {
  86. if (vm.time1) {
  87. let currentTime = vm.time1;
  88. let threeMonths = currentTime.setMonth(currentTime.getMonth() + 1);
  89. currentTime.setMonth(currentTime.getMonth() - 1)
  90. return time.getTime() < vm.time1 || time.getTime() > threeMonths;
  91. } else {
  92. return time.getTime() > Date.now();
  93. }
  94. },
  95. },
  96. drugName: '',
  97. eventType: '0',
  98. options: [],
  99. inspect: '',
  100. }
  101. },
  102. mounted: function () {
  103. this.getData()
  104. this.formInit()
  105. },
  106. methods: {
  107. handleCurrentChange: function (val) {
  108. this.currentPage = val;
  109. this.getData()
  110. },
  111. handleSizeChange: function (val) {
  112. this.pageSize = val;
  113. this.initData()
  114. },
  115. initData: function () { //初始化
  116. this.currentPage = 1;
  117. this.getData()
  118. },
  119. searchClick: function () {
  120. console.log(this.drugName)
  121. this.initData()
  122. },
  123. formInit: function () {
  124. var url = httpRequest.server + '/gateway/hos-admin/api/v1.0/standardCenter/lastVersionDrug/list'
  125. $("#dataArr").customCombo(url, {
  126. token: sessionStorage.asstoken,
  127. tenant_name: 'jkzl',
  128. code: "STD_MEDICINE",
  129. }, false, false, false, {
  130. valueField: "id",//id
  131. textField: 'value',//name
  132. conditionSearchClick: function (g) {
  133. debugger
  134. var searchParm = g.rules.length > 0 ? g.rules[0].value : '';
  135. var parms = g.grid.get("parms");
  136. if (searchParm) {
  137. parms.filters = "value?" + searchParm + ' g1;stdDatasetCode?' + searchParm + ' g1;';
  138. } else {
  139. parms.filters = "";
  140. }
  141. g.grid.set({
  142. parms: parms,
  143. newPage: 1
  144. });
  145. g.grid.reload();
  146. }
  147. }, {
  148. columns: [
  149. { display: '名称', name: 'value', width: 210, align: 'left' }
  150. ],
  151. });
  152. },
  153. getData: function () {
  154. var vm = this;
  155. var params = {
  156. start: this.time1.format('yyyy-MM-dd'),
  157. end: this.time2.format('yyyy-MM-dd'),
  158. drugName: $('#dataArr').val(),
  159. eventType: this.eventType,
  160. size: this.pageSize,
  161. page: this.currentPage
  162. }
  163. GlobalEventBus.$emit('setLoading', {
  164. loading: true
  165. }); //缓存效果
  166. bigDataOutApi.drugAnalysis(params).then(function (res) {
  167. console.log(res)
  168. GlobalEventBus.$emit('setLoading');
  169. vm.tableData = res.detailModelList;
  170. vm.tableData = vm.tableData.map(function (item) {
  171. item.event_date = new Date(item.event_date).format('yyyy-MM-dd')
  172. return item;
  173. })
  174. vm.total = res.totalCount;
  175. }).catch(function (err) {
  176. console.log(err)
  177. GlobalEventBus.$emit('setLoading');
  178. })
  179. },
  180. handleClick: function (row) {
  181. console.log(row)
  182. demographic_id = row.demographic_id,
  183. medication = row.HDSD00_04_023,
  184. eventdate = row.event_date_real
  185. var url = httpRequest.server + '/profile/app/medication/html/medication.html?' +
  186. 'healthProblemName=' + '&demographic_id=' + demographic_id + '&medication=' + medication + '&eventdate=' + eventdate
  187. console.log(url)
  188. var width = 1000 + 'px';
  189. var height = 600 + 'px';
  190. top.layer.open({
  191. id: 'Lay_xiangqingD',
  192. type: 2,
  193. title: false,
  194. closeBtn: 0,
  195. shade: 0.5,
  196. shadeClose: true,
  197. area: [width, height],
  198. content: url
  199. })
  200. },
  201. handleZidian: function () {
  202. var url = httpRequest.server + '/bigScreenShow/page/bigDataOut/html/zidian.html?'
  203. console.log(url)
  204. var width = 1000 + 'px';
  205. var height = 600 + 'px';
  206. top.layer.open({
  207. id: 'Lay_zidian',
  208. type: 2,
  209. title: false,
  210. closeBtn: 0,
  211. shade: 0.5,
  212. shadeClose: true,
  213. area: [width, height],
  214. content: url
  215. })
  216. }
  217. }
  218. })