graphics.vue 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769
  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. </tbody>
  603. </table>
  604. <div style="text-align: center">
  605. <div style="font-size: 20px; font-weight: bold">
  606. {{ `第${info.pageNo}页` }}
  607. </div>
  608. </div>
  609. </div>
  610. </template>
  611. <script>
  612. import * as d3 from "d3";
  613. import dayjs from "dayjs";
  614. import { getKeyMap, SectionToChinese } from "./utils";
  615. import {
  616. getChartData,
  617. getAllPatintInfo,
  618. } from "@/api/medical-advice/nursing-manage";
  619. import { getFormatDatetime } from "@/utils/date";
  620. import env from "../../../utils/setting";
  621. export default {
  622. props: {
  623. patientInfo: Object,
  624. queryParam: Object,
  625. },
  626. data() {
  627. return {
  628. marginTop: 0,
  629. keyMap: getKeyMap(),
  630. info: {
  631. age: 0,
  632. beginDate: "",
  633. inpatientNo: "",
  634. hospDate: 0,
  635. admissDate: "",
  636. bedNo: "",
  637. inDate: 0,
  638. inDiagName: null,
  639. name: "",
  640. admissWardName: "",
  641. sexName: "",
  642. pageNo: "1",
  643. operaDays: [],
  644. admissDateTime: null, // 完整的入院时间
  645. },
  646. xyList: [],
  647. typesInfo: [],
  648. typesViewData: {},
  649. breathData: [],
  650. tdList: new Array(42).fill(0),
  651. comKey: 1,
  652. symbolTextArr: [],
  653. array42: [],
  654. // 动态样式
  655. recordeTextStyle: {
  656. width: '12px',
  657. height: '10px',
  658. color: '#ff0000',
  659. fontSize: '8px',
  660. position: 'relative',
  661. top: '-1px',
  662. lineHeight: '14px'
  663. },
  664. // 动态刻度样式
  665. pulseScaleStyle: {
  666. titleMarginTop: '0px',
  667. firstRowMarginTop: '32px',
  668. normalRowMarginTop: '55px',
  669. lastRowMarginTop: '56px'
  670. },
  671. temperatureScaleStyle: {
  672. titleMarginTop: '0px',
  673. firstRowMarginTop: '32px',
  674. normalRowMarginTop: '55px',
  675. lastRowMarginTop: '56px'
  676. },
  677. legendStyle: {
  678. marginTop: '476px'
  679. },
  680. containerStyle: {
  681. marginTop: '-12px'
  682. }
  683. };
  684. },
  685. computed: {
  686. env() {
  687. return env;
  688. },
  689. // 日期
  690. inHospitalTime() {
  691. const initday = dayjs(this.info.beginDate);
  692. return [
  693. null, // 文案天
  694. initday.format("YYYY-MM-DD"),
  695. initday.add(1, "day").format("MM-DD"),
  696. initday.add(2, "day").format("MM-DD"),
  697. initday.add(3, "day").format("MM-DD"),
  698. initday.add(4, "day").format("MM-DD"),
  699. initday.add(5, "day").format("MM-DD"),
  700. initday.add(6, "day").format("MM-DD"),
  701. ];
  702. },
  703. // 住院天数
  704. inHospitalDays() {
  705. const initday = this.info.hospDays || 0;
  706. return [
  707. null, // 文案天
  708. initday + 1,
  709. initday + 2,
  710. initday + 3,
  711. initday + 4,
  712. initday + 5,
  713. initday + 6,
  714. initday + 7,
  715. ];
  716. },
  717. // 手术天数
  718. surgeryDays() {
  719. const initday = this.info.operaDays;
  720. if (initday.length <= 0) {
  721. return new Array(8).fill(null);
  722. } else {
  723. return initday;
  724. }
  725. },
  726. },
  727. mounted() {
  728. for (let i = 0; i < 43; i++) {
  729. this.array42.push(i);
  730. }
  731. this.initData();
  732. // 计算默认marginTop
  733. const defaultMarginTop =
  734. (Math.round(this.$refs.topTd[0].getBoundingClientRect().height) - 18) *
  735. 10 +
  736. 28;
  737. this.marginTop = defaultMarginTop;
  738. // 根据分辨率设置样式
  739. this.setStyleByResolution();
  740. // setTimeout(() => {
  741. // this.$emit('done')
  742. // })
  743. },
  744. methods: {
  745. SectionToChinese,
  746. // 将时间转换为中文格式
  747. convertTimeToChinese(hour, minute) {
  748. // 参考 Java 版本的 numberToChinese 方法,创建专门的时间转换函数
  749. const numberToChinese = (number) => {
  750. if (number === 0) return "零";
  751. if (number === 1) return "一";
  752. if (number === 2) return "二";
  753. if (number === 3) return "三";
  754. if (number === 4) return "四";
  755. if (number === 5) return "五";
  756. if (number === 6) return "六";
  757. if (number === 7) return "七";
  758. if (number === 8) return "八";
  759. if (number === 9) return "九";
  760. if (number === 10) return "十";
  761. if (number === 11) return "十一";
  762. if (number === 12) return "十二";
  763. if (number === 13) return "十三";
  764. if (number === 14) return "十四";
  765. if (number === 15) return "十五";
  766. if (number === 16) return "十六";
  767. if (number === 17) return "十七";
  768. if (number === 18) return "十八";
  769. if (number === 19) return "十九";
  770. if (number === 20) return "二十";
  771. if (number === 21) return "二十一";
  772. if (number === 22) return "二十二";
  773. if (number === 23) return "二十三";
  774. if (number === 24) return "二十四";
  775. if (number === 25) return "二十五";
  776. if (number === 26) return "二十六";
  777. if (number === 27) return "二十七";
  778. if (number === 28) return "二十八";
  779. if (number === 29) return "二十九";
  780. if (number === 30) return "三十";
  781. if (number === 31) return "三十一";
  782. if (number === 32) return "三十二";
  783. if (number === 33) return "三十三";
  784. if (number === 34) return "三十四";
  785. if (number === 35) return "三十五";
  786. if (number === 36) return "三十六";
  787. if (number === 37) return "三十七";
  788. if (number === 38) return "三十八";
  789. if (number === 39) return "三十九";
  790. if (number === 40) return "四十";
  791. if (number === 41) return "四十一";
  792. if (number === 42) return "四十二";
  793. if (number === 43) return "四十三";
  794. if (number === 44) return "四十四";
  795. if (number === 45) return "四十五";
  796. if (number === 46) return "四十六";
  797. if (number === 47) return "四十七";
  798. if (number === 48) return "四十八";
  799. if (number === 49) return "四十九";
  800. if (number === 50) return "五十";
  801. if (number === 51) return "五十一";
  802. if (number === 52) return "五十二";
  803. if (number === 53) return "五十三";
  804. if (number === 54) return "五十四";
  805. if (number === 55) return "五十五";
  806. if (number === 56) return "五十六";
  807. if (number === 57) return "五十七";
  808. if (number === 58) return "五十八";
  809. if (number === 59) return "五十九";
  810. // 对于其他数字,使用通用的转换逻辑
  811. if (number < 10) {
  812. return numberToChinese(number);
  813. } else if (number < 20) {
  814. return "十" + (number === 10 ? "" : numberToChinese(number - 10));
  815. } else if (number < 60) {
  816. const tens = Math.floor(number / 10);
  817. const ones = number % 10;
  818. let tensStr = "";
  819. switch (tens) {
  820. case 2: tensStr = "二十"; break;
  821. case 3: tensStr = "三十"; break;
  822. case 4: tensStr = "四十"; break;
  823. case 5: tensStr = "五十"; break;
  824. }
  825. return tensStr + (ones === 0 ? "" : numberToChinese(ones));
  826. }
  827. return String(number);
  828. };
  829. const hourStr = numberToChinese(hour);
  830. const minuteStr = numberToChinese(minute);
  831. // 处理分钟为0的情况
  832. if (minute === 0) {
  833. return `${hourStr}时`;
  834. }
  835. // 处理分钟小于10的情况,需要加"零"
  836. if (minute < 10) {
  837. return `${hourStr}时零${minuteStr}分`;
  838. }
  839. return `${hourStr}时${minuteStr}分`;
  840. },
  841. // 生成入院标识文字
  842. generateAdmissionText(admissionDateTime) {
  843. if (!admissionDateTime) return "";
  844. const date = new Date(admissionDateTime);
  845. const hour = date.getHours();
  846. const minute = date.getMinutes();
  847. return `入院时间${this.convertTimeToChinese(hour, minute)}`;
  848. },
  849. // 获取入院时间应该显示的时间段索引
  850. getAdmissionTimeSlot(admissionDateTime) {
  851. if (!admissionDateTime) return -1;
  852. const date = new Date(admissionDateTime);
  853. const hour = date.getHours();
  854. const minute = date.getMinutes();
  855. const second = date.getSeconds();
  856. // 将时间转换为分钟数,便于精确计算
  857. const totalMinutes = hour * 60 + minute + second / 60;
  858. // 标准时间点:02:00, 06:00, 10:00, 14:00, 18:00, 22:00
  859. const standardMinutes = [2 * 60, 6 * 60, 10 * 60, 14 * 60, 18 * 60, 22 * 60];
  860. // 计算到每个标准时间点的距离,选择最近的
  861. let minDistance = Infinity;
  862. let closestIndex = -1;
  863. for (let i = 0; i < standardMinutes.length; i++) {
  864. const standardMinute = standardMinutes[i];
  865. let distance;
  866. // 计算距离,考虑跨天的情况
  867. if (Math.abs(totalMinutes - standardMinute) <= 12 * 60) {
  868. // 同一天内或相邻天的情况
  869. distance = Math.abs(totalMinutes - standardMinute);
  870. } else {
  871. // 跨天的情况,需要计算最短距离
  872. if (totalMinutes > standardMinute) {
  873. // 例如:23点到02点
  874. distance = Math.min(totalMinutes - standardMinute, (24 * 60 - totalMinutes) + standardMinute);
  875. } else {
  876. // 例如:1点到22点
  877. distance = Math.min(standardMinute - totalMinutes, (24 * 60 - standardMinute) + totalMinutes);
  878. }
  879. }
  880. // 更新最小距离和对应的索引
  881. if (distance < minDistance) {
  882. minDistance = distance;
  883. closestIndex = i;
  884. }
  885. }
  886. return closestIndex;
  887. },
  888. getSymbolTextArr(index) {
  889. // 检查是否是入院时间对应的位置
  890. if (this.info.admissDateTime) {
  891. // 计算入院时间对应的日期索引
  892. const admissionDate = new Date(this.info.admissDateTime);
  893. const currentDate = dayjs(this.info.beginDate).add(Math.floor(index / 6), 'day');
  894. // 判断是否是入院当天
  895. if (dayjs(admissionDate).format('YYYY-MM-DD') === currentDate.format('YYYY-MM-DD')) {
  896. // 判断是否是入院时间段
  897. const admissionSlot = this.getAdmissionTimeSlot(this.info.admissDateTime);
  898. if (admissionSlot === (index % 6)) {
  899. return this.generateAdmissionText(this.info.admissDateTime);
  900. }
  901. }
  902. }
  903. // 原有的特殊标注文字逻辑
  904. const current = this.symbolTextArr.find(i => i.x === index);
  905. if (current) {
  906. return current.y;
  907. } else {
  908. return "";
  909. }
  910. },
  911. temperatureConverter(c) {
  912. const value = (c * 9) / 5 + 32;
  913. return value.toFixed(1);
  914. },
  915. initData() {
  916. // this.info = dataModel.grParamBOS
  917. this.info.pageNo = this.queryParam.week;
  918. this.info.beginDate = this.queryParam.startRecTime;
  919. this.info.hospDays = (Number(this.queryParam.week) - 1) * 7;
  920. // this.rowsInfo = dataModel.rows || []
  921. // this.typesInfo = dataModel.types || []
  922. let param = {
  923. inpatientNo: this.patientInfo.inpatientNo,
  924. admissTimes: this.patientInfo.admissTimes,
  925. week: this.queryParam.week,
  926. startRecTime: this.queryParam.startRecTime,
  927. endRecTime: this.queryParam.endRecTime,
  928. mbFlag: this.queryParam.checkBoxFlag.mbFlag,
  929. hxFlag: this.queryParam.checkBoxFlag.hxFlag,
  930. xyFlag: this.queryParam.checkBoxFlag.xyFlag,
  931. wcyRqFlag: this.queryParam.checkBoxFlag.wcyRqFlag,
  932. };
  933. getAllPatintInfo({
  934. inpatientNo: this.patientInfo.inpatientNo,
  935. admissTimes: this.patientInfo.admissTimes,
  936. }).then(res => {
  937. this.info.name = res.name;
  938. this.info.age = res.age || "";
  939. this.info.sexName = res.sexName;
  940. this.info.bedNo = res.bedNo;
  941. this.info.inpatientNo = res.inpatientNo;
  942. this.info.admissWardName = res.admissWardName;
  943. this.info.admissDate = getFormatDatetime(res.admissDate, "YYYY-MM-DD");
  944. // 保存完整的入院时间用于生成入院标识
  945. this.info.admissDateTime = res.admissDate;
  946. });
  947. getChartData(param).then(res => {
  948. this.rowsInfo = res.rows;
  949. this.typesInfo = res.types;
  950. this.info.operaDays = res.operaDays;
  951. this.init();
  952. });
  953. },
  954. init() {
  955. //800 758
  956. var width = 690;
  957. var height = 682;
  958. // SVG画布边缘与图表内容的距离
  959. var padding = { top: 50, right: 0, bottom: 50, left: 50 };
  960. // 创建一个分组用来组合要画的图表元素
  961. var main = d3
  962. .select(".container svg")
  963. .append("g")
  964. .classed("main", true)
  965. .attr("transform", "translate(" + 80 + "," + 80 + ")");
  966. // 模拟数据 体温
  967. var dataset = getTypeData("003", this.rowsInfo);
  968. var datasetAnus = getTypeData("015", this.rowsInfo);
  969. var datasetHeartrate = getTypeData("014", this.rowsInfo);
  970. var datasetPulse = getTypeData("002", this.rowsInfo);
  971. var symbolTextArr = getTypeData("012", this.rowsInfo, false);
  972. this.symbolTextArr = symbolTextArr;
  973. // 口表【黑实圆】
  974. var datasetPain = getTypeData("001", this.rowsInfo);
  975. this.breathData = datasetPain;
  976. // const circleNode = document.createElement('circle')
  977. // circleNode.setAttribute('cx', '179.2439024390244')
  978. // circleNode.setAttribute('cy', '582')
  979. // circleNode.setAttribute('r', '4')
  980. // circleNode.setAttribute('stroke', '#000000')
  981. // circleNode.setAttribute('stroke-width', '1')
  982. // circleNode.setAttribute('fill', '#FFFFFF')
  983. // document.querySelector('.main').appendChild(circleNode)
  984. // 创建x轴的比例尺(线性比例尺)
  985. var xScale = d3
  986. .scaleLinear()
  987. .domain([0, 41])
  988. .range([9, width - padding.left - padding.right + 75]);
  989. // 创建y轴的比例尺(线性比例尺)
  990. /* var yScale = d3.scale.linear()
  991. .domain([0, d3.max(dataset,function(d) {
  992. return d.y;
  993. })])
  994. .range([height - padding.top - padding.bottom, 0]); */
  995. // 体温
  996. var yScale = d3
  997. .scaleLinear()
  998. .domain([33, 42])
  999. .range([height - padding.top - padding.bottom, -56]);
  1000. // 脉搏
  1001. var yScale1 = d3
  1002. .scaleLinear()
  1003. .domain([20, 200])
  1004. .range([height - padding.top - padding.bottom, -55]);
  1005. // 呼吸
  1006. var yScale2 = d3
  1007. .scaleLinear()
  1008. .domain([0, 40])
  1009. .range([height - padding.top + 22, -55]);
  1010. // 创建x轴
  1011. var xAxis = d3.axisBottom().scale(xScale);
  1012. // 创建y轴
  1013. var yAxis = d3.axisLeft().scale(yScale);
  1014. var yAxis1 = d3.axisLeft().scale(yScale1);
  1015. var yAxis2 = d3.axisLeft().scale(yScale2);
  1016. // 添加SVG元素并与x轴进行“绑定”
  1017. main
  1018. .append("g")
  1019. .attr("class", "axis")
  1020. .attr(
  1021. "transform",
  1022. "translate(0," + (height - padding.top - padding.bottom) + ")"
  1023. )
  1024. .call(xAxis);
  1025. // 添加SVG元素并与y轴进行“绑定”
  1026. main.append("g").attr("class", "axis").call(yAxis);
  1027. main.append("g").attr("class", "axis").call(yAxis1);
  1028. main.append("g").attr("class", "axis").call(yAxis2);
  1029. // 添加折线
  1030. var line = d3
  1031. .line()
  1032. .x(function (d) {
  1033. return xScale(d.x);
  1034. })
  1035. .y(function (d) {
  1036. return yScale(d.y);
  1037. });
  1038. var line1 = d3
  1039. .line()
  1040. .x(function (d) {
  1041. return xScale(d.x);
  1042. })
  1043. .y(function (d) {
  1044. return yScale1(d.y);
  1045. });
  1046. var line2 = d3
  1047. .line()
  1048. .x(function (d) {
  1049. return xScale(d.x);
  1050. })
  1051. .y(function (d) {
  1052. return yScale(d.y);
  1053. });
  1054. // .interpolate('linear')
  1055. // 选择线条的类型
  1056. // 添加path元素,并通过line()计算出值来赋值
  1057. main
  1058. .append("path")
  1059. .attr("class", "line tiwenline")
  1060. .attr("d", line(dataset));
  1061. main.append("path").attr("class", "line").attr("d", line(datasetAnus));
  1062. main.append("path").attr("class", "line").attr("d", line2(datasetPain));
  1063. main
  1064. .append("path")
  1065. .attr("class", "line redColor")
  1066. .attr("d", line1(datasetHeartrate));
  1067. main
  1068. .append("path")
  1069. .attr("class", "line redColor")
  1070. .attr("d", line1(datasetPulse));
  1071. // main.append('path').attr('class', 'line').attr('d', line3(dataset))
  1072. // 添加点
  1073. /* 黑实圆--start */
  1074. // main
  1075. // .selectAll('rect')
  1076. // .data(dataset_mouth)
  1077. // .enter()
  1078. // .append('circle')
  1079. // .attr('cx', function (d) {
  1080. // return xScale(d.x)
  1081. // })
  1082. // .attr('cy', function (d) {
  1083. // return yScale(d.y)
  1084. // })
  1085. // .attr('r', 4)
  1086. // .attr('fill', function (d, i) {
  1087. // return 'black'
  1088. // })
  1089. /* 黑实圆--end */
  1090. /* 黑空圆--start */
  1091. main
  1092. .selectAll("rect")
  1093. .data(datasetAnus)
  1094. .enter()
  1095. .append("circle")
  1096. .attr("cx", function (d) {
  1097. return xScale(d.x);
  1098. })
  1099. .attr("cy", function (d) {
  1100. return yScale(d.y);
  1101. })
  1102. .attr("r", 4)
  1103. .attr("stroke", "#000000")
  1104. .attr("stroke-width", 1)
  1105. .attr("fill", "#FFFFFF");
  1106. /* 黑空圆--end */
  1107. /* 红空圆--start */
  1108. main
  1109. .selectAll("rect")
  1110. .data(datasetHeartrate)
  1111. .enter()
  1112. .append("circle")
  1113. .attr("cx", function (d) {
  1114. return xScale(d.x);
  1115. })
  1116. .attr("cy", function (d) {
  1117. return yScale1(d.y);
  1118. })
  1119. .attr("r", 4)
  1120. .attr("stroke", "#EE0000")
  1121. .attr("stroke-width", 1)
  1122. .attr("fill", "#FFFFFF");
  1123. /* 红空圆--end */
  1124. /* 红实圆--start */
  1125. main
  1126. .selectAll("rect")
  1127. .data(datasetPulse)
  1128. .enter()
  1129. .append("circle")
  1130. .attr("cx", function (d) {
  1131. return xScale(d.x);
  1132. })
  1133. .attr("cy", function (d) {
  1134. return yScale1(d.y);
  1135. })
  1136. .attr("r", 4)
  1137. .attr("fill", "#EE0000");
  1138. // .on('mouseover', function (d) {
  1139. // // (1)取得提示显示的位置
  1140. // var xPosition = parseFloat(d3.select(this).attr('cx')) + 698
  1141. // var yPosition = parseFloat(d3.select(this).attr('cy')) + 24
  1142. //
  1143. // // (2)创建提示条SVG
  1144. // d3.select('.container svg')
  1145. // .append('text')
  1146. // .attr('id', 'tooltip') // 设置id便于移除提示
  1147. // .attr('x', xPosition)
  1148. // .attr('y', yPosition)
  1149. // .attr('text-anchor', 'middle')
  1150. // .attr('font-family', 'sans-setif')
  1151. // .attr('font-size', '11px')
  1152. // .attr('font-weight', 'bold')
  1153. // .attr('fill', 'white')
  1154. // .text(d.value)
  1155. // })
  1156. // (3)移除提示条SVG
  1157. /* 红实圆--end */
  1158. /* 黑实圆--start */
  1159. main
  1160. .selectAll("rect")
  1161. .data(datasetPain)
  1162. .enter()
  1163. .append("circle")
  1164. .attr("cx", function (d) {
  1165. return xScale(d.x);
  1166. })
  1167. .attr("cy", function (d) {
  1168. return yScale(d.y);
  1169. })
  1170. .attr("r", 4)
  1171. .attr("stroke", "#000000")
  1172. .attr("fill", "#000000");
  1173. /* 黑实圆--end */
  1174. this.drawx(main, dataset, xScale, yScale);
  1175. this.initTypes();
  1176. // this.hoverEvent(main)
  1177. },
  1178. drawx(main, dataset, xScale, yScale) {
  1179. /* 【叉形】--start */
  1180. main
  1181. .selectAll("rect")
  1182. .data(dataset)
  1183. .enter()
  1184. .append("line")
  1185. .attr("x1", function (d) {
  1186. return xScale(d.x) - 4;
  1187. })
  1188. .attr("y1", function (d) {
  1189. return yScale(d.y) - 4;
  1190. })
  1191. .attr("x2", function (d) {
  1192. return xScale(d.x) + 4;
  1193. })
  1194. .attr("y2", function (d) {
  1195. return yScale(d.y) + 4;
  1196. })
  1197. .attr("stroke", function (d, i) {
  1198. return "blue";
  1199. });
  1200. main
  1201. .selectAll("rect")
  1202. .data(dataset)
  1203. .enter()
  1204. .append("line")
  1205. .attr("x1", function (d) {
  1206. return xScale(d.x) + 4;
  1207. })
  1208. .attr("y1", function (d) {
  1209. return yScale(d.y) - 4;
  1210. })
  1211. .attr("x2", function (d) {
  1212. return xScale(d.x) - 4;
  1213. })
  1214. .attr("y2", function (d) {
  1215. return yScale(d.y) + 4;
  1216. })
  1217. .attr("stroke", function (d, i) {
  1218. return "blue";
  1219. });
  1220. /* 体温【叉形】--end */
  1221. },
  1222. hoverEvent(main) {
  1223. ///* 鼠标悬停直线--start
  1224. // var dataset_line = [{x: 0,y: 0}]
  1225. // main.selectAll('rect')
  1226. // .data(dataset_line)
  1227. // .enter()
  1228. // .append('line')
  1229. // .attr({
  1230. // 'x1':100,'y1':-56,
  1231. // 'x2':100,'y2':582
  1232. // })
  1233. // .attr('stroke', function(d, i) {
  1234. // return 'black';
  1235. // });
  1236. // 鼠标悬停直线--end */
  1237. document.querySelector(".lineColor").style.stroke = "red";
  1238. const recordeNode = document.createElement("div");
  1239. recordeNode.setAttribute("class", "recorde-text");
  1240. document.querySelector(".recorde td").append(recordeNode);
  1241. const allTrtd = document.querySelectorAll(".temperatureChart tr td");
  1242. [...allTrtd].map(ele => {
  1243. ele.setAttribute("title", ele.innerText);
  1244. });
  1245. /* 鼠标悬停提示框 */
  1246. var tooltip = d3
  1247. .select("body")
  1248. .append("div")
  1249. .attr("class", "tooltip")
  1250. .style("opacity", 0.0);
  1251. main
  1252. .on("mouseover", function (d) {
  1253. /*
  1254. 鼠标移入时,
  1255. (1)通过 selection.html() 来更改提示框的文字
  1256. (2)通过更改样式 left 和 top 来设定提示框的位置
  1257. (3)设定提示框的透明度为1.0(完全不透明)
  1258. */
  1259. tooltip
  1260. .html("呼吸:19次/分<br/>录入信息:2017-11-02<br/>姓名:张三")
  1261. .style("left", d3.event.pageX + "px")
  1262. .style("top", d3.event.pageY + 20 + "px")
  1263. .style("opacity", 1.0);
  1264. })
  1265. .on("mousemove", function (d) {
  1266. /* 鼠标移动时,更改样式 left 和 top 来改变提示框的位置 */
  1267. tooltip
  1268. .style("left", d3.event.pageX + "px")
  1269. .style("top", d3.event.pageY + 20 + "px");
  1270. })
  1271. .on("mouseout", function (d) {
  1272. /* 鼠标移出时,将透明度设定为0.0(完全透明) */
  1273. tooltip.style("opacity", 0.0);
  1274. });
  1275. },
  1276. initTypes() {
  1277. const keyMap = {};
  1278. this.typesInfo.map(item => {
  1279. const key = item.typeCode;
  1280. if (keyMap[key]) {
  1281. keyMap[key].push(item.typeValue);
  1282. } else {
  1283. keyMap[key] = [item.typeValue];
  1284. }
  1285. });
  1286. this.typesViewData = keyMap;
  1287. },
  1288. // 根据分辨率设置样式
  1289. setStyleByResolution() {
  1290. const screenWidth = window.screen.width;
  1291. const screenHeight = window.screen.height;
  1292. console.log('当前分辨率:', screenWidth + 'x' + screenHeight);
  1293. // 默认样式(当前分辨率)
  1294. let style = {
  1295. width: '12px',
  1296. height: '10px',
  1297. color: '#ff0000',
  1298. fontSize: '8px',
  1299. position: 'relative',
  1300. top: '-1px',
  1301. lineHeight: '14px'
  1302. };
  1303. // 可以根据不同分辨率设置不同样式
  1304. // 例如:1920x1080
  1305. if (screenWidth === 1920 && screenHeight === 1080) {
  1306. style = {
  1307. width: '12px',
  1308. height: '10px',
  1309. color: '#ff0000',
  1310. fontSize: '8px',
  1311. position: 'relative',
  1312. top: '-1px',
  1313. lineHeight: '14px'
  1314. };
  1315. }
  1316. // 例如:1366x768
  1317. else if (screenWidth === 1366 && screenHeight === 768) {
  1318. style = {
  1319. width: '12px',
  1320. height: '10px',
  1321. color: '#ff0000',
  1322. fontSize: '8px',
  1323. position: 'relative',
  1324. top: '-1px',
  1325. lineHeight: '14px'
  1326. };
  1327. }
  1328. // 例如:1536x864
  1329. else if (screenWidth === 1536 && screenHeight === 864) {
  1330. style = {
  1331. width: '12px',
  1332. height: '10px',
  1333. color: '#ff0000',
  1334. fontSize: '8px',
  1335. position: 'relative',
  1336. top: '-1px',
  1337. lineHeight: '14px'
  1338. };
  1339. }
  1340. // 例如:1360x768
  1341. else if (screenWidth === 1360 && screenHeight === 768) {
  1342. style = {
  1343. width: '12px',
  1344. height: '10px',
  1345. color: '#ff0000',
  1346. fontSize: '8px',
  1347. position: 'relative',
  1348. top: '-1px',
  1349. lineHeight: '14px'
  1350. };
  1351. }
  1352. // // 例如:1440x900
  1353. // else if (screenWidth === 1440 && screenHeight === 900) {
  1354. // style = {
  1355. // width: '12px',
  1356. // height: '10px',
  1357. // color: '#ff0000',
  1358. // fontSize: '8px',
  1359. // position: 'relative',
  1360. // top: '-1px',
  1361. // lineHeight: '14px'
  1362. // };
  1363. // }
  1364. // 其他分辨率使用默认样式
  1365. else {
  1366. style = {
  1367. width: '12px',
  1368. height: '10px',
  1369. color: '#ff0000',
  1370. fontSize: '8px',
  1371. position: 'relative',
  1372. top: '-1px',
  1373. lineHeight: '14px'
  1374. };
  1375. }
  1376. this.recordeTextStyle = style;
  1377. // 设置刻度样式
  1378. this.setScaleStyles(screenWidth, screenHeight);
  1379. },
  1380. // 设置刻度样式
  1381. setScaleStyles(screenWidth, screenHeight) {
  1382. // 默认刻度样式
  1383. let pulseStyle = {
  1384. titleMarginTop: '0px',
  1385. firstRowMarginTop: '32px',
  1386. normalRowMarginTop: '55px',
  1387. lastRowMarginTop: '56px'
  1388. };
  1389. let temperatureStyle = {
  1390. titleMarginTop: '0px',
  1391. firstRowMarginTop: '32px',
  1392. normalRowMarginTop: '55px',
  1393. lastRowMarginTop: '56px'
  1394. };
  1395. let legendStyle = {
  1396. marginTop: '476px'
  1397. };
  1398. let containerStyle = {
  1399. marginTop: '-12px'
  1400. };
  1401. // 可以根据不同分辨率设置不同样式
  1402. // 例如:1920x1080
  1403. if (screenWidth === 1920 && screenHeight === 1080) {
  1404. pulseStyle = {
  1405. titleMarginTop: '0px',
  1406. firstRowMarginTop: '44px',
  1407. normalRowMarginTop: '61px',
  1408. lastRowMarginTop: '61px'
  1409. };
  1410. temperatureStyle = {
  1411. titleMarginTop: '0px',
  1412. firstRowMarginTop: '44px',
  1413. normalRowMarginTop: '61px',
  1414. lastRowMarginTop: '61px'
  1415. };
  1416. legendStyle = {
  1417. marginTop: '476px'
  1418. };
  1419. containerStyle = {
  1420. marginTop: '22px'
  1421. };
  1422. }
  1423. // 例如:1366x768
  1424. else if (screenWidth === 1366 && screenHeight === 768) {
  1425. pulseStyle = {
  1426. titleMarginTop: '0px',
  1427. firstRowMarginTop: '32px',
  1428. normalRowMarginTop: '55px',
  1429. lastRowMarginTop: '56px'
  1430. };
  1431. temperatureStyle = {
  1432. titleMarginTop: '0px',
  1433. firstRowMarginTop: '32px',
  1434. normalRowMarginTop: '55px',
  1435. lastRowMarginTop: '56px'
  1436. };
  1437. legendStyle = {
  1438. marginTop: '476px'
  1439. };
  1440. containerStyle = {
  1441. marginTop: (this.marginTop + 10) + 'px',
  1442. };
  1443. console.log("this.marginTop0000000000000000000000",this.marginTop)
  1444. console.log("marginTop.containerStyle",containerStyle.marginTop)
  1445. }
  1446. // 例如:1536x864
  1447. else if (screenWidth === 1536 && screenHeight === 864) {
  1448. pulseStyle = {
  1449. titleMarginTop: '0px',
  1450. firstRowMarginTop: '40px',
  1451. normalRowMarginTop: '60px',
  1452. lastRowMarginTop: '60px'
  1453. };
  1454. temperatureStyle = {
  1455. titleMarginTop: '0px',
  1456. firstRowMarginTop: '40px',
  1457. normalRowMarginTop: '60px',
  1458. lastRowMarginTop: '60px'
  1459. };
  1460. legendStyle = {
  1461. marginTop: '476px'
  1462. };
  1463. containerStyle = {
  1464. marginTop: '23px'
  1465. };
  1466. }
  1467. // 例如:1360x768
  1468. else if (screenWidth === 1360 && screenHeight === 768) {
  1469. pulseStyle = {
  1470. titleMarginTop: '0px',
  1471. firstRowMarginTop: '44px',
  1472. normalRowMarginTop: '61px',
  1473. lastRowMarginTop: '61px'
  1474. };
  1475. temperatureStyle = {
  1476. titleMarginTop: '0px',
  1477. firstRowMarginTop: '44px',
  1478. normalRowMarginTop: '61px',
  1479. lastRowMarginTop: '61px'
  1480. };
  1481. legendStyle = {
  1482. marginTop: '476px'
  1483. };
  1484. containerStyle = {
  1485. marginTop: '22px'
  1486. };
  1487. }
  1488. // // 例如:1440x900
  1489. // else if (screenWidth === 1440 && screenHeight === 900) {
  1490. // pulseStyle = {
  1491. // titleMarginTop: '0px',
  1492. // firstRowMarginTop: '44px',
  1493. // normalRowMarginTop: '61px',
  1494. // lastRowMarginTop: '61px'
  1495. // };
  1496. // temperatureStyle = {
  1497. // titleMarginTop: '0px',
  1498. // firstRowMarginTop: '44px',
  1499. // normalRowMarginTop: '61px',
  1500. // lastRowMarginTop: '61px'
  1501. // };
  1502. // legendStyle = {
  1503. // marginTop: '476px'
  1504. // };
  1505. // containerStyle = {
  1506. // marginTop: '22px'
  1507. // };
  1508. // }
  1509. // 其他分辨率使用默认样式
  1510. else {
  1511. pulseStyle = {
  1512. titleMarginTop: '0px',
  1513. firstRowMarginTop: '32px',
  1514. normalRowMarginTop: '55px',
  1515. lastRowMarginTop: '56px'
  1516. };
  1517. temperatureStyle = {
  1518. titleMarginTop: '0px',
  1519. firstRowMarginTop: '32px',
  1520. normalRowMarginTop: '55px',
  1521. lastRowMarginTop: '56px'
  1522. };
  1523. legendStyle = {
  1524. marginTop: '476px'
  1525. };
  1526. containerStyle = {
  1527. marginTop: this.marginTop + 'px',
  1528. };
  1529. }
  1530. console.log("this.marginTop11111111111111111111",this.marginTop)
  1531. this.pulseScaleStyle = pulseStyle;
  1532. this.temperatureScaleStyle = temperatureStyle;
  1533. this.legendStyle = legendStyle;
  1534. this.containerStyle = containerStyle;
  1535. },
  1536. },
  1537. };
  1538. function getTypeData(type, allData = [], isNumber = true) {
  1539. return allData
  1540. .map((rowBOSItem, index) => {
  1541. const rowBOS = rowBOSItem.rowBOS;
  1542. const cur =
  1543. rowBOS.find(item => {
  1544. return item.typeCode === type;
  1545. }) || {};
  1546. return { x: index, y: (isNumber ? +cur.typeValue : cur.typeValue) || "" };
  1547. })
  1548. .filter(item => {
  1549. return item.y !== "";
  1550. });
  1551. }
  1552. </script>
  1553. <style scoped>
  1554. .table_wrap {
  1555. line-height: normal;
  1556. }
  1557. table {
  1558. font-weight: normal;
  1559. border-collapse: collapse;
  1560. font-size: 8px;
  1561. text-align: center;
  1562. width: 100%;
  1563. table-layout: fixed;
  1564. border: 2px #2f4f4f solid;
  1565. }
  1566. td {
  1567. border: 1px solid #ccc;
  1568. width: 12px;
  1569. height: 11px;
  1570. }
  1571. .redLineTd {
  1572. border-right: 1px solid #ff6e71;
  1573. }
  1574. .recorde-text {
  1575. /* 样式现在通过动态计算设置 */
  1576. color: #ff0000;
  1577. position: relative;
  1578. }
  1579. .table_wrap {
  1580. position: relative;
  1581. margin: 0 auto;
  1582. width: 835px;
  1583. }
  1584. .container {
  1585. /* 高度最好动态计算,不然很容易错位*/
  1586. margin: 30px auto;
  1587. margin-top: 28px;
  1588. width: 805px;
  1589. height: 758px;
  1590. position: absolute;
  1591. top: 142px;
  1592. left: 28px;
  1593. }
  1594. .temperature_mark td p {
  1595. position: relative;
  1596. top: 0;
  1597. margin-top: 58px;
  1598. }
  1599. .num_wrapper {
  1600. width: 35px;
  1601. height: 636px;
  1602. position: relative;
  1603. }
  1604. .pain_wrapper {
  1605. position: absolute;
  1606. width: 100%;
  1607. height: 70px;
  1608. right: 0;
  1609. bottom: -3px;
  1610. border: 1px solid #ccc;
  1611. }
  1612. .zeroline {
  1613. fill: none;
  1614. stroke: red;
  1615. stroke-width: 0.5px;
  1616. stroke-dasharray: 5 5;
  1617. }
  1618. .zerolinetext {
  1619. fill: red;
  1620. }
  1621. .overlay {
  1622. fill: none;
  1623. stroke: none;
  1624. pointer-events: all;
  1625. }
  1626. .tooltip {
  1627. font-family: "宋体";
  1628. font-size: 10px;
  1629. line-height: 16px;
  1630. color: #736269;
  1631. width: auto;
  1632. height: auto;
  1633. padding: 4px;
  1634. position: absolute;
  1635. text-align: left;
  1636. border: 1px solid #736269;
  1637. background-color: #e7e9f3;
  1638. border-radius: 2px;
  1639. background: linear-gradient(#fefdff, #e5e5f1);
  1640. /* 标准的语法(必须放在最后) */
  1641. }
  1642. </style>
  1643. <style>
  1644. .table_wrap {
  1645. font-family: "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  1646. }
  1647. .table_wrap .tick,
  1648. .table_wrap .domain {
  1649. display: none;
  1650. }
  1651. .table_wrap .tbale-label {
  1652. font-weight: 700;
  1653. }
  1654. .table_wrap .focusLine {
  1655. fill: none;
  1656. stroke: red;
  1657. stroke-width: 0.5px;
  1658. }
  1659. .table_wrap .focusText {
  1660. color: red;
  1661. }
  1662. .table_wrap .breath_td_odd {
  1663. vertical-align: top;
  1664. font-size: 10px;
  1665. }
  1666. .table_wrap .breath_td_even {
  1667. vertical-align: bottom;
  1668. font-size: 10px;
  1669. }
  1670. .table_wrap .line {
  1671. fill: none;
  1672. stroke: black;
  1673. stroke-width: 2px;
  1674. }
  1675. .table_wrap .line.tiwenline {
  1676. stroke: blue;
  1677. fill: none;
  1678. }
  1679. .table_wrap .line.redColor {
  1680. stroke: red;
  1681. fill: none;
  1682. }
  1683. .table_wrap .axis path,
  1684. .table_wrap .axis line,
  1685. .table_wrap .line {
  1686. stroke: #000;
  1687. fill: none;
  1688. }
  1689. .table_wrap .legend {
  1690. display: flex;
  1691. }
  1692. .table_wrap .legend .legend-text {
  1693. display: flex;
  1694. }
  1695. .table_wrap .legend .legend-item {
  1696. margin-right: 20px;
  1697. }
  1698. </style>