handleChangeViewD.js 8.6 KB

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