Symptom.vue 9.4 KB

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