Symptom.vue 9.2 KB

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