add.vue 32 KB

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