Preview.vue 16 KB

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