Symptom.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <div class="symp-wrap symper">
  3. <div class="content">
  4. <div
  5. class="choose"
  6. v-if="chooseSymp.length>0"
  7. >
  8. <p class="quest">已选症状</p>
  9. <p
  10. class="choo-symp"
  11. v-for="(v,i) in chooseSymp"
  12. >
  13. <span @click="showChecked(v)">{{v.name}}</span>
  14. <span @click="deletSymp(v,i)"><img
  15. src="../images/del.png"
  16. alt=""
  17. ></span>
  18. </p>
  19. </div>
  20. <div class="label">
  21. <p class="quest">请问您有哪些不适?<img
  22. @click="search(true)"
  23. class="searchImg"
  24. src="../images/search.png"
  25. alt=""
  26. ></p>
  27. <span
  28. class="symp"
  29. v-for="(it,ind) in symp"
  30. :key="it.conceptId"
  31. @click="showDetil(it)"
  32. >{{it.name}}</span>
  33. </div>
  34. <div
  35. class="result"
  36. v-if="checkText.length>0"
  37. >
  38. <p class="title">{{nameStr}}</p>
  39. <p v-for="(value,index) in checkText">{{value.textP}}</p>
  40. </div>
  41. </div>
  42. <div v-if="modluesLen>1"
  43. :class="['footer',{'nofoot':chooseSymp.length==0}]"
  44. @click="toNext"
  45. >下一步</div>
  46. <div v-if="modluesLen==1"
  47. :class="['footer',{'nofoot':chooseSymp.length==0}]"
  48. @click="toNext"
  49. >预览并提交病历</div>
  50. <div
  51. class="detail"
  52. v-if="show"
  53. >
  54. <DetailBox
  55. @close="closeDetal"
  56. :data="labelDetail"
  57. :moduleType="1"
  58. v-if="labelDetail.questionMapping&&labelDetail.questionMapping.length>0"
  59. @pComplete="complete"
  60. @reload="reload"
  61. />
  62. </div>
  63. <Toast
  64. :message="delText"
  65. :show="showToast"
  66. @comfirn="comfirnDel"
  67. @cancel="cancelDel"
  68. />
  69. <Search
  70. v-if="searchShow"
  71. @search="search"
  72. @showDetil="showDetil"
  73. :age="age"
  74. :chooseSymp="chooseSymp"
  75. :sexType="sexType"
  76. ></Search>
  77. </div>
  78. </template>
  79. <script type="text/javascript">
  80. import api from '@utils/api.js';
  81. import DetailBox from './DetailBox.vue';
  82. import Toast from '../common/Toast.vue';
  83. import Search from './Search.vue';
  84. import {moduleCP,setScroll} from '@utils/tools'
  85. import BScroll from 'better-scroll';
  86. export default {
  87. name: 'Symptom',
  88. props:['modluesLen','nameStr'],
  89. data() {
  90. let { datas, pathInfo } = this.$store.state;
  91. const { choose, text } = this.$store.state.symptom;
  92. return {
  93. age: pathInfo.patientAge,
  94. sexType: pathInfo.patientSex == '男' ? 1 : (pathInfo.patientSex == '女' ? 2 : 3),
  95. deptName: pathInfo.selfDeptName,
  96. hosCode: pathInfo.hospitalCode,
  97. show: false, //显示明细
  98. chooseSymp: choose, //已选症状
  99. symp: [], //症状
  100. labelDetail: {}, //明细
  101. checkText: text, //症状情况文字
  102. questId: null, //id
  103. delText: "是否删除该信息?<br/>(已填内容将清除)",
  104. delIndex: null,
  105. showToast: false,
  106. searchShow: false,//显示搜索界面
  107. tmpItem:{},//检索的症状
  108. isSearch:false,
  109. scroll:null
  110. }
  111. },
  112. created() {
  113. if (this.chooseSymp.length > 0) {
  114. // 推送
  115. const sympText = this.getSympText();
  116. this.getPush(sympText);
  117. } else {
  118. this.getSympList(); //常见
  119. }
  120. },
  121. mounted(){
  122. let scroll = setScroll(BScroll,true,'.symper')
  123. this.scroll = scroll
  124. },
  125. methods: {
  126. searchVal(val) {
  127. console.log(val)
  128. },
  129. search(flg) {
  130. this.searchShow = flg
  131. },
  132. getSympList() {
  133. const param = {
  134. "age": this.age,
  135. "deptName": this.deptName,
  136. "sexType": this.sexType
  137. }
  138. api.getSymptom(param).then((res) => {
  139. const result = res.data;
  140. if (result.code == 0) {
  141. this.symp = result.data;
  142. }
  143. })
  144. },
  145. toNext() {
  146. // 把1切换成完成图标,且2高亮--判断有几个模块显示,1个--提交预览;1个以上--下一步
  147. if (this.chooseSymp.length == 0) { return }
  148. // 把症状情况的数据存起-已选
  149. this.$store.commit('setChoose', { choose: this.chooseSymp, type: moduleCP['symp'] });
  150. if(this.modluesLen==1){
  151. this.$emit('next','preview')
  152. }else{
  153. this.$emit('next');
  154. }
  155. },
  156. showDetil(item,flg) {
  157. this.tmpItem=item
  158. this.isSearch=flg||false
  159. this.questId = item.questionId || item.id || item.conceptId;
  160. const id = item.questionId || item.id; //常见症状questionId,推送id,两者均有可能没有
  161. //将选中的name存到store中的text
  162. this.$store.commit('setText', { type: moduleCP['symp'], text: item.name,textP: item.name, pId: this.questId });
  163. if (id) {
  164. const param = {
  165. "age": this.age,
  166. "id": id,
  167. "sexType": this.sexType
  168. }
  169. api.getById(param).then((res) => {
  170. const result = res.data;
  171. if (result.code == 0) {
  172. const mapping = result.data.questionMapping;
  173. this.labelDetail = result.data;
  174. this.$store.commit('setOrigin', { type: moduleCP['symp'], data: result.data });
  175. if (mapping && mapping.length > 0) {
  176. this.show = true;
  177. // this.scroll = setScroll(BScroll,false,'.symper')
  178. if(flg){
  179. return
  180. }
  181. this.chooseSymp.push(item);
  182. } else { //没有详情,推送
  183. const sympText = this.getSympText();
  184. this.getPush(sympText);
  185. this.chooseSymp.push(item);
  186. this.searchShow = false
  187. // this.complete()
  188. }
  189. }
  190. })
  191. } else {//没有questionId或id 则直接调推送
  192. this.chooseSymp.push(item);
  193. const sympText = this.getSympText();
  194. this.getPush(sympText);
  195. this.checkText = this.$store.state.symptom.text;
  196. }
  197. },
  198. getSympText() {
  199. const text = this.$store.state.symptom.text;
  200. let msg = "";
  201. for (let i in text) {
  202. msg += text[i].text;
  203. }
  204. return msg;
  205. },
  206. getPush(symptoms) {//推理
  207. const param = {
  208. "age": this.age,
  209. "hosCode": this.hosCode,
  210. "sex": this.sexType,
  211. "symptom": symptoms //症状+选择的明细,string
  212. }
  213. api.getPush(param).then((res) => {
  214. const result = res.data;
  215. if (result.code == 0) {
  216. this.symp = result.data.symptom;
  217. }
  218. })
  219. },
  220. closeDetal() {
  221. // 推理
  222. const sympText = this.getSympText();
  223. this.getPush(sympText);
  224. this.show = false;
  225. this.questId = null;
  226. // this.scroll = setScroll(BScroll,true,'.symper')
  227. },
  228. deletSymp(item, index) {
  229. this.delIndex = index;
  230. this.questId = item.questionId || item.id || item.conceptId;
  231. if (this.chooseSymp.length == 1) {
  232. this.delText = "是否删除该信息?<br/>删除后将重新填写预问诊流程 <br/>(已填内容将清除)"
  233. }
  234. this.showToast = true;
  235. // this.scroll = setScroll(BScroll,false,'.symper')
  236. },
  237. comfirnDel() {
  238. this.chooseSymp.splice(this.delIndex, 1);
  239. this.checkText.splice(this.delIndex, 1);
  240. this.$store.commit('delText', { type: moduleCP['symp'], pId: this.questId })
  241. // 删除setDatas数据,防止回读
  242. this.$store.commit('setDatas', { type: moduleCP['symp'], pId: this.questId ,data:''})
  243. // 删除完-常见;其他-推送
  244. if (this.chooseSymp.length > 0) {
  245. const sympText = this.getSympText();
  246. this.getPush(sympText);//删除后重新调推理-入参:拼好的内容
  247. } else {
  248. // 全部删除完 重新走问诊流程
  249. // this.$router.push("/")
  250. this.$router.replace({path:'/'})
  251. // this.getSympList();
  252. }
  253. this.cancelDel();
  254. },
  255. cancelDel() {
  256. this.showToast = false;
  257. this.delIndex = null;
  258. this.questId = null;
  259. this.delText = "是否删除该信息?<br/>(已填内容将清除)";
  260. // this.scroll = setScroll(BScroll,true,'.symper')
  261. },
  262. complete() {//明细填写完成
  263. this.searchShow = false;
  264. this.checkText = this.$store.state.symptom.text;
  265. this.show = false;
  266. // this.scroll = setScroll(BScroll,true,'.symper')
  267. this.questId = null;
  268. // 推理
  269. const sympText = this.getSympText();
  270. this.getPush(sympText);
  271. },
  272. showChecked(item) {
  273. const origin = this.$store.state.symptom.origin;
  274. const read = this.$store.state.symptom.datas;
  275. const data = read[(item.questionId||item.id)] || origin[(item.questionId||item.id)];
  276. if (data.questionMapping && data.questionMapping.length > 0) {
  277. this.labelDetail = data;
  278. this.show = true;
  279. // this.scroll = setScroll(BScroll,true,'.symper')
  280. }
  281. },
  282. reload(id) {//清空重新赋值
  283. const read = this.$store.state.symptom.datas;
  284. const data = read[id];
  285. this.labelDetail = data;
  286. }
  287. },
  288. components: {
  289. DetailBox,
  290. Toast,
  291. Search
  292. },
  293. }
  294. </script>
  295. <style lang="less" scoped>
  296. @import "../less/base.less";
  297. .symp-wrap {
  298. font-size: 0.3rem;
  299. .btscroll;
  300. .quest {
  301. color: #000;
  302. margin-bottom: 0.36rem;
  303. font-weight: 700;
  304. // padding-right: .2rem;
  305. .searchImg {
  306. width: 0.44rem;
  307. height: 0.44rem;
  308. float: right;
  309. }
  310. }
  311. }
  312. .choose{
  313. padding-bottom: .2rem;
  314. .choo-symp{
  315. display: inline-block;
  316. min-width:1.9rem;
  317. // min-width:1.42rem;
  318. height: .74rem;
  319. // background: linear-gradient(-270deg, #4F4FFF, #4F8BFF);
  320. background: linear-gradient(-270deg, #3638EE, #4E72FF);
  321. box-shadow: 0 .08rem .16rem 0 rgba(79,129,255,0.40);
  322. border-radius: .08rem;
  323. white-space: nowrap;
  324. // margin: 0 .3rem .3rem 0;
  325. margin: 0 .25rem .3rem 0;
  326. span{
  327. display: inline-block;
  328. vertical-align: top;
  329. }
  330. span:first-child{
  331. // min-width:1.34rem;
  332. min-width:1.42rem;
  333. height: .74rem;
  334. line-height: .74rem;
  335. text-align: center;
  336. color: #fff;
  337. }
  338. img{
  339. // width:.56rem;
  340. width:.48rem;
  341. height: .74rem;
  342. }
  343. }
  344. .choo-symp:last-child{
  345. margin-right: 0;
  346. }
  347. .label{
  348. .label;
  349. }
  350. .result{
  351. padding-right: .3rem;
  352. .title{
  353. color: #4F50FF;
  354. padding-left: .1rem;
  355. border-left: .08rem solid #4F50FF;
  356. margin-bottom: .19rem;
  357. font-weight: 700;
  358. }
  359. p{
  360. color: #666;
  361. line-height: .44rem;
  362. }
  363. }
  364. .footer{
  365. .footer;
  366. }
  367. }
  368. .label{
  369. .label;
  370. }
  371. .result{
  372. .result;
  373. }
  374. .footer{
  375. .footer;
  376. }
  377. .nofoot{
  378. // opacity: 0.3;
  379. // background: linear-gradient(-270deg,#4F4FFF, #4F8BFF);
  380. background:#CACCFF;
  381. }
  382. .detail{
  383. // .mask;
  384. // z-index: 103;
  385. }
  386. </style>