inquiryOrder.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <div class="app-container">
  3. <div class="app-content">
  4. <div class="title" style="display: flex; justify-content: center; align-items: center;">问诊统计</div>
  5. <el-form class="search-form" :inline="true" label-width="90px">
  6. <el-form-item label=" 统计">
  7. <el-select v-model="queryParams.type" placeholder="请选择日期">
  8. <el-option
  9. v-for="item in options"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value">
  13. </el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="医生" prop="doctorId">
  17. <el-select v-model="queryParams.doctorId" filterable placeholder="输入名称搜索" :filter-method="doctorMethod">
  18. <el-option
  19. v-for="item in docuser"
  20. :key="item.name"
  21. :label="item.name"
  22. :value="item.id">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  28. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  29. </el-form-item>
  30. </el-form>
  31. </div>
  32. <div ref="chartContainer" style="width: 100%; height: 400px;"></div>
  33. <el-button class="export" size="small" @click="handleExport" style="float: right; margin-bottom: 15px; margin-right: 40px;" >导出</el-button>
  34. <div class="table-box" style="margin-left: 40px; margin-right: 40px;">
  35. <el-table
  36. :data="list"
  37. border
  38. show-summary
  39. style="width: 100%;">
  40. <el-table-column
  41. prop="name"
  42. label="医生姓名">
  43. </el-table-column>
  44. <el-table-column
  45. prop="count"
  46. label="问诊次数">
  47. </el-table-column>
  48. <el-table-column
  49. prop="money"
  50. label="金额">
  51. </el-table-column>
  52. </el-table>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import {listdocuser} from "@/api/his/doctorArticle";
  59. import echarts from 'echarts'
  60. import { orderChartData,storeOrderChart,inquiryOrderChart ,inquiryOrderChartInq,inquiryExport } from "@/api/his/index";
  61. export default {
  62. data() {
  63. return {
  64. // 导出遮罩层
  65. exportLoading: false,
  66. doctorName: null,
  67. queryParams:{
  68. type: null,
  69. doctorId: null,
  70. },
  71. doctorName: {name:"1"},
  72. list:[],
  73. docuser:[],
  74. storeOPtions:[],
  75. chart: null,
  76. data: [
  77. ],
  78. options: [{
  79. value: '1',
  80. label: '今天'
  81. }, {
  82. value: '2',
  83. label: '昨天'
  84. }, {
  85. value: '3',
  86. label: '本周'
  87. }, {
  88. value: '4',
  89. label: '上周'
  90. }, {
  91. value: '5',
  92. label: '本月'
  93. }
  94. , {
  95. value: '6',
  96. label: '上月'
  97. },
  98. {
  99. value: '7',
  100. label: '本季度'
  101. },
  102. {
  103. value: '8',
  104. label: '上季度'
  105. }
  106. , {
  107. value: '9',
  108. label: '本年'
  109. }
  110. , {
  111. value: '10',
  112. label: '去年'
  113. }],
  114. };
  115. },
  116. created() {
  117. },
  118. mounted() {
  119. this.chart = echarts.init(this.$refs.chartContainer, 'macarons');
  120. this.chart.on('mouseout', this.hideTooltip);
  121. this.updateChart();
  122. this.getorderChartData();
  123. },
  124. watch: {
  125. data() {
  126. this.updateChart();
  127. },
  128. },
  129. methods: {
  130. /** 导出按钮操作 */
  131. handleExport() {
  132. const queryParams = this.queryParams;
  133. this.$confirm('是否确认导出所有数据?', "警告", {
  134. confirmButtonText: "确定",
  135. cancelButtonText: "取消",
  136. type: "warning"
  137. }).then(() => {
  138. this.exportLoading = true;
  139. return inquiryExport(queryParams);
  140. }).then(response => {
  141. this.download(response.msg);
  142. this.exportLoading = false;
  143. }).catch(() => {});
  144. },
  145. doctorMethod(rows){
  146. this.doctorName.name=rows;
  147. this.getlistdocuser();
  148. },
  149. getlistdocuser(){
  150. listdocuser(this.doctorName).then(response => {
  151. this.docuser=response.rows;
  152. });
  153. },
  154. handleQuery(){
  155. inquiryOrderChart(this.queryParams).then(response => {
  156. this.data = response.data;
  157. });
  158. inquiryOrderChartInq(this.queryParams).then(response => {
  159. this.list = response.data;
  160. });
  161. },
  162. /** 重置按钮操作 */
  163. resetQuery() {
  164. this.queryParams={
  165. type: null,
  166. doctorId: null,
  167. }
  168. this.getorderChartData()
  169. },
  170. getorderChartData(){
  171. inquiryOrderChart().then(response => {
  172. this.data = response.data;
  173. });
  174. inquiryOrderChartInq(this.queryParams).then(response => {
  175. this.list = response.data;
  176. });
  177. },
  178. formatter(params) {
  179. const item = params[0];
  180. return `
  181. <div>
  182. <div>日期:${item.axisValue}</div>
  183. <div>问诊数量:${item.value}次</div>
  184. <div>金额:${item.data.info}</div>
  185. </div>
  186. `;
  187. },
  188. updateChart() {
  189. const option = {
  190. xAxis: {
  191. type: 'category',
  192. data: this.data.map((item) => item.label),
  193. },
  194. yAxis: {
  195. type: 'value',
  196. },
  197. tooltip: {
  198. trigger: 'axis',
  199. formatter: this.formatter,
  200. axisPointer: {
  201. type: "line",
  202. lineStyle: {
  203. color: "rgba(227, 242, 252, 0.39)",
  204. width: 40,
  205. type: "solid",
  206. },
  207. z: 0, //注意要设置层级,不然会在覆盖在柱子前面,设置为0就在柱子后面显示了。
  208. },
  209. },
  210. series: [
  211. {
  212. name: 'Value',
  213. type: 'line',
  214. barWidth: '40%',
  215. itemStyle: {
  216. color: '#000000',
  217. },
  218. label: {
  219. show: true,
  220. position: 'top',
  221. },
  222. data: this.data.map((item) => ({ value: item.value, info: item.info })),
  223. },
  224. ],
  225. };
  226. this.chart.setOption(option);
  227. },
  228. hideTooltip() {
  229. this.chart.dispatchAction({
  230. type: 'hideTip',
  231. });
  232. },
  233. },
  234. };
  235. </script>
  236. <style>
  237. .app-container{
  238. border: 1px solid #e6e6e6;
  239. padding: 12px;
  240. .app-content{
  241. background-color: white;
  242. .title{
  243. padding: 20px 30px 0px 30px;
  244. font-size: 18px;
  245. font-weight: bold;
  246. color: black;
  247. }
  248. .search-form{
  249. margin: 20px 30px 0px 30px;
  250. }
  251. .data-box{
  252. padding: 30px;
  253. background-color: rgb(255, 255, 255);
  254. height: 100%;
  255. .echart-box{
  256. margin: 0 auto;
  257. text-align: center;
  258. }
  259. .el-select{
  260. margin: 5px 10px;
  261. }
  262. .table-box{
  263. margin-top: 15px;
  264. .export{
  265. float: right;
  266. margin: 10px 0px;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. </style>