RecipeFrom.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <div class="doctorWork">
  3. <!-- 顶部筛选 -->
  4. <div class="screening">
  5. <div class="screening-title flex-vertical-center-l">
  6. <span></span>
  7. <div>筛选</div>
  8. </div>
  9. <div class="screening-form flex-vertical-center-l flex-wrap">
  10. <div class="screening-item flex-vertical-center-l">
  11. <span>年度:</span>
  12. <div class="input">
  13. <el-date-picker size="mini" v-model="form.year" type="year" placeholder="选择年"></el-date-picker>
  14. </div>
  15. </div>
  16. <div class="screening-item flex-vertical-center-l">
  17. <span>月度:</span>
  18. <div class="input">
  19. <el-date-picker
  20. size="mini"
  21. v-model="form.month"
  22. format="MM"
  23. type="month"
  24. placeholder="选择月"
  25. ></el-date-picker>
  26. </div>
  27. </div>
  28. <div class="screening-item flex-vertical-center-l">
  29. <span>机构名称:</span>
  30. <div class="input">
  31. <el-select size="mini" v-model="form.medName" placeholder="请选择">
  32. <el-option
  33. :label="item.name"
  34. :value="item.pid"
  35. v-for="(item,index) in medSelectList"
  36. :key="index"
  37. ></el-option>
  38. </el-select>
  39. </div>
  40. </div>
  41. <div class="screening-item flex-vertical-center-l">
  42. <div class="input flex-vertical-center-l" style="width:auto;">
  43. <el-checkbox v-model="form.checked">是否包含下级</el-checkbox>
  44. </div>
  45. </div>
  46. <el-button size="mini" type="primary" @click="search">搜索</el-button>
  47. <el-button size="mini" type="warning" @click="clearFilter">清空</el-button>
  48. </div>
  49. </div>
  50. <!-- 展示数据层 -->
  51. <div class="showData">
  52. <!-- 展示两种数据 -->
  53. <div class="showEcharts">
  54. <div id="myChart" :style="{width: '100%'}" class="myCharts"></div>
  55. <div class="e-format" style="margin-bottom:20px;">
  56. 格式:中医疾病-时间:数量
  57. <span style="margin-left:30px;"></span> X轴:时间 Y轴:单位(个)
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import { mapState, mapGetters, mapActions, mapMutations } from "vuex";
  65. import { medicalInstitution } from "@/api/city.js";
  66. import { getRecipeFrom } from "@/api/dataAnalysis.js";
  67. export default {
  68. data() {
  69. return {
  70. // 筛选数据
  71. form: {
  72. medName: "",
  73. year: "",
  74. month: "",
  75. checked: false
  76. },
  77. // 医疗机构
  78. medSelectList: [],
  79. // 是否是图表
  80. isEcharts: 0, // 0 图表 1 列表
  81. associationCount: [], // 协定方开方
  82. dialecticalCount: [], // 只能辨证
  83. famousCount: [], // 名家验案
  84. medicalCount: [], // 病历转方
  85. myCount: [], // 自拟开方
  86. prescriptionsCount: [], // 方剂检索开方
  87. pushCount: [], // 智能推方
  88. xAxisData: [] // 图表 横向坐标
  89. };
  90. },
  91. created() {
  92. this.medicalInstitution();
  93. },
  94. mounted() {
  95. let date = new Date();
  96. this.form.year = date.getFullYear().toString();
  97. this.getRecipeFrom();
  98. },
  99. methods: {
  100. // 顶部列表更改
  101. topChange(type) {
  102. this.isEcharts = type;
  103. if (type == 0) {
  104. setTimeout(() => {
  105. this.drawLine();
  106. }, 200);
  107. }
  108. },
  109. // 绘制 图表
  110. drawLine() {
  111. // 基于准备好的dom,初始化echarts实例
  112. let myChart = this.$echarts.init(document.getElementById("myChart"));
  113. // 绘制图表
  114. myChart.setOption({
  115. grid: {
  116. left: "1%",
  117. right: "1%",
  118. bottom: "3%",
  119. containLabel: true
  120. },
  121. legend: {
  122. data: [
  123. "智能辨证开方量",
  124. "智能推方开方量",
  125. "协定方开方量",
  126. "自拟开方量",
  127. "方剂检索开方量",
  128. "名家医案开方量",
  129. "病历转方量"
  130. ]
  131. },
  132. color: [
  133. "#5FA0FA",
  134. "#FFB703",
  135. "#1bb2d8",
  136. "#FD2446",
  137. "#51CEC6",
  138. "#DAEDF6",
  139. "#48AD4B"
  140. ],
  141. tooltip: {},
  142. xAxis: {
  143. type: "category",
  144. data: this.xAxisData
  145. },
  146. yAxis: {
  147. type: "value"
  148. },
  149. series: [
  150. {
  151. name: "智能辨证开方量",
  152. type: "bar",
  153. data: this.dialecticalCount
  154. },
  155. {
  156. name: "智能推方开方量",
  157. type: "bar",
  158. data: this.pushCount
  159. },
  160. {
  161. name: "协定方开方量",
  162. type: "bar",
  163. data: this.associationCount
  164. },
  165. {
  166. name: "自拟开方量",
  167. type: "bar",
  168. data: this.myCount
  169. },
  170. {
  171. name: "方剂检索开方量",
  172. type: "bar",
  173. data: this.prescriptionsCount
  174. },
  175. {
  176. name: "名家医案开方量",
  177. type: "bar",
  178. data: this.famousCount
  179. },
  180. {
  181. name: "病历转方量",
  182. type: "bar",
  183. data: this.medicalCount
  184. }
  185. ]
  186. });
  187. },
  188. search() {
  189. this.getRecipeFrom();
  190. },
  191. clearFilter() {
  192. let date = new Date();
  193. this.form = {
  194. medName: "",
  195. year: date.getFullYear().toString(),
  196. month: "",
  197. checked: false
  198. };
  199. this.getRecipeFrom();
  200. },
  201. // 处理选择器 时间数据
  202. forMatDate(type, data) {
  203. if (!data) return "";
  204. // type : 0 year 1 month
  205. let date = new Date(data);
  206. let year = date.getFullYear();
  207. let month = date.getMonth() + 1;
  208. if (type == 0) {
  209. return year;
  210. } else if (type == 1) {
  211. return month;
  212. }
  213. },
  214. // 获取医疗机构选择器
  215. async medicalInstitution() {
  216. let params = {
  217. organizationId: this.getuserinfo.organizationid
  218. };
  219. let res = await medicalInstitution(params);
  220. if (res.ResultCode == 0) {
  221. this.medSelectList = res.Data;
  222. }
  223. },
  224. // 获取处方来源
  225. async getRecipeFrom() {
  226. let params = {
  227. month: this.forMatDate(1, this.form.month),
  228. stiId: this.form.medName,
  229. type: this.form.checked ? "0" : "1",
  230. year: this.forMatDate(0, this.form.year)
  231. };
  232. let res = await getRecipeFrom(params);
  233. if (res.ResultCode == 0) {
  234. this.xAxisData = [];
  235. if (!this.form.month) {
  236. for (let i = 1; i <= 12; i++) {
  237. let j = i < 10 ? "0" + i : i;
  238. let xAxis = this.forMatDate(0, this.form.year) + "-" + j + "月";
  239. this.xAxisData.push(xAxis);
  240. }
  241. } else {
  242. this.xAxisData = [
  243. this.forMatDate(0, this.form.year) +
  244. "-" +
  245. this.forMatDate(1, this.form.month) +
  246. "月"
  247. ];
  248. }
  249. let associationCount = [], // 协定方开方
  250. dialecticalCount = [], // 只能辨证
  251. famousCount = [], // 名家验案
  252. medicalCount = [], // 病历转方
  253. myCount = [], // 自拟开方
  254. prescriptionsCount = [], // 方剂检索开方
  255. pushCount = []; // 智能推方
  256. res.Data.forEach((item, index) => {
  257. associationCount.push(item.associationCount);
  258. dialecticalCount.push(item.dialecticalCount);
  259. famousCount.push(item.famousCount);
  260. medicalCount.push(item.medicalCount);
  261. myCount.push(item.myCount);
  262. prescriptionsCount.push(item.prescriptionsCount);
  263. pushCount.push(item.pushCount);
  264. });
  265. this.associationCount = associationCount; // 协定方开方
  266. this.dialecticalCount = dialecticalCount; // 只能辨证
  267. this.famousCount = famousCount; // 名家验案
  268. this.medicalCount = medicalCount; // 病历转方
  269. this.myCount = myCount; // 自拟开方
  270. this.prescriptionsCount = prescriptionsCount; // 方剂检索开方
  271. this.pushCount = pushCount; // 智能推方
  272. this.drawLine();
  273. }
  274. }
  275. },
  276. computed: {
  277. ...mapGetters(["getuserinfo"])
  278. }
  279. };
  280. </script>
  281. <style lang="scss" scoped>
  282. @import "../../style/common.scss";
  283. @import "../../style/base.scss";
  284. .showData {
  285. background: #fff;
  286. border-radius: 10px;
  287. margin-top: 5px;
  288. padding: 10px;
  289. height: 71vh;
  290. overflow: auto;
  291. .top-change {
  292. margin-bottom: 20px;
  293. width: 100px;
  294. height: 34px;
  295. border-radius: 8px;
  296. cursor: pointer;
  297. border: 1px solid #dcdfe6;
  298. font-size: 14px;
  299. div:first-child {
  300. border-radius: 8px 0 0 8px;
  301. }
  302. div:last-child {
  303. border-radius: 0 8px 8px 0;
  304. }
  305. div {
  306. height: 34px;
  307. width: 50px;
  308. box-sizing: border-box;
  309. line-height: 34px;
  310. text-align: center;
  311. }
  312. .choosed {
  313. background: #5386f6;
  314. color: #fff;
  315. }
  316. }
  317. .bg-yellow {
  318. border-radius: 8px;
  319. background: #ffae45;
  320. color: #fff;
  321. width: 74px;
  322. height: 34px;
  323. margin-bottom: 20px;
  324. cursor: pointer;
  325. margin-left: 20px;
  326. }
  327. .showEcharts {
  328. width: 100%;
  329. .myCharts {
  330. height: 360px;
  331. }
  332. }
  333. .showList {
  334. width: 100%;
  335. ul {
  336. li {
  337. padding: 15px;
  338. border-bottom: 1px solid #dcdfe6;
  339. }
  340. li:hover {
  341. background: #dcdfe6;
  342. cursor: default;
  343. }
  344. .title {
  345. font-weight: bold;
  346. color: #5386f6;
  347. width: 90px;
  348. }
  349. }
  350. }
  351. }
  352. </style>
  353. <style lang="scss" scoped>
  354. @media screen and (min-width: 1681px) and (max-width: 1920px) {
  355. .showData {
  356. height: 81vh;
  357. .showEcharts {
  358. width: 100%;
  359. .myCharts {
  360. height: 500px;
  361. }
  362. }
  363. }
  364. }
  365. @media screen and (min-width: 1601px) and (max-width: 1680px) {
  366. .showData {
  367. height: 80vh;
  368. .showEcharts {
  369. width: 100%;
  370. .myCharts {
  371. height: 500px;
  372. }
  373. }
  374. }
  375. }
  376. @media screen and (min-width: 1361px) and (max-width: 1600px) {
  377. .showData {
  378. height: 73vh;
  379. .showEcharts {
  380. width: 100%;
  381. .myCharts {
  382. height: 410px;
  383. }
  384. }
  385. }
  386. }
  387. @media screen and(min-width:1281px) and (max-width: 1360px) {
  388. .showData {
  389. height: 73vh;
  390. .showEcharts {
  391. width: 100%;
  392. .myCharts {
  393. height: 410px;
  394. }
  395. }
  396. }
  397. }
  398. </style>