Preview.vue 15 KB

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