Preview.vue 10 KB

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