Symptom.vue 11 KB

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