Symptom.vue 9.8 KB

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