graphics.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882
  1. <template>
  2. <div class="table_wrap">
  3. <div
  4. :key="'comKey' + comKey"
  5. class="container"
  6. :style="{
  7. marginTop: containerStyle.marginTop,
  8. }"
  9. >
  10. <svg width="100%" height="100%"></svg>
  11. </div>
  12. <table class="temperatureChart">
  13. <caption>
  14. <p style="font-size: 20px; font-weight: bold">
  15. {{ env.VITE_HOSPITAL_NAME }}
  16. </p>
  17. <p style="font-size: 20px; font-weight: bold">体温单</p>
  18. <p style="position: relative; text-align: left">
  19. <span class="tbale-label">&nbsp;&nbsp;姓名:</span
  20. ><span style="display: inline-block; width: 75px; text-align: left">{{
  21. info.name
  22. }}</span>
  23. <span class="tbale-label">年龄:</span>
  24. <span style="display: inline-block; width: 60px; text-align: left">{{
  25. info.age + "岁"
  26. }}</span>
  27. <span class="tbale-label">性别:</span>
  28. <span style="display: inline-block; width: 60px; text-align: left">{{
  29. info.sexName
  30. }}</span>
  31. <span class="tbale-label">入院日期:</span>
  32. <span style="display: inline-block; width: 100px; text-align: left">{{
  33. info.admissDate
  34. }}</span>
  35. <span class="tbale-label">科室:</span>
  36. <span style="display: inline-block; width: 65px; text-align: left">{{
  37. info.admissWardName
  38. }}</span>
  39. <span class="tbale-label">床号:</span>
  40. <span style="display: inline-block; width: 60px; text-align: left">{{
  41. info.bedNo
  42. }}</span>
  43. <span class="tbale-label">住院号:</span>
  44. <span style="display: inline-block; width: 100px; text-align: left">{{
  45. info.inpatientNo
  46. }}</span>
  47. </p>
  48. </caption>
  49. <thead></thead>
  50. <tbody>
  51. <tr>
  52. <td
  53. ref="topTd"
  54. :colspan="index === 0 ? 8 : 6"
  55. :class="[index && 'redLineTd', !index && 'table-just']"
  56. v-for="(item, index) in inHospitalTime"
  57. :key="index + '|indays'"
  58. >
  59. {{
  60. index === 0
  61. ? "日&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;期"
  62. : item
  63. }}
  64. </td>
  65. </tr>
  66. <tr>
  67. <td
  68. :colspan="index === 0 ? 8 : 6"
  69. :class="[index && 'redLineTd', !index && 'table-just']"
  70. v-for="(item, index) in inHospitalDays"
  71. :key="index + '|inHospitalDays'"
  72. >
  73. {{ index === 0 ? "住院天数" : item }}
  74. </td>
  75. </tr>
  76. <tr>
  77. <td
  78. :colspan="index === 0 ? 8 : 6"
  79. :class="[index && 'redLineTd', !index && 'table-just']"
  80. v-for="(item, index) in surgeryDays"
  81. :key="index + '|surgeryDays'"
  82. >
  83. {{ index === 0 ? "手术后天数" : item }}
  84. </td>
  85. </tr>
  86. <tr>
  87. <td class="table-just" rowspan="2" colspan="8">
  88. 时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间
  89. </td>
  90. </tr>
  91. <!-- 已屏蔽,保留以备后用 - 旧的时间显示代码 -->
  92. <tr>
  93. <!-- <td class="focusText">3</td>
  94. <td>7</td>
  95. <td>11</td>
  96. <td>15</td>
  97. <td class="focusText">19</td>
  98. <td class="focusText redLineTd">23</td>
  99. <td class="focusText">3</td>
  100. <td>7</td>
  101. <td>11</td>
  102. <td>15</td>
  103. <td class="focusText">19</td>
  104. <td class="focusText redLineTd">23</td>
  105. <td class="focusText">3</td>
  106. <td>7</td>
  107. <td>11</td>
  108. <td>15</td>
  109. <td class="focusText">19</td>
  110. <td class="focusText redLineTd">23</td>
  111. <td class="focusText">3</td>
  112. <td>7</td>
  113. <td>11</td>
  114. <td>15</td>
  115. <td class="focusText">19</td>
  116. <td class="focusText redLineTd">23</td>
  117. <td class="focusText">3</td>
  118. <td>7</td>
  119. <td>11</td>
  120. <td>15</td>
  121. <td class="focusText">19</td>
  122. <td class="focusText redLineTd">23</td>
  123. <td class="focusText">3</td>
  124. <td>7</td>
  125. <td>11</td>
  126. <td>15</td>
  127. <td class="focusText">19</td>
  128. <td class="focusText redLineTd">23</td>
  129. <td class="focusText">3</td>
  130. <td>7</td>
  131. <td>11</td>
  132. <td>15</td>
  133. <td class="focusText">19</td>
  134. <td class="focusText">23</td> -->
  135. <td class="focusText">2</td>
  136. <td>6</td>
  137. <td>10</td>
  138. <td>14</td>
  139. <td class="focusText">18</td>
  140. <td class="focusText redLineTd">22</td>
  141. <td class="focusText">2</td>
  142. <td>6</td>
  143. <td>10</td>
  144. <td>14</td>
  145. <td class="focusText">18</td>
  146. <td class="focusText redLineTd">22</td>
  147. <td class="focusText">2</td>
  148. <td>6</td>
  149. <td>10</td>
  150. <td>14</td>
  151. <td class="focusText">18</td>
  152. <td class="focusText redLineTd">22</td>
  153. <td class="focusText">2</td>
  154. <td>6</td>
  155. <td>10</td>
  156. <td>14</td>
  157. <td class="focusText">18</td>
  158. <td class="focusText redLineTd">22</td>
  159. <td class="focusText">2</td>
  160. <td>6</td>
  161. <td>10</td>
  162. <td>14</td>
  163. <td class="focusText">18</td>
  164. <td class="focusText redLineTd">22</td>
  165. <td class="focusText">2</td>
  166. <td>6</td>
  167. <td>10</td>
  168. <td>14</td>
  169. <td class="focusText">18</td>
  170. <td class="focusText redLineTd">22</td>
  171. <td class="focusText">2</td>
  172. <td>6</td>
  173. <td>10</td>
  174. <td>14</td>
  175. <td class="focusText">18</td>
  176. <td class="focusText">22</td>
  177. </tr>
  178. <!-- <record></record> -->
  179. <tr class="recorde temperature_mark">
  180. <td colspan="2" rowspan="45" style="border-right: 1px solid white">
  181. <div :style="{ marginTop: legendStyle.marginTop, height: '31px' }">
  182. <p style="width: 35px">
  183. <span>口表•</span>
  184. <span style="color: blue">腋表x</span>
  185. <span>肛表o</span>
  186. <span style="color: red">脉搏•</span>
  187. <span style="color: red">心率o</span>
  188. </p>
  189. <p></p>
  190. </div>
  191. </td>
  192. <td colspan="3" rowspan="45">
  193. <div style="color: red" class="num_wrapper">
  194. <p :style="{ marginTop: pulseScaleStyle.titleMarginTop, textAlign: 'right' }">脉搏次/分</p>
  195. <p :style="{ marginTop: pulseScaleStyle.firstRowMarginTop }">180</p>
  196. <p :style="{ marginTop: pulseScaleStyle.normalRowMarginTop }">160</p>
  197. <p :style="{ marginTop: pulseScaleStyle.normalRowMarginTop }">140</p>
  198. <p :style="{ marginTop: pulseScaleStyle.normalRowMarginTop }">120</p>
  199. <p :style="{ marginTop: pulseScaleStyle.normalRowMarginTop }">100</p>
  200. <p :style="{ marginTop: pulseScaleStyle.normalRowMarginTop }">80</p>
  201. <p :style="{ marginTop: pulseScaleStyle.lastRowMarginTop }">60</p>
  202. <p :style="{ marginTop: pulseScaleStyle.lastRowMarginTop }">40</p>
  203. </div>
  204. </td>
  205. <td colspan="3" rowspan="45">
  206. <div style="color: blue" class="num_wrapper">
  207. <p :style="{ marginTop: temperatureScaleStyle.titleMarginTop }">体温<br />x</p>
  208. <p :style="{ marginTop: temperatureScaleStyle.firstRowMarginTop }">41</p>
  209. <p :style="{ marginTop: temperatureScaleStyle.normalRowMarginTop }">40</p>
  210. <p :style="{ marginTop: temperatureScaleStyle.normalRowMarginTop }">39</p>
  211. <p :style="{ marginTop: temperatureScaleStyle.normalRowMarginTop }">38</p>
  212. <p :style="{ marginTop: temperatureScaleStyle.normalRowMarginTop }">37</p>
  213. <p :style="{ marginTop: temperatureScaleStyle.normalRowMarginTop }">36</p>
  214. <p :style="{ marginTop: temperatureScaleStyle.lastRowMarginTop }">35</p>
  215. <p :style="{ marginTop: temperatureScaleStyle.lastRowMarginTop }">34</p>
  216. </div>
  217. </td>
  218. <td
  219. v-for="(item, y) in tdList"
  220. :key="y + 'td0'"
  221. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  222. >
  223. <div class="recorde-text" :style="recordeTextStyle">{{ getSymbolTextArr(y) }}</div>
  224. </td>
  225. </tr>
  226. <tr
  227. class="recorde"
  228. v-for="(tr, index) in [0, 0, 0]"
  229. :key="index + 'tr1'"
  230. >
  231. <td
  232. v-for="(item, y) in tdList"
  233. :key="y + 'td1'"
  234. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  235. ></td>
  236. </tr>
  237. <tr class="recorde">
  238. <template v-for="(item, index) of tdList">
  239. <td
  240. :key="index + 'td2'"
  241. v-if="index % 6 === 5 && index != tdList.length"
  242. style="
  243. border-right: 1px solid #ff6e71;
  244. border-bottom: 1px solid #7e7eff;
  245. "
  246. ></td>
  247. <td
  248. :key="index + 'td2'"
  249. v-else
  250. style="border-bottom: 1px solid #7e7eff"
  251. ></td>
  252. </template>
  253. </tr>
  254. <tr
  255. class="recorde"
  256. v-for="(tr, index) in [0, 0, 0, 0]"
  257. :key="index + 'tr2'"
  258. >
  259. <td
  260. v-for="(item, y) in tdList"
  261. :key="y + 'td3'"
  262. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  263. ></td>
  264. </tr>
  265. <tr class="recorde">
  266. <template v-for="(item, index) of tdList">
  267. <td
  268. :key="index + 'td4'"
  269. v-if="index % 6 === 5 && index != tdList.length"
  270. style="
  271. border-right: 1px solid #ff6e71;
  272. border-bottom: 1px solid #7e7eff;
  273. "
  274. ></td>
  275. <td
  276. :key="index + 'td4'"
  277. v-else
  278. style="border-bottom: 1px solid #7e7eff"
  279. ></td>
  280. </template>
  281. </tr>
  282. <tr
  283. class="recorde"
  284. v-for="(tr, index) in [0, 0, 0, 0]"
  285. :key="index + 'tr3'"
  286. >
  287. <td
  288. v-for="(item, y) in tdList"
  289. :key="y + 'td5'"
  290. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  291. ></td>
  292. </tr>
  293. <tr class="recorde">
  294. <template v-for="(item, index) of tdList">
  295. <td
  296. :key="index + 'td6'"
  297. v-if="index % 6 === 5 && index != tdList.length"
  298. style="
  299. border-right: 1px solid #ff6e71;
  300. border-bottom: 1px solid #7e7eff;
  301. "
  302. ></td>
  303. <td
  304. :key="index + 'td6'"
  305. v-else
  306. style="border-bottom: 1px solid #7e7eff"
  307. ></td>
  308. </template>
  309. </tr>
  310. <tr
  311. class="recorde"
  312. v-for="(tr, index) in [0, 0, 0, 0]"
  313. :key="index + 'tr4'"
  314. >
  315. <td
  316. v-for="(item, y) in tdList"
  317. :key="y + 'td7'"
  318. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  319. ></td>
  320. </tr>
  321. <tr class="recorde">
  322. <template v-for="(item, index) of tdList">
  323. <td
  324. :key="index + 'td8'"
  325. v-if="index % 6 === 5 && index != tdList.length"
  326. style="
  327. border-right: 1px solid #ff6e71;
  328. border-bottom: 1px solid #7e7eff;
  329. "
  330. ></td>
  331. <td
  332. :key="index + 'td8'"
  333. v-else
  334. style="border-bottom: 1px solid #7e7eff"
  335. ></td>
  336. </template>
  337. </tr>
  338. <tr
  339. class="recorde"
  340. v-for="(tr, index) in [0, 0, 0, 0]"
  341. :key="index + 'tr5'"
  342. >
  343. <td
  344. v-for="(item, y) in tdList"
  345. :key="y + 'td9'"
  346. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  347. ></td>
  348. </tr>
  349. <tr class="recorde">
  350. <template v-for="(item, index) of tdList">
  351. <td
  352. :key="index + 'td10'"
  353. v-if="index % 6 === 5 && index != tdList.length"
  354. style="
  355. border-right: 1px solid #ff6e71;
  356. border-bottom: 1px solid #ff0000;
  357. "
  358. ></td>
  359. <td
  360. :key="index + 'td10'"
  361. v-else
  362. style="border-bottom: 1px solid #ff0000"
  363. ></td>
  364. </template>
  365. </tr>
  366. <tr
  367. class="recorde"
  368. v-for="(tr, index) in [0, 0, 0, 0]"
  369. :key="index + 'tr6'"
  370. >
  371. <td
  372. v-for="(item, y) in tdList"
  373. :key="y + 'td11'"
  374. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  375. ></td>
  376. </tr>
  377. <tr class="recorde">
  378. <template v-for="(item, index) of tdList">
  379. <td
  380. :key="index + 'td11'"
  381. v-if="index % 6 === 5 && index != tdList.length"
  382. style="
  383. border-right: 1px solid #ff6e71;
  384. border-bottom: 1px solid #7e7eff;
  385. "
  386. ></td>
  387. <td
  388. :key="index + 'td11'"
  389. v-else
  390. style="border-bottom: 1px solid #7e7eff"
  391. ></td>
  392. </template>
  393. </tr>
  394. <tr
  395. class="recorde"
  396. v-for="(tr, index) in [0, 0, 0, 0]"
  397. :key="index + 'tr7'"
  398. >
  399. <td
  400. v-for="(item, y) in tdList"
  401. :key="y"
  402. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  403. ></td>
  404. </tr>
  405. <tr class="recorde">
  406. <template v-for="(item, index) of tdList">
  407. <td
  408. :key="index + 'td12'"
  409. v-if="index % 6 === 5 && index != tdList.length"
  410. style="
  411. border-right: 1px solid #ff6e71;
  412. border-bottom: 1px solid #7e7eff;
  413. "
  414. ></td>
  415. <td
  416. :key="index + 'td12'"
  417. v-else
  418. style="border-bottom: 1px solid #7e7eff"
  419. ></td>
  420. </template>
  421. </tr>
  422. <tr
  423. class="recorde"
  424. v-for="(tr, index) in [0, 0, 0, 0]"
  425. :key="index + 'tr8'"
  426. >
  427. <td
  428. v-for="(item, y) in tdList"
  429. :key="y + 'td13'"
  430. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  431. ></td>
  432. </tr>
  433. <tr class="recorde">
  434. <template v-for="(item, index) of tdList">
  435. <td
  436. :key="index + 'td14'"
  437. v-if="index % 6 === 5 && index != tdList.length"
  438. style="
  439. border-right: 1px solid #ff6e71;
  440. border-bottom: 1px solid #7e7eff;
  441. "
  442. ></td>
  443. <td
  444. :key="index + 'td14'"
  445. v-else
  446. style="border-bottom: 1px solid #7e7eff"
  447. ></td>
  448. </template>
  449. </tr>
  450. <tr
  451. class="recorde"
  452. v-for="(tr, index) in [0, 0, 0, 0, 0]"
  453. :key="index + 'tr9'"
  454. >
  455. <td
  456. v-for="(item, y) in tdList"
  457. :key="y + 'td15'"
  458. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  459. ></td>
  460. </tr>
  461. <tr></tr>
  462. <tr>
  463. <td
  464. :colspan="index === 0 ? 8 : 1"
  465. v-for="(item, index) in array42"
  466. :class="[index && 'redLineTd']"
  467. :key="index + '|098'"
  468. >
  469. {{
  470. index === 0
  471. ? "呼吸(次/分)"
  472. : typesViewData["098"] && typesViewData["098"][index - 1]
  473. }}
  474. </td>
  475. </tr>
  476. <tr>
  477. <td
  478. :colspan="index === 0 ? 8 : 1"
  479. v-for="(item, index) in array42"
  480. :class="[index && 'redLineTd']"
  481. :key="index + '|099'"
  482. >
  483. {{
  484. index === 0
  485. ? "疼痛强度"
  486. : typesViewData["099"] && typesViewData["099"][index - 1]
  487. }}
  488. </td>
  489. </tr>
  490. <tr>
  491. <td
  492. :colspan="index === 0 ? 8 : 6"
  493. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  494. :class="[index && 'redLineTd']"
  495. :key="index + '|005'"
  496. >
  497. {{
  498. index === 0
  499. ? "大便(次/日)"
  500. : typesViewData["005"] && typesViewData["005"][index - 1]
  501. }}
  502. </td>
  503. </tr>
  504. <tr>
  505. <td
  506. :colspan="index === 0 ? 8 : 6"
  507. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  508. :class="[index && 'redLineTd']"
  509. :key="index + '|004'"
  510. >
  511. {{
  512. index === 0
  513. ? "小便(ml)"
  514. : typesViewData["004"] && typesViewData["004"][index - 1]
  515. }}
  516. </td>
  517. </tr>
  518. <tr>
  519. <td
  520. :colspan="index === 0 ? 8 : 6"
  521. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  522. :class="[index && 'redLineTd']"
  523. :key="index + '|008'"
  524. >
  525. {{
  526. index === 0
  527. ? "血压(mmHg)"
  528. : typesViewData["008"] && typesViewData["008"][index - 1]
  529. }}
  530. </td>
  531. </tr>
  532. <tr>
  533. <td
  534. :colspan="index === 0 ? 8 : 6"
  535. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  536. :class="[index && 'redLineTd']"
  537. :key="index + '|030'"
  538. >
  539. {{
  540. index === 0
  541. ? "身高(cm)"
  542. : typesViewData["030"] && typesViewData["030"][index - 1]
  543. }}
  544. </td>
  545. </tr>
  546. <tr>
  547. <td
  548. :colspan="index === 0 ? 8 : 6"
  549. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  550. :class="[index && 'redLineTd']"
  551. :key="index + '|009'"
  552. >
  553. {{
  554. index === 0
  555. ? "体重(kg)"
  556. : typesViewData["009"] && typesViewData["009"][index - 1]
  557. }}
  558. </td>
  559. </tr>
  560. <tr>
  561. <td
  562. :colspan="index === 0 ? 8 : 6"
  563. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  564. :class="[index && 'redLineTd']"
  565. :key="index + '|006'"
  566. >
  567. {{
  568. index === 0
  569. ? "入量"
  570. : typesViewData["006"] && typesViewData["006"][index - 1]
  571. }}
  572. </td>
  573. </tr>
  574. <tr>
  575. <td
  576. :colspan="index === 0 ? 8 : 6"
  577. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  578. :class="[index && 'redLineTd']"
  579. :key="index + '|011'"
  580. >
  581. {{
  582. index === 0
  583. ? "出量"
  584. : typesViewData["011"] && typesViewData["011"][index - 1]
  585. }}
  586. </td>
  587. </tr>
  588. <tr>
  589. <td
  590. :colspan="index === 0 ? 8 : 6"
  591. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  592. :class="[index && 'redLineTd']"
  593. :key="index + '|010'"
  594. >
  595. {{
  596. index === 0
  597. ? "过敏药物"
  598. : typesViewData["010"] && typesViewData["010"][index - 1]
  599. }}
  600. </td>
  601. </tr>
  602. <!-- 皮试结果第一行 -->
  603. <tr>
  604. <td
  605. :colspan="index === 0 ? 8 : 6"
  606. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  607. :class="[index && 'redLineTd']"
  608. :key="index + '|031'"
  609. >
  610. {{
  611. index === 0
  612. ? "皮试结果1"
  613. : typesViewData["031"] && typesViewData["031"][index - 1]
  614. }}
  615. </td>
  616. </tr>
  617. <!-- 皮试结果第二行 -->
  618. <tr>
  619. <td
  620. :colspan="index === 0 ? 8 : 6"
  621. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  622. :class="[index && 'redLineTd']"
  623. :key="index + '|032'"
  624. >
  625. {{
  626. index === 0
  627. ? "皮试结果2"
  628. : typesViewData["032"] && typesViewData["032"][index - 1]
  629. }}
  630. </td>
  631. </tr>
  632. <!-- 皮试结果第三行 -->
  633. <tr>
  634. <td
  635. :colspan="index === 0 ? 8 : 6"
  636. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  637. :class="[index && 'redLineTd']"
  638. :key="index + '|033'"
  639. >
  640. {{
  641. index === 0
  642. ? "皮试结果3"
  643. : typesViewData["033"] && typesViewData["033"][index - 1]
  644. }}
  645. </td>
  646. </tr>
  647. <!-- 皮试结果第四行 -->
  648. <tr>
  649. <td
  650. :colspan="index === 0 ? 8 : 6"
  651. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  652. :class="[index && 'redLineTd']"
  653. :key="index + '|034'"
  654. >
  655. {{
  656. index === 0
  657. ? "皮试结果4"
  658. : typesViewData["034"] && typesViewData["034"][index - 1]
  659. }}
  660. </td>
  661. </tr>
  662. </tbody>
  663. </table>
  664. <div style="text-align: center">
  665. <div style="font-size: 20px; font-weight: bold">
  666. {{ `第${info.pageNo}页` }}
  667. </div>
  668. </div>
  669. </div>
  670. </template>
  671. <script>
  672. import * as d3 from "d3";
  673. import dayjs from "dayjs";
  674. import { getKeyMap, SectionToChinese } from "./utils";
  675. import {
  676. getChartData,
  677. getAllPatintInfo,
  678. } from "@/api/medical-advice/nursing-manage";
  679. import { getFormatDatetime } from "@/utils/date";
  680. import env from "../../../utils/setting";
  681. export default {
  682. props: {
  683. patientInfo: Object,
  684. queryParam: Object,
  685. },
  686. data() {
  687. return {
  688. marginTop: 0,
  689. keyMap: getKeyMap(),
  690. info: {
  691. age: 0,
  692. beginDate: "",
  693. inpatientNo: "",
  694. hospDate: 0,
  695. admissDate: "",
  696. bedNo: "",
  697. inDate: 0,
  698. inDiagName: null,
  699. name: "",
  700. admissWardName: "",
  701. sexName: "",
  702. pageNo: "1",
  703. operaDays: [],
  704. admissDateTime: null, // 完整的入院时间
  705. },
  706. xyList: [],
  707. typesInfo: [],
  708. coolingMarkers: [],
  709. typesViewData: {},
  710. breathData: [],
  711. tdList: new Array(42).fill(0),
  712. comKey: 1,
  713. symbolTextArr: [],
  714. array42: [],
  715. // 动态样式
  716. recordeTextStyle: {
  717. width: '12px',
  718. height: '10px',
  719. color: '#ff0000',
  720. fontSize: '8px',
  721. position: 'relative',
  722. top: '-1px',
  723. lineHeight: '14px'
  724. },
  725. // 动态刻度样式
  726. pulseScaleStyle: {
  727. titleMarginTop: '0px',
  728. firstRowMarginTop: '32px',
  729. normalRowMarginTop: '55px',
  730. lastRowMarginTop: '56px'
  731. },
  732. temperatureScaleStyle: {
  733. titleMarginTop: '0px',
  734. firstRowMarginTop: '32px',
  735. normalRowMarginTop: '55px',
  736. lastRowMarginTop: '56px'
  737. },
  738. legendStyle: {
  739. marginTop: '476px'
  740. },
  741. containerStyle: {
  742. marginTop: '-12px'
  743. }
  744. };
  745. },
  746. computed: {
  747. env() {
  748. return env;
  749. },
  750. // 日期
  751. inHospitalTime() {
  752. const initday = dayjs(this.info.beginDate);
  753. return [
  754. null, // 文案天
  755. initday.format("YYYY-MM-DD"),
  756. initday.add(1, "day").format("MM-DD"),
  757. initday.add(2, "day").format("MM-DD"),
  758. initday.add(3, "day").format("MM-DD"),
  759. initday.add(4, "day").format("MM-DD"),
  760. initday.add(5, "day").format("MM-DD"),
  761. initday.add(6, "day").format("MM-DD"),
  762. ];
  763. },
  764. // 住院天数
  765. inHospitalDays() {
  766. const initday = this.info.hospDays || 0;
  767. return [
  768. null, // 文案天
  769. initday + 1,
  770. initday + 2,
  771. initday + 3,
  772. initday + 4,
  773. initday + 5,
  774. initday + 6,
  775. initday + 7,
  776. ];
  777. },
  778. // 手术天数
  779. surgeryDays() {
  780. const initday = this.info.operaDays;
  781. if (initday.length <= 0) {
  782. return new Array(8).fill(null);
  783. } else {
  784. return initday;
  785. }
  786. },
  787. },
  788. mounted() {
  789. for (let i = 0; i < 43; i++) {
  790. this.array42.push(i);
  791. }
  792. this.initData();
  793. // 计算默认marginTop
  794. const defaultMarginTop =
  795. (Math.round(this.$refs.topTd[0].getBoundingClientRect().height) - 18) *
  796. 10 +
  797. 28;
  798. this.marginTop = defaultMarginTop;
  799. // 根据分辨率设置样式
  800. this.setStyleByResolution();
  801. // setTimeout(() => {
  802. // this.$emit('done')
  803. // })
  804. },
  805. methods: {
  806. SectionToChinese,
  807. // 将时间转换为中文格式
  808. convertTimeToChinese(hour, minute) {
  809. // 参考 Java 版本的 numberToChinese 方法,创建专门的时间转换函数
  810. const numberToChinese = (number) => {
  811. if (number === 0) return "零";
  812. if (number === 1) return "一";
  813. if (number === 2) return "二";
  814. if (number === 3) return "三";
  815. if (number === 4) return "四";
  816. if (number === 5) return "五";
  817. if (number === 6) return "六";
  818. if (number === 7) return "七";
  819. if (number === 8) return "八";
  820. if (number === 9) return "九";
  821. if (number === 10) return "十";
  822. if (number === 11) return "十一";
  823. if (number === 12) return "十二";
  824. if (number === 13) return "十三";
  825. if (number === 14) return "十四";
  826. if (number === 15) return "十五";
  827. if (number === 16) return "十六";
  828. if (number === 17) return "十七";
  829. if (number === 18) return "十八";
  830. if (number === 19) return "十九";
  831. if (number === 20) return "二十";
  832. if (number === 21) return "二十一";
  833. if (number === 22) return "二十二";
  834. if (number === 23) return "二十三";
  835. if (number === 24) return "二十四";
  836. if (number === 25) return "二十五";
  837. if (number === 26) return "二十六";
  838. if (number === 27) return "二十七";
  839. if (number === 28) return "二十八";
  840. if (number === 29) return "二十九";
  841. if (number === 30) return "三十";
  842. if (number === 31) return "三十一";
  843. if (number === 32) return "三十二";
  844. if (number === 33) return "三十三";
  845. if (number === 34) return "三十四";
  846. if (number === 35) return "三十五";
  847. if (number === 36) return "三十六";
  848. if (number === 37) return "三十七";
  849. if (number === 38) return "三十八";
  850. if (number === 39) return "三十九";
  851. if (number === 40) return "四十";
  852. if (number === 41) return "四十一";
  853. if (number === 42) return "四十二";
  854. if (number === 43) return "四十三";
  855. if (number === 44) return "四十四";
  856. if (number === 45) return "四十五";
  857. if (number === 46) return "四十六";
  858. if (number === 47) return "四十七";
  859. if (number === 48) return "四十八";
  860. if (number === 49) return "四十九";
  861. if (number === 50) return "五十";
  862. if (number === 51) return "五十一";
  863. if (number === 52) return "五十二";
  864. if (number === 53) return "五十三";
  865. if (number === 54) return "五十四";
  866. if (number === 55) return "五十五";
  867. if (number === 56) return "五十六";
  868. if (number === 57) return "五十七";
  869. if (number === 58) return "五十八";
  870. if (number === 59) return "五十九";
  871. // 对于其他数字,使用通用的转换逻辑
  872. if (number < 10) {
  873. return numberToChinese(number);
  874. } else if (number < 20) {
  875. return "十" + (number === 10 ? "" : numberToChinese(number - 10));
  876. } else if (number < 60) {
  877. const tens = Math.floor(number / 10);
  878. const ones = number % 10;
  879. let tensStr = "";
  880. switch (tens) {
  881. case 2: tensStr = "二十"; break;
  882. case 3: tensStr = "三十"; break;
  883. case 4: tensStr = "四十"; break;
  884. case 5: tensStr = "五十"; break;
  885. }
  886. return tensStr + (ones === 0 ? "" : numberToChinese(ones));
  887. }
  888. return String(number);
  889. };
  890. const hourStr = numberToChinese(hour);
  891. const minuteStr = numberToChinese(minute);
  892. // 处理分钟为0的情况
  893. if (minute === 0) {
  894. return `${hourStr}时`;
  895. }
  896. // 处理分钟小于10的情况,需要加"零"
  897. if (minute < 10) {
  898. return `${hourStr}时零${minuteStr}分`;
  899. }
  900. return `${hourStr}时${minuteStr}分`;
  901. },
  902. // 生成入院标识文字
  903. generateAdmissionText(admissionDateTime) {
  904. if (!admissionDateTime) return "";
  905. const date = new Date(admissionDateTime);
  906. const hour = date.getHours();
  907. const minute = date.getMinutes();
  908. return `入院时间${this.convertTimeToChinese(hour, minute)}`;
  909. },
  910. // 获取入院时间应该显示的时间段索引
  911. getAdmissionTimeSlot(admissionDateTime) {
  912. if (!admissionDateTime) return -1;
  913. const date = new Date(admissionDateTime);
  914. const hour = date.getHours();
  915. const minute = date.getMinutes();
  916. const second = date.getSeconds();
  917. // 将时间转换为分钟数,便于精确计算
  918. const totalMinutes = hour * 60 + minute + second / 60;
  919. // 标准时间点:02:00, 06:00, 10:00, 14:00, 18:00, 22:00
  920. const standardMinutes = [2 * 60, 6 * 60, 10 * 60, 14 * 60, 18 * 60, 22 * 60];
  921. // 计算到每个标准时间点的距离,选择最近的
  922. let minDistance = Infinity;
  923. let closestIndex = -1;
  924. for (let i = 0; i < standardMinutes.length; i++) {
  925. const standardMinute = standardMinutes[i];
  926. let distance;
  927. // 计算距离,考虑跨天的情况
  928. if (Math.abs(totalMinutes - standardMinute) <= 12 * 60) {
  929. // 同一天内或相邻天的情况
  930. distance = Math.abs(totalMinutes - standardMinute);
  931. } else {
  932. // 跨天的情况,需要计算最短距离
  933. if (totalMinutes > standardMinute) {
  934. // 例如:23点到02点
  935. distance = Math.min(totalMinutes - standardMinute, (24 * 60 - totalMinutes) + standardMinute);
  936. } else {
  937. // 例如:1点到22点
  938. distance = Math.min(standardMinute - totalMinutes, (24 * 60 - standardMinute) + totalMinutes);
  939. }
  940. }
  941. // 更新最小距离和对应的索引
  942. if (distance < minDistance) {
  943. minDistance = distance;
  944. closestIndex = i;
  945. }
  946. }
  947. return closestIndex;
  948. },
  949. getSymbolTextArr(index) {
  950. // 检查是否是入院时间对应的位置
  951. if (this.info.admissDateTime) {
  952. // 计算入院时间对应的日期索引
  953. const admissionDate = new Date(this.info.admissDateTime);
  954. const currentDate = dayjs(this.info.beginDate).add(Math.floor(index / 6), 'day');
  955. // 判断是否是入院当天
  956. if (dayjs(admissionDate).format('YYYY-MM-DD') === currentDate.format('YYYY-MM-DD')) {
  957. // 判断是否是入院时间段
  958. const admissionSlot = this.getAdmissionTimeSlot(this.info.admissDateTime);
  959. if (admissionSlot === (index % 6)) {
  960. return this.generateAdmissionText(this.info.admissDateTime);
  961. }
  962. }
  963. }
  964. // 原有的特殊标注文字逻辑
  965. const current = this.symbolTextArr.find(i => i.x === index);
  966. if (current) {
  967. return current.y;
  968. } else {
  969. return "";
  970. }
  971. },
  972. temperatureConverter(c) {
  973. const value = (c * 9) / 5 + 32;
  974. return value.toFixed(1);
  975. },
  976. initData() {
  977. // this.info = dataModel.grParamBOS
  978. this.info.pageNo = this.queryParam.week;
  979. this.info.beginDate = this.queryParam.startRecTime;
  980. this.info.hospDays = (Number(this.queryParam.week) - 1) * 7;
  981. // this.rowsInfo = dataModel.rows || []
  982. // this.typesInfo = dataModel.types || []
  983. let param = {
  984. inpatientNo: this.patientInfo.inpatientNo,
  985. admissTimes: this.patientInfo.admissTimes,
  986. week: this.queryParam.week,
  987. startRecTime: this.queryParam.startRecTime,
  988. endRecTime: this.queryParam.endRecTime,
  989. mbFlag: this.queryParam.checkBoxFlag.mbFlag,
  990. hxFlag: this.queryParam.checkBoxFlag.hxFlag,
  991. xyFlag: this.queryParam.checkBoxFlag.xyFlag,
  992. wcyRqFlag: this.queryParam.checkBoxFlag.wcyRqFlag,
  993. };
  994. getAllPatintInfo({
  995. inpatientNo: this.patientInfo.inpatientNo,
  996. admissTimes: this.patientInfo.admissTimes,
  997. }).then(res => {
  998. this.info.name = res.name;
  999. this.info.age = res.age || "";
  1000. this.info.sexName = res.sexName;
  1001. this.info.bedNo = res.bedNo;
  1002. this.info.inpatientNo = res.inpatientNo;
  1003. this.info.admissWardName = res.admissWardName;
  1004. this.info.admissDate = getFormatDatetime(res.admissDate, "YYYY-MM-DD");
  1005. // 保存完整的入院时间用于生成入院标识
  1006. this.info.admissDateTime = res.admissDate;
  1007. });
  1008. getChartData(param).then(res => {
  1009. this.rowsInfo = res.rows;
  1010. this.typesInfo = res.types;
  1011. this.coolingMarkers = res.coolingMarkers || [];
  1012. this.info.operaDays = res.operaDays;
  1013. this.init();
  1014. });
  1015. },
  1016. init() {
  1017. //800 758
  1018. var width = 690;
  1019. var height = 682;
  1020. // SVG画布边缘与图表内容的距离
  1021. var padding = { top: 50, right: 0, bottom: 50, left: 50 };
  1022. // 创建一个分组用来组合要画的图表元素
  1023. var main = d3
  1024. .select(".container svg")
  1025. .append("g")
  1026. .classed("main", true)
  1027. .attr("transform", "translate(" + 80 + "," + 80 + ")");
  1028. // 模拟数据 体温
  1029. var dataset = getTypeData("003", this.rowsInfo);
  1030. var datasetAnus = getTypeData("015", this.rowsInfo);
  1031. var datasetHeartrate = getTypeData("014", this.rowsInfo);
  1032. var datasetPulse = getTypeData("002", this.rowsInfo);
  1033. var symbolTextArr = getTypeData("012", this.rowsInfo, false);
  1034. this.symbolTextArr = symbolTextArr;
  1035. // 口表【黑实圆】
  1036. var datasetPain = getTypeData("001", this.rowsInfo);
  1037. this.breathData = datasetPain;
  1038. // const circleNode = document.createElement('circle')
  1039. // circleNode.setAttribute('cx', '179.2439024390244')
  1040. // circleNode.setAttribute('cy', '582')
  1041. // circleNode.setAttribute('r', '4')
  1042. // circleNode.setAttribute('stroke', '#000000')
  1043. // circleNode.setAttribute('stroke-width', '1')
  1044. // circleNode.setAttribute('fill', '#FFFFFF')
  1045. // document.querySelector('.main').appendChild(circleNode)
  1046. // 创建x轴的比例尺(线性比例尺)
  1047. var xScale = d3
  1048. .scaleLinear()
  1049. .domain([0, 41])
  1050. .range([9, width - padding.left - padding.right + 75]);
  1051. // 创建y轴的比例尺(线性比例尺)
  1052. /* var yScale = d3.scale.linear()
  1053. .domain([0, d3.max(dataset,function(d) {
  1054. return d.y;
  1055. })])
  1056. .range([height - padding.top - padding.bottom, 0]); */
  1057. // 体温
  1058. var yScale = d3
  1059. .scaleLinear()
  1060. .domain([33, 42])
  1061. .range([height - padding.top - padding.bottom, -56]);
  1062. // 脉搏
  1063. var yScale1 = d3
  1064. .scaleLinear()
  1065. .domain([20, 200])
  1066. .range([height - padding.top - padding.bottom, -55]);
  1067. // 呼吸
  1068. var yScale2 = d3
  1069. .scaleLinear()
  1070. .domain([0, 40])
  1071. .range([height - padding.top + 22, -55]);
  1072. // 创建x轴
  1073. var xAxis = d3.axisBottom().scale(xScale);
  1074. // 创建y轴
  1075. var yAxis = d3.axisLeft().scale(yScale);
  1076. var yAxis1 = d3.axisLeft().scale(yScale1);
  1077. var yAxis2 = d3.axisLeft().scale(yScale2);
  1078. // 添加SVG元素并与x轴进行“绑定”
  1079. main
  1080. .append("g")
  1081. .attr("class", "axis")
  1082. .attr(
  1083. "transform",
  1084. "translate(0," + (height - padding.top - padding.bottom) + ")"
  1085. )
  1086. .call(xAxis);
  1087. // 添加SVG元素并与y轴进行“绑定”
  1088. main.append("g").attr("class", "axis").call(yAxis);
  1089. main.append("g").attr("class", "axis").call(yAxis1);
  1090. main.append("g").attr("class", "axis").call(yAxis2);
  1091. // 添加折线
  1092. var line = d3
  1093. .line()
  1094. .x(function (d) {
  1095. return xScale(d.x);
  1096. })
  1097. .y(function (d) {
  1098. return yScale(d.y);
  1099. });
  1100. var line1 = d3
  1101. .line()
  1102. .x(function (d) {
  1103. return xScale(d.x);
  1104. })
  1105. .y(function (d) {
  1106. return yScale1(d.y);
  1107. });
  1108. var line2 = d3
  1109. .line()
  1110. .x(function (d) {
  1111. return xScale(d.x);
  1112. })
  1113. .y(function (d) {
  1114. return yScale(d.y);
  1115. });
  1116. // .interpolate('linear')
  1117. // 选择线条的类型
  1118. // 添加path元素,并通过line()计算出值来赋值
  1119. main
  1120. .append("path")
  1121. .attr("class", "line tiwenline")
  1122. .attr("d", line(dataset));
  1123. main.append("path").attr("class", "line").attr("d", line(datasetAnus));
  1124. main.append("path").attr("class", "line").attr("d", line2(datasetPain));
  1125. main
  1126. .append("path")
  1127. .attr("class", "line redColor")
  1128. .attr("d", line1(datasetHeartrate));
  1129. main
  1130. .append("path")
  1131. .attr("class", "line redColor")
  1132. .attr("d", line1(datasetPulse));
  1133. // main.append('path').attr('class', 'line').attr('d', line3(dataset))
  1134. // 添加点
  1135. /* 黑实圆--start */
  1136. // main
  1137. // .selectAll('rect')
  1138. // .data(dataset_mouth)
  1139. // .enter()
  1140. // .append('circle')
  1141. // .attr('cx', function (d) {
  1142. // return xScale(d.x)
  1143. // })
  1144. // .attr('cy', function (d) {
  1145. // return yScale(d.y)
  1146. // })
  1147. // .attr('r', 4)
  1148. // .attr('fill', function (d, i) {
  1149. // return 'black'
  1150. // })
  1151. /* 黑实圆--end */
  1152. /* 黑空圆--start */
  1153. main
  1154. .selectAll("rect")
  1155. .data(datasetAnus)
  1156. .enter()
  1157. .append("circle")
  1158. .attr("cx", function (d) {
  1159. return xScale(d.x);
  1160. })
  1161. .attr("cy", function (d) {
  1162. return yScale(d.y);
  1163. })
  1164. .attr("r", 4)
  1165. .attr("stroke", "#000000")
  1166. .attr("stroke-width", 1)
  1167. .attr("fill", "#FFFFFF");
  1168. /* 黑空圆--end */
  1169. /* 红空圆--start */
  1170. main
  1171. .selectAll("rect")
  1172. .data(datasetHeartrate)
  1173. .enter()
  1174. .append("circle")
  1175. .attr("cx", function (d) {
  1176. return xScale(d.x);
  1177. })
  1178. .attr("cy", function (d) {
  1179. return yScale1(d.y);
  1180. })
  1181. .attr("r", 4)
  1182. .attr("stroke", "#EE0000")
  1183. .attr("stroke-width", 1)
  1184. .attr("fill", "#FFFFFF");
  1185. /* 红空圆--end */
  1186. /* 红实圆--start */
  1187. main
  1188. .selectAll("rect")
  1189. .data(datasetPulse)
  1190. .enter()
  1191. .append("circle")
  1192. .attr("cx", function (d) {
  1193. return xScale(d.x);
  1194. })
  1195. .attr("cy", function (d) {
  1196. return yScale1(d.y);
  1197. })
  1198. .attr("r", 4)
  1199. .attr("fill", "#EE0000");
  1200. // .on('mouseover', function (d) {
  1201. // // (1)取得提示显示的位置
  1202. // var xPosition = parseFloat(d3.select(this).attr('cx')) + 698
  1203. // var yPosition = parseFloat(d3.select(this).attr('cy')) + 24
  1204. //
  1205. // // (2)创建提示条SVG
  1206. // d3.select('.container svg')
  1207. // .append('text')
  1208. // .attr('id', 'tooltip') // 设置id便于移除提示
  1209. // .attr('x', xPosition)
  1210. // .attr('y', yPosition)
  1211. // .attr('text-anchor', 'middle')
  1212. // .attr('font-family', 'sans-setif')
  1213. // .attr('font-size', '11px')
  1214. // .attr('font-weight', 'bold')
  1215. // .attr('fill', 'white')
  1216. // .text(d.value)
  1217. // })
  1218. // (3)移除提示条SVG
  1219. /* 红实圆--end */
  1220. /* 黑实圆--start */
  1221. main
  1222. .selectAll("rect")
  1223. .data(datasetPain)
  1224. .enter()
  1225. .append("circle")
  1226. .attr("cx", function (d) {
  1227. return xScale(d.x);
  1228. })
  1229. .attr("cy", function (d) {
  1230. return yScale(d.y);
  1231. })
  1232. .attr("r", 4)
  1233. .attr("stroke", "#000000")
  1234. .attr("fill", "#000000");
  1235. /* 黑实圆--end */
  1236. this.drawx(main, dataset, xScale, yScale);
  1237. this.drawCoolingMarkers(main, xScale, yScale);
  1238. this.initTypes();
  1239. // this.hoverEvent(main)
  1240. },
  1241. drawCoolingMarkers(main, xScale, yScale) {
  1242. if (!this.coolingMarkers || this.coolingMarkers.length === 0) return;
  1243. const group = {};
  1244. this.coolingMarkers.forEach(m => {
  1245. if (!m) return;
  1246. const idx = Number(m.index);
  1247. const before = m.before != null ? Number(m.before) : null;
  1248. const after = m.after != null ? Number(m.after) : null;
  1249. if (!Number.isFinite(idx) || before === null || after === null) return;
  1250. if (!group[idx]) group[idx] = [];
  1251. group[idx].push({ before, after });
  1252. });
  1253. const step = 2; // 同格多标记时的水平偏移像素
  1254. Object.keys(group).forEach(k => {
  1255. const idx = Number(k);
  1256. const arr = group[k];
  1257. const n = arr.length;
  1258. const start = -Math.floor((n - 1) / 2) * step;
  1259. arr.forEach((m, i) => {
  1260. const x = xScale(idx) + (n > 1 ? start + i * step : 0);
  1261. const yTop = yScale(Number(m.before));
  1262. const yBottom = yScale(Number(m.after));
  1263. if (!Number.isFinite(yTop) || !Number.isFinite(yBottom)) return;
  1264. // 竖向红色虚线
  1265. main
  1266. .append("line")
  1267. .attr("x1", x)
  1268. .attr("y1", yTop)
  1269. .attr("x2", x)
  1270. .attr("y2", yBottom)
  1271. .attr("stroke", "#ff0000")
  1272. .attr("stroke-width", 1)
  1273. .attr("stroke-dasharray", "5 5");
  1274. // 底部小圆圈
  1275. main
  1276. .append("circle")
  1277. .attr("cx", x)
  1278. .attr("cy", yBottom)
  1279. .attr("r", 3)
  1280. .attr("stroke", "#ff0000")
  1281. .attr("stroke-width", 1)
  1282. .attr("fill", "none");
  1283. });
  1284. });
  1285. },
  1286. drawx(main, dataset, xScale, yScale) {
  1287. /* 【叉形】--start */
  1288. main
  1289. .selectAll("rect")
  1290. .data(dataset)
  1291. .enter()
  1292. .append("line")
  1293. .attr("x1", function (d) {
  1294. return xScale(d.x) - 4;
  1295. })
  1296. .attr("y1", function (d) {
  1297. return yScale(d.y) - 4;
  1298. })
  1299. .attr("x2", function (d) {
  1300. return xScale(d.x) + 4;
  1301. })
  1302. .attr("y2", function (d) {
  1303. return yScale(d.y) + 4;
  1304. })
  1305. .attr("stroke", function (d, i) {
  1306. return "blue";
  1307. });
  1308. main
  1309. .selectAll("rect")
  1310. .data(dataset)
  1311. .enter()
  1312. .append("line")
  1313. .attr("x1", function (d) {
  1314. return xScale(d.x) + 4;
  1315. })
  1316. .attr("y1", function (d) {
  1317. return yScale(d.y) - 4;
  1318. })
  1319. .attr("x2", function (d) {
  1320. return xScale(d.x) - 4;
  1321. })
  1322. .attr("y2", function (d) {
  1323. return yScale(d.y) + 4;
  1324. })
  1325. .attr("stroke", function (d, i) {
  1326. return "blue";
  1327. });
  1328. /* 体温【叉形】--end */
  1329. },
  1330. hoverEvent(main) {
  1331. ///* 鼠标悬停直线--start
  1332. // var dataset_line = [{x: 0,y: 0}]
  1333. // main.selectAll('rect')
  1334. // .data(dataset_line)
  1335. // .enter()
  1336. // .append('line')
  1337. // .attr({
  1338. // 'x1':100,'y1':-56,
  1339. // 'x2':100,'y2':582
  1340. // })
  1341. // .attr('stroke', function(d, i) {
  1342. // return 'black';
  1343. // });
  1344. // 鼠标悬停直线--end */
  1345. document.querySelector(".lineColor").style.stroke = "red";
  1346. const recordeNode = document.createElement("div");
  1347. recordeNode.setAttribute("class", "recorde-text");
  1348. document.querySelector(".recorde td").append(recordeNode);
  1349. const allTrtd = document.querySelectorAll(".temperatureChart tr td");
  1350. [...allTrtd].map(ele => {
  1351. ele.setAttribute("title", ele.innerText);
  1352. });
  1353. /* 鼠标悬停提示框 */
  1354. var tooltip = d3
  1355. .select("body")
  1356. .append("div")
  1357. .attr("class", "tooltip")
  1358. .style("opacity", 0.0);
  1359. main
  1360. .on("mouseover", function (d) {
  1361. /*
  1362. 鼠标移入时,
  1363. (1)通过 selection.html() 来更改提示框的文字
  1364. (2)通过更改样式 left 和 top 来设定提示框的位置
  1365. (3)设定提示框的透明度为1.0(完全不透明)
  1366. */
  1367. tooltip
  1368. .html("呼吸:19次/分<br/>录入信息:2017-11-02<br/>姓名:张三")
  1369. .style("left", d3.event.pageX + "px")
  1370. .style("top", d3.event.pageY + 20 + "px")
  1371. .style("opacity", 1.0);
  1372. })
  1373. .on("mousemove", function (d) {
  1374. /* 鼠标移动时,更改样式 left 和 top 来改变提示框的位置 */
  1375. tooltip
  1376. .style("left", d3.event.pageX + "px")
  1377. .style("top", d3.event.pageY + 20 + "px");
  1378. })
  1379. .on("mouseout", function (d) {
  1380. /* 鼠标移出时,将透明度设定为0.0(完全透明) */
  1381. tooltip.style("opacity", 0.0);
  1382. });
  1383. },
  1384. initTypes() {
  1385. const keyMap = {};
  1386. this.typesInfo.map(item => {
  1387. const key = item.typeCode;
  1388. if (keyMap[key]) {
  1389. keyMap[key].push(item.typeValue);
  1390. } else {
  1391. keyMap[key] = [item.typeValue];
  1392. }
  1393. });
  1394. this.typesViewData = keyMap;
  1395. },
  1396. // 根据分辨率设置样式
  1397. setStyleByResolution() {
  1398. const screenWidth = window.screen.width;
  1399. const screenHeight = window.screen.height;
  1400. console.log('当前分辨率:', screenWidth + 'x' + screenHeight);
  1401. // 默认样式(当前分辨率)
  1402. let style = {
  1403. width: '12px',
  1404. height: '10px',
  1405. color: '#ff0000',
  1406. fontSize: '8px',
  1407. position: 'relative',
  1408. top: '-1px',
  1409. lineHeight: '14px'
  1410. };
  1411. // 可以根据不同分辨率设置不同样式
  1412. // 例如:1920x1080
  1413. if (screenWidth === 1920 && screenHeight === 1080) {
  1414. style = {
  1415. width: '12px',
  1416. height: '10px',
  1417. color: '#ff0000',
  1418. fontSize: '8px',
  1419. position: 'relative',
  1420. top: '-1px',
  1421. lineHeight: '14px'
  1422. };
  1423. }
  1424. // 例如:1366x768
  1425. else if (screenWidth === 1366 && screenHeight === 768) {
  1426. style = {
  1427. width: '12px',
  1428. height: '10px',
  1429. color: '#ff0000',
  1430. fontSize: '8px',
  1431. position: 'relative',
  1432. top: '-1px',
  1433. lineHeight: '14px'
  1434. };
  1435. }
  1436. // 例如:1536x864
  1437. else if (screenWidth === 1536 && screenHeight === 864) {
  1438. style = {
  1439. width: '12px',
  1440. height: '10px',
  1441. color: '#ff0000',
  1442. fontSize: '8px',
  1443. position: 'relative',
  1444. top: '-1px',
  1445. lineHeight: '14px'
  1446. };
  1447. }
  1448. // 例如:1360x768
  1449. else if (screenWidth === 1360 && screenHeight === 768) {
  1450. style = {
  1451. width: '12px',
  1452. height: '10px',
  1453. color: '#ff0000',
  1454. fontSize: '8px',
  1455. position: 'relative',
  1456. top: '-1px',
  1457. lineHeight: '14px'
  1458. };
  1459. }
  1460. // // 例如:1440x900
  1461. // else if (screenWidth === 1440 && screenHeight === 900) {
  1462. // style = {
  1463. // width: '12px',
  1464. // height: '10px',
  1465. // color: '#ff0000',
  1466. // fontSize: '8px',
  1467. // position: 'relative',
  1468. // top: '-1px',
  1469. // lineHeight: '14px'
  1470. // };
  1471. // }
  1472. // 其他分辨率使用默认样式
  1473. else {
  1474. style = {
  1475. width: '12px',
  1476. height: '10px',
  1477. color: '#ff0000',
  1478. fontSize: '8px',
  1479. position: 'relative',
  1480. top: '-1px',
  1481. lineHeight: '14px'
  1482. };
  1483. }
  1484. this.recordeTextStyle = style;
  1485. // 设置刻度样式
  1486. this.setScaleStyles(screenWidth, screenHeight);
  1487. },
  1488. // 设置刻度样式
  1489. setScaleStyles(screenWidth, screenHeight) {
  1490. // 默认刻度样式
  1491. let pulseStyle = {
  1492. titleMarginTop: '0px',
  1493. firstRowMarginTop: '32px',
  1494. normalRowMarginTop: '55px',
  1495. lastRowMarginTop: '56px'
  1496. };
  1497. let temperatureStyle = {
  1498. titleMarginTop: '0px',
  1499. firstRowMarginTop: '32px',
  1500. normalRowMarginTop: '55px',
  1501. lastRowMarginTop: '56px'
  1502. };
  1503. let legendStyle = {
  1504. marginTop: '476px'
  1505. };
  1506. let containerStyle = {
  1507. marginTop: '-12px'
  1508. };
  1509. // 可以根据不同分辨率设置不同样式
  1510. // 例如:1920x1080
  1511. if (screenWidth === 1920 && screenHeight === 1080) {
  1512. pulseStyle = {
  1513. titleMarginTop: '0px',
  1514. firstRowMarginTop: '44px',
  1515. normalRowMarginTop: '61px',
  1516. lastRowMarginTop: '61px'
  1517. };
  1518. temperatureStyle = {
  1519. titleMarginTop: '0px',
  1520. firstRowMarginTop: '44px',
  1521. normalRowMarginTop: '61px',
  1522. lastRowMarginTop: '61px'
  1523. };
  1524. legendStyle = {
  1525. marginTop: '476px'
  1526. };
  1527. containerStyle = {
  1528. marginTop: '22px'
  1529. };
  1530. }
  1531. // 例如:1366x768
  1532. else if (screenWidth === 1366 && screenHeight === 768) {
  1533. pulseStyle = {
  1534. titleMarginTop: '0px',
  1535. firstRowMarginTop: '32px',
  1536. normalRowMarginTop: '55px',
  1537. lastRowMarginTop: '56px'
  1538. };
  1539. temperatureStyle = {
  1540. titleMarginTop: '0px',
  1541. firstRowMarginTop: '32px',
  1542. normalRowMarginTop: '55px',
  1543. lastRowMarginTop: '56px'
  1544. };
  1545. legendStyle = {
  1546. marginTop: '476px'
  1547. };
  1548. containerStyle = {
  1549. marginTop: (this.marginTop + 10) + 'px',
  1550. };
  1551. console.log("this.marginTop0000000000000000000000",this.marginTop)
  1552. console.log("marginTop.containerStyle",containerStyle.marginTop)
  1553. }
  1554. // 例如:1536x864
  1555. else if (screenWidth === 1536 && screenHeight === 864) {
  1556. pulseStyle = {
  1557. titleMarginTop: '0px',
  1558. firstRowMarginTop: '40px',
  1559. normalRowMarginTop: '60px',
  1560. lastRowMarginTop: '60px'
  1561. };
  1562. temperatureStyle = {
  1563. titleMarginTop: '0px',
  1564. firstRowMarginTop: '40px',
  1565. normalRowMarginTop: '60px',
  1566. lastRowMarginTop: '60px'
  1567. };
  1568. legendStyle = {
  1569. marginTop: '476px'
  1570. };
  1571. containerStyle = {
  1572. marginTop: '23px'
  1573. };
  1574. }
  1575. // 例如:1360x768
  1576. else if (screenWidth === 1360 && screenHeight === 768) {
  1577. pulseStyle = {
  1578. titleMarginTop: '0px',
  1579. firstRowMarginTop: '44px',
  1580. normalRowMarginTop: '61px',
  1581. lastRowMarginTop: '61px'
  1582. };
  1583. temperatureStyle = {
  1584. titleMarginTop: '0px',
  1585. firstRowMarginTop: '44px',
  1586. normalRowMarginTop: '61px',
  1587. lastRowMarginTop: '61px'
  1588. };
  1589. legendStyle = {
  1590. marginTop: '476px'
  1591. };
  1592. containerStyle = {
  1593. marginTop: '22px'
  1594. };
  1595. }
  1596. // // 例如:1440x900
  1597. // else if (screenWidth === 1440 && screenHeight === 900) {
  1598. // pulseStyle = {
  1599. // titleMarginTop: '0px',
  1600. // firstRowMarginTop: '44px',
  1601. // normalRowMarginTop: '61px',
  1602. // lastRowMarginTop: '61px'
  1603. // };
  1604. // temperatureStyle = {
  1605. // titleMarginTop: '0px',
  1606. // firstRowMarginTop: '44px',
  1607. // normalRowMarginTop: '61px',
  1608. // lastRowMarginTop: '61px'
  1609. // };
  1610. // legendStyle = {
  1611. // marginTop: '476px'
  1612. // };
  1613. // containerStyle = {
  1614. // marginTop: '22px'
  1615. // };
  1616. // }
  1617. // 其他分辨率使用默认样式
  1618. else {
  1619. pulseStyle = {
  1620. titleMarginTop: '0px',
  1621. firstRowMarginTop: '32px',
  1622. normalRowMarginTop: '55px',
  1623. lastRowMarginTop: '56px'
  1624. };
  1625. temperatureStyle = {
  1626. titleMarginTop: '0px',
  1627. firstRowMarginTop: '32px',
  1628. normalRowMarginTop: '55px',
  1629. lastRowMarginTop: '56px'
  1630. };
  1631. legendStyle = {
  1632. marginTop: '476px'
  1633. };
  1634. containerStyle = {
  1635. marginTop: this.marginTop + 'px',
  1636. };
  1637. }
  1638. console.log("this.marginTop11111111111111111111",this.marginTop)
  1639. this.pulseScaleStyle = pulseStyle;
  1640. this.temperatureScaleStyle = temperatureStyle;
  1641. this.legendStyle = legendStyle;
  1642. this.containerStyle = containerStyle;
  1643. },
  1644. },
  1645. };
  1646. function getTypeData(type, allData = [], isNumber = true) {
  1647. return allData
  1648. .map((rowBOSItem, index) => {
  1649. const rowBOS = rowBOSItem.rowBOS;
  1650. const cur =
  1651. rowBOS.find(item => {
  1652. return item.typeCode === type;
  1653. }) || {};
  1654. return { x: index, y: (isNumber ? +cur.typeValue : cur.typeValue) || "" };
  1655. })
  1656. .filter(item => {
  1657. return item.y !== "";
  1658. });
  1659. }
  1660. </script>
  1661. <style scoped>
  1662. .table_wrap {
  1663. line-height: normal;
  1664. }
  1665. table {
  1666. font-weight: normal;
  1667. border-collapse: collapse;
  1668. font-size: 8px;
  1669. text-align: center;
  1670. width: 100%;
  1671. table-layout: fixed;
  1672. border: 2px #2f4f4f solid;
  1673. }
  1674. td {
  1675. border: 1px solid #ccc;
  1676. width: 12px;
  1677. height: 11px;
  1678. }
  1679. .redLineTd {
  1680. border-right: 1px solid #ff6e71;
  1681. }
  1682. .recorde-text {
  1683. /* 样式现在通过动态计算设置 */
  1684. color: #ff0000;
  1685. position: relative;
  1686. }
  1687. .table_wrap {
  1688. position: relative;
  1689. margin: 0 auto;
  1690. width: 835px;
  1691. }
  1692. .container {
  1693. /* 高度最好动态计算,不然很容易错位*/
  1694. margin: 30px auto;
  1695. margin-top: 28px;
  1696. width: 805px;
  1697. height: 758px;
  1698. position: absolute;
  1699. top: 142px;
  1700. left: 28px;
  1701. }
  1702. .temperature_mark td p {
  1703. position: relative;
  1704. top: 0;
  1705. margin-top: 58px;
  1706. }
  1707. .num_wrapper {
  1708. width: 35px;
  1709. height: 636px;
  1710. position: relative;
  1711. }
  1712. .pain_wrapper {
  1713. position: absolute;
  1714. width: 100%;
  1715. height: 70px;
  1716. right: 0;
  1717. bottom: -3px;
  1718. border: 1px solid #ccc;
  1719. }
  1720. .zeroline {
  1721. fill: none;
  1722. stroke: red;
  1723. stroke-width: 0.5px;
  1724. stroke-dasharray: 5 5;
  1725. }
  1726. .zerolinetext {
  1727. fill: red;
  1728. }
  1729. .overlay {
  1730. fill: none;
  1731. stroke: none;
  1732. pointer-events: all;
  1733. }
  1734. .tooltip {
  1735. font-family: "宋体";
  1736. font-size: 10px;
  1737. line-height: 16px;
  1738. color: #736269;
  1739. width: auto;
  1740. height: auto;
  1741. padding: 4px;
  1742. position: absolute;
  1743. text-align: left;
  1744. border: 1px solid #736269;
  1745. background-color: #e7e9f3;
  1746. border-radius: 2px;
  1747. background: linear-gradient(#fefdff, #e5e5f1);
  1748. /* 标准的语法(必须放在最后) */
  1749. }
  1750. </style>
  1751. <style>
  1752. .table_wrap {
  1753. font-family: "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  1754. }
  1755. .table_wrap .tick,
  1756. .table_wrap .domain {
  1757. display: none;
  1758. }
  1759. .table_wrap .tbale-label {
  1760. font-weight: 700;
  1761. }
  1762. .table_wrap .focusLine {
  1763. fill: none;
  1764. stroke: red;
  1765. stroke-width: 0.5px;
  1766. }
  1767. .table_wrap .focusText {
  1768. color: red;
  1769. }
  1770. .table_wrap .breath_td_odd {
  1771. vertical-align: top;
  1772. font-size: 10px;
  1773. }
  1774. .table_wrap .breath_td_even {
  1775. vertical-align: bottom;
  1776. font-size: 10px;
  1777. }
  1778. .table_wrap .line {
  1779. fill: none;
  1780. stroke: black;
  1781. stroke-width: 2px;
  1782. }
  1783. .table_wrap .line.tiwenline {
  1784. stroke: blue;
  1785. fill: none;
  1786. }
  1787. .table_wrap .line.redColor {
  1788. stroke: red;
  1789. fill: none;
  1790. }
  1791. .table_wrap .axis path,
  1792. .table_wrap .axis line,
  1793. .table_wrap .line {
  1794. stroke: #000;
  1795. fill: none;
  1796. }
  1797. .table_wrap .legend {
  1798. display: flex;
  1799. }
  1800. .table_wrap .legend .legend-text {
  1801. display: flex;
  1802. }
  1803. .table_wrap .legend .legend-item {
  1804. margin-right: 20px;
  1805. }
  1806. </style>