Symptom.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div class="symp-wrap">
  3. <div class="choose" v-if="chooseSymp.length>0">
  4. <p class="quest">已选症状</p>
  5. <p class="choo-symp" v-for="(v,i) in chooseSymp">
  6. <span>{{v.name}}</span>
  7. <span @click="deletSymp(v,i)"><img src="../images/delete.png" alt=""></span>
  8. </p>
  9. </div>
  10. <div class="label">
  11. <p class="quest">请问您有哪些不适?</p>
  12. <span class="symp"
  13. v-for="(it,ind) in symp"
  14. :key="it.conceptId"
  15. @click="showDetil(it)">{{it.name}}</span>
  16. </div>
  17. <div class="result" v-if="JSON.stringify(checkText) !== '{}'">
  18. <p class="title">症状情况</p>
  19. <p v-for="(value,key,index) in checkText">{{value}}</p>
  20. </div>
  21. <div :class="['footer',{'nofoot':chooseSymp.length==0}]" @click="toNext">下一步</div>
  22. <div class="detail" v-if="show">
  23. <DetailBox @close="closeDetal"
  24. :data="labelDetail"
  25. v-if="labelDetail.questionMapping&&labelDetail.questionMapping.length>0"
  26. @pComplete="complete"/>
  27. </div>
  28. <Toast :message="delText"
  29. :show="showToast"
  30. @comfirn="comfirnDel"
  31. @cancel="cancelDel"/>
  32. </div>
  33. </template>
  34. <script type="text/javascript">
  35. import api from '@utils/api.js';
  36. import DetailBox from './DetailBox.vue';
  37. import Toast from '../common/Toast.vue';
  38. export default {
  39. name:'Symptom',
  40. data(){
  41. let {datas,update} = this.$store.state;
  42. const {pathInfo,originDatas} = this.$store.state;
  43. return {
  44. age:pathInfo.patientAge,
  45. sexType:pathInfo.patientSex=='男'?1:(pathInfo.patientSex=='女'?2:3),
  46. deptName:pathInfo.selfDeptName,
  47. hosCode:pathInfo.hospitalCode,
  48. choose:false,
  49. check:false,
  50. show:false, //显示明细
  51. chooseSymp:[], //已选症状
  52. symp:[], //症状
  53. labelDetail:{}, //明细
  54. checkText:{}, //选中拼好的明细
  55. questId:null, //id
  56. // symptomName:'', //点击的症状名称
  57. delText:"是否删除该信息? (已填内容将清除)",
  58. delIndex:null,
  59. showToast:false,
  60. finished:false, //是否填写了明细
  61. upData:update
  62. }
  63. },
  64. created(){
  65. this.getSympList();
  66. },
  67. methods:{
  68. getSympList(){
  69. const param = {
  70. "age":this.age,
  71. "deptName":this.deptName,
  72. "sexType":this.sexType
  73. }
  74. api.getSymptom(param).then((res)=>{
  75. const result = res.data;
  76. if(result.code==0){
  77. this.symp = result.data;
  78. }
  79. })
  80. },
  81. toNext(){
  82. // 把1切换成完成图标,且2高亮
  83. if(this.chooseSymp.length==0){return}
  84. this.$emit('next');
  85. },
  86. showDetil(item){
  87. this.chooseSymp.push(item);
  88. // this.questId = item.conceptId;
  89. this.questId = item.questionId;
  90. const param = {
  91. "age":this.age,
  92. "id":item.questionId,
  93. "sexType":this.sexType
  94. }
  95. api.getById(param).then((res)=>{
  96. const result = res.data;
  97. if(result.code==0){
  98. const mapping = result.data.questionMapping;
  99. this.labelDetail = result.data;
  100. this.$store.commit('setOrigin',result.data);
  101. // this.$store.commit('getUpdate');
  102. if(mapping&&mapping.length>0){
  103. this.show = true;
  104. }
  105. }
  106. })
  107. // 推理
  108. const sympText = this.getSympText();
  109. this.getPush(sympText);
  110. },
  111. getSympText(){
  112. let sympText = "";
  113. for(let k in this.chooseSymp){
  114. sympText += this.chooseSymp[k].name;
  115. }
  116. return sympText;
  117. },
  118. getPush(symptoms){//推理
  119. const param = {
  120. "age":this.age,
  121. "hosCode":this.hosCode,
  122. "sex":this.sexType,
  123. "symptom":symptoms //症状+选择的明细,string
  124. }
  125. api.getPush(param).then((res)=>{
  126. const result = res.data;
  127. if(result.code==0){
  128. this.symp = result.data.symptom;
  129. }
  130. })
  131. },
  132. closeDetal(msg){
  133. const questId = this.questId;
  134. this.getPush(msg);
  135. // this.checkText = Object.assign({},this.checkText,{[questId]:msg});
  136. this.show = false;
  137. this.questId = null;
  138. },
  139. deletSymp(item,index){
  140. this.delIndex = index;
  141. this.questId = item.questionId;
  142. if(this.chooseSymp.length==1){
  143. this.delText = "是否删除该信息?删除后将重新填写预问诊流程 (已填内容将清除)"
  144. }
  145. this.showToast = true;
  146. },
  147. comfirnDel(){
  148. this.chooseSymp.splice(this.delIndex,1);
  149. delete(this.checkText[this.questId]);
  150. // 删除完-常见;其他-推送
  151. if(this.chooseSymp.length>0){
  152. const sympText = this.getSympText();
  153. this.getPush(sympText);//删除后重新调推理-入参:拼好的内容
  154. }else{
  155. this.getSympList();
  156. }
  157. this.cancelDel();
  158. },
  159. cancelDel(){
  160. this.showToast = false;
  161. this.delIndex = null;
  162. this.questId = null;
  163. this.delText = "是否删除该信息? (已填内容将清除)";
  164. },
  165. complete(msg){//明细填写完成
  166. // 获取选择后的明细数据-拼接症状情况-关闭明细弹窗
  167. // let text = this.symptomName + text;
  168. this.checkText = Object.assign({},this.checkText,{[this.questId]:msg});
  169. this.show = false;
  170. this.questId = null;
  171. }
  172. },
  173. components:{
  174. DetailBox,
  175. Toast
  176. },
  177. computed:{
  178. getQuestId(){
  179. return this.upData;
  180. }
  181. },
  182. watch:{
  183. getQuestId:{
  184. handler(newVal,oldVal){
  185. console.log("数据更新了11",newVal,oldVal);
  186. let datas = this.$store.state.datas;
  187. let originDatas = this.$store.state.originDatas;
  188. this.labelDetail = datas[this.questId] || originDatas[this.questId];
  189. },
  190. deep:true
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="less" scoped>
  196. @import '../less/base.less';
  197. .symp-wrap{
  198. font-size: .3rem;
  199. .quest{
  200. color: #000;
  201. margin-bottom: .36rem;
  202. font-weight: 700;
  203. }
  204. }
  205. .choose{
  206. padding-bottom: .2rem;
  207. .choo-symp{
  208. display: inline-block;
  209. width:1.9rem;
  210. height: .74rem;
  211. background: linear-gradient(-270deg, #4F4FFF, #4F8BFF);
  212. box-shadow: 0 .08rem .16rem 0 rgba(79,129,255,0.40);
  213. border-radius: .08rem;
  214. white-space: nowrap;
  215. margin: 0 .3rem .3rem 0;
  216. span{
  217. display: inline-block;
  218. vertical-align: top;
  219. }
  220. span:first-child{
  221. width:1.34rem;
  222. height: .74rem;
  223. line-height: .74rem;
  224. text-align: center;
  225. color: #fff;
  226. }
  227. img{
  228. width:.56rem;
  229. height: .74rem;
  230. }
  231. }
  232. }
  233. .label{
  234. padding-bottom: .2rem;
  235. .symp{
  236. display: inline-block;
  237. width:1.9rem;
  238. height: .74rem;
  239. line-height: .74rem;
  240. border: 1px solid #DFE0E4;
  241. border-radius: .08rem;
  242. text-align: center;
  243. color: #7C828E;
  244. margin: 0 0 .3rem .3rem;
  245. box-sizing: border-box;
  246. }
  247. .symp:nth-child(3n+2){
  248. margin-left: 0;
  249. }
  250. }
  251. .result{
  252. .title{
  253. color: #4F50FF;
  254. padding-left: .1rem;
  255. border-left: .08rem solid #4F50FF;
  256. margin-bottom: .19rem;
  257. font-weight: 700;
  258. }
  259. p{
  260. color: #666;
  261. line-height: .44rem;
  262. }
  263. }
  264. .footer{
  265. .footer;
  266. }
  267. .nofoot{
  268. opacity: 0.3;
  269. background: linear-gradient(-270deg,#4F4FFF, #4F8BFF);
  270. }
  271. .detail{
  272. .mask;
  273. z-index: 66;
  274. }
  275. </style>