Preview.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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">
  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. err:''
  156. }
  157. },
  158. created(){
  159. this.getTime();
  160. },
  161. mounted() {
  162. this.$nextTick(()=>{
  163. let scroll = setScroll(BScroll,true,'.previewper')
  164. this.scroll = scroll
  165. })
  166. },
  167. methods: {
  168. getTime() {
  169. let scan = localStorage.getItem('scan');
  170. let params = JSON.parse(localStorage.getItem('infoParam'));
  171. let param = JSON.parse(localStorage.getItem('loginParam'));
  172. let tmpArr = localStorage.getItem('recordTime')
  173. let tmpTime = tmpArr&&Array.isArray(JSON.parse(tmpArr))?JSON.parse(tmpArr):[];
  174. if(!scan){
  175. this.time = dateParser(param.time)
  176. }else{
  177. this.time = dateParser(params.recordTime)
  178. }
  179. },
  180. handleClick(flg){
  181. this.showDoc = flg
  182. },
  183. showSubmit(flg) {
  184. this.submit = flg
  185. },
  186. back() {
  187. this.$emit('back', 'preview')
  188. },
  189. saveAllImage() {
  190. let formData = new FormData();
  191. let imgList = this.diagnose.imgFile;
  192. // let tmpNum = this.tmpNum;
  193. // var dateBegin = new Date();//获取当前时间
  194. if (imgList.length > 0) {//有图片先上传图片
  195. this.$store.commit('handleToggleShow', true);
  196. for (let i = 0; i < imgList.length; i++) {
  197. let pageFile = imgList[i].file
  198. console.log(pageFile.size,pageFile.name)
  199. formData.append('upfiles', imgList[i].file);
  200. // formData.append('upfile', imgList[i].file);
  201. formData.append('type', imgList[i].type);
  202. // api.uploadImageThum(formData).then((res)=>{
  203. // console.log(res)
  204. // let result = res.data;
  205. // if (result.code == 0) {
  206. // this.tmpNum = ++tmpNum
  207. // if(this.tmpNum == imgList.length){
  208. // var dateEnd = new Date();//获取当前时间
  209. // var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
  210. // var dayDiff = dateDiff / 1000;//计算出秒数
  211. // alert('图片上传完成:'+dayDiff+'s')
  212. // }
  213. // }
  214. // })
  215. }
  216. api.uploadImageThums(formData).then((res) => {//获取图片
  217. console.log(res,1111111111)
  218. let data = res.data;
  219. if (data.code == 0) {//图片提交成功再保存数据
  220. let reportList = [];
  221. let result = data.data;
  222. for(let i = 0;i < result.length;i++){
  223. let obg = {}
  224. obg.narrowImage = result[i].thumbnail.url
  225. obg.narrowName = result[i].thumbnail.original
  226. obg.originalImage = result[i].source.url
  227. obg.originalName = result[i].source.original
  228. obg.orderNum = i+1
  229. obg.type = result[i].source.type
  230. reportList.push(obg)
  231. }
  232. this.imgList = reportList
  233. // var dateEnd = new Date();//获取当前时间
  234. // var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
  235. // var dayDiff = dateDiff / 1000;//计算出秒数
  236. // alert('图片上传完成:'+dayDiff+'s')
  237. this.saveAllDate()
  238. } else {//提交失败提示
  239. this.defaultWaring(res)
  240. }
  241. }).catch((err)=>{
  242. this.defaultWaring(err)
  243. })
  244. return;
  245. } else {//没有图片直接保存数据
  246. this.$store.commit('handleToggleShow', true);
  247. this.saveAllDate();
  248. }
  249. },
  250. getDetailText(textArr,flg){
  251. let msg = "",obg={},msgP = "";
  252. if(flg == 1){
  253. for(let k in textArr){
  254. let item = textArr[k]
  255. if(item.special){
  256. msg+=item.name+item.special+(k == textArr.length-1?'':',')
  257. msgP+=item.name+item.specialP+(k == textArr.length-1?'':',')
  258. }else{
  259. msg+=item.name+(k == textArr.length-1?'':',')
  260. msgP+=item.name+(k == textArr.length-1?'':',')
  261. }
  262. }
  263. }else{
  264. for(let k in textArr){
  265. if(textArr[k] && Array.isArray(textArr[k])){
  266. let temp = textArr[k];
  267. for(let j in temp){
  268. if(temp[j]){
  269. msg += temp[j].text + ','
  270. msgP += temp[j].textP + ','
  271. }
  272. }
  273. }else if(textArr[k]){
  274. msg += textArr[k].text + ','
  275. msgP += textArr[k].textP + ','
  276. }
  277. }
  278. }
  279. obg.view=trimDots(msgP.replace(/,$/,''))
  280. obg.content=trimDots(msg.replace(/,$/,''))
  281. obg.contentJson=trimDots(msg.replace(/,$/,''))
  282. obg.contentValue=trimDots(msg.replace(/,$/,''))
  283. obg.type=flg
  284. return obg;
  285. },
  286. saveAllDate() {
  287. const {pathInfo,symptom,diagnose,others,addContent} = this
  288. let detailList = [{type:1},{type:2},{type:3},{type:4}]
  289. for(let i = 0;i < detailList.length;i++){
  290. if(i == 0){
  291. detailList[0]=this.getDetailText(symptom.choose,1)
  292. }else if(i == 1){
  293. let tmpArr = []
  294. let tmpStr = this.getDetailText(diagnose.text,2).content
  295. for(let j = 0;j < symptom.text.length;j++){
  296. tmpArr.push(symptom.text[j].text)
  297. }
  298. tmpStr.length>0?tmpArr.push(tmpStr):null
  299. detailList[1].content=tmpArr.join()
  300. detailList[1].contentJson=JSON.stringify(tmpArr)
  301. detailList[1].contentValue=tmpArr.join()
  302. }else if(i == 2){
  303. detailList[2] = this.getDetailText(others.text,3)
  304. }else if(i == 3){
  305. detailList[3].content=addContent.txtDoc
  306. detailList[3].contentJson=addContent.txtDoc
  307. detailList[3].contentValue=addContent.txtDoc
  308. }
  309. }
  310. let params = {
  311. "dataJson": "1",
  312. "detailList": detailList,
  313. "hospitalId": pathInfo.hospitalId,//医院id
  314. "hospitalName": pathInfo.hospitalName,//医院名称
  315. "hospitalCode": pathInfo.hospitalCode,//医院编码
  316. "doctorId": pathInfo.doctorId,//医生id
  317. "doctorCode": pathInfo.doctorCode,//医生编码
  318. "doctorName": pathInfo.doctorName,//医生name
  319. "hospitalDeptCode": pathInfo.hospitalDeptCode,//医院科室编码
  320. "hospitalDeptId": pathInfo.hospitalDeptId,//科室id
  321. "hospitalDeptName": pathInfo.hospitalDeptName,//科室name
  322. "inquiryCode": pathInfo.recordId,//就诊序列号,目前是门诊号
  323. "patientBirthday": pathInfo.birthday+':00',//患者出生日期,格式为:2018-11-28 17:25:30
  324. "patientCode": pathInfo.patientCode,//患者编号
  325. "patientId": pathInfo.patientId,//患者id
  326. "patientIdNo": pathInfo.patientIdNo,//患者证件号码(病历号)
  327. "patientName": pathInfo.patientName,//患者姓名
  328. // "patientPhone": pathInfo,//患者联系电话(非)
  329. "patientSex": pathInfo.patientSex=='男'?1:2,//患者性别:1男2女(非)
  330. // "regVisitedState": pathInfo,//就诊状态(0待接诊,1接诊中,2完成接诊)(非)
  331. "reportList": this.imgList,
  332. // "type": 0//病历分类(1:门诊,2:住院)
  333. }
  334. // console.log(params)
  335. api.saveInquiry(params).then((res) => {
  336. if (res.data.code == 0) {
  337. this.$store.commit('handleToggleShow', false);
  338. this.showType = 'success'
  339. this.submit = true
  340. } else {
  341. this.defaultWaring(res)
  342. }
  343. }).catch((err)=>{
  344. this.defaultWaring(err)
  345. })
  346. },
  347. defaultWaring(res){
  348. this.$store.commit('handleToggleShow', false);
  349. this.showType = 'fail'
  350. this.err = 'sdsdsdsd'
  351. this.submit = true
  352. let timer = setTimeout(() => {
  353. this.submit = false
  354. clearTimeout(timer)
  355. }, 2000);
  356. }
  357. },
  358. components: {
  359. Submit,
  360. Loading,
  361. }
  362. }
  363. </script>
  364. <style lang="less" scoped>
  365. @import "../less/base.less";
  366. .foot {
  367. .dbfooter;
  368. z-index: 998;
  369. }
  370. .doctorData {
  371. float: right;
  372. color: #0043E8;
  373. margin-bottom: 30px;
  374. }
  375. .preview {
  376. color: red;
  377. background-color: #fff;
  378. position: fixed;
  379. width: 100%;
  380. height: 100%;
  381. top: 0;
  382. left: 0;
  383. box-sizing: border-box;
  384. padding: 0 0.4rem 1rem .4rem;
  385. overflow: hidden;
  386. -webkit-overflow-scrolling:touch;
  387. .btscroll;
  388. }
  389. .tmpDiv {
  390. height: .3rem;
  391. }
  392. .imgView {
  393. width: 1.86rem;
  394. height: 1.9rem;
  395. float: left;
  396. border: 1px solid #dfe0e4;
  397. margin: 0 0.2rem 0.3rem 0;
  398. box-sizing: border-box;
  399. position: relative;
  400. overflow: hidden;
  401. border-radius: 0.08rem;
  402. img {
  403. position: absolute;
  404. left: 50%;
  405. top: 50%;
  406. width: 100%;
  407. transform: translate(-50%, -50%);
  408. }
  409. }
  410. .imgTitle {
  411. padding-bottom: .20rem;
  412. }
  413. .personMsg {
  414. padding: 0.3rem 0.4rem;
  415. box-sizing: border-box;
  416. background-color: #fff;
  417. border-radius: 0.16rem;
  418. margin-bottom: 0.38rem;
  419. box-shadow:0px 3px 20px 0px rgba(192,187,224,0.23);
  420. .previewParts {
  421. li {
  422. padding: .1rem .3rem;
  423. overflow: hidden;
  424. }
  425. li.imgLis {
  426. padding-right: 0;
  427. padding-left: 0;
  428. }
  429. h4 {
  430. color: #colors[quest];
  431. font-size: .32rem;
  432. font-weight: bold;
  433. position: relative;
  434. i {
  435. width: .16rem;
  436. height: .16rem;
  437. border-radius: 50%;
  438. background: #colors[theme];
  439. display: inline-block;
  440. position: absolute;
  441. top: .15rem;
  442. left: -0.3rem;
  443. }
  444. }
  445. p {
  446. font-size: .28rem;
  447. color: #424242;
  448. margin: .2rem 0;
  449. word-break: break-all;
  450. }
  451. }
  452. .baseMsg {
  453. font-size: 0.32rem;
  454. color: #colors[quest];
  455. letter-spacing: 0;
  456. text-align: justify;
  457. font-weight: bold;
  458. margin-bottom: 0.15rem;
  459. }
  460. table {
  461. width: 100%;
  462. font-size: 0.3rem;
  463. color: #333333;
  464. letter-spacing: 0;
  465. text-align: justify;
  466. margin-top: .2rem;
  467. tr {
  468. padding: .2rem 0;
  469. line-height: .5rem;
  470. td {
  471. padding-bottom: 0.1rem;
  472. }
  473. span {
  474. color:#777;
  475. width: 1.5rem;
  476. display: inline-block;
  477. }
  478. }
  479. }
  480. .line {
  481. opacity: 0.3;
  482. background: #d8d8d8;
  483. margin: 0.2rem 0;
  484. height: 1px;
  485. }
  486. }
  487. .personMsg2 {
  488. padding-right: 0;
  489. }
  490. .personMsgDoc {
  491. position: fixed;
  492. height: 100%;
  493. width: 100%;
  494. top: 0;
  495. left: 0;
  496. overflow: auto;
  497. z-index: 999;
  498. .personMsgDocModal {
  499. .mask;
  500. position: fixed;
  501. width: 100%;
  502. height: 100%;
  503. top: 0;
  504. left: 0;
  505. z-index: 999;
  506. }
  507. .personMsgDocDetail {
  508. position: fixed;
  509. z-index: 1000;
  510. top: 50%;
  511. left: 50%;
  512. transform: translate(-50%, -50%);
  513. // padding: 0 .4rem;
  514. background-color: #fff;
  515. box-sizing: border-box;
  516. width: 90%;
  517. border-radius: .1rem;
  518. overflow: hidden;
  519. .personMsg {
  520. max-height: 9rem;
  521. overflow: auto;
  522. width: 100%;
  523. border-radius: 0;
  524. -webkit-overflow-scrolling:touch;
  525. }
  526. }
  527. }
  528. .close {
  529. width: .34rem;
  530. height: .34rem;
  531. position: absolute;
  532. right: 0;
  533. top: 0;
  534. padding: 8px;
  535. z-index: 1001;
  536. }
  537. </style>