add.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490
  1. <template>
  2. <view class="container">
  3. <image
  4. class="jkda_top_bg"
  5. :src="baseUrl+'/images/healthRecords/integral_top_bg@2x.png'"
  6. mode="widthFix"
  7. v-if="this.formType!='dietList' && this.formType!='sleepList'&&this.formType!='sportList'&& this.formType!='healthLife'"
  8. ></image>
  9. <view class="container-body">
  10. <!-- 就诊人信息 -->
  11. <view class="userbox" v-if="this.formType!='dietList' && this.formType!='sleepList'&&this.formType!='sportList'&& this.formType!='healthLife'">
  12. <view class="userbox-left" style="opacity: 0.65;" @click="addPatient()" v-if="patient!=null">
  13. <view class="userbox-headimg">
  14. <image :src="defaultHeadimg" mode="aspectFill" style="width: 100%;height: 100%"></image>
  15. </view>
  16. <view class="userbox-info">
  17. <view class="userbox-name">
  18. <text>{{patient.patientName}}</text>
  19. <text class="userbox-idcard">{{$parseIdCard(patient.idCard)}}</text>
  20. </view>
  21. <view class="userbox-info-tag">
  22. <view v-if="patient.sex==1">男</view>
  23. <view v-if="patient.sex==2">女</view>
  24. <view>{{$getAge(patient.birthday)}}岁</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="userbind" @click="addPatient()" v-if="patient==null">
  29. <image :src="baseUrl+'/images/healthRecords/upload_id_card_icon.png'" mode="aspectFill"></image>
  30. <text>绑定就诊人</text>
  31. </view>
  32. </view>
  33. <!-- 问卷 -->
  34. <view class="listbox multiplebox" v-for="(item,index) in list" :key="index">
  35. <view class="listbox-titlebox">
  36. <text>{{index + 1}}.</text>
  37. <view class="listbox-titletag" v-if="item.type == 2">多选</view>
  38. <text class="listbox-title">{{item.name}}</text>
  39. </view>
  40. <!-- 多选 -->
  41. <view class="listbox-option" v-if="item.type == 2">
  42. <view v-for="(option,i) in item.question" :key="i" class="listbox-option-flex">
  43. <view
  44. @click="handleMultiple(item,index,option)"
  45. :class="item.value.indexOf(option.name) === -1 ? 'listbox-option-item' : 'listbox-option-item option-active'">
  46. {{option.name}}
  47. </view>
  48. <view class="otherinput" v-if="option.isWrite == 1 && item.value.indexOf(option.name) !== -1" @click="handleEdit(index,i)">
  49. {{option.writeVal || '请输入相关描述'}}
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 单选 -->
  54. <view style="margin-top: 20rpx;" v-if="item.type == 1">
  55. <view class="listbox-choose" v-for="(option,i) in item.question" :key="i" @click="handleChoose(item,option)">
  56. <image class="choose-icon" v-if="item.value == option.name" :src="baseUrl+'/images/healthRecords/choose_icon.png'" mode="aspectFill"></image>
  57. <image class="choose-icon" v-if="item.value != option.name" :src="baseUrl+'/images/healthRecords/choose_no_icon.png'" mode="aspectFill"></image>
  58. <text style="flex-shrink: 0;">{{option.name}}</text>
  59. <view class="choose-input" v-if="option.isWrite == 1 && item.value == option.name" @click.stop="handleEdit(index,i)">
  60. {{option.writeVal || '请输入相关描述'}}
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 饮食调查 -->
  65. <view class="dietary-survey" v-if="item.type == 3">
  66. <view class="dietary-survey-item" v-for="(option,i) in item.question" :key="i"
  67. @click="handleChoose(item,option)">
  68. <view class="dietary-survey-iteml" v-if="option.name !== '每周多少次'">
  69. <view :class="item.value == option.name ? 'dietary-survey-active':''">{{i+1}}</view>
  70. <text>{{option.name}}</text>
  71. </view>
  72. <view class="dietary-survey-input" v-if="item.name == '平时应酬' && option.name === '每周多少次'">
  73. <text>每周</text>
  74. <input class="uni-input" type="number" maxlength="2"
  75. :value="option.writeVal" @input="clearInput($event,option)" />
  76. <text>次</text>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <u-popup :show="show" @close="close" >
  83. <view class="popbox">
  84. <view class="popbox-title" v-if="list&&list.length>0">{{chooseIndex+1}}.{{list[chooseIndex].name}}</view>
  85. <view class="popbox-desc" v-if="list&&list.length>0">选项:{{list[chooseIndex].question[chooseItemIdx].name}}</view>
  86. <view class="uni-textarea-wrapper">
  87. <textarea class="textarea" placeholder-style="font-size: 28rpx;" :focus="focus" placeholder="请输入相关描述" :value="writeVal" @input="handleinput"/>
  88. <view class="popbox-confirm-btn" @click="popSubmit">确认</view>
  89. </view>
  90. </view>
  91. </u-popup>
  92. <!-- footer -->
  93. <view class="footer">
  94. <button class="footer-btn" :loading="btnLoading" :disabled="btnLoading" @click="handelSubmit">
  95. {{this.formType=='dietList' || this.formType=='sleepList'||this.formType=='sportList' ? '提交':'提交健康档案'}}
  96. </button>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. import {getUserInfo} from '@/api/user';
  102. import {
  103. myRecord,
  104. healthHistoryTempList,
  105. addRecord,
  106. addFsHealthLife,
  107. HealthLife,
  108. } from "@/api/healthRecords.js"
  109. export default {
  110. data() {
  111. return {
  112. isShare:null,
  113. baseUrl:uni.getStorageSync('requestPath'),
  114. show:false,
  115. patient:null,
  116. focus: false,
  117. chooseIndex: 0,
  118. chooseItemIdx: 0,
  119. writeVal: "",
  120. inputValue: "",
  121. btnLoading: false,
  122. formType: "",
  123. defaultHeadimg: uni.getStorageSync('requestPath')+"/images/healthRecords/my_heads_icon.png",
  124. title: "快速填写健康档案",
  125. user: {},
  126. defaultList: [
  127. {
  128. name: "目前是否有以下不适?",
  129. questionType: "symptomHistory",
  130. type: 2,
  131. value: "",
  132. required: true,
  133. question: [
  134. {
  135. name: "无",
  136. value: 1,
  137. isWrite: 0,
  138. writeVal: ""
  139. },
  140. {
  141. name: "头晕",
  142. value: 2,
  143. isWrite: 0,
  144. writeVal: ""
  145. },
  146. {
  147. name: "头痛",
  148. value: 3,
  149. isWrite: 0,
  150. writeVal: ""
  151. },{
  152. name: "容易疲劳",
  153. value: 4,
  154. isWrite: 0,
  155. writeVal: ""
  156. },{
  157. name: "记忆力下降",
  158. value: 5,
  159. isWrite: 0,
  160. writeVal: ""
  161. },{
  162. name: "咳嗽",
  163. value: 6,
  164. isWrite: 0,
  165. writeVal: ""
  166. },{
  167. name: "咳痰",
  168. value: 7,
  169. isWrite: 0,
  170. writeVal: ""
  171. },{
  172. name: "呼吸困难",
  173. value: 8,
  174. isWrite: 0,
  175. writeVal: ""
  176. },{
  177. name: "胸痛",
  178. value: 9,
  179. isWrite: 0,
  180. writeVal: ""
  181. },{
  182. name: "心悸",
  183. value: 10,
  184. isWrite: 0,
  185. writeVal: ""
  186. },{
  187. name: "腹痛",
  188. value: 11,
  189. isWrite: 0,
  190. writeVal: ""
  191. },{
  192. name: "腹胀",
  193. value: 12,
  194. isWrite: 0,
  195. writeVal: ""
  196. },{
  197. name: "便秘",
  198. value: 13,
  199. isWrite: 0,
  200. writeVal: ""
  201. },{
  202. name: "腹泻",
  203. value: 14,
  204. isWrite: 0,
  205. writeVal: ""
  206. },{
  207. name: "食欲差",
  208. value: 15,
  209. isWrite: 0,
  210. writeVal: ""
  211. },{
  212. name: "骨痛",
  213. value: 16,
  214. isWrite: 0,
  215. writeVal: ""
  216. },{
  217. name: "尿频、尿急、尿不尽",
  218. value: 17,
  219. isWrite: 0,
  220. writeVal: ""
  221. },{
  222. name: "其它",
  223. value: 18,
  224. isWrite: 1,
  225. writeVal: ""
  226. },
  227. ]
  228. },{
  229. name: "您父母或直系亲属是否有以下疾病?",
  230. questionType: "familyHistory",
  231. type: 2,
  232. value: "",
  233. required: true,
  234. question: [
  235. {
  236. name: "无",
  237. value: 1,
  238. isWrite: 0,
  239. writeVal: ""
  240. },{
  241. name: "糖尿病",
  242. value: 2,
  243. isWrite: 0,
  244. writeVal: ""
  245. },{
  246. name: "高血压",
  247. value: 3,
  248. isWrite: 0,
  249. writeVal: ""
  250. },{
  251. name: "心脑血管病",
  252. value: 4,
  253. isWrite: 0,
  254. writeVal: ""
  255. },{
  256. name: "高脂血症",
  257. value: 5,
  258. isWrite: 0,
  259. writeVal: ""
  260. },{
  261. name: "肥胖",
  262. value: 6,
  263. isWrite: 0,
  264. writeVal: ""
  265. },{
  266. name: "其它",
  267. value: 7,
  268. isWrite: 1,
  269. writeVal: ""
  270. },
  271. ],
  272. },
  273. {
  274. name: "目前是否在用其它疾病的药品?",
  275. questionType: "drugHistory",
  276. type: 1,
  277. value: "",
  278. required: false,
  279. question: [
  280. {
  281. name: "无",
  282. value: 1,
  283. isWrite: 0,
  284. writeVal: ""
  285. },{
  286. name: "有",
  287. value: 2,
  288. isWrite: 1,
  289. writeVal: ""
  290. },
  291. ],
  292. },{
  293. name: "用药是否出现了不良反应?",
  294. questionType: "drugHistory",
  295. type: 1,
  296. value: "",
  297. required: false,
  298. question: [
  299. {
  300. name: "无",
  301. value: 1,
  302. isWrite: 0,
  303. writeVal: ""
  304. },{
  305. name: "有",
  306. value: 2,
  307. isWrite: 1,
  308. writeVal: ""
  309. },
  310. ],
  311. },{
  312. name: "是否对药物或某些物质过敏?",
  313. questionType: "allergyHistory",
  314. type: 1,
  315. value: "",
  316. required: false,
  317. question: [
  318. {
  319. name: "无",
  320. value: 1,
  321. isWrite: 0,
  322. writeVal: ""
  323. },{
  324. name: "有",
  325. value: 2,
  326. isWrite: 1,
  327. writeVal: ""
  328. },
  329. ],
  330. }
  331. ],
  332. list: [],
  333. // 饮食调查
  334. dietList: [
  335. {
  336. name: "三餐规律",
  337. type: 3,
  338. value: "",
  339. questionType: "dietList",
  340. question: [
  341. {
  342. name: "非常规律",
  343. value: 1,
  344. isWrite: 0,
  345. writeVal: ""
  346. },{
  347. name: "比较规律",
  348. value: 2,
  349. isWrite: 0,
  350. writeVal: ""
  351. },{
  352. name: "没有规律",
  353. value: 3,
  354. isWrite: 0,
  355. writeVal: ""
  356. }
  357. ],
  358. },{
  359. name: "就餐习惯",
  360. type: 3,
  361. value: "",
  362. questionType: "dietList",
  363. question: [
  364. {
  365. name: "暴饮暴食",
  366. value: 1,
  367. isWrite: 0,
  368. writeVal: ""
  369. },{
  370. name: "压力大经常进食",
  371. value: 2,
  372. isWrite: 0,
  373. writeVal: ""
  374. },{
  375. name: "就外就餐多",
  376. value: 3,
  377. isWrite: 0,
  378. writeVal: ""
  379. },{
  380. name: "夜宵",
  381. value: 4,
  382. isWrite: 0,
  383. writeVal: ""
  384. },{
  385. name: "不吃早餐",
  386. value: 5,
  387. isWrite: 0,
  388. writeVal: ""
  389. }
  390. ],
  391. },{
  392. name: "进食速度",
  393. type: 3,
  394. value: "",
  395. questionType: "dietList",
  396. question: [
  397. {
  398. name: "大约20-30分钟",
  399. value: 1,
  400. isWrite: 0,
  401. writeVal: ""
  402. },{
  403. name: "大约10-20分钟",
  404. value: 2,
  405. isWrite: 0,
  406. writeVal: ""
  407. },{
  408. name: "大约5-10分钟",
  409. value: 3,
  410. isWrite: 0,
  411. writeVal: ""
  412. }
  413. ],
  414. },{
  415. name: "酒类",
  416. type: 3,
  417. value: "",
  418. questionType: "dietList",
  419. question: [
  420. {
  421. name: "从不喝酒",
  422. value: 1,
  423. isWrite: 0,
  424. writeVal: ""
  425. },{
  426. name: "每天",
  427. value: 2,
  428. isWrite: 0,
  429. writeVal: ""
  430. },{
  431. name: "大于3次/周",
  432. value: 3,
  433. isWrite: 0,
  434. writeVal: ""
  435. },{
  436. name: "小于3次/周",
  437. value: 4,
  438. isWrite: 0,
  439. writeVal: ""
  440. }
  441. ],
  442. },{
  443. name: "平时应酬",
  444. type: 3,
  445. value: "",
  446. questionType: "dietList",
  447. question: [
  448. {
  449. name: "多",
  450. value: 1,
  451. isWrite: 0,
  452. writeVal: ""
  453. },{
  454. name: "一般",
  455. value: 2,
  456. isWrite: 0,
  457. writeVal: ""
  458. },{
  459. name: "少",
  460. value: 3,
  461. isWrite: 0,
  462. writeVal: ""
  463. },{
  464. name: "每周多少次",
  465. value: 3,
  466. isWrite: 1,
  467. writeVal: ""
  468. }
  469. ],
  470. },{
  471. name: "喝水量",
  472. type: 3,
  473. value: "",
  474. questionType: "dietList",
  475. question: [
  476. {
  477. name: "低于1000ml",
  478. value: 1,
  479. isWrite: 0,
  480. writeVal: ""
  481. },{
  482. name: "1000ml-1500ml",
  483. value: 2,
  484. isWrite: 0,
  485. writeVal: ""
  486. },{
  487. name: "1500ml-1700ml",
  488. value: 3,
  489. isWrite: 0,
  490. writeVal: ""
  491. },{
  492. name: "1700ml以上",
  493. value: 4,
  494. isWrite: 0,
  495. writeVal: ""
  496. }
  497. ],
  498. },{
  499. name: "您每天吃的食物种类多吗?",
  500. type: 3,
  501. value: "",
  502. questionType: "dietList",
  503. question: [
  504. {
  505. name: "种类非常多,12种以上",
  506. value: 1,
  507. isWrite: 0,
  508. writeVal: ""
  509. },{
  510. name: "一般6-10种",
  511. value: 2,
  512. isWrite: 0,
  513. writeVal: ""
  514. },{
  515. name: "种类较少3-5种",
  516. value: 3,
  517. isWrite: 0,
  518. writeVal: ""
  519. },{
  520. name: "种类比较固定",
  521. value: 4,
  522. isWrite: 0,
  523. writeVal: ""
  524. }
  525. ],
  526. },{
  527. name: "您是否有抽烟习惯?",
  528. type: 3,
  529. value: "",
  530. questionType: "dietList",
  531. question: [
  532. {
  533. name: "是",
  534. value: 1,
  535. isWrite: 0,
  536. writeVal: ""
  537. },{
  538. name: "无",
  539. value: 2,
  540. isWrite: 0,
  541. writeVal: ""
  542. }
  543. ],
  544. },
  545. ],
  546. sleepList: [
  547. {
  548. name: "睡眠状况",
  549. type: 3,
  550. value: "",
  551. questionType: "sleepList",
  552. question: [
  553. {
  554. name: "很差",
  555. value: 1,
  556. isWrite: 0,
  557. writeVal: ""
  558. },{
  559. name: "差",
  560. value: 2,
  561. isWrite: 0,
  562. writeVal: ""
  563. },{
  564. name: "一般",
  565. value: 3,
  566. isWrite: 0,
  567. writeVal: ""
  568. },{
  569. name: "良好",
  570. value: 4,
  571. isWrite: 0,
  572. writeVal: ""
  573. }
  574. ],
  575. },{
  576. name: "睡眠时间",
  577. type: 3,
  578. value: "",
  579. questionType: "sleepList",
  580. question: [
  581. {
  582. name: "<6小时",
  583. value: 1,
  584. isWrite: 0,
  585. writeVal: ""
  586. },{
  587. name: "6-8小时",
  588. value: 2,
  589. isWrite: 0,
  590. writeVal: ""
  591. },{
  592. name: "9-10小时",
  593. value: 3,
  594. isWrite: 0,
  595. writeVal: ""
  596. },{
  597. name: ">10小时",
  598. value: 4,
  599. isWrite: 0,
  600. writeVal: ""
  601. }
  602. ],
  603. },{
  604. name: "经常熬夜吗?",
  605. type: 3,
  606. value: "",
  607. questionType: "sleepList",
  608. question: [
  609. {
  610. name: "经常",
  611. value: 1,
  612. isWrite: 0,
  613. writeVal: ""
  614. },{
  615. name: "偶尔",
  616. value: 2,
  617. isWrite: 0,
  618. writeVal: ""
  619. },{
  620. name: "很少",
  621. value: 3,
  622. isWrite: 0,
  623. writeVal: ""
  624. },{
  625. name: "无",
  626. value: 4,
  627. isWrite: 0,
  628. writeVal: ""
  629. }
  630. ],
  631. },
  632. ],
  633. sportList: [
  634. {
  635. name: "日常运动量",
  636. type: 3,
  637. value: "",
  638. questionType: "sportList",
  639. question: [
  640. {
  641. name: "久坐不动",
  642. value: 1,
  643. isWrite: 0,
  644. writeVal: ""
  645. },{
  646. name: "轻度运动(3000-6000步)",
  647. value: 2,
  648. isWrite: 0,
  649. writeVal: ""
  650. },{
  651. name: "中度运动(6000-10000步)",
  652. value: 3,
  653. isWrite: 0,
  654. writeVal: ""
  655. },{
  656. name: "大量运动(一万步以上)",
  657. value: 4,
  658. isWrite: 0,
  659. writeVal: ""
  660. }
  661. ],
  662. },{
  663. name: "日常是否有运动?",
  664. type: 2,
  665. value: "",
  666. questionType: "sportList",
  667. question: [
  668. {
  669. name: "无",
  670. value: 1,
  671. isWrite: 0,
  672. writeVal: ""
  673. },{
  674. name: "散步",
  675. value: 2,
  676. isWrite: 0,
  677. writeVal: ""
  678. },{
  679. name: "跑步",
  680. value: 3,
  681. isWrite: 0,
  682. writeVal: ""
  683. },{
  684. name: "自行车",
  685. value: 4,
  686. isWrite: 0,
  687. writeVal: ""
  688. },{
  689. name: "舞蹈或太极拳",
  690. value: 5,
  691. isWrite: 0,
  692. writeVal: ""
  693. },{
  694. name: "上下楼梯",
  695. value: 6,
  696. isWrite: 0,
  697. writeVal: ""
  698. },{
  699. name: "球类",
  700. value: 7,
  701. isWrite: 0,
  702. writeVal: ""
  703. },{
  704. name: "游泳",
  705. value: 8,
  706. isWrite: 0,
  707. writeVal: ""
  708. },{
  709. name: "其他",
  710. value: 9,
  711. isWrite: 1,
  712. writeVal: ""
  713. }
  714. ],
  715. },{
  716. name: "您平均每周锻炼次数?",
  717. type: 3,
  718. value: "",
  719. questionType: "sportList",
  720. question: [
  721. {
  722. name: "≤2次",
  723. value: 1,
  724. isWrite: 0,
  725. writeVal: ""
  726. },{
  727. name: "3-5次",
  728. value: 2,
  729. isWrite: 0,
  730. writeVal: ""
  731. },{
  732. name: "≥5次",
  733. value: 3,
  734. isWrite: 0,
  735. writeVal: ""
  736. }
  737. ],
  738. },{
  739. name: "平均每次锻炼时间是多少分钟?",
  740. type: 3,
  741. value: "",
  742. questionType: "sportList",
  743. question: [
  744. {
  745. name: "≤20",
  746. value: 1,
  747. isWrite: 0,
  748. writeVal: ""
  749. },{
  750. name: "20-40",
  751. value: 2,
  752. isWrite: 0,
  753. writeVal: ""
  754. },{
  755. name: "41-60",
  756. value: 3,
  757. isWrite: 0,
  758. writeVal: ""
  759. },{
  760. name: ">60",
  761. value: 3,
  762. isWrite: 0,
  763. writeVal: ""
  764. }
  765. ],
  766. }
  767. ]
  768. }
  769. },
  770. onLoad(option) {
  771. this.formType = option.formType
  772. this.isShare = option.isShare
  773. if(this.formType=="dietList") {
  774. this.list = this.dietList
  775. }else if(this.formType=="sleepList") {
  776. this.list = this.sleepList
  777. }else if(this.formType=="sportList") {
  778. this.list = this.sportList
  779. }else if(this.formType=="healthLife") {
  780. this.list = [...this.dietList,...this.sleepList,...this.sportList]
  781. }else {
  782. this.list = this.defaultList
  783. }
  784. if(option.isShare!=null){
  785. this.companyId=option.companyId;
  786. this.companyUserId=option.companyUserId;
  787. }
  788. else{
  789. this.companyId=uni.getStorageSync('companyId');
  790. this.companyUserId=uni.getStorageSync('companyUserId');
  791. }
  792. const formTypeOption = {
  793. "healthHistory": "填写疾病史",
  794. "symptomHistory": "填写症状史",
  795. "familyHistory": "填写家族史",
  796. "drugHistory": "填写用药史",
  797. "allergyHistory": "填写过敏史",
  798. "dietList": "饮食",
  799. "sleepList": "睡眠情况",
  800. "sportList": "运动",
  801. "healthLife": "生活习惯", // 包括 饮食、睡眠情况、运动
  802. }
  803. this.title = formTypeOption[this.formType] || ""
  804. uni.setNavigationBarTitle({
  805. title: this.title || "",
  806. });
  807. uni.$on('refreshOrderPatient', (res) => {
  808. this.patient=res
  809. })
  810. },
  811. onShow() {
  812. this.user = {}
  813. this.$isLogin().then(
  814. res => {
  815. if(res){
  816. this.getUserInfo();
  817. }
  818. },
  819. rej => {}
  820. );
  821. },
  822. onShareAppMessage(res) {
  823. //禁止二次转发--
  824. uni.showShareMenu({
  825. withShareTicket: true
  826. });
  827. wx.updateShareMenu({
  828. isPrivateMessage: true,
  829. withShareTicket: true,
  830. success(res) {
  831. console.log('updateShareMenu: ', res);
  832. },
  833. fail() {}
  834. });
  835. //禁止二次转发--end
  836. return {
  837. title: "健康档案",
  838. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png',
  839. path: "/pages_user/healthRecords/add?isShare=1&formType="+this.formType+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId,
  840. }
  841. },
  842. methods: {
  843. getUserInfo(){
  844. getUserInfo().then(
  845. res => {
  846. if(res.code==200){
  847. if(res.user!=null){
  848. this.user=res.user;
  849. if(this.formType!="dietList" && this.formType!="sleepList"&&this.formType!="sportList"&& this.formType!='healthLife') {
  850. this.getHealthHistoryTempList()
  851. }else {
  852. this.getHealthLife()
  853. }
  854. this.getMyRecord();
  855. }
  856. }else{
  857. uni.showToast({
  858. icon:'none',
  859. title: "请求失败",
  860. });
  861. }
  862. },
  863. rej => {}
  864. );
  865. },
  866. addPatient(){
  867. uni.navigateTo({
  868. url: '/pages_user/patient'
  869. })
  870. },
  871. handleEdit(index,i) {
  872. this.chooseIndex = index
  873. this.chooseItemIdx = i
  874. this.focus = true
  875. this.writeVal = this.list[index].question[i].writeVal
  876. this.show=true;
  877. },
  878. close() {
  879. this.focus = false
  880. this.show=false;
  881. },
  882. // 输入
  883. handleinput(e) {
  884. this.writeVal = e.detail.value
  885. },
  886. popSubmit() {
  887. this.list[this.chooseIndex].question[this.chooseItemIdx].writeVal = this.writeVal
  888. this.close()
  889. },
  890. // 每周喝多少次
  891. clearInput(event,option) {
  892. this.inputValue = event.detail.value;
  893. option.writeVal = this.inputValue
  894. },
  895. // 健康档案
  896. getMyRecord() {
  897. myRecord().then(res => {
  898. if (res.code == 200) {
  899. if(res.data) {
  900. if(this.isShare!=null){
  901. uni.showToast({
  902. icon:'none',
  903. title: "您已填写过档案",
  904. });
  905. setTimeout(function(){
  906. uni.redirectTo({
  907. url:"/pages_user/healthRecords/index"
  908. })
  909. },2000);
  910. }
  911. } else {
  912. }
  913. } else {
  914. uni.showToast({
  915. icon:'none',
  916. title: res.msg,
  917. });
  918. }
  919. },
  920. rej => {}
  921. )
  922. },
  923. // 健康生活
  924. getHealthLife() {
  925. const param = {
  926. userId: this.user.userId
  927. }
  928. HealthLife(param).then(res => {
  929. if (res.code == 200 && res.data) {
  930. this.dietList = res.data.eat ? JSON.parse(res.data.eat) : this.dietList
  931. this.sleepList = res.data.sleep ? JSON.parse(res.data.sleep) : this.sleepList
  932. this.sportList = res.data.sport ? JSON.parse(res.data.sport) : this.sportList
  933. if (this.formType == "healthLife") {
  934. this.list = [...this.dietList,...this.sleepList,...this.sportList]
  935. } else {
  936. this.list = this.formType == "dietList" ? this.dietList : this.formType == "sleepList" ? this.sleepList : this.formType == "sportList" ? this.sportList : []
  937. }
  938. }
  939. },
  940. rej => {}
  941. )
  942. },
  943. getHealthHistoryTempList() {
  944. healthHistoryTempList().then(res => {
  945. let list = []
  946. if (res.code == 200 && res.data && res.data.length > 0) {
  947. list = res.data.map(item => ({
  948. ...item,
  949. value: item.value || "",
  950. required: true,
  951. question: JSON.parse(item.question).map((it, i) => ({
  952. ...it,
  953. writeVal: ""
  954. }))
  955. }));
  956. }
  957. this.list = list.concat(this.defaultList)
  958. },
  959. rej => {}
  960. );
  961. },
  962. // 单选
  963. handleChoose(item,option) {
  964. if(this.patient==null&&this.formType!="dietList" && this.formType!="sleepList"&&this.formType!="sportList"&& this.formType!='healthLife'){
  965. uni.showToast({
  966. icon:'none',
  967. title: "请选择就诊人",
  968. });
  969. return;
  970. }
  971. if(item.name == '平时应酬' && option.name === '每周多少次') return
  972. item.value = option.name
  973. },
  974. // 多选
  975. handleMultiple(item,index,option) {
  976. if(this.patient==null&&this.formType!="dietList" && this.formType!="sleepList"&&this.formType!="sportList"&& this.formType!='healthLife'){
  977. uni.showToast({
  978. icon:'none',
  979. title: "请选择就诊人",
  980. });
  981. return;
  982. }
  983. const arry = item.value ? item.value.split(',') : []
  984. if(arry.indexOf(option.name) === -1) {
  985. arry.push(option.name)
  986. item.value = arry.join(',')
  987. } else {
  988. arry.splice(arry.indexOf(option.name),1)
  989. item.value = arry.join(',')
  990. }
  991. },
  992. // 提交健康档案
  993. handelSubmit() {
  994. if(this.patient==null && this.formType!="dietList" && this.formType!="sleepList"&&this.formType!="sportList"&& this.formType!='healthLife'){
  995. uni.showToast({
  996. icon:'none',
  997. title: "请选择就诊人",
  998. });
  999. return;
  1000. }
  1001. for (let i = 0; i < this.list.length; i++) {
  1002. // 检查当前项的字段是否有值
  1003. if (!this.list[i].value) {
  1004. uni.showToast({
  1005. title: "请检查健康档案是否填写完整",
  1006. icon: "none"
  1007. })
  1008. return
  1009. }
  1010. }
  1011. const arry = this.list.map((item, index) => ({
  1012. id: index + 1,
  1013. name: item.name,
  1014. sort: item.sort,
  1015. type: item.type,
  1016. value: item.value,
  1017. questionType: item.questionType,
  1018. question: item.question.map(it=>({
  1019. ...it,
  1020. writeVal: item.value.indexOf(it.name) == -1 && item.name != '平时应酬' && it.name != '每周多少次' ? '' : it.writeVal // 清空没有选中的选项输入的文字,(除了应酬次数)
  1021. }))
  1022. }));
  1023. if(this.formType=="dietList" || this.formType=="sleepList" || this.formType=="sportList" || this.formType=='healthLife') {
  1024. this.submitHealthLife(arry)
  1025. } else {
  1026. this.addHealthForm(arry)
  1027. }
  1028. },
  1029. // 新增修改生活习惯
  1030. submitHealthLife(arry) {
  1031. // 判断字符串为正整数
  1032. const reg = /^[1-9]\d*$/
  1033. if(this.inputValue && !reg.test(this.inputValue)) {
  1034. uni.showToast({
  1035. title: "请输入正确的平时应酬次数",
  1036. icon: "none"
  1037. })
  1038. return
  1039. }
  1040. const filterByQuestionType = (questionType) => arry.filter(item => item.questionType && item.questionType === questionType);
  1041. const eat = filterByQuestionType("dietList");
  1042. const sleep = filterByQuestionType("sleepList");
  1043. const sport = filterByQuestionType("sportList");
  1044. const param = {
  1045. eat: eat && eat.length > 0 ? JSON.stringify(eat) : JSON.stringify(this.dietList),
  1046. sleep: sleep && sleep.length > 0 ? JSON.stringify(sleep) : JSON.stringify(this.sleepList),
  1047. sport: sport && sport.length > 0 ? JSON.stringify(sport) : JSON.stringify(this.sportList),
  1048. }
  1049. addFsHealthLife(param).then(res => {
  1050. this.btnLoading = false
  1051. if (res.code == 200) {
  1052. uni.showToast({
  1053. title: "保存成功",
  1054. icon: 'none',
  1055. duration: 1000,
  1056. });
  1057. var timer = setTimeout(function() {
  1058. uni.redirectTo({
  1059. url: "/pages_user/healthRecords/index"
  1060. });
  1061. clearTimeout('timer')
  1062. }, 1000)
  1063. } else {
  1064. uni.showToast({
  1065. title: res.msg,
  1066. icon: "none"
  1067. })
  1068. }
  1069. },
  1070. rej => {
  1071. this.btnLoading = false
  1072. }
  1073. ).catch(()=>{
  1074. this.btnLoading = false
  1075. });
  1076. },
  1077. // 新增健康史
  1078. addHealthForm(arry) {
  1079. const filterByQuestionType = (questionType) => arry.filter(item => item.questionType && item.questionType === questionType);
  1080. const symptomHistory = filterByQuestionType("symptomHistory");
  1081. const drugHistory = filterByQuestionType("drugHistory");
  1082. const allergyHistory = filterByQuestionType("allergyHistory");
  1083. const familyHistory = filterByQuestionType("familyHistory");
  1084. const healthHistory = arry.filter(item => !item.questionType);
  1085. var companyUserId=this.companyUserId;
  1086. var companyId=this.companyId;
  1087. const param = {
  1088. companyId:companyId,
  1089. companyUserId:companyUserId,
  1090. name: this.patient.patientName,
  1091. sex: this.patient.sex, // this.patient.sex1男2女
  1092. age: this.$getAge(this.patient.birthday),
  1093. weight: undefined,
  1094. height: undefined,
  1095. bmi: undefined,
  1096. symptomHistory: JSON.stringify(symptomHistory), // 症状史
  1097. healthHistory: JSON.stringify(healthHistory), // 健康史
  1098. drugHistory: JSON.stringify(drugHistory), // 用药史
  1099. allergyHistory: JSON.stringify(allergyHistory), // 过敏史
  1100. familyHistory: JSON.stringify(familyHistory) // 家族史
  1101. };
  1102. this.btnLoading = true
  1103. addRecord(param).then(res => {
  1104. this.btnLoading = false
  1105. if(res.code == 200) {
  1106. uni.showToast({
  1107. title: "提交健康档案成功",
  1108. icon: 'none',
  1109. duration: 1000,
  1110. });
  1111. var timer = setTimeout(function() {
  1112. uni.redirectTo({
  1113. url: "/pages_user/healthRecords/index"
  1114. });
  1115. clearTimeout('timer')
  1116. }, 1000)
  1117. } else {
  1118. uni.showToast({
  1119. title: res.msg,
  1120. icon: "none"
  1121. })
  1122. }
  1123. },
  1124. rej => {this.btnLoading = false}
  1125. ).catch(()=>{
  1126. this.btnLoading = false
  1127. });
  1128. }
  1129. }
  1130. }
  1131. </script>
  1132. <style scoped lang="scss">
  1133. .container {
  1134. position: relative;
  1135. font-family: PingFang SC, PingFang SC;
  1136. .jkda_top_bg {
  1137. position: absolute;
  1138. top: 0;
  1139. left: 0;
  1140. width: 100%;
  1141. height: auto;
  1142. }
  1143. &-body {
  1144. position: relative;
  1145. padding: 32rpx 24rpx;
  1146. padding-bottom: calc(var(--window-bottom) + 152rpx);
  1147. }
  1148. }
  1149. .userbox {
  1150. padding: 32rpx;
  1151. margin-bottom: 20rpx;
  1152. background: #FFFFFF;
  1153. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1154. display: flex;
  1155. flex-direction: row;
  1156. align-items: center;
  1157. justify-content: space-between;
  1158. overflow: hidden;
  1159. .userbind {
  1160. width: 100%;
  1161. padding: 8rpx 0;
  1162. font-weight: 400;
  1163. font-size: 34rpx;
  1164. color: #FF5C03;
  1165. display: flex;
  1166. flex-direction: row;
  1167. align-items: center;
  1168. justify-content: center;
  1169. image {
  1170. width: 48rpx;
  1171. height: 48rpx;
  1172. margin-right: 16rpx;
  1173. }
  1174. }
  1175. &-headimg {
  1176. flex-shrink: 0;
  1177. width: 140rpx;
  1178. height: 140rpx;
  1179. }
  1180. &-left {
  1181. flex-shrink: 0;
  1182. flex: 1;
  1183. display: flex;
  1184. flex-direction: row;
  1185. align-items: center;
  1186. justify-content: flex-start;
  1187. }
  1188. &-name {
  1189. display: flex;
  1190. flex-direction: row;
  1191. align-items: center;
  1192. justify-content: flex-start;
  1193. flex-wrap: wrap;
  1194. gap: 0 30rpx;
  1195. }
  1196. &-idcard {
  1197. font-weight: 500;
  1198. font-size: 28rpx;
  1199. }
  1200. &-info {
  1201. margin-left: 24rpx;
  1202. font-weight: 600;
  1203. font-size: 32rpx;
  1204. color: #222222;
  1205. &-tag {
  1206. margin-top: 30rpx;
  1207. font-weight: 400;
  1208. font-size: 22rpx;
  1209. color: #FF5C03;
  1210. display: flex;
  1211. flex-direction: row;
  1212. align-items: center;
  1213. justify-content: flex-start;
  1214. view {
  1215. min-width: 62rpx;
  1216. height: 42rpx;
  1217. padding: 0 20rpx;
  1218. box-sizing: border-box;
  1219. background: #FCF0E7;
  1220. border-radius: 24rpx 24rpx 24rpx 24rpx;
  1221. text-align: center;
  1222. line-height: 42rpx;
  1223. margin-right: 14rpx;
  1224. }
  1225. }
  1226. }
  1227. }
  1228. .listbox {
  1229. padding: 32rpx 24rpx;
  1230. margin-bottom: 20rpx;
  1231. background: #FFFFFF;
  1232. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1233. font-family: PingFang SC, PingFang SC;
  1234. font-weight: 400;
  1235. font-size: 28rpx;
  1236. color: #222222;
  1237. &-titlebox {
  1238. font-weight: 600;
  1239. font-size: 34rpx;
  1240. white-space: normal;
  1241. }
  1242. &-titletag {
  1243. min-width: 80rpx;
  1244. height: 40rpx;
  1245. padding: 0 16rpx;
  1246. margin: 0 12rpx;
  1247. flex-shrink: 0;
  1248. box-sizing: border-box;
  1249. line-height: 40rpx;
  1250. text-align: center;
  1251. background: #FF5C03;
  1252. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1253. font-weight: 400;
  1254. font-size: 24rpx;
  1255. color: #FFFFFF;
  1256. display: inline-block;
  1257. }
  1258. &-option {
  1259. margin-top: 34rpx;
  1260. display: flex;
  1261. flex-direction: row;
  1262. align-items: center;
  1263. justify-content: flex-start;
  1264. flex-wrap: wrap;
  1265. gap: 18rpx;
  1266. &-flex {
  1267. display: flex;
  1268. flex-direction: row;
  1269. align-items: center;
  1270. justify-content: flex-start;
  1271. gap: 18rpx;
  1272. }
  1273. &-item {
  1274. display: inline-flex;
  1275. min-width: 206rpx;
  1276. min-height: 72rpx;
  1277. padding: 16rpx;
  1278. box-sizing: border-box;
  1279. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1280. border: 2rpx solid #ECECEC;
  1281. align-items: center;
  1282. justify-content: center;
  1283. }
  1284. }
  1285. .otherinput {
  1286. width: 430rpx;
  1287. height: 72rpx;
  1288. overflow: hidden;
  1289. padding: 16rpx 24rpx;
  1290. box-sizing: border-box;
  1291. background: #F5F7FA;
  1292. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1293. font-weight: 400;
  1294. font-size: 28rpx;
  1295. color: #999999;
  1296. justify-content: flex-start;
  1297. overflow: hidden;
  1298. white-space: nowrap;
  1299. text-overflow: ellipsis;
  1300. }
  1301. .option-active{
  1302. font-weight: 400;
  1303. font-size: 28rpx;
  1304. color: #FF5C03;
  1305. background: #FCF0E7;
  1306. border: 2rpx solid #FF5C03;
  1307. }
  1308. &-choose {
  1309. display: flex;
  1310. flex-direction: row;
  1311. align-items: center;
  1312. justify-content: flex-start;
  1313. min-height: 86rpx;
  1314. image {
  1315. flex-shrink: 0;
  1316. width: 36rpx;
  1317. height: 36rpx;
  1318. margin-right: 18rpx;
  1319. }
  1320. }
  1321. .choose-input {
  1322. width: 430rpx;
  1323. height: 72rpx;
  1324. padding: 16rpx 24rpx;
  1325. box-sizing: border-box;
  1326. margin-left: 42rpx;
  1327. background: #FFFFFF;
  1328. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1329. border: 2rpx solid #ECECEC;
  1330. display: inline-flex;
  1331. align-items: center;
  1332. justify-content: flex-start;
  1333. font-weight: 400;
  1334. font-size: 28rpx;
  1335. color: #999999;
  1336. overflow: hidden;
  1337. white-space: nowrap;
  1338. text-overflow: ellipsis;
  1339. }
  1340. .dietary-survey {
  1341. display: flex;
  1342. flex-direction: row;
  1343. align-items: flex-start;
  1344. justify-content: flex-start;
  1345. flex-wrap: wrap;
  1346. gap: 18rpx;
  1347. margin-top: 36rpx;
  1348. }
  1349. .dietary-survey-iteml {
  1350. width: 206rpx;
  1351. display: inline-flex;
  1352. flex-direction: column;
  1353. align-items: center;
  1354. font-weight: 400;
  1355. font-size: 32rpx;
  1356. view {
  1357. width: 206rpx;
  1358. height: 90rpx;
  1359. background: #F5F7FA;
  1360. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1361. border: 2rpx solid #ECECEC;
  1362. box-sizing: border-box;
  1363. margin-bottom: 20rpx;
  1364. text-align: center;
  1365. line-height: 90rpx;
  1366. }
  1367. text {
  1368. font-size: 24rpx;
  1369. color: #757575;
  1370. }
  1371. }
  1372. .dietary-survey-item {
  1373. display: inline-flex;
  1374. }
  1375. .dietary-survey-input {
  1376. height: 90rpx;
  1377. display: flex;
  1378. flex-direction: row;
  1379. align-items: center;
  1380. justify-content: flex-start;
  1381. display: inline-flex;
  1382. font-family: PingFang SC, PingFang SC;
  1383. font-weight: 400;
  1384. font-size: 24rpx;
  1385. color: #757575;
  1386. .uni-input {
  1387. width: 100rpx;
  1388. height: 72rpx;
  1389. padding: 0 10rpx;
  1390. text-align: center;
  1391. box-sizing: border-box;
  1392. margin: 0 10rpx;
  1393. background: #FFFFFF;
  1394. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1395. border: 2rpx solid #ECECEC;
  1396. }
  1397. }
  1398. .dietary-survey-active {
  1399. color: #fff !important;
  1400. background: #FF5C03 !important;
  1401. border: 2rpx solid #FF5C03 !important;
  1402. }
  1403. }
  1404. .footer {
  1405. width: 100%;
  1406. height: 152rpx;
  1407. padding: 20rpx 24rpx;
  1408. box-sizing: border-box;
  1409. background: #FFFFFF;
  1410. box-shadow: 0rpx -6rpx 8rpx 0rpx rgba(114,114,114,0.1);
  1411. position: fixed;
  1412. bottom: var(--window-bottom);
  1413. left: 0;
  1414. &-btn {
  1415. height: 112rpx;
  1416. background: #FF5C03;
  1417. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1418. font-weight: 600;
  1419. font-size: 34rpx;
  1420. color: #FFFFFF;
  1421. line-height: 112rpx;
  1422. text-align: center;
  1423. &::after {
  1424. border: none;
  1425. }
  1426. }
  1427. }
  1428. .popbox {
  1429. background: #fff;
  1430. padding: 20rpx;
  1431. font-family: PingFang SC, PingFang SC;
  1432. color: #222222;
  1433. font-weight: 400;
  1434. font-size: 28rpx;
  1435. &-title {
  1436. font-weight: 600;
  1437. font-size: 34rpx;
  1438. }
  1439. &-desc {
  1440. margin: 20rpx 0;
  1441. }
  1442. .uni-textarea-wrapper {
  1443. display: flex;
  1444. flex-direction: row;
  1445. align-items: flex-end;
  1446. justify-content: space-between;
  1447. }
  1448. .textarea {
  1449. flex: 1;
  1450. max-height: 146rpx;
  1451. padding: 15rpx 24rpx;
  1452. box-sizing: border-box;
  1453. background: #FFFFFF;
  1454. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1455. line-height: 36rpx;
  1456. border: 2rpx solid #ECECEC;
  1457. color: #222222;
  1458. font-weight: 400;
  1459. font-size: 28rpx;
  1460. }
  1461. .popbox-confirm-btn {
  1462. flex-shrink: 0;
  1463. width: 140rpx;
  1464. height: 70rpx;
  1465. margin-left: 10rpx;
  1466. background: #FF5C03;
  1467. border-radius: 16rpx;
  1468. color: #fff;
  1469. text-align: center;
  1470. line-height: 70rpx;
  1471. }
  1472. }
  1473. </style>