graphics.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  1. <template>
  2. <div class="table_wrap">
  3. <div
  4. :key="'comKey' + comKey"
  5. class="container"
  6. :style="{
  7. marginTop: marginTop + 'px',
  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. <tr>
  92. <td class="focusText">3</td>
  93. <td>7</td>
  94. <td>11</td>
  95. <td>15</td>
  96. <td class="focusText">19</td>
  97. <td class="focusText redLineTd">23</td>
  98. <td class="focusText">3</td>
  99. <td>7</td>
  100. <td>11</td>
  101. <td>15</td>
  102. <td class="focusText">19</td>
  103. <td class="focusText redLineTd">23</td>
  104. <td class="focusText">3</td>
  105. <td>7</td>
  106. <td>11</td>
  107. <td>15</td>
  108. <td class="focusText">19</td>
  109. <td class="focusText redLineTd">23</td>
  110. <td class="focusText">3</td>
  111. <td>7</td>
  112. <td>11</td>
  113. <td>15</td>
  114. <td class="focusText">19</td>
  115. <td class="focusText redLineTd">23</td>
  116. <td class="focusText">3</td>
  117. <td>7</td>
  118. <td>11</td>
  119. <td>15</td>
  120. <td class="focusText">19</td>
  121. <td class="focusText redLineTd">23</td>
  122. <td class="focusText">3</td>
  123. <td>7</td>
  124. <td>11</td>
  125. <td>15</td>
  126. <td class="focusText">19</td>
  127. <td class="focusText redLineTd">23</td>
  128. <td class="focusText">3</td>
  129. <td>7</td>
  130. <td>11</td>
  131. <td>15</td>
  132. <td class="focusText">19</td>
  133. <td class="focusText">23</td>
  134. </tr>
  135. <!-- <record></record> -->
  136. <tr class="recorde temperature_mark">
  137. <td colspan="2" rowspan="45" style="border-right: 1px solid white">
  138. <div style="margin-top: 476px; height: 31px">
  139. <p style="width: 35px">
  140. <span>口表•</span>
  141. <span style="color: blue">腋表x</span>
  142. <span>肛表o</span>
  143. <span style="color: red">脉搏•</span>
  144. <span style="color: red">心率o</span>
  145. </p>
  146. <p></p>
  147. </div>
  148. </td>
  149. <td colspan="3" rowspan="45">
  150. <div style="color: red" class="num_wrapper">
  151. <p style="margin-top: 0; text-align: right">脉搏次/分</p>
  152. <p style="margin-top: 32px">180</p>
  153. <p style="margin-top: 55px">160</p>
  154. <p style="margin-top: 55px">140</p>
  155. <p style="margin-top: 55px">120</p>
  156. <p style="margin-top: 55px">100</p>
  157. <p style="margin-top: 55px">80</p>
  158. <p style="margin-top: 56px">60</p>
  159. <p style="margin-top: 56px">40</p>
  160. </div>
  161. </td>
  162. <td colspan="3" rowspan="45">
  163. <div style="color: blue" class="num_wrapper">
  164. <p style="margin-top: 0">体温<br />x</p>
  165. <p style="margin-top: 32px">41</p>
  166. <p style="margin-top: 55px">40</p>
  167. <p style="margin-top: 55px">39</p>
  168. <p style="margin-top: 55px">38</p>
  169. <p style="margin-top: 55px">37</p>
  170. <p style="margin-top: 55px">36</p>
  171. <p style="margin-top: 56px">35</p>
  172. <p style="margin-top: 56px">34</p>
  173. </div>
  174. </td>
  175. <td
  176. v-for="(item, y) in tdList"
  177. :key="y + 'td0'"
  178. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  179. >
  180. <div class="recorde-text">{{ getSymbolTextArr(y) }}</div>
  181. </td>
  182. </tr>
  183. <tr
  184. class="recorde"
  185. v-for="(tr, index) in [0, 0, 0]"
  186. :key="index + 'tr1'"
  187. >
  188. <td
  189. v-for="(item, y) in tdList"
  190. :key="y + 'td1'"
  191. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  192. ></td>
  193. </tr>
  194. <tr class="recorde">
  195. <template v-for="(item, index) of tdList">
  196. <td
  197. :key="index + 'td2'"
  198. v-if="index % 6 === 5 && index != tdList.length"
  199. style="
  200. border-right: 1px solid #ff6e71;
  201. border-bottom: 1px solid #7e7eff;
  202. "
  203. ></td>
  204. <td
  205. :key="index + 'td2'"
  206. v-else
  207. style="border-bottom: 1px solid #7e7eff"
  208. ></td>
  209. </template>
  210. </tr>
  211. <tr
  212. class="recorde"
  213. v-for="(tr, index) in [0, 0, 0, 0]"
  214. :key="index + 'tr2'"
  215. >
  216. <td
  217. v-for="(item, y) in tdList"
  218. :key="y + 'td3'"
  219. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  220. ></td>
  221. </tr>
  222. <tr class="recorde">
  223. <template v-for="(item, index) of tdList">
  224. <td
  225. :key="index + 'td4'"
  226. v-if="index % 6 === 5 && index != tdList.length"
  227. style="
  228. border-right: 1px solid #ff6e71;
  229. border-bottom: 1px solid #7e7eff;
  230. "
  231. ></td>
  232. <td
  233. :key="index + 'td4'"
  234. v-else
  235. style="border-bottom: 1px solid #7e7eff"
  236. ></td>
  237. </template>
  238. </tr>
  239. <tr
  240. class="recorde"
  241. v-for="(tr, index) in [0, 0, 0, 0]"
  242. :key="index + 'tr3'"
  243. >
  244. <td
  245. v-for="(item, y) in tdList"
  246. :key="y + 'td5'"
  247. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  248. ></td>
  249. </tr>
  250. <tr class="recorde">
  251. <template v-for="(item, index) of tdList">
  252. <td
  253. :key="index + 'td6'"
  254. v-if="index % 6 === 5 && index != tdList.length"
  255. style="
  256. border-right: 1px solid #ff6e71;
  257. border-bottom: 1px solid #7e7eff;
  258. "
  259. ></td>
  260. <td
  261. :key="index + 'td6'"
  262. v-else
  263. style="border-bottom: 1px solid #7e7eff"
  264. ></td>
  265. </template>
  266. </tr>
  267. <tr
  268. class="recorde"
  269. v-for="(tr, index) in [0, 0, 0, 0]"
  270. :key="index + 'tr4'"
  271. >
  272. <td
  273. v-for="(item, y) in tdList"
  274. :key="y + 'td7'"
  275. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  276. ></td>
  277. </tr>
  278. <tr class="recorde">
  279. <template v-for="(item, index) of tdList">
  280. <td
  281. :key="index + 'td8'"
  282. v-if="index % 6 === 5 && index != tdList.length"
  283. style="
  284. border-right: 1px solid #ff6e71;
  285. border-bottom: 1px solid #7e7eff;
  286. "
  287. ></td>
  288. <td
  289. :key="index + 'td8'"
  290. v-else
  291. style="border-bottom: 1px solid #7e7eff"
  292. ></td>
  293. </template>
  294. </tr>
  295. <tr
  296. class="recorde"
  297. v-for="(tr, index) in [0, 0, 0, 0]"
  298. :key="index + 'tr5'"
  299. >
  300. <td
  301. v-for="(item, y) in tdList"
  302. :key="y + 'td9'"
  303. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  304. ></td>
  305. </tr>
  306. <tr class="recorde">
  307. <template v-for="(item, index) of tdList">
  308. <td
  309. :key="index + 'td10'"
  310. v-if="index % 6 === 5 && index != tdList.length"
  311. style="
  312. border-right: 1px solid #ff6e71;
  313. border-bottom: 1px solid #7e7eff;
  314. "
  315. ></td>
  316. <td
  317. :key="index + 'td10'"
  318. v-else
  319. style="border-bottom: 1px solid #7e7eff"
  320. ></td>
  321. </template>
  322. </tr>
  323. <tr
  324. class="recorde"
  325. v-for="(tr, index) in [0, 0, 0, 0]"
  326. :key="index + 'tr6'"
  327. >
  328. <td
  329. v-for="(item, y) in tdList"
  330. :key="y + 'td11'"
  331. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  332. ></td>
  333. </tr>
  334. <tr class="recorde">
  335. <template v-for="(item, index) of tdList">
  336. <td
  337. :key="index + 'td11'"
  338. v-if="index % 6 === 5 && index != tdList.length"
  339. style="
  340. border-right: 1px solid #ff6e71;
  341. border-bottom: 1px solid #7e7eff;
  342. "
  343. ></td>
  344. <td
  345. :key="index + 'td11'"
  346. v-else
  347. style="border-bottom: 1px solid #7e7eff"
  348. ></td>
  349. </template>
  350. </tr>
  351. <tr
  352. class="recorde"
  353. v-for="(tr, index) in [0, 0, 0, 0]"
  354. :key="index + 'tr7'"
  355. >
  356. <td
  357. v-for="(item, y) in tdList"
  358. :key="y"
  359. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  360. ></td>
  361. </tr>
  362. <tr class="recorde">
  363. <template v-for="(item, index) of tdList">
  364. <td
  365. :key="index + 'td12'"
  366. v-if="index % 6 === 5 && index != tdList.length"
  367. style="
  368. border-right: 1px solid #ff6e71;
  369. border-bottom: 1px solid #7e7eff;
  370. "
  371. ></td>
  372. <td
  373. :key="index + 'td12'"
  374. v-else
  375. style="border-bottom: 1px solid #7e7eff"
  376. ></td>
  377. </template>
  378. </tr>
  379. <tr
  380. class="recorde"
  381. v-for="(tr, index) in [0, 0, 0, 0]"
  382. :key="index + 'tr8'"
  383. >
  384. <td
  385. v-for="(item, y) in tdList"
  386. :key="y + 'td13'"
  387. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  388. ></td>
  389. </tr>
  390. <tr class="recorde">
  391. <template v-for="(item, index) of tdList">
  392. <td
  393. :key="index + 'td14'"
  394. v-if="index % 6 === 5 && index != tdList.length"
  395. style="
  396. border-right: 1px solid #ff6e71;
  397. border-bottom: 1px solid #7e7eff;
  398. "
  399. ></td>
  400. <td
  401. :key="index + 'td14'"
  402. v-else
  403. style="border-bottom: 1px solid #7e7eff"
  404. ></td>
  405. </template>
  406. </tr>
  407. <tr
  408. class="recorde"
  409. v-for="(tr, index) in [0, 0, 0, 0, 0]"
  410. :key="index + 'tr9'"
  411. >
  412. <td
  413. v-for="(item, y) in tdList"
  414. :key="y + 'td15'"
  415. :class="[y % 6 === 5 && y != tdList.length && 'redLineTd']"
  416. ></td>
  417. </tr>
  418. <tr></tr>
  419. <tr>
  420. <td
  421. :colspan="index === 0 ? 8 : 1"
  422. v-for="(item, index) in array42"
  423. :class="[index && 'redLineTd']"
  424. :key="index + '|098'"
  425. >
  426. {{
  427. index === 0
  428. ? "呼吸(次/分)"
  429. : typesViewData["098"] && typesViewData["098"][index - 1]
  430. }}
  431. </td>
  432. </tr>
  433. <tr>
  434. <td
  435. :colspan="index === 0 ? 8 : 1"
  436. v-for="(item, index) in array42"
  437. :class="[index && 'redLineTd']"
  438. :key="index + '|099'"
  439. >
  440. {{
  441. index === 0
  442. ? "疼痛强度"
  443. : typesViewData["099"] && typesViewData["099"][index - 1]
  444. }}
  445. </td>
  446. </tr>
  447. <tr>
  448. <td
  449. :colspan="index === 0 ? 8 : 6"
  450. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  451. :class="[index && 'redLineTd']"
  452. :key="index + '|005'"
  453. >
  454. {{
  455. index === 0
  456. ? "大便(次/日)"
  457. : typesViewData["005"] && typesViewData["005"][index - 1]
  458. }}
  459. </td>
  460. </tr>
  461. <tr>
  462. <td
  463. :colspan="index === 0 ? 8 : 6"
  464. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  465. :class="[index && 'redLineTd']"
  466. :key="index + '|004'"
  467. >
  468. {{
  469. index === 0
  470. ? "小便(ml)"
  471. : typesViewData["004"] && typesViewData["004"][index - 1]
  472. }}
  473. </td>
  474. </tr>
  475. <tr>
  476. <td
  477. :colspan="index === 0 ? 8 : 6"
  478. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  479. :class="[index && 'redLineTd']"
  480. :key="index + '|008'"
  481. >
  482. {{
  483. index === 0
  484. ? "血压(mmHg)"
  485. : typesViewData["008"] && typesViewData["008"][index - 1]
  486. }}
  487. </td>
  488. </tr>
  489. <tr>
  490. <td
  491. :colspan="index === 0 ? 8 : 6"
  492. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  493. :class="[index && 'redLineTd']"
  494. :key="index + '|030'"
  495. >
  496. {{
  497. index === 0
  498. ? "身高(cm)"
  499. : typesViewData["030"] && typesViewData["030"][index - 1]
  500. }}
  501. </td>
  502. </tr>
  503. <tr>
  504. <td
  505. :colspan="index === 0 ? 8 : 6"
  506. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  507. :class="[index && 'redLineTd']"
  508. :key="index + '|009'"
  509. >
  510. {{
  511. index === 0
  512. ? "体重(kg)"
  513. : typesViewData["009"] && typesViewData["009"][index - 1]
  514. }}
  515. </td>
  516. </tr>
  517. <tr>
  518. <td
  519. :colspan="index === 0 ? 8 : 6"
  520. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  521. :class="[index && 'redLineTd']"
  522. :key="index + '|006'"
  523. >
  524. {{
  525. index === 0
  526. ? "入量"
  527. : typesViewData["006"] && typesViewData["006"][index - 1]
  528. }}
  529. </td>
  530. </tr>
  531. <tr>
  532. <td
  533. :colspan="index === 0 ? 8 : 6"
  534. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  535. :class="[index && 'redLineTd']"
  536. :key="index + '|011'"
  537. >
  538. {{
  539. index === 0
  540. ? "出量"
  541. : typesViewData["011"] && typesViewData["011"][index - 1]
  542. }}
  543. </td>
  544. </tr>
  545. <tr>
  546. <td
  547. :colspan="index === 0 ? 8 : 6"
  548. v-for="(item, index) in [0, 1, 2, 3, 4, 5, 6, 7]"
  549. :class="[index && 'redLineTd']"
  550. :key="index + '|010'"
  551. >
  552. {{
  553. index === 0
  554. ? "过敏药物"
  555. : typesViewData["010"] && typesViewData["010"][index - 1]
  556. }}
  557. </td>
  558. </tr>
  559. </tbody>
  560. </table>
  561. <div style="text-align: center">
  562. <div style="font-size: 20px; font-weight: bold">
  563. {{ `第${info.pageNo}页` }}
  564. </div>
  565. </div>
  566. </div>
  567. </template>
  568. <script>
  569. import * as d3 from "d3";
  570. import dayjs from "dayjs";
  571. import { getKeyMap, SectionToChinese } from "./utils";
  572. import {
  573. getChartData,
  574. getAllPatintInfo,
  575. } from "@/api/medical-advice/nursing-manage";
  576. import { getFormatDatetime } from "@/utils/date";
  577. import env from "../../../utils/setting.js";
  578. export default {
  579. props: {
  580. patientInfo: Object,
  581. queryParam: Object,
  582. },
  583. data() {
  584. return {
  585. marginTop: 0,
  586. keyMap: getKeyMap(),
  587. info: {
  588. age: 0,
  589. beginDate: "",
  590. inpatientNo: "",
  591. hospDate: 0,
  592. admissDate: "",
  593. bedNo: "",
  594. inDate: 0,
  595. inDiagName: null,
  596. name: "",
  597. admissWardName: "",
  598. sexName: "",
  599. pageNo: "1",
  600. operaDays: [],
  601. },
  602. xyList: [],
  603. typesInfo: [],
  604. typesViewData: {},
  605. breathData: [],
  606. tdList: new Array(42).fill(0),
  607. comKey: 1,
  608. symbolTextArr: [],
  609. array42: [],
  610. };
  611. },
  612. computed: {
  613. env() {
  614. return env;
  615. },
  616. // 日期
  617. inHospitalTime() {
  618. const initday = dayjs(this.info.beginDate);
  619. return [
  620. null, // 文案天
  621. initday.format("YYYY-MM-DD"),
  622. initday.add(1, "day").format("MM-DD"),
  623. initday.add(2, "day").format("MM-DD"),
  624. initday.add(3, "day").format("MM-DD"),
  625. initday.add(4, "day").format("MM-DD"),
  626. initday.add(5, "day").format("MM-DD"),
  627. initday.add(6, "day").format("MM-DD"),
  628. ];
  629. },
  630. // 住院天数
  631. inHospitalDays() {
  632. const initday = this.info.hospDays || 0;
  633. return [
  634. null, // 文案天
  635. initday + 1,
  636. initday + 2,
  637. initday + 3,
  638. initday + 4,
  639. initday + 5,
  640. initday + 6,
  641. initday + 7,
  642. ];
  643. },
  644. // 手术天数
  645. surgeryDays() {
  646. const initday = this.info.operaDays;
  647. if (initday.length <= 0) {
  648. return new Array(8).fill(null);
  649. } else {
  650. return initday;
  651. }
  652. },
  653. },
  654. mounted() {
  655. for (let i = 0; i < 43; i++) {
  656. this.array42.push(i);
  657. }
  658. this.initData();
  659. const marginTop =
  660. (Math.round(this.$refs.topTd[0].getBoundingClientRect().height) - 18) *
  661. 10 +
  662. 28;
  663. this.marginTop = marginTop;
  664. // setTimeout(() => {
  665. // this.$emit('done')
  666. // })
  667. },
  668. methods: {
  669. SectionToChinese,
  670. getSymbolTextArr(index) {
  671. const current = this.symbolTextArr.find(i => i.x === index);
  672. if (current) {
  673. return current.y;
  674. } else {
  675. return "";
  676. }
  677. },
  678. temperatureConverter(c) {
  679. const value = (c * 9) / 5 + 32;
  680. return value.toFixed(1);
  681. },
  682. initData() {
  683. // this.info = dataModel.grParamBOS
  684. this.info.pageNo = this.queryParam.week;
  685. this.info.beginDate = this.queryParam.startRecTime;
  686. this.info.hospDays = (Number(this.queryParam.week) - 1) * 7;
  687. // this.rowsInfo = dataModel.rows || []
  688. // this.typesInfo = dataModel.types || []
  689. let param = {
  690. inpatientNo: this.patientInfo.inpatientNo,
  691. admissTimes: this.patientInfo.admissTimes,
  692. week: this.queryParam.week,
  693. startRecTime: this.queryParam.startRecTime,
  694. endRecTime: this.queryParam.endRecTime,
  695. mbFlag: this.queryParam.checkBoxFlag.mbFlag,
  696. hxFlag: this.queryParam.checkBoxFlag.hxFlag,
  697. xyFlag: this.queryParam.checkBoxFlag.xyFlag,
  698. wcyRqFlag: this.queryParam.checkBoxFlag.wcyRqFlag,
  699. };
  700. getAllPatintInfo({
  701. inpatientNo: this.patientInfo.inpatientNo,
  702. admissTimes: this.patientInfo.admissTimes,
  703. }).then(res => {
  704. this.info.name = res.name;
  705. this.info.age = res.age || "";
  706. this.info.sexName = res.sexName;
  707. this.info.bedNo = res.bedNo;
  708. this.info.inpatientNo = res.inpatientNo;
  709. this.info.admissWardName = res.admissWardName;
  710. this.info.admissDate = getFormatDatetime(res.admissDate, "YYYY-MM-DD");
  711. });
  712. getChartData(param).then(res => {
  713. this.rowsInfo = res.rows;
  714. this.typesInfo = res.types;
  715. this.info.operaDays = res.operaDays;
  716. this.init();
  717. });
  718. },
  719. init() {
  720. //800 758
  721. var width = 690;
  722. var height = 682;
  723. // SVG画布边缘与图表内容的距离
  724. var padding = { top: 50, right: 0, bottom: 50, left: 50 };
  725. // 创建一个分组用来组合要画的图表元素
  726. var main = d3
  727. .select(".container svg")
  728. .append("g")
  729. .classed("main", true)
  730. .attr("transform", "translate(" + 80 + "," + 80 + ")");
  731. // 模拟数据 体温
  732. var dataset = getTypeData("003", this.rowsInfo);
  733. var datasetAnus = getTypeData("015", this.rowsInfo);
  734. var datasetHeartrate = getTypeData("014", this.rowsInfo);
  735. var datasetPulse = getTypeData("002", this.rowsInfo);
  736. var symbolTextArr = getTypeData("012", this.rowsInfo, false);
  737. this.symbolTextArr = symbolTextArr;
  738. // 口表【黑实圆】
  739. var datasetPain = getTypeData("001", this.rowsInfo);
  740. this.breathData = datasetPain;
  741. // const circleNode = document.createElement('circle')
  742. // circleNode.setAttribute('cx', '179.2439024390244')
  743. // circleNode.setAttribute('cy', '582')
  744. // circleNode.setAttribute('r', '4')
  745. // circleNode.setAttribute('stroke', '#000000')
  746. // circleNode.setAttribute('stroke-width', '1')
  747. // circleNode.setAttribute('fill', '#FFFFFF')
  748. // document.querySelector('.main').appendChild(circleNode)
  749. // 创建x轴的比例尺(线性比例尺)
  750. var xScale = d3
  751. .scaleLinear()
  752. .domain([0, 41])
  753. .range([9, width - padding.left - padding.right + 75]);
  754. // 创建y轴的比例尺(线性比例尺)
  755. /* var yScale = d3.scale.linear()
  756. .domain([0, d3.max(dataset,function(d) {
  757. return d.y;
  758. })])
  759. .range([height - padding.top - padding.bottom, 0]); */
  760. // 体温
  761. var yScale = d3
  762. .scaleLinear()
  763. .domain([33, 42])
  764. .range([height - padding.top - padding.bottom, -56]);
  765. // 脉搏
  766. var yScale1 = d3
  767. .scaleLinear()
  768. .domain([20, 200])
  769. .range([height - padding.top - padding.bottom, -55]);
  770. // 呼吸
  771. var yScale2 = d3
  772. .scaleLinear()
  773. .domain([0, 40])
  774. .range([height - padding.top + 22, -55]);
  775. // 创建x轴
  776. var xAxis = d3.axisBottom().scale(xScale);
  777. // 创建y轴
  778. var yAxis = d3.axisLeft().scale(yScale);
  779. var yAxis1 = d3.axisLeft().scale(yScale1);
  780. var yAxis2 = d3.axisLeft().scale(yScale2);
  781. // 添加SVG元素并与x轴进行“绑定”
  782. main
  783. .append("g")
  784. .attr("class", "axis")
  785. .attr(
  786. "transform",
  787. "translate(0," + (height - padding.top - padding.bottom) + ")"
  788. )
  789. .call(xAxis);
  790. // 添加SVG元素并与y轴进行“绑定”
  791. main.append("g").attr("class", "axis").call(yAxis);
  792. main.append("g").attr("class", "axis").call(yAxis1);
  793. main.append("g").attr("class", "axis").call(yAxis2);
  794. // 添加折线
  795. var line = d3
  796. .line()
  797. .x(function (d) {
  798. return xScale(d.x);
  799. })
  800. .y(function (d) {
  801. return yScale(d.y);
  802. });
  803. var line1 = d3
  804. .line()
  805. .x(function (d) {
  806. return xScale(d.x);
  807. })
  808. .y(function (d) {
  809. return yScale1(d.y);
  810. });
  811. var line2 = d3
  812. .line()
  813. .x(function (d) {
  814. return xScale(d.x);
  815. })
  816. .y(function (d) {
  817. return yScale(d.y);
  818. });
  819. // .interpolate('linear')
  820. // 选择线条的类型
  821. // 添加path元素,并通过line()计算出值来赋值
  822. main
  823. .append("path")
  824. .attr("class", "line tiwenline")
  825. .attr("d", line(dataset));
  826. main.append("path").attr("class", "line").attr("d", line(datasetAnus));
  827. main.append("path").attr("class", "line").attr("d", line2(datasetPain));
  828. main
  829. .append("path")
  830. .attr("class", "line redColor")
  831. .attr("d", line1(datasetHeartrate));
  832. main
  833. .append("path")
  834. .attr("class", "line redColor")
  835. .attr("d", line1(datasetPulse));
  836. // main.append('path').attr('class', 'line').attr('d', line3(dataset))
  837. // 添加点
  838. /* 黑实圆--start */
  839. // main
  840. // .selectAll('rect')
  841. // .data(dataset_mouth)
  842. // .enter()
  843. // .append('circle')
  844. // .attr('cx', function (d) {
  845. // return xScale(d.x)
  846. // })
  847. // .attr('cy', function (d) {
  848. // return yScale(d.y)
  849. // })
  850. // .attr('r', 4)
  851. // .attr('fill', function (d, i) {
  852. // return 'black'
  853. // })
  854. /* 黑实圆--end */
  855. /* 黑空圆--start */
  856. main
  857. .selectAll("rect")
  858. .data(datasetAnus)
  859. .enter()
  860. .append("circle")
  861. .attr("cx", function (d) {
  862. return xScale(d.x);
  863. })
  864. .attr("cy", function (d) {
  865. return yScale(d.y);
  866. })
  867. .attr("r", 4)
  868. .attr("stroke", "#000000")
  869. .attr("stroke-width", 1)
  870. .attr("fill", "#FFFFFF");
  871. /* 黑空圆--end */
  872. /* 红空圆--start */
  873. main
  874. .selectAll("rect")
  875. .data(datasetHeartrate)
  876. .enter()
  877. .append("circle")
  878. .attr("cx", function (d) {
  879. return xScale(d.x);
  880. })
  881. .attr("cy", function (d) {
  882. return yScale1(d.y);
  883. })
  884. .attr("r", 4)
  885. .attr("stroke", "#EE0000")
  886. .attr("stroke-width", 1)
  887. .attr("fill", "#FFFFFF");
  888. /* 红空圆--end */
  889. /* 红实圆--start */
  890. main
  891. .selectAll("rect")
  892. .data(datasetPulse)
  893. .enter()
  894. .append("circle")
  895. .attr("cx", function (d) {
  896. return xScale(d.x);
  897. })
  898. .attr("cy", function (d) {
  899. return yScale1(d.y);
  900. })
  901. .attr("r", 4)
  902. .attr("fill", "#EE0000");
  903. // .on('mouseover', function (d) {
  904. // // (1)取得提示显示的位置
  905. // var xPosition = parseFloat(d3.select(this).attr('cx')) + 698
  906. // var yPosition = parseFloat(d3.select(this).attr('cy')) + 24
  907. //
  908. // // (2)创建提示条SVG
  909. // d3.select('.container svg')
  910. // .append('text')
  911. // .attr('id', 'tooltip') // 设置id便于移除提示
  912. // .attr('x', xPosition)
  913. // .attr('y', yPosition)
  914. // .attr('text-anchor', 'middle')
  915. // .attr('font-family', 'sans-setif')
  916. // .attr('font-size', '11px')
  917. // .attr('font-weight', 'bold')
  918. // .attr('fill', 'white')
  919. // .text(d.value)
  920. // })
  921. // (3)移除提示条SVG
  922. /* 红实圆--end */
  923. /* 黑实圆--start */
  924. main
  925. .selectAll("rect")
  926. .data(datasetPain)
  927. .enter()
  928. .append("circle")
  929. .attr("cx", function (d) {
  930. return xScale(d.x);
  931. })
  932. .attr("cy", function (d) {
  933. return yScale(d.y);
  934. })
  935. .attr("r", 4)
  936. .attr("stroke", "#000000")
  937. .attr("fill", "#000000");
  938. /* 黑实圆--end */
  939. this.drawx(main, dataset, xScale, yScale);
  940. this.initTypes();
  941. // this.hoverEvent(main)
  942. },
  943. drawx(main, dataset, xScale, yScale) {
  944. /* 【叉形】--start */
  945. main
  946. .selectAll("rect")
  947. .data(dataset)
  948. .enter()
  949. .append("line")
  950. .attr("x1", function (d) {
  951. return xScale(d.x) - 4;
  952. })
  953. .attr("y1", function (d) {
  954. return yScale(d.y) - 4;
  955. })
  956. .attr("x2", function (d) {
  957. return xScale(d.x) + 4;
  958. })
  959. .attr("y2", function (d) {
  960. return yScale(d.y) + 4;
  961. })
  962. .attr("stroke", function (d, i) {
  963. return "blue";
  964. });
  965. main
  966. .selectAll("rect")
  967. .data(dataset)
  968. .enter()
  969. .append("line")
  970. .attr("x1", function (d) {
  971. return xScale(d.x) + 4;
  972. })
  973. .attr("y1", function (d) {
  974. return yScale(d.y) - 4;
  975. })
  976. .attr("x2", function (d) {
  977. return xScale(d.x) - 4;
  978. })
  979. .attr("y2", function (d) {
  980. return yScale(d.y) + 4;
  981. })
  982. .attr("stroke", function (d, i) {
  983. return "blue";
  984. });
  985. /* 体温【叉形】--end */
  986. },
  987. hoverEvent(main) {
  988. ///* 鼠标悬停直线--start
  989. // var dataset_line = [{x: 0,y: 0}]
  990. // main.selectAll('rect')
  991. // .data(dataset_line)
  992. // .enter()
  993. // .append('line')
  994. // .attr({
  995. // 'x1':100,'y1':-56,
  996. // 'x2':100,'y2':582
  997. // })
  998. // .attr('stroke', function(d, i) {
  999. // return 'black';
  1000. // });
  1001. // 鼠标悬停直线--end */
  1002. document.querySelector(".lineColor").style.stroke = "red";
  1003. const recordeNode = document.createElement("div");
  1004. recordeNode.setAttribute("class", "recorde-text");
  1005. document.querySelector(".recorde td").append(recordeNode);
  1006. const allTrtd = document.querySelectorAll(".temperatureChart tr td");
  1007. [...allTrtd].map(ele => {
  1008. ele.setAttribute("title", ele.innerText);
  1009. });
  1010. /* 鼠标悬停提示框 */
  1011. var tooltip = d3
  1012. .select("body")
  1013. .append("div")
  1014. .attr("class", "tooltip")
  1015. .style("opacity", 0.0);
  1016. main
  1017. .on("mouseover", function (d) {
  1018. /*
  1019. 鼠标移入时,
  1020. (1)通过 selection.html() 来更改提示框的文字
  1021. (2)通过更改样式 left 和 top 来设定提示框的位置
  1022. (3)设定提示框的透明度为1.0(完全不透明)
  1023. */
  1024. tooltip
  1025. .html("呼吸:19次/分<br/>录入信息:2017-11-02<br/>姓名:张三")
  1026. .style("left", d3.event.pageX + "px")
  1027. .style("top", d3.event.pageY + 20 + "px")
  1028. .style("opacity", 1.0);
  1029. })
  1030. .on("mousemove", function (d) {
  1031. /* 鼠标移动时,更改样式 left 和 top 来改变提示框的位置 */
  1032. tooltip
  1033. .style("left", d3.event.pageX + "px")
  1034. .style("top", d3.event.pageY + 20 + "px");
  1035. })
  1036. .on("mouseout", function (d) {
  1037. /* 鼠标移出时,将透明度设定为0.0(完全透明) */
  1038. tooltip.style("opacity", 0.0);
  1039. });
  1040. },
  1041. initTypes() {
  1042. const keyMap = {};
  1043. this.typesInfo.map(item => {
  1044. const key = item.typeCode;
  1045. if (keyMap[key]) {
  1046. keyMap[key].push(item.typeValue);
  1047. } else {
  1048. keyMap[key] = [item.typeValue];
  1049. }
  1050. });
  1051. this.typesViewData = keyMap;
  1052. },
  1053. },
  1054. };
  1055. function getTypeData(type, allData = [], isNumber = true) {
  1056. return allData
  1057. .map((rowBOSItem, index) => {
  1058. const rowBOS = rowBOSItem.rowBOS;
  1059. const cur =
  1060. rowBOS.find(item => {
  1061. return item.typeCode === type;
  1062. }) || {};
  1063. return { x: index, y: (isNumber ? +cur.typeValue : cur.typeValue) || "" };
  1064. })
  1065. .filter(item => {
  1066. return item.y !== "";
  1067. });
  1068. }
  1069. </script>
  1070. <style scoped>
  1071. .table_wrap {
  1072. line-height: normal;
  1073. }
  1074. table {
  1075. font-weight: normal;
  1076. border-collapse: collapse;
  1077. font-size: 8px;
  1078. text-align: center;
  1079. width: 100%;
  1080. table-layout: fixed;
  1081. border: 2px #2f4f4f solid;
  1082. }
  1083. td {
  1084. border: 1px solid #ccc;
  1085. width: 12px;
  1086. height: 11px;
  1087. }
  1088. .redLineTd {
  1089. border-right: 1px solid #ff6e71;
  1090. }
  1091. .recorde-text {
  1092. width: 13px;
  1093. height: 8px;
  1094. color: #ff0000;
  1095. font-size: 10px;
  1096. position: relative;
  1097. top: -4px;
  1098. }
  1099. .table_wrap {
  1100. position: relative;
  1101. margin: 0 auto;
  1102. width: 835px;
  1103. }
  1104. .container {
  1105. /* 高度最好动态计算,不然很容易错位*/
  1106. margin: 30px auto;
  1107. margin-top: 28px;
  1108. width: 805px;
  1109. height: 758px;
  1110. position: absolute;
  1111. top: 142px;
  1112. left: 28px;
  1113. }
  1114. .temperature_mark td p {
  1115. position: relative;
  1116. top: 0;
  1117. margin-top: 58px;
  1118. }
  1119. .num_wrapper {
  1120. width: 35px;
  1121. height: 636px;
  1122. position: relative;
  1123. }
  1124. .pain_wrapper {
  1125. position: absolute;
  1126. width: 100%;
  1127. height: 70px;
  1128. right: 0;
  1129. bottom: -3px;
  1130. border: 1px solid #ccc;
  1131. }
  1132. .zeroline {
  1133. fill: none;
  1134. stroke: red;
  1135. stroke-width: 0.5px;
  1136. stroke-dasharray: 5 5;
  1137. }
  1138. .zerolinetext {
  1139. fill: red;
  1140. }
  1141. .overlay {
  1142. fill: none;
  1143. stroke: none;
  1144. pointer-events: all;
  1145. }
  1146. .tooltip {
  1147. font-family: "宋体";
  1148. font-size: 10px;
  1149. line-height: 16px;
  1150. color: #736269;
  1151. width: auto;
  1152. height: auto;
  1153. padding: 4px;
  1154. position: absolute;
  1155. text-align: left;
  1156. border: 1px solid #736269;
  1157. background-color: #e7e9f3;
  1158. border-radius: 2px;
  1159. background: linear-gradient(#fefdff, #e5e5f1);
  1160. /* 标准的语法(必须放在最后) */
  1161. }
  1162. </style>
  1163. <style>
  1164. .table_wrap {
  1165. font-family: "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  1166. }
  1167. .table_wrap .tick,
  1168. .table_wrap .domain {
  1169. display: none;
  1170. }
  1171. .table_wrap .tbale-label {
  1172. font-weight: 700;
  1173. }
  1174. .table_wrap .focusLine {
  1175. fill: none;
  1176. stroke: red;
  1177. stroke-width: 0.5px;
  1178. }
  1179. .table_wrap .focusText {
  1180. color: red;
  1181. }
  1182. .table_wrap .breath_td_odd {
  1183. vertical-align: top;
  1184. font-size: 10px;
  1185. }
  1186. .table_wrap .breath_td_even {
  1187. vertical-align: bottom;
  1188. font-size: 10px;
  1189. }
  1190. .table_wrap .line {
  1191. fill: none;
  1192. stroke: black;
  1193. stroke-width: 2px;
  1194. }
  1195. .table_wrap .line.tiwenline {
  1196. stroke: blue;
  1197. fill: none;
  1198. }
  1199. .table_wrap .line.redColor {
  1200. stroke: red;
  1201. fill: none;
  1202. }
  1203. .table_wrap .axis path,
  1204. .table_wrap .axis line,
  1205. .table_wrap .line {
  1206. stroke: #000;
  1207. fill: none;
  1208. }
  1209. .table_wrap .legend {
  1210. display: flex;
  1211. }
  1212. .table_wrap .legend .legend-text {
  1213. display: flex;
  1214. }
  1215. .table_wrap .legend .legend-item {
  1216. margin-right: 20px;
  1217. }
  1218. </style>