Symptom.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="symp-wrap">
  3. <div class="choose" v-if="chooseSymp.length>0">
  4. <h3>已选症状</h3>
  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. <h3>请问您有哪些不适?</h3>
  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. <h4>症状情况</h4>
  19. <p v-for="(value,key,index) in checkText">{{value}}</p>
  20. </div>
  21. <div class="footer" @click="toNext">下一步</div>
  22. <div class="detail" v-if="show">
  23. <DetailBox @close="closeDetal" :data="labelDetail"/>
  24. </div>
  25. <Toast :message="delText"
  26. :show="showToast"
  27. @comfirn="comfirnDel"
  28. @cancel="cancelDel"/>
  29. </div>
  30. </template>
  31. <script type="text/javascript">
  32. import api from '@utils/api.js';
  33. import DetailBox from './DetailBox.vue';
  34. import Toast from '../common/Toast.vue';
  35. export default {
  36. name:'Symptom',
  37. data(){
  38. const pathInfo = this.$store.state.pathInfo;
  39. return {
  40. age:pathInfo.patientAge,
  41. sexType:pathInfo.patientSex=='男'?1:(pathInfo.patientSex=='女'?2:3),
  42. deptName:pathInfo.selfDeptName,
  43. hosCode:pathInfo.hospitalCode,
  44. choose:false,
  45. check:false,
  46. show:false, //显示明细
  47. chooseSymp:[], //已选症状
  48. symp:[], //症状
  49. labelDetail:{}, //明细
  50. checkText:{}, //选中拼好的明细
  51. current:null,
  52. delText:"是否删除该信息?",
  53. delIndex:null,
  54. showToast:false
  55. }
  56. },
  57. created(){
  58. this.getSympList();
  59. },
  60. methods:{
  61. getSympList(){
  62. const param = {
  63. "age":this.age,
  64. "deptName":this.deptName,
  65. "sexType":this.sexType
  66. }
  67. api.getSymptom(param).then((res)=>{
  68. const result = res.data;
  69. if(result.code==0){
  70. this.symp = result.data;
  71. }
  72. })
  73. },
  74. toNext(){
  75. // 把1切换成完成图标,且2高亮
  76. this.$emit("nextStep",3);
  77. },
  78. showDetil(item){
  79. this.chooseSymp.push(item);
  80. this.current = item.conceptId;
  81. const id = item.questionId;
  82. const param = {
  83. "age":this.age,
  84. "id":id,
  85. "sexType":this.sexType
  86. }
  87. api.getById(param).then((res)=>{
  88. const result = res.data;
  89. if(result.code==0){
  90. this.labelDetail = result.data;
  91. this.show = true;
  92. }
  93. })
  94. // 推理
  95. },
  96. getPush(symptoms){//推理
  97. const param = {
  98. "age":this.age,
  99. "hosCode":this.hosCode,
  100. "sex":this.sexType,
  101. "symptom":symptoms //症状+选择的明细,string
  102. }
  103. api.getPush(param).then((res)=>{
  104. const result = res.data;
  105. if(result.code==0){
  106. this.symp = result.data.symptom;
  107. }
  108. })
  109. },
  110. closeDetal(msg){
  111. const current = this.current;
  112. this.getPush(msg);
  113. this.checkText = Object.assign({},this.checkText,{[current]:msg});
  114. this.show = false;
  115. this.current = null;console.log('子组件触发关闭',this.checkText);
  116. },
  117. deletSymp(item,index){
  118. this.delIndex = index;
  119. this.current = item.conceptId;
  120. if(this.chooseSymp.length==1){
  121. this.delText = "是否删除该信息?删除后将重新填写预问诊流程"
  122. }
  123. this.showToast = true;
  124. },
  125. comfirnDel(){
  126. this.chooseSymp.splice(this.delIndex,1);
  127. delete(this.checkText[this.current]);
  128. // this.getPush(''); //删除后重新调推理-入参:拼好的内容
  129. this.cancelDel();
  130. console.log("确认删除:",this.chooseSymp,this.checkText)
  131. },
  132. cancelDel(){
  133. this.showToast = false;
  134. this.delIndex = null;
  135. this.current = null;
  136. }
  137. },
  138. components:{
  139. DetailBox,
  140. Toast
  141. }
  142. }
  143. </script>
  144. <style lang="less" scoped>
  145. @import '../less/base.less';
  146. .symp-wrap{
  147. font-size: .3rem;
  148. h3{
  149. color: #000;
  150. margin-bottom: .36rem;
  151. }
  152. }
  153. .choose{
  154. padding-bottom: .2rem;
  155. .choo-symp{
  156. display: inline-block;
  157. width:1.9rem;
  158. height: .74rem;
  159. background: linear-gradient(-270deg, #4F4FFF, #4F8BFF);
  160. box-shadow: 0 .08rem .16rem 0 rgba(79,129,255,0.40);
  161. border-radius: .08rem;
  162. white-space: nowrap;
  163. margin: 0 .3rem .3rem 0;
  164. span{
  165. display: inline-block;
  166. vertical-align: top;
  167. }
  168. span:first-child{
  169. width:1.34rem;
  170. height: .74rem;
  171. line-height: .74rem;
  172. text-align: center;
  173. color: #fff;
  174. }
  175. img{
  176. width:.56rem;
  177. height: .74rem;
  178. }
  179. }
  180. }
  181. .label{
  182. padding-bottom: .2rem;
  183. .symp{
  184. display: inline-block;
  185. width:1.9rem;
  186. height: .74rem;
  187. line-height: .74rem;
  188. border: 1px solid #DFE0E4;
  189. border-radius: .08rem;
  190. text-align: center;
  191. color: #7C828E;
  192. margin: 0 0 .3rem .3rem;
  193. box-sizing: border-box;
  194. }
  195. .symp:nth-child(3n+2){
  196. margin-left: 0;
  197. }
  198. }
  199. .result{
  200. h4{
  201. color: #4F50FF;
  202. padding-left: .1rem;
  203. border-left: .08rem solid #4F50FF;
  204. margin-bottom: .19rem;
  205. }
  206. p{
  207. color: #666;
  208. line-height: .44rem;
  209. }
  210. }
  211. .footer{
  212. .footer;
  213. }
  214. .detail{
  215. .mask;
  216. z-index: 66;
  217. }
  218. </style>