Preview.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div class="preview">
  3. <div class="personMsg">
  4. <p class="baseMsg">{{pathInfo.patientName}}&nbsp;&nbsp;&nbsp;&nbsp;{{pathInfo.patientSex}}&nbsp;&nbsp;&nbsp;&nbsp;{{pathInfo.patientAge}}岁</p>
  5. <table>
  6. <tr>
  7. <td colspan="2">挂号科室:{{pathInfo.selfDeptName}}</td>
  8. </tr>
  9. <tr>
  10. <td>门诊号:{{pathInfo.recordId}}</td>
  11. <td>预约医生:{{pathInfo.doctorName}}</td>
  12. </tr>
  13. <tr>
  14. <td colspan="2">就诊时间:{{pathInfo.systemTime}}</td>
  15. </tr>
  16. </table>
  17. <div class="line"></div>
  18. <p>采集时间:{{pathInfo.systemTime}}</p>
  19. </div>
  20. <div class="personMsg personMsg2">
  21. <ul class="previewParts">
  22. <!-- <li v-if="symptom.choose.length>0"> -->
  23. <li>
  24. <h4><i :style="{'background': '#FF9A9A'}"></i> 主诉:</h4>
  25. <p>
  26. <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">{{item.name+(idx == symptom.choose.length-1?'':'、')}}</span>
  27. </p>
  28. </li>
  29. <!-- <li v-if="diagnose.text.length>0||symptom.choose.length>0"> -->
  30. <li>
  31. <h4><i :style="{'background': '#3D69D9'}"></i> 现病史:</h4>
  32. <p>
  33. <span v-for="(item,idx) in symptom.text" :key="item.text+idx">{{item.textP+(idx == symptom.choose.length-1?'。':';')}}</span>
  34. </p>
  35. <p>
  36. <span v-for="(item,idx) in diagnose.text" :key="item.text+idx">{{item.textP+(idx == diagnose.text.length-1?'。':';')}}</span>
  37. </p>
  38. </li>
  39. <li v-if="showLis[moduleCP['other']]==1">
  40. <h4><i></i> 其他史:</h4>
  41. <p>
  42. <span v-for="(item,idx) in others.text" :key="item.text+idx">{{item.textP+(idx == others.text.length-1?'。':';')}}</span>
  43. </p>
  44. </li>
  45. <li v-if="showLis[moduleCP['suplement']]==1">
  46. <h4><i></i> 补充内容:</h4>
  47. <p>{{addContent.txt}}</p>
  48. </li>
  49. <li v-if="JSON.stringify(diagnose.imgSrc) !='{}'" class="imgLis">
  50. <h4 class="imgTitle"><i></i> 最近一次治疗报告:</h4>
  51. <div v-for="(value,key,idx) in diagnose.imgSrc" class="imgView">
  52. <img :src="value" alt="">
  53. </div>
  54. </li>
  55. </ul>
  56. </div>
  57. <div class="foot">
  58. <span
  59. class="back"
  60. @click="back"
  61. >{{'返回'+ preName}}</span>
  62. <span
  63. class="next"
  64. @click="saveAllImage"
  65. >提 交</span>
  66. </div>
  67. <Submit
  68. v-if="submit"
  69. :showType="showType"
  70. @showSubmit="showSubmit"
  71. ></Submit>
  72. <Loading v-if="loadingShow"></Loading>
  73. </div>
  74. </template>
  75. <script>
  76. import api from '@utils/api.js';
  77. import Submit from '../common/Submit';
  78. import Loading from '../common/Loading';
  79. import {moduleCP} from '@utils/tools.js'
  80. export default {
  81. props: ['preName','showLis','loadingShow'],
  82. data() {
  83. const { pathInfo, originDatas,loadingShow } = this.$store.state;
  84. let symptomDate = this.$store.state.symptom;
  85. let diagnoseDate = this.$store.state.diagnose;
  86. let othersDate = this.$store.state.others;
  87. let addContentDate = this.$store.state.addContent;
  88. return {
  89. msg: '预览',
  90. pathInfo: pathInfo,
  91. symptom: symptomDate,
  92. diagnose: diagnoseDate,
  93. others: othersDate,
  94. addContent: addContentDate,
  95. submit: false,
  96. showType: 'fail',
  97. imgList:[],
  98. // show:loadingShow,//提交等待的动画loading
  99. tmpNum:0,
  100. moduleCP:moduleCP
  101. }
  102. },
  103. methods: {
  104. showSubmit(flg) {
  105. this.submit = flg
  106. },
  107. back() {
  108. this.$emit('back', 'preview')
  109. },
  110. saveAllImage() {
  111. let formData = new FormData();
  112. let imgList = this.diagnose.imgFile;
  113. // let tmpNum = this.tmpNum;
  114. // var dateBegin = new Date();//获取当前时间
  115. if (imgList.length > 0) {//有图片先上传图片
  116. this.$store.commit('handleToggleShow', true);
  117. for (let i = 0; i < imgList.length; i++) {
  118. alert(imgList[i].file.size,1111111)
  119. let pageFile = imgList[i].file
  120. formData.append('upfiles', imgList[i].file);
  121. // formData.append('upfile', imgList[i].file);
  122. formData.append('type', imgList[i].type);
  123. // api.uploadImageThum(formData).then((res)=>{
  124. // console.log(res)
  125. // let result = res.data;
  126. // if (result.code == 0) {
  127. // this.tmpNum = ++tmpNum
  128. // if(this.tmpNum == imgList.length){
  129. // var dateEnd = new Date();//获取当前时间
  130. // var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
  131. // var dayDiff = dateDiff / 1000;//计算出秒数
  132. // alert('图片上传完成:'+dayDiff+'s')
  133. // }
  134. // }
  135. // })
  136. }
  137. // return
  138. api.uploadImageThums(formData).then((res) => {//获取图片
  139. let result = res.data;
  140. if (result.code == 0) {//图片提交成功再保存数据
  141. // this.showType = 'success'
  142. // this.submit = true
  143. let reportList = []
  144. for(let i = 0;i < result.length;i++){
  145. let obg = {}
  146. obg.narrowImage = result[i].thumbnail.url
  147. obg.narrowName = result[i].thumbnail.original
  148. obg.originalImage = result[i].source.url
  149. obg.originalName = result[i].source.original
  150. obg.orderNum = i+1
  151. obg.type = result[i].source.type
  152. reportList.push(obg)
  153. }
  154. this.imgList = reportList
  155. // var dateEnd = new Date();//获取当前时间
  156. // var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数
  157. // var dayDiff = dateDiff / 1000;//计算出秒数
  158. // alert('图片上传完成:'+dayDiff+'s')
  159. this.saveAllDate()
  160. } else {//提交失败提示
  161. this.defaultWaring(res)
  162. }
  163. }).catch((err)=>{
  164. this.defaultWaring(err)
  165. })
  166. return;
  167. } else {//没有图片直接保存数据
  168. this.$store.commit('handleToggleShow', true);
  169. this.saveAllDate()
  170. }
  171. },
  172. getStr(arr,flg){
  173. let tmpStr = '',tmpStrDoc = '',obg={};
  174. for(let i = 0;i<arr.length;i++){
  175. tmpStr+=arr[i].text+';'
  176. tmpStrDoc+=arr[i].textP+';'
  177. }
  178. obg.content=tmpStr
  179. obg.contentValue=tmpStrDoc
  180. obg.type=flg
  181. return obg;
  182. },
  183. saveAllDate() {
  184. const {pathInfo,symptom,diagnose,others,addContent} = this
  185. let detailList = []
  186. if(symptom.text.length>0){
  187. detailList.push(this.getStr(symptom.text,1))
  188. }
  189. if(diagnose.text.length>0){
  190. detailList.push(this.getStr(diagnose.text,2))
  191. }
  192. if(others.text.length>0){
  193. let obg = {}
  194. detailList.push(this.getStr(others.text,3))
  195. }
  196. if(addContent.txt){
  197. let obg = {}
  198. obg.content=addContent.txtDoc
  199. obg.contentValue=addContent.txt
  200. obg.type=4
  201. detailList.push(obg)
  202. }
  203. let params = {
  204. "dataJson": "1",
  205. "detailList": detailList,
  206. "hospitalId": pathInfo.hospitalId,//医院id
  207. "hospitalName": pathInfo.hospitalName,//医院名称
  208. "hospitalCode": pathInfo.hospitalCode,//医院编码
  209. "doctorId": pathInfo.doctorId,//医生id
  210. "doctorCode": pathInfo.doctorCode,//医生编码
  211. "doctorName": pathInfo.doctorName,//医生name
  212. "hospitalDeptCode": pathInfo.hospitalDeptCode,//医院科室编码
  213. "hospitalDeptId": pathInfo.hospitalDeptId,//科室id
  214. "hospitalDeptName": pathInfo.hospitalDeptName,//科室name
  215. "inquiryCode": pathInfo.recordId,//就诊序列号,目前是门诊号
  216. "patientBirthday": pathInfo.birthday+':00',//患者出生日期,格式为:2018-11-28 17:25:30
  217. "patientCode": pathInfo.patientCode,//患者编号
  218. "patientId": pathInfo.patientId,//患者id
  219. "patientIdNo": pathInfo.patientIdNo,//患者证件号码(病历号)
  220. "patientName": pathInfo.patientName,//患者姓名
  221. // "patientPhone": pathInfo,//患者联系电话(非)
  222. "patientSex": pathInfo.patientSex=='男'?1:2,//患者性别:1男2女(非)
  223. // "regVisitedState": pathInfo,//就诊状态(0待接诊,1接诊中,2完成接诊)(非)
  224. "reportList": this.imgList,
  225. // "type": 0//病历分类(1:门诊,2:住院)
  226. }
  227. // console.log(params)
  228. api.saveInquiry(params).then((res) => {
  229. if (res.data.code == 0) {
  230. this.$store.commit('handleToggleShow', false);
  231. this.showType = 'success'
  232. this.submit = true
  233. } else {
  234. this.defaultWaring(res)
  235. }
  236. }).catch((err)=>{
  237. this.defaultWaring(err)
  238. })
  239. },
  240. defaultWaring(res){
  241. alert(JSON.stringify(res))
  242. this.$store.commit('handleToggleShow', false);
  243. this.showType = 'fail'
  244. this.submit = true
  245. let timer = setTimeout(() => {
  246. this.submit = false
  247. clearTimeout(timer)
  248. }, 2000);
  249. }
  250. },
  251. components: {
  252. Submit,
  253. Loading,
  254. }
  255. }
  256. </script>
  257. <style lang="less" scoped>
  258. @import "../less/base.less";
  259. .foot {
  260. .dbfooter;
  261. }
  262. .preview {
  263. color: red;
  264. background-color: #f2f2f5;
  265. position: fixed;
  266. width: 100%;
  267. height: 100%;
  268. top: 0;
  269. left: 0;
  270. box-sizing: border-box;
  271. padding: 0.3rem 0.4rem 1rem .4rem;
  272. overflow: auto;
  273. }
  274. .imgView {
  275. width: 1.86rem;
  276. height: 1.9rem;
  277. float: left;
  278. border: 1px solid #dfe0e4;
  279. margin: 0 0.2rem 0.3rem 0;
  280. box-sizing: border-box;
  281. img {
  282. width: 100%;
  283. }
  284. }
  285. .imgTitle {
  286. padding-bottom: .20rem;
  287. }
  288. .personMsg {
  289. padding: 0.3rem 0.4rem;
  290. box-sizing: border-box;
  291. background-color: #fff;
  292. border-radius: 0.16rem;
  293. margin-bottom: 0.38rem;
  294. .previewParts {
  295. li {
  296. padding: .1rem .3rem;
  297. overflow: hidden;
  298. }
  299. li.imgLis {
  300. padding-right: 0;
  301. padding-left: 0;
  302. }
  303. h4 {
  304. color: #000;
  305. font-size: .32rem;
  306. font-weight: bold;
  307. position: relative;
  308. i {
  309. width: .16rem;
  310. height: .16rem;
  311. border-radius: 50%;
  312. background: #767676;
  313. display: inline-block;
  314. position: absolute;
  315. top: .15rem;
  316. left: -0.3rem;
  317. }
  318. }
  319. p {
  320. font-size: .28rem;
  321. color: #424242;
  322. margin: .2rem 0;
  323. }
  324. }
  325. .baseMsg {
  326. font-size: 0.32rem;
  327. color: #000000;
  328. letter-spacing: 0;
  329. text-align: justify;
  330. font-weight: bold;
  331. margin-bottom: 0.13rem;
  332. }
  333. table {
  334. width: 100%;
  335. font-size: 0.26rem;
  336. color: #333333;
  337. letter-spacing: 0;
  338. text-align: justify;
  339. margin-top: .2rem;
  340. tr {
  341. padding: .2rem 0;
  342. line-height: .5rem;
  343. }
  344. }
  345. .line {
  346. opacity: 0.3;
  347. background: #d8d8d8;
  348. margin: 0.2rem 0;
  349. height: 1px;
  350. }
  351. }
  352. .personMsg2 {
  353. padding-right: 0;
  354. }
  355. </style>