Symptom.vue 9.2 KB

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