Preview.vue 16 KB

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