MainPage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <div class="page">
  3. <div class="progress-bar">
  4. <div class="title">
  5. <span :class="{'active':activeTab===0}">症状情况</span>
  6. <span :class="{'active':activeTab===1}">诊疗情况</span>
  7. <span :class="{'active':activeTab===2}">其他情况</span>
  8. </div>
  9. <div class="progress">
  10. <p :style="{width:progress}"></p>
  11. </div>
  12. </div>
  13. <div class="wrapper">
  14. <div class="scrollPart" :style="{'paddingBottom':pdbm}">
  15. <!--<div class="right clearfix">
  16. <img src="../assets/patient.png" alt="" class="fr">
  17. <div class="content fr">
  18. <p>医生您好!我想咨询新型冠状病毒。(个人信息:{{userInfo.patientName}}{{userInfo.patientSex?','+userInfo.patientSex:''}}{{userInfo.patientAge?','+userInfo.patientAge+'岁':''}})</p>
  19. </div>
  20. </div>-->
  21. <div class="left clearfix">
  22. <img src="../images/doctor.png" alt="" class="fl">
  23. <div class="content fl">
  24. <p>欢迎来到{{userInfo.hospitalName}}!候诊期间请先填写自己实际症状,信息会马上传送到您预约的医生,便于您实现快速就诊。</p>
  25. </div>
  26. </div>
  27. <!--<div class="left clearfix" @click="selectToggle(2,disData.symptom.result,true)">
  28. <img src="../assets/doctor.png" alt="" class="fl">
  29. <div class="content fl">
  30. <p>您哪里不舒服?</p>
  31. </div>
  32. </div>-->
  33. <UsualSymptom v-if="showUsual" @selectUsual="selectUsual"></UsualSymptom>
  34. <div class="right clearfix" v-if="selectedSymptom.name">
  35. <img src="../images/patient.png" alt="" class="fr">
  36. <div class="content fr">
  37. <p>{{selectedSymptom.description||selectedSymptom.name}}</p>
  38. </div>
  39. </div>
  40. <div v-for="(item,idx) in allquestionLis" :key="'0'+item.id" v-if="activeTab>-1">
  41. <Dialog :idx="idx" v-if="item.show" :item="item" @selectToggle="selectToggle"/>
  42. </div>
  43. <div v-for="(item,idx) in diagQasList" :key="'1'+item.id" v-if="activeTab>0">
  44. <Dialog :idx="idx" v-if="item.show" :item="item" @selectToggle="selectToggle"/>
  45. </div>
  46. <div v-for="(item,idx) in otherQasList" :key="'2'+item.id" v-if="activeTab>1">
  47. <Dialog :idx="idx" v-if="item.show" :item="item" @selectToggle="selectToggle"/>
  48. </div>
  49. </div>
  50. </div>
  51. <MultSelect @updataResult="updataResultSingle" :num="num" :symptomResult="symptomResult" v-if="type==3"></MultSelect>
  52. <Select @updataResult="updataResultSingle" :num="num" :symptomResult="symptomResult" v-if="type == 2||type==8"></Select>
  53. <Radio @updataResultSingle="updataResultSingle" :num="num" :symptomResult="symptomResult" v-if="type == 1"></Radio>
  54. <!--普通单列拨盘-->
  55. <Picker v-if="type==10" @confirm="updataResultSingle" :num="num" :defaultIndex = "defaultIndex"></Picker>
  56. <!--时间拨盘,拨盘内容写死-->
  57. <Picker v-if="type == 9" :symptomResult="symptomResult" :columns="getTimeColumns()" :defaultVal="pickDVal" @confirm="updataResultSingle" :num="num" :defaultIndex = "defaultIndex"></Picker>
  58. <PushSymptom v-if="type == 99" @updataResult="updataResultSingle" :num="num"></PushSymptom>
  59. <!-- 上传图片 -->
  60. <UploadImg v-if="type==4"
  61. :num="num"
  62. :item="symptomResult"
  63. :moduleType="symptomResult.type"
  64. @updataResult="updataResultSingle"
  65. :imgList="imgs"/>
  66. <!-- 输入框 -->
  67. <Input v-if="type==7"
  68. :num="num"
  69. :item="symptomResult"
  70. :key="symptomResult.id"
  71. @updata="updataResultSingle"/>
  72. <!-- 文本域 -->
  73. <ComTextArea v-if="type==6 || type == 5"
  74. :num="num"
  75. :item="symptomResult"
  76. width="92%"
  77. @updata="updataResultSingle"/>
  78. <div class="submit" v-if="showPreview">
  79. <a href="javascript:void(0)" @click="previewRes">提交并预览</a>
  80. </div>
  81. <!--<div v-if="wrong" class="tip">{{waring}}</div>-->
  82. <TipWarning v-if="wrong" :text="waring" @close="closeTip"/>
  83. </div>
  84. </template>
  85. <script>
  86. import BScroll from 'better-scroll';
  87. import Radio from '../common/Radio';
  88. import Select from '../common/Select';
  89. import Dialog from '../common/Dialog';
  90. import Picker from '../common/Picker';
  91. import Label from '../common/Label.vue';
  92. import ComTextArea from '../common/ComTextArea.vue';
  93. import Input from '../common/Input.vue';
  94. import PickTime from '../common/PickTime.vue';
  95. import UploadImg from '../common/UploadImg.vue';
  96. import PushSymptom from '../common/PushSymptom.vue';
  97. import ConfirmBox from '../common/ConfirmBox'
  98. import UsualSymptom from '../common/UsualSymptom';
  99. import MultSelect from '../common/MultSelect.vue';
  100. import TipWarning from '../common/TipWarning.vue';
  101. import api from "../utils/api.js";
  102. import {mapState} from 'vuex';
  103. import {moduleCP} from '@utils/tools'
  104. export default {
  105. name:'MainPage',
  106. data(){
  107. return {
  108. num:0,//题目计数
  109. pickDVal:'1天', //时间控件默认值
  110. showUsual:false, //常用症状显示
  111. activeTab:0, //当前模块
  112. scroll:null,
  113. type :-1, //当前显示的控件类型
  114. showPreview:false,//显示预览按钮
  115. selectedSymptom:{},
  116. symptomResult:'',//症状选择
  117. connectResult:[],//关联问题的id
  118. contentResult:{},//选中的结果val医生端显示,valp患者端显示
  119. allquestionLis:[],//症状详情所有的问题
  120. diagQasList:[], //诊疗详情所有问题
  121. otherQasList:[],//其他情况所有问题
  122. moduleKeys:[1,51,3,52],
  123. listMap:{
  124. 0:'allquestionLis',
  125. 1:'diagQasList',
  126. 2:'otherQasList'
  127. },
  128. moduleMap:{
  129. 0:'symptom',
  130. 1:'diagnose',
  131. 2:'others'
  132. },
  133. defaultIndex: 0, //温度默认值
  134. order:0,
  135. userInfo: {}, //用户信息
  136. pdbm:'8.5rem',
  137. waring:'', //错误提示语
  138. wrong:false, //是否显示错误toast
  139. showConfirm: false,
  140. time:1000,
  141. }
  142. },
  143. created() {
  144. //const userInfo= JSON.parse(localStorage.getItem("userInfo"))
  145. const userInfo = this.$store.state.pathInfo;
  146. this.userInfo = userInfo;
  147. this.updata()
  148. },
  149. mounted(){
  150. this.$nextTick(()=>{
  151. let bs = new BScroll('.wrapper', {
  152. probeType: 3,
  153. click:true
  154. })
  155. this.scroll = bs
  156. })
  157. // this.tmpSymptom = JSON.parse(JSON.stringify(data))
  158. //this.symptomResult = data.symptom.result;
  159. },
  160. computed:{
  161. ...mapState({
  162. imgs: state => state.diagnose.imgSrc,
  163. }),
  164. progress(){
  165. if(!this.num){
  166. return '0.1px';
  167. }
  168. const moduleName = this.listMap[this.activeTab];
  169. const precent = this.num/(this[moduleName].length+1);
  170. return precent*100+"%";
  171. }
  172. },
  173. methods:{
  174. previewRes(){
  175. this.$router.push({
  176. path:'/preview'
  177. })
  178. },
  179. updata(){
  180. this.allquestionLis = [];
  181. this.pdbm = '8.5rem'
  182. this.showUsual=true;
  183. this.num = 0;
  184. },
  185. selectToggle(type,result,flg,idx,order){
  186. return
  187. if(flg){
  188. this.num = 1
  189. }
  190. this.symptomResult = result
  191. this.type = type
  192. this.order = order
  193. this.scrollDown()
  194. },
  195. getTimeColumns(){
  196. let num = [];
  197. for(let i = 1; i <=60; i++) {
  198. num.push(i)
  199. }
  200. let unit = ['分钟', '小时', '天', '周', '月','年'];
  201. return [
  202. {
  203. values:num,
  204. className:'column1',
  205. defaultIndex: 0
  206. },
  207. {
  208. values:unit,
  209. className:'column2',
  210. defaultIndex: 2
  211. },
  212. ]
  213. },
  214. updataResultSingle(result,contentResult,num){
  215. this.num = num;
  216. this.type = -1;
  217. let moduleName = this.listMap[this.activeTab];
  218. let tmpArr = JSON.parse(JSON.stringify(this[moduleName]));
  219. tmpArr[num-1].content = contentResult.valp;
  220. //选没有可上传报告,则上传控件不显示
  221. const noUpload = this.symptomResult.id===999999&&contentResult.valp.indexOf("没有")!==-1;
  222. if(noUpload){
  223. tmpArr.splice(num,1);
  224. }
  225. this[moduleName] = tmpArr;
  226. //上传的图片及是否有可上传***答案不显示在预览所以不记录到state.diagnose.text中
  227. if(this.symptomResult.id!==999999&&this.symptomResult.controlType!=4){
  228. this.$store.commit('setText', { type: this.moduleKeys[this.activeTab], text: contentResult.val,textP: contentResult.valp,idx:contentResult.idx,flag:contentResult.flag });
  229. }
  230. console.log(this.$store.state); //最后一题答完
  231. if(+num===this[moduleName].length||(noUpload&&+num===this[moduleName].length+1)){
  232. if(this.activeTab>1){ //模块配置待修改
  233. this.showPreview=true;
  234. return;
  235. }
  236. const state = this.$store.state;
  237. this.activeTab++; //进入下一个阶段问题
  238. this.num = 0;
  239. moduleName = this.listMap[this.activeTab];
  240. const mDataName = this.moduleMap[this.activeTab];
  241. this[moduleName] = JSON.parse(JSON.stringify(state[mDataName].datas));
  242. let tmpArrDetail1 = JSON.parse(JSON.stringify(this[moduleName][0]));
  243. this[moduleName][0] = tmpArrDetail1;
  244. const tmpNowItem = this[moduleName][this.num];
  245. let timer = setTimeout(() => {
  246. this.type = tmpNowItem.controlType;
  247. tmpNowItem.show = true;
  248. console.log(tmpNowItem)
  249. this.symptomResult = tmpNowItem;
  250. });
  251. this.$nextTick(()=>{
  252. this.scroll.refresh()
  253. this.scroll.scrollTo(0, this.scroll.maxScrollY,500)
  254. })
  255. return;
  256. }
  257. let tmpArrDetailResult = JSON.parse(JSON.stringify(this[moduleName][num]));
  258. let tmpArrDetail = JSON.parse(JSON.stringify(tmpArr[num]));
  259. let timer = setTimeout(() => {
  260. this.type = tmpArrDetail.controlType;
  261. tmpArrDetail.show = true;
  262. tmpArr[num] = tmpArrDetail;
  263. this.symptomResult = tmpArrDetailResult;
  264. clearTimeout(timer)
  265. }, this.time);
  266. this.$nextTick(()=>{
  267. this.scroll.refresh()
  268. this.scroll.scrollTo(0, this.scroll.maxScrollY,500)
  269. })
  270. },
  271. closeTip(){
  272. this.wrong=false;
  273. },
  274. selectUsual(sym){
  275. this.getSymptomQas(sym.questionId); //获取症状下的关联问题
  276. sym.idx=1; //标记主诉
  277. this.$store.commit('setChoose', { choose: [sym], type: moduleCP['symp'] });
  278. this.selectedSymptom = sym; //设置搜索选中症状
  279. this.showUsual=false; //关闭症状选择进入下一个问题
  280. },
  281. getSymptomQas(id){
  282. const param = {
  283. age:this.userInfo.patientAge,
  284. id:id,
  285. sexType:this.userInfo.sexType
  286. };
  287. api.getById(param).then((res) => {
  288. const result = res.data;
  289. if(result.code==='0'){
  290. const data = result.data;
  291. if(!data){
  292. return ;
  293. }
  294. let qaLis = data.questionMapping;
  295. if(qaLis.length===0){
  296. this.wrong = true;
  297. this.waring ='该症状数据未维护';
  298. return ;
  299. }
  300. //qaLis.length=2; //开发测试代码,要删除
  301. qaLis[0].show=true; //第一题自动显示
  302. this.type = qaLis[0].controlType;
  303. this.symptomResult = qaLis[0];
  304. this.$store.commit('setSymptomDatas',qaLis);
  305. this.allquestionLis = this.$store.state.symptom.origin;
  306. }else{
  307. }
  308. });
  309. },
  310. scrollDown(){
  311. this.scroll.scrollTo(0, this.scroll.maxScrollY)
  312. },
  313. },
  314. components:{
  315. Radio,
  316. Select,
  317. Dialog,
  318. Picker,
  319. Label,
  320. ComTextArea,
  321. Input,
  322. PickTime,
  323. UploadImg,
  324. PushSymptom,
  325. ConfirmBox,
  326. UsualSymptom,
  327. MultSelect,
  328. TipWarning
  329. }
  330. }
  331. </script>
  332. <style lang="less" scoped>
  333. @import "../less/base.less";
  334. .wrapper {
  335. height: 100%;
  336. width: 100%;
  337. position: fixed;
  338. box-sizing: border-box;
  339. overflow: hidden;
  340. }
  341. .scrollPart {
  342. // padding-bottom: 5rem;
  343. // padding-top: 1.44rem;
  344. // box-sizing: border-box;
  345. }
  346. .progress-bar {
  347. height: .8rem;
  348. line-height: .8rem;
  349. background: #fff;
  350. color: #aaa;
  351. margin-bottom:.4rem;
  352. span{
  353. display: inline-block;
  354. font-size: .26rem;
  355. width: 30%;
  356. color: #aaa;
  357. text-align: center;
  358. &:not(:last-child):after{
  359. content: ">";
  360. float: right;
  361. color: #aaa;
  362. }
  363. }
  364. .active{
  365. font-size: .28rem;
  366. color: #colors[theme];
  367. }
  368. .progress{
  369. height:0.06rem;
  370. background:#F5F5F5;
  371. p{
  372. width:.1px;
  373. height: 100%;
  374. background: #colors[theme];
  375. }
  376. }
  377. }
  378. .right {
  379. padding-top: .2rem;
  380. margin-bottom: .12rem;
  381. padding-right: .24rem;
  382. .content {
  383. max-width: 5rem;
  384. background-color: #colors[theme];
  385. border-radius: .24rem 0 .24rem .24rem;
  386. margin-top: .3rem;
  387. font-size: .28rem;
  388. padding: .24rem;
  389. display: inline-block;
  390. p {
  391. color: #fff;
  392. }
  393. }
  394. img {
  395. width: 0.8rem;
  396. height: 0.8rem;
  397. margin-left: .24rem;
  398. }
  399. }
  400. .left {
  401. margin-bottom: .2rem;
  402. padding-top: .12rem;
  403. padding-left: .24rem;
  404. .content {
  405. max-width: 5rem;
  406. background-color: #colors[bgques];
  407. border-radius: 0 .24rem .24rem .24rem;
  408. margin-top: .3rem;
  409. font-size: .28rem;
  410. padding: .24rem;
  411. display: inline-block;
  412. }
  413. img {
  414. width: 0.8rem;
  415. height: 0.8rem;
  416. margin-right: .24rem;
  417. }
  418. }
  419. .submit{
  420. position: fixed;
  421. bottom: 0;
  422. width: 100%;
  423. a{
  424. display: inline-block;
  425. width: 100%;
  426. height: 0.88rem;
  427. font-size: .28rem;
  428. background-color: #colors[btn];
  429. line-height: 0.88rem;
  430. margin-top: 0.8rem;
  431. text-align: center;
  432. color: #fff;
  433. }
  434. }
  435. </style>