Preview.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <template>
  2. <div class="wrapper">
  3. <div class="preview previewper">
  4. <div class="content">
  5. <div class="tmpDiv"></div>
  6. <div class="personMsg personMsg1">
  7. <p class="baseMsg">{{pathInfo.patientName}}&nbsp;&nbsp;&nbsp;&nbsp;{{pathInfo.patientSex}}&nbsp;&nbsp;&nbsp;&nbsp;{{pathInfo.patientAge}}岁</p>
  8. <table>
  9. <tr>
  10. <td><span>挂号科室:</span>{{pathInfo.selfDeptName}}</td>
  11. </tr>
  12. <tr>
  13. <td><span>门诊号:</span>{{pathInfo.recordId}}</td>
  14. </tr>
  15. <tr>
  16. <td><span>预约医生:</span>{{pathInfo.doctorName}}</td>
  17. </tr>
  18. <tr>
  19. <td><span>就诊时间:</span>{{time}}</td>
  20. </tr>
  21. </table>
  22. <!-- <div class="line"></div>
  23. <p>采集时间:{{pathInfo.systemTime}}</p> -->
  24. </div>
  25. <div class="personMsg personMsg2">
  26. <ul class="previewParts">
  27. <li>
  28. <h4><i></i> 主诉:</h4>
  29. <p>
  30. <template v-for="(value,index) in checkText">
  31. <span :key="index" v-if="index==0&&value.idx==1">{{value.textP.split(',')[0]}}</span>
  32. </template>
  33. </p>
  34. </li>
  35. <li>
  36. <h4><i></i> 现病史:</h4>
  37. <p>
  38. <template v-for="(value,index) in checkText">
  39. <!-- 患者于时间单位前诱因出现症状,其余题目的内容; -->
  40. <span :key="index" v-if="index==0">{{(value.idx==1?'':'伴')+value.textP}}{{checkText.length==1?'':','}}</span>
  41. <span :key="index" v-if="index==1">{{(checkText[0].idx == 1?'伴':'')+value.textP}}{{checkText.length==2?'':'、'}}</span>
  42. <span :key="index" v-if="index>1">{{value.textP}}{{index == checkText.length-1?'':'、'}}</span>
  43. </template>
  44. </p>
  45. </li>
  46. <li v-if="showLis[moduleCP['other']]==1">
  47. <h4><i></i> 其他史:</h4>
  48. <p>
  49. <span>{{getDetailText(others.text,false).view}}</span>
  50. </p>
  51. </li>
  52. <li v-if="showLis[moduleCP['suplement']]==1">
  53. <h4><i></i> 补充内容:</h4>
  54. <p>{{addContent.txt}}</p>
  55. </li>
  56. <li v-if="JSON.stringify(diagnose.imgSrc) !='{}'" class="imgLis">
  57. <h4 class="imgTitle"><i></i> 最近一次治疗报告:</h4>
  58. <div v-for="(value,key,idx) in diagnose.imgSrc" class="imgView">
  59. <img :src="value" alt="">
  60. </div>
  61. </li>
  62. </ul>
  63. </div>
  64. <div class="doctorData" @click="handleClick(true)">医生端数据展示</div>
  65. </div>
  66. </div>
  67. <div class="foot">
  68. <!-- <span
  69. class="back"
  70. @click="back"
  71. >{{'返回'+ preName}}</span> -->
  72. <span
  73. class="back"
  74. @click="back"
  75. >上一步</span>
  76. <span
  77. class="next"
  78. @click="saveAllImage"
  79. >提 交</span>
  80. </div>
  81. <Submit
  82. v-if="submit"
  83. :showType="showType"
  84. @showSubmit="showSubmit"
  85. ></Submit>
  86. <Loading v-if="loadingShow"></Loading>
  87. <div class="personMsgDoc" v-if="showDoc">
  88. <div class="personMsgDocModal" @click="handleClick(false)"></div>
  89. <div class="personMsgDocDetail">
  90. <img class="close" src="../images/small-close.png" alt="" @click="handleClick(false)">
  91. <div class="personMsg personMsg2 modal">
  92. <ul class="previewParts">
  93. <li>
  94. <h4><i></i> 主诉:</h4>
  95. <p>
  96. <template v-for="(value,index) in checkText">
  97. <span :key="index" v-if="index==0&&value.idx==1">{{value.text.split(',')[0]}}</span>
  98. </template>
  99. </p>
  100. </li>
  101. <li>
  102. <h4><i></i> 现病史:</h4>
  103. <p>
  104. <template v-for="(value,index) in checkText">
  105. <!-- 患者于时间单位前诱因出现症状,其余题目的内容; -->
  106. <span :key="index" v-if="index==0">{{(value.idx==1?'':'伴')+value.textP}}{{checkText.length==1?'':','}}</span>
  107. <span :key="index" v-if="index==1">{{(checkText[0].idx == 1?'伴':'')+value.textP}}{{checkText.length==2?'':'、'}}</span>
  108. <span :key="index" v-if="index>1">{{value.textP}}{{index == checkText.length-1?'':'、'}}</span>
  109. </template>
  110. </p>
  111. </li>
  112. <li v-if="showLis[moduleCP['other']]==1">
  113. <h4><i></i> 其他史:</h4>
  114. <p>
  115. <span>{{getDetailText(others.text,false).content}}</span>
  116. </p>
  117. </li>
  118. <li v-if="showLis[moduleCP['suplement']]==1">
  119. <h4><i></i> 补充内容:</h4>
  120. <p>{{addContent.txtDoc}}</p>
  121. </li>
  122. <li v-if="JSON.stringify(diagnose.imgSrc) !='{}'" class="imgLis">
  123. <h4 class="imgTitle"><i></i> 最近一次治疗报告:</h4>
  124. <div v-for="(value,key,idx) in diagnose.imgSrc" class="imgView">
  125. <img :src="value" alt="">
  126. </div>
  127. </li>
  128. </ul>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </template>
  134. <script>
  135. import api from '@utils/api.js';
  136. import Submit from '../common/Submit';
  137. import Loading from '../common/Loading';
  138. import BScroll from 'better-scroll';
  139. import {moduleCP,trimDots,setScroll,dateParser} from '@utils/tools.js'
  140. export default {
  141. props: ['preName','showLis','loadingShow'],
  142. data() {
  143. const { pathInfo, originDatas,loadingShow } = this.$store.state;
  144. let symptomDate = this.$store.state.symptom;
  145. let diagnoseDate = this.$store.state.diagnose;
  146. let othersDate = this.$store.state.others;
  147. let addContentDate = this.$store.state.addContent;
  148. return {
  149. msg: '预览',
  150. pathInfo: pathInfo,
  151. symptom: symptomDate,
  152. diagnose: diagnoseDate,
  153. others: othersDate,
  154. addContent: addContentDate,
  155. checkText: symptomDate.text, //症状情况文字
  156. submit: false,
  157. showType: 'fail',
  158. imgList:[],
  159. tmpNum:0,
  160. moduleCP:moduleCP,
  161. showDoc:false,
  162. trimDots:trimDots,
  163. time:''
  164. }
  165. },
  166. created(){
  167. this.getTime();
  168. },
  169. mounted() {
  170. this.$nextTick(()=>{
  171. let scroll = setScroll(BScroll,true,'.previewper')
  172. this.scroll = scroll
  173. })
  174. },
  175. methods: {
  176. getTime() {
  177. let scan = localStorage.getItem('scan');
  178. let params = JSON.parse(localStorage.getItem('infoParam'));
  179. let param = JSON.parse(localStorage.getItem('loginParam'));
  180. let tmpArr = localStorage.getItem('recordTime')
  181. let tmpTime = tmpArr&&Array.isArray(JSON.parse(tmpArr))?JSON.parse(tmpArr):[];
  182. if(!scan){
  183. this.time = dateParser(param.time)
  184. }else{
  185. this.time = dateParser(params.recordTime)
  186. }
  187. },
  188. handleClick(flg){
  189. this.showDoc = flg
  190. },
  191. showSubmit(flg) {
  192. this.submit = flg
  193. },
  194. back() {
  195. this.$emit('back', 'preview')
  196. },
  197. saveAllImage() {
  198. let formData = new FormData();
  199. let imgList = this.diagnose.imgFile;
  200. // let tmpNum = this.tmpNum;
  201. // var dateBegin = new Date();//获取当前时间
  202. if (imgList.length > 0) {//有图片先上传图片
  203. this.$store.commit('handleToggleShow', true);
  204. for (let i = 0; i < imgList.length; i++) {
  205. let pageFile = imgList[i].file
  206. formData.append('upfiles', imgList[i].file);
  207. // formData.append('upfile', imgList[i].file);
  208. formData.append('type', imgList[i].type);
  209. // api.uploadImageThum(formData).then((res)=>{
  210. // console.log(res)
  211. // let result = res.data;
  212. // if (result.code == 0) {
  213. // this.tmpNum = ++tmpNum
  214. // if(this.tmpNum == imgList.length){
  215. // var dateEnd = new Date();//获取当前时间
  216. // var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
  217. // var dayDiff = dateDiff / 1000;//计算出秒数
  218. // alert('图片上传完成:'+dayDiff+'s')
  219. // }
  220. // }
  221. // })
  222. }
  223. api.uploadImageThums(formData).then((res) => {//获取图片
  224. let data = res.data;
  225. if (data.code == 0) {//图片提交成功再保存数据
  226. let reportList = [];
  227. let result = data.data;
  228. for(let i = 0;i < result.length;i++){
  229. let obg = {}
  230. obg.originalImage = result[i].url
  231. obg.originalName = result[i].original
  232. obg.orderNum = i+1
  233. obg.type = result[i].type
  234. reportList.push(obg)
  235. }
  236. this.imgList = reportList
  237. // var dateEnd = new Date();//获取当前时间
  238. // var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
  239. // var dayDiff = dateDiff / 1000;//计算出秒数
  240. // alert('图片上传完成:'+dayDiff+'s')
  241. this.saveAllDate()
  242. } else {//提交失败提示
  243. this.defaultWaring(res)
  244. }
  245. }).catch((err)=>{
  246. this.defaultWaring(err)
  247. })
  248. return;
  249. } else {//没有图片直接保存数据
  250. this.$store.commit('handleToggleShow', true);
  251. this.saveAllDate();
  252. }
  253. },
  254. getDetailText(textArr,flg){
  255. let msg = "",obg={},msgP = "";
  256. if(flg == 1){
  257. for(let k in textArr){
  258. let item = textArr[k]
  259. if(item.special){
  260. msg+=item.name+item.special+(k == textArr.length-1?'':',')
  261. msgP+=item.name+item.specialP+(k == textArr.length-1?'':',')
  262. }else{
  263. msg+=item.name+(k == textArr.length-1?'':',')
  264. msgP+=item.name+(k == textArr.length-1?'':',')
  265. }
  266. }
  267. }else{
  268. for(let k in textArr){
  269. if(textArr[k] && Array.isArray(textArr[k])){
  270. let temp = textArr[k];
  271. for(let j in temp){
  272. if(temp[j]){
  273. msg += temp[j].text + ','
  274. msgP += temp[j].textP + ','
  275. }
  276. }
  277. }else if(textArr[k]){
  278. msg += textArr[k].text + ','
  279. msgP += textArr[k].textP + ','
  280. }
  281. }
  282. }
  283. obg.view=trimDots(msgP.replace(/,$/,''))
  284. obg.content=trimDots(msg.replace(/,$/,''))
  285. obg.contentJson=trimDots(msg.replace(/,$/,''))
  286. obg.contentValue=trimDots(msg.replace(/,$/,''))
  287. obg.type=flg
  288. return obg;
  289. },
  290. saveAllDate() {
  291. const {pathInfo,symptom,diagnose,others,addContent} = this
  292. let detailList = [{type:1},{type:2},{type:3},{type:4}]
  293. for(let i = 0;i < detailList.length;i++){
  294. if(i == 0){
  295. detailList[0]=this.getDetailText(symptom.choose,1)
  296. }else if(i == 1){
  297. let tmpArr = []
  298. let tmpStr = this.getDetailText(diagnose.text,2).content
  299. for(let j = 0;j < symptom.text.length;j++){
  300. tmpArr.push(symptom.text[j].text)
  301. }
  302. tmpStr.length>0?tmpArr.push(tmpStr):null
  303. detailList[1].content=tmpArr.join()
  304. detailList[1].contentJson=JSON.stringify(tmpArr)
  305. detailList[1].contentValue=tmpArr.join()
  306. }else if(i == 2){
  307. detailList[2] = this.getDetailText(others.text,3)
  308. }else if(i == 3){
  309. detailList[3].content=addContent.txtDoc
  310. detailList[3].contentJson=addContent.txtDoc
  311. detailList[3].contentValue=addContent.txtDoc
  312. }
  313. }
  314. let params = {
  315. "dataJson": "1",
  316. "detailList": detailList,
  317. "hospitalId": pathInfo.hospitalId,//医院id
  318. "hospitalName": pathInfo.hospitalName,//医院名称
  319. "hospitalCode": pathInfo.hospitalCode,//医院编码
  320. "doctorId": pathInfo.doctorId,//医生id
  321. "doctorCode": pathInfo.doctorCode,//医生编码
  322. "doctorName": pathInfo.doctorName,//医生name
  323. "hospitalDeptCode": pathInfo.hospitalDeptCode,//医院科室编码
  324. "hospitalDeptId": pathInfo.hospitalDeptId,//科室id
  325. "hospitalDeptName": pathInfo.hospitalDeptName,//科室name
  326. "inquiryCode": pathInfo.recordId,//就诊序列号,目前是门诊号
  327. "patientBirthday": pathInfo.birthday+':00',//患者出生日期,格式为:2018-11-28 17:25:30
  328. "patientCode": pathInfo.patientCode,//患者编号
  329. "patientId": pathInfo.patientId,//患者id
  330. "patientIdNo": pathInfo.patientIdNo,//患者证件号码(病历号)
  331. "patientName": pathInfo.patientName,//患者姓名
  332. // "patientPhone": pathInfo,//患者联系电话(非)
  333. "patientSex": pathInfo.patientSex=='男'?1:2,//患者性别:1男2女(非)
  334. // "regVisitedState": pathInfo,//就诊状态(0待接诊,1接诊中,2完成接诊)(非)
  335. "reportList": this.imgList,
  336. // "type": 0//病历分类(1:门诊,2:住院)
  337. }
  338. // console.log(params)
  339. api.saveInquiry(params).then((res) => {
  340. if (res.data.code == 0) {
  341. this.$store.commit('handleToggleShow', false);
  342. this.showType = 'success'
  343. this.submit = true
  344. } else {
  345. this.defaultWaring(res)
  346. }
  347. }).catch((err)=>{
  348. this.defaultWaring(err)
  349. })
  350. },
  351. defaultWaring(res){
  352. this.$store.commit('handleToggleShow', false);
  353. this.showType = 'fail'
  354. this.submit = true
  355. let timer = setTimeout(() => {
  356. this.submit = false
  357. clearTimeout(timer)
  358. }, 2000);
  359. }
  360. },
  361. components: {
  362. Submit,
  363. Loading,
  364. }
  365. }
  366. </script>
  367. <style lang="less" scoped>
  368. @import "../less/base.less";
  369. .foot {
  370. .dbfooter;
  371. z-index: 998;
  372. }
  373. .doctorData {
  374. float: right;
  375. color: #0043E8;
  376. margin-bottom: 30px;
  377. }
  378. .preview {
  379. color: red;
  380. background-color: #fff;
  381. position: fixed;
  382. width: 100%;
  383. height: 100%;
  384. top: 0;
  385. left: 0;
  386. box-sizing: border-box;
  387. padding: 0 0.4rem 1rem .4rem;
  388. overflow: hidden;
  389. -webkit-overflow-scrolling:touch;
  390. .btscroll;
  391. .content {
  392. padding-top: 0;
  393. padding-bottom: 2rem;
  394. }
  395. }
  396. .tmpDiv {
  397. height: .3rem;
  398. }
  399. .imgView {
  400. width: 1.86rem;
  401. height: 1.9rem;
  402. float: left;
  403. border: 1px solid #dfe0e4;
  404. margin: 0 0.2rem 0.3rem 0;
  405. box-sizing: border-box;
  406. position: relative;
  407. overflow: hidden;
  408. border-radius: 0.08rem;
  409. img {
  410. position: absolute;
  411. left: 50%;
  412. top: 50%;
  413. width: 100%;
  414. transform: translate(-50%, -50%);
  415. }
  416. }
  417. .imgTitle {
  418. padding-bottom: .20rem;
  419. }
  420. .personMsg {
  421. padding: 0.3rem 0.4rem;
  422. box-sizing: border-box;
  423. background-color: #fff;
  424. border-radius: 0.16rem;
  425. margin-bottom: 0.38rem;
  426. box-shadow:0px 3px 20px 0px rgba(192,187,224,0.23);
  427. .previewParts {
  428. li {
  429. padding: .1rem .3rem;
  430. overflow: hidden;
  431. }
  432. li.imgLis {
  433. padding-right: 0;
  434. padding-left: 0;
  435. }
  436. h4 {
  437. color: #colors[quest];
  438. font-size: .32rem;
  439. font-weight: bold;
  440. position: relative;
  441. i {
  442. width: .16rem;
  443. height: .16rem;
  444. border-radius: 50%;
  445. background: #colors[theme];
  446. display: inline-block;
  447. position: absolute;
  448. top: .15rem;
  449. left: -0.3rem;
  450. }
  451. }
  452. p {
  453. font-size: .28rem;
  454. color: #424242;
  455. margin: .2rem 0;
  456. word-break: break-all;
  457. }
  458. }
  459. .baseMsg {
  460. font-size: 0.32rem;
  461. color: #colors[quest];
  462. letter-spacing: 0;
  463. text-align: justify;
  464. font-weight: bold;
  465. margin-bottom: 0.15rem;
  466. }
  467. table {
  468. width: 100%;
  469. font-size: 0.3rem;
  470. color: #333333;
  471. letter-spacing: 0;
  472. text-align: justify;
  473. margin-top: .2rem;
  474. tr {
  475. padding: .2rem 0;
  476. line-height: .5rem;
  477. td {
  478. padding-bottom: 0.1rem;
  479. }
  480. span {
  481. color:#777;
  482. width: 1.6rem;
  483. display: inline-block;
  484. }
  485. }
  486. }
  487. .line {
  488. opacity: 0.3;
  489. background: #d8d8d8;
  490. margin: 0.2rem 0;
  491. height: 1px;
  492. }
  493. }
  494. .personMsg2 {
  495. padding-right: 0;
  496. }
  497. .personMsg2.modal {
  498. margin-bottom: 0;
  499. }
  500. .personMsgDoc {
  501. position: fixed;
  502. height: 100%;
  503. width: 100%;
  504. top: 0;
  505. left: 0;
  506. overflow: auto;
  507. z-index: 999;
  508. .personMsgDocModal {
  509. .mask;
  510. position: fixed;
  511. width: 100%;
  512. height: 100%;
  513. top: 0;
  514. left: 0;
  515. z-index: 999;
  516. }
  517. .personMsgDocDetail {
  518. position: fixed;
  519. z-index: 1000;
  520. top: 50%;
  521. left: 50%;
  522. transform: translate(-50%, -50%);
  523. // padding: 0 .4rem;
  524. background-color: #fff;
  525. box-sizing: border-box;
  526. width: 90%;
  527. border-radius: .1rem;
  528. overflow: hidden;
  529. .personMsg {
  530. max-height: 9rem;
  531. overflow: auto;
  532. width: 100%;
  533. border-radius: 0;
  534. -webkit-overflow-scrolling:touch;
  535. }
  536. }
  537. }
  538. .close {
  539. width: .34rem;
  540. height: .34rem;
  541. position: absolute;
  542. right: 0;
  543. top: 0;
  544. padding: 8px;
  545. z-index: 1001;
  546. }
  547. </style>