medicalCharts.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. var fontSize = 0.0067 * window.screen.width;//字体13(默认)
  2. var fontSize1 = 0.0057 * window.screen.width;//字体11(默认)
  3. var fontSize2 = 0.00625 * window.screen.width;//字体12(默认)
  4. var leftChart1DataFormat = function(options) {
  5. var xAxisData = _.map(options.xAxis[0].data, function(item, idx) {
  6. item = parseInt(item.substring(5, 7)) + "月";
  7. return item;
  8. });
  9. var series0data = options.series[0].data || [];
  10. var series1data = options.series[1].data || [];
  11. var option = {
  12. "title": {
  13. "text": "门诊人次月趋势",
  14. "x": "center",
  15. textStyle: {
  16. color: '#b5e1fc',
  17. fontSize: 16,
  18. fontWeight: 'bold'
  19. }
  20. },
  21. tooltip: {
  22. trigger: 'axis',
  23. axisPointer: {
  24. type: 'cross',
  25. crossStyle: {
  26. color: '#fff'
  27. }
  28. },
  29. formatter: '{b} <br /> {a0}: {c0}<br />{a1}: {c1}' + "%"
  30. },
  31. "grid": {
  32. top: '70',
  33. left: '75',
  34. bottom: '40'
  35. },
  36. legend: {
  37. data: ['门诊人次', '环比'],
  38. textStyle: {
  39. color: '#b5e1fc'
  40. },
  41. top: '40'
  42. },
  43. xAxis: [{
  44. type: 'category',
  45. data: xAxisData,
  46. axisPointer: {
  47. type: 'shadow'
  48. },
  49. axisTick: {
  50. show: false
  51. },
  52. axisLine: {
  53. lineStyle: {
  54. color: '#095f8e'
  55. }
  56. },
  57. axisLabel: {
  58. color: '#b5e1fc',
  59. fontSize: fontSize
  60. }
  61. }],
  62. yAxis: [{
  63. type: 'value',
  64. name: '门诊人次',
  65. nameTextStyle: {
  66. color: '#b5e1fc' // 坐标轴名称颜色
  67. },
  68. splitLine: {
  69. show: false
  70. },
  71. axisLine: {
  72. lineStyle: {
  73. color: '#095f8e'
  74. }
  75. },
  76. axisLabel: {
  77. color: '#b5e1fc',
  78. fontSize: fontSize
  79. }
  80. },
  81. {
  82. type: 'value',
  83. name: '环比',
  84. nameTextStyle: {
  85. color: '#b5e1fc' // 坐标轴名称颜色
  86. },
  87. splitLine: {
  88. show: false // 不显示坐标轴刻度
  89. },
  90. axisLine: {
  91. lineStyle: {
  92. color: '#095f8e' // 坐标轴轴线颜色
  93. }
  94. },
  95. axisLabel: {
  96. color: '#b5e1fc', // 坐标轴刻度标签文本颜色
  97. fontSize: fontSize
  98. },
  99. show: true
  100. }
  101. ],
  102. series: [{
  103. name: '门诊人次',
  104. type: 'bar',
  105. "data": series0data,
  106. barWidth: 20,
  107. label: {
  108. normal: {
  109. show: true,
  110. position: 'top', // 在柱状图上方显示
  111. color: '#fff' // 柱状图上方显示的数值颜色
  112. }
  113. },
  114. itemStyle: {
  115. barBorderRadius: [8, 8, 0, 0],
  116. color: '#00e6f3'
  117. }
  118. },
  119. {
  120. name: '环比',
  121. type: 'line',
  122. yAxisIndex: 1,
  123. "data": series1data,
  124. itemStyle: {
  125. color: '#03fa6d'
  126. },
  127. markLine:{
  128. data:[
  129. {yAxis: 0, name: '环比'}
  130. ],
  131. label:{
  132. show: true,
  133. position: 'middle'
  134. },
  135. lineStyle:{
  136. color: '#ffffff'
  137. }
  138. }
  139. }
  140. ]
  141. }
  142. return option;
  143. },
  144. leftChart2DataFormat = function(options){
  145. var xAxisData = _.map(options.xAxis[0].data, function(item, idx) {
  146. item = parseInt(item.substring(5, 7)) + "月";
  147. return item;
  148. });
  149. var series0data = options.series[0].data || [];;
  150. var series1data = options.series[1].data || [];;
  151. var option = {
  152. "title": {
  153. "text": "住院人次月趋势",
  154. "x": "center",
  155. textStyle: {
  156. color: '#b5e1fc',
  157. fontSize: 16,
  158. fontWeight: 'bold'
  159. }
  160. },
  161. tooltip: {
  162. trigger: 'axis',
  163. axisPointer: {
  164. type: 'cross',
  165. crossStyle: {
  166. color: '#fff'
  167. }
  168. }
  169. },
  170. "grid": {
  171. top: '70',
  172. left: '70',
  173. bottom: '40'
  174. },
  175. legend: {
  176. data: ['住院人次', '环比'],
  177. textStyle: {
  178. color: '#b5e1fc'
  179. },
  180. top: '40'
  181. },
  182. xAxis: [{
  183. type: 'category',
  184. data: xAxisData,
  185. axisPointer: {
  186. type: 'shadow'
  187. },
  188. axisTick: {
  189. show: false
  190. },
  191. axisLine: {
  192. lineStyle: {
  193. color: '#095f8e'
  194. }
  195. },
  196. axisLabel: {
  197. color: '#b5e1fc',
  198. fontSize: fontSize
  199. }
  200. }],
  201. yAxis: [{
  202. type: 'value',
  203. name: '住院人次',
  204. nameTextStyle: {
  205. color: '#b5e1fc' // 坐标轴名称颜色
  206. },
  207. splitLine: {
  208. show: false
  209. },
  210. axisLine: {
  211. lineStyle: {
  212. color: '#095f8e'
  213. }
  214. },
  215. axisLabel: {
  216. color: '#b5e1fc',
  217. fontSize: fontSize
  218. }
  219. },
  220. {
  221. type: 'value',
  222. name: '环比',
  223. nameTextStyle: {
  224. color: '#b5e1fc' // 坐标轴名称颜色
  225. },
  226. splitLine: {
  227. show: false // 不显示坐标轴刻度
  228. },
  229. axisLine: {
  230. lineStyle: {
  231. color: '#095f8e' // 坐标轴轴线颜色
  232. }
  233. },
  234. axisLabel: {
  235. color: '#b5e1fc', // 坐标轴刻度标签文本颜色
  236. fontSize: fontSize
  237. },
  238. show:true
  239. }
  240. ],
  241. series: [{
  242. name: '住院人次',
  243. type: 'bar',
  244. "data": series0data,
  245. barWidth: 20,
  246. label: {
  247. normal: {
  248. show: true,
  249. position: 'top', // 在柱状图上方显示
  250. color: '#fff' // 柱状图上方显示的数值颜色
  251. }
  252. },
  253. itemStyle: {
  254. barBorderRadius: [8, 8, 0, 0],
  255. color: '#ff616f'
  256. }
  257. },
  258. {
  259. name: '环比',
  260. type: 'line',
  261. yAxisIndex: 1,
  262. "data": series1data,
  263. itemStyle: {
  264. color: '#03fa6d'
  265. },
  266. markLine:{
  267. data:[
  268. {yAxis: 0, name: '环比'}
  269. ],
  270. label:{
  271. show: true,
  272. position: 'middle'
  273. },
  274. lineStyle:{
  275. color: '#ffffff'
  276. }
  277. }
  278. }
  279. ]
  280. }
  281. return option;
  282. },
  283. rightChart1DataFormat = function(options){
  284. var xAxisData = _.map(options.xAxis[0].data, function(item, idx) {
  285. item = parseInt(item.substring(5, 7)) + "月";
  286. return item;
  287. });
  288. var series0data = options.series[0].data || [];
  289. var series1data = options.series[1].data || [];
  290. var series2data = options.series[2].data || [];
  291. var series3data = options.series[3].data || []
  292. series2data = _.map(series2data,function(item,idx){
  293. return parseFloat(item)
  294. })
  295. console.error(JSON.stringify(series2data))
  296. var option = {
  297. "title": {
  298. "text": "门诊分类别月趋势",
  299. "x": "center",
  300. textStyle: {
  301. color: '#b5e1fc',
  302. fontSize: 16,
  303. fontWeight: 'bold'
  304. }
  305. },
  306. tooltip: {
  307. trigger: 'axis',
  308. axisPointer: {
  309. type: 'cross',
  310. crossStyle: {
  311. color: '#fff'
  312. }
  313. },
  314. formatter: function(value){
  315. var resStr = "";
  316. _.map(value,function(item,idx){
  317. if(idx==0){
  318. resStr+=item.axisValue+" <br /> ";
  319. }
  320. resStr+=item.seriesName+":"+item.data;
  321. if(idx==2 || idx==3){//环比值加%
  322. if(item.data!="--"){
  323. resStr+="%";
  324. }
  325. }
  326. resStr+=" <br /> ";
  327. })
  328. return resStr;
  329. }
  330. },
  331. "grid":{
  332. top: '80',
  333. left: '80',
  334. bottom: '30'
  335. },
  336. legend: {
  337. data: ['普通号', '专家号', '普通号环比', '专家号环比'],
  338. textStyle: {
  339. color: '#b5e1fc'
  340. },
  341. top: '30',
  342. itemWidth: 10
  343. },
  344. xAxis: [{
  345. type: 'category',
  346. data: xAxisData,
  347. axisPointer: {
  348. type: 'shadow'
  349. },
  350. axisTick: {
  351. show: false
  352. },
  353. axisLine: {
  354. lineStyle: {
  355. color: '#095f8e'
  356. }
  357. },
  358. axisLabel: {
  359. color: '#b5e1fc',
  360. fontSize: fontSize
  361. }
  362. }],
  363. yAxis: [{
  364. type: 'value',
  365. name: '人次',
  366. nameTextStyle: {
  367. color: '#b5e1fc' // 坐标轴名称颜色
  368. },
  369. splitLine: {
  370. show: false
  371. },
  372. axisLine: {
  373. lineStyle: {
  374. color: '#095f8e'
  375. }
  376. },
  377. axisLabel: {
  378. color: '#b5e1fc',
  379. fontSize: fontSize2
  380. },
  381. splitNumber: 2
  382. },
  383. {
  384. type: 'value',
  385. name: '环比',
  386. nameTextStyle: {
  387. color: '#b5e1fc' // 坐标轴名称颜色
  388. },
  389. splitLine: {
  390. show: false // 不显示坐标轴刻度
  391. },
  392. axisLine: {
  393. lineStyle: {
  394. color: '#095f8e' // 坐标轴轴线颜色
  395. }
  396. },
  397. axisLabel: {
  398. color: '#b5e1fc', // 坐标轴刻度标签文本颜色
  399. fontSize: fontSize2
  400. },
  401. show:true,
  402. splitNumber: 4
  403. }
  404. ],
  405. series: [{
  406. name: '普通号',
  407. type: 'bar',
  408. "data": series0data,
  409. barWidth: 20,
  410. label: {
  411. normal: {
  412. show: true,
  413. position: 'top', // 在柱状图上方显示
  414. color: '#fff', // 柱状图上方显示的数值颜色
  415. fontSize: fontSize1
  416. }
  417. },
  418. itemStyle: {
  419. barBorderRadius: [8, 8, 0, 0],
  420. color: '#00e6f3'
  421. }
  422. },
  423. {
  424. name: '专家号',
  425. type: 'bar',
  426. "data": series1data,
  427. barWidth: 20,
  428. label: {
  429. normal: {
  430. show: true,
  431. position: 'top', // 在柱状图上方显示
  432. color: '#fff', // 柱状图上方显示的数值颜色
  433. fontSize: fontSize1
  434. }
  435. },
  436. itemStyle: {
  437. barBorderRadius: [8, 8, 0, 0],
  438. color: '#fff71a'
  439. }
  440. },
  441. {
  442. name: '普通号环比',
  443. type: 'line',
  444. yAxisIndex: 1,
  445. "data": series2data,
  446. itemStyle: {
  447. color: '#03fa6d'
  448. }
  449. },
  450. {
  451. name: '专家号环比',
  452. type: 'line',
  453. yAxisIndex: 1,
  454. "data": series3data,
  455. itemStyle: {
  456. color: '#ff616f'
  457. },
  458. markLine:{
  459. data:[
  460. {yAxis: 0, name: '环比'}
  461. ],
  462. label:{
  463. show: true,
  464. position: 'middle'
  465. },
  466. lineStyle:{
  467. color: '#ffffff'
  468. }
  469. }
  470. },
  471. ]
  472. }
  473. return option;
  474. },
  475. rightChart2DataFormat = function(options){
  476. var xAxisData = _.map(options.xAxis[0].data, function(item, idx) {
  477. item = parseInt(item.substring(5, 7)) + "月";
  478. return item;
  479. });
  480. var series0data = options.series[0].data || [];;
  481. var series1data = options.series[1].data || [];;
  482. var option = {
  483. "title": {
  484. "text": "住院平均日数月趋势",
  485. "x": "center",
  486. textStyle: {
  487. color: '#b5e1fc',
  488. fontSize: 16,
  489. fontWeight: 'bold'
  490. }
  491. },
  492. tooltip: {
  493. trigger: 'axis',
  494. axisPointer: {
  495. type: 'cross',
  496. crossStyle: {
  497. color: '#fff'
  498. }
  499. },
  500. formatter:'{b} <br /> {a0}: {c0}<br />{a1}: {c1}' + "%"
  501. },
  502. "grid": {
  503. top: '70',
  504. left: '60',
  505. bottom: '30'
  506. },
  507. legend: {
  508. data: ['住院平均床日数', '环比'],
  509. textStyle: {
  510. color: '#b5e1fc'
  511. },
  512. top: '30'
  513. },
  514. xAxis: [{
  515. type: 'category',
  516. data: xAxisData,
  517. axisPointer: {
  518. type: 'shadow'
  519. },
  520. axisTick: {
  521. show: false
  522. },
  523. axisLine: {
  524. lineStyle: {
  525. color: '#095f8e'
  526. }
  527. },
  528. axisLabel: {
  529. color: '#b5e1fc',
  530. fontSize: fontSize
  531. }
  532. }],
  533. yAxis: [{
  534. type: 'value',
  535. name: '天',
  536. nameTextStyle: {
  537. color: '#b5e1fc' // 坐标轴名称颜色
  538. },
  539. splitLine: {
  540. show: false
  541. },
  542. axisLine: {
  543. lineStyle: {
  544. color: '#095f8e'
  545. }
  546. },
  547. axisLabel: {
  548. color: '#b5e1fc',
  549. fontSize: fontSize2
  550. },
  551. splitNumber: 2
  552. },
  553. {
  554. type: 'value',
  555. name: '环比',
  556. nameTextStyle: {
  557. color: '#b5e1fc' // 坐标轴名称颜色
  558. },
  559. splitLine: {
  560. show: false // 不显示坐标轴刻度
  561. },
  562. axisLine: {
  563. lineStyle: {
  564. color: '#095f8e' // 坐标轴轴线颜色
  565. }
  566. },
  567. axisLabel: {
  568. color: '#b5e1fc', // 坐标轴刻度标签文本颜色
  569. fontSize: fontSize2
  570. },
  571. show:true,
  572. splitNumber: 4
  573. }
  574. ],
  575. series: [{
  576. name: '住院平均床日数',
  577. type: 'bar',
  578. "data": series0data,
  579. barWidth: 20,
  580. label: {
  581. normal: {
  582. show: true,
  583. position: 'top', // 在柱状图上方显示
  584. color: '#fff' // 柱状图上方显示的数值颜色
  585. }
  586. },
  587. itemStyle: {
  588. barBorderRadius: [8, 8, 0, 0],
  589. color: '#00e6f3'
  590. }
  591. },
  592. {
  593. name: '环比',
  594. type: 'line',
  595. yAxisIndex: 1,
  596. "data": series1data,
  597. itemStyle: {
  598. color: '#03fa6d'
  599. },
  600. markLine:{
  601. data:[
  602. {yAxis: 0, name: '环比'}
  603. ],
  604. label:{
  605. show: true,
  606. position: 'middle'
  607. },
  608. lineStyle:{
  609. color: '#ffffff'
  610. }
  611. }
  612. }
  613. ]
  614. }
  615. return option;
  616. }