Preview.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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">
  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. }
  95. },
  96. methods: {
  97. showSubmit(flg) {
  98. this.submit = flg
  99. },
  100. back() {
  101. this.$emit('back', 'preview')
  102. },
  103. saveAllImage() {
  104. let formData = new FormData();
  105. let imgList = this.diagnose.imgFile;
  106. if (imgList.length > 0) {//有图片先上传图片
  107. this.show = true
  108. for (let i = 0; i < imgList.length; i++) {
  109. let pageFile = imgList[i].file
  110. formData.append('upfiles', imgList[i].file);
  111. formData.append('type', imgList[i].type);
  112. }
  113. api.uploadImageThums(formData).then((res) => {//获取图片
  114. console.log(res.data)
  115. let result = res.data;
  116. if (result.code == 0) {//图片提交成功再保存数据
  117. // this.showType = 'success'
  118. // this.submit = true
  119. let reportList = []
  120. for(let i = 0;i < result.length;i++){
  121. let obg = {}
  122. obg.narrowImage = result[i].thumbnail.url
  123. obg.narrowName = result[i].thumbnail.original
  124. obg.originalImage = result[i].source.url
  125. obg.originalName = result[i].source.original
  126. obg.orderNum = i+1
  127. obg.type = result[i].source.type
  128. reportList.push(obg)
  129. }
  130. this.imgList = reportList
  131. this.saveAllDate()
  132. } else {//提交失败提示
  133. this.show=false
  134. this.showType = 'fail'
  135. this.submit = true
  136. let timer = setTimeout(() => {
  137. this.submit = false
  138. clearTimeout(timer)
  139. }, 2000);
  140. }
  141. })
  142. return;
  143. } else {//没有图片直接保存数据
  144. this.show = true
  145. this.saveAllDate()
  146. }
  147. },
  148. getStr(arr,flg){
  149. let tmpStr = '',obg={};
  150. for(let i = 0;i<arr.length;i++){
  151. tmpStr+=arr[i].text+';'
  152. }
  153. obg.content=tmpStr
  154. obg.contentValue=tmpStr
  155. obg.type=flg
  156. return obg;
  157. },
  158. saveAllDate() {
  159. const {pathInfo,symptom,diagnose,others,addContent} = this
  160. let detailList = []
  161. if(symptom.text.length>0){
  162. detailList.push(this.getStr(symptom.text,1))
  163. }
  164. if(diagnose.text.length>0){
  165. detailList.push(this.getStr(diagnose.text,2))
  166. }
  167. if(others.text.length>0){
  168. let obg = {}
  169. detailList.push(this.getStr(others.text,3))
  170. }
  171. if(addContent.txt){
  172. let obg = {}
  173. obg.content=addContent.txt
  174. obg.contentValue=addContent.txt
  175. obg.type=4
  176. detailList.push(obg)
  177. }
  178. let params = {
  179. "dataJson": "1",
  180. "detailList": detailList,
  181. "hospitalId": pathInfo.hospitalId,//医院id
  182. "hospitalName": pathInfo.hospitalName,//医院名称
  183. "hospitalCode": pathInfo.hospitalCode,//医院编码
  184. "doctorId": pathInfo.doctorId,//医生id
  185. "doctorCode": pathInfo.doctorCode,//医生编码
  186. "doctorName": pathInfo.doctorName,//医生name
  187. "hospitalDeptCode": pathInfo.hospitalDeptCode,//医院科室编码
  188. "hospitalDeptId": pathInfo.hospitalDeptId,//科室id
  189. "hospitalDeptName": pathInfo.hospitalDeptName,//科室name
  190. "inquiryCode": '1',//就诊序列号,目前没有先写死
  191. "patientBirthday": pathInfo.birthday+':00',//患者出生日期,格式为:2018-11-28 17:25:30
  192. "patientCode": pathInfo.patientCode,//患者编号
  193. "patientId": pathInfo.patientId,//患者id
  194. "patientIdNo": pathInfo.patientIdNo,//患者证件号码(病历号)
  195. "patientName": pathInfo.patientName,//患者姓名
  196. // "patientPhone": pathInfo,//患者联系电话(非)
  197. "patientSex": pathInfo.patientSex=='男'?1:2,//患者性别:1男2女(非)
  198. // "regVisitedState": pathInfo,//就诊状态(0待接诊,1接诊中,2完成接诊)(非)
  199. "reportList": this.imgList,
  200. // "type": 0//病历分类(1:门诊,2:住院)
  201. }
  202. console.log(params)
  203. api.saveInquiry(params).then((res) => {
  204. console.log(res)
  205. if (res.data.code == 0) {
  206. this.show=false
  207. this.showType = 'success'
  208. this.submit = true
  209. } else {
  210. this.show=false
  211. this.showType = 'fail'
  212. this.submit = true
  213. let timer = setTimeout(() => {
  214. this.submit = false
  215. clearTimeout(timer)
  216. }, 2000);
  217. }
  218. })
  219. }
  220. },
  221. components: {
  222. Submit,
  223. Loading,
  224. }
  225. }
  226. </script>
  227. <style lang="less" scoped>
  228. @import "../less/base.less";
  229. .foot {
  230. .dbfooter;
  231. }
  232. .preview {
  233. color: red;
  234. background-color: #f2f2f5;
  235. position: fixed;
  236. width: 100%;
  237. height: 100%;
  238. top: 0;
  239. left: 0;
  240. box-sizing: border-box;
  241. padding: 0.3rem 0.4rem 1rem .4rem;
  242. overflow: auto;
  243. }
  244. .imgView {
  245. width: 2.44rem;
  246. height: 3.25rem;
  247. float: left;
  248. margin: .3rem .2rem 0 0;
  249. img {
  250. width: 100%;
  251. }
  252. }
  253. .personMsg {
  254. padding: 0.3rem 0.4rem;
  255. box-sizing: border-box;
  256. background-color: #fff;
  257. border-radius: 0.16rem;
  258. margin-bottom: 0.38rem;
  259. .previewParts {
  260. li {
  261. padding: .1rem .3rem;
  262. overflow: hidden;
  263. }
  264. h4 {
  265. color: #000;
  266. font-size: .32rem;
  267. font-weight: bold;
  268. position: relative;
  269. i {
  270. width: .16rem;
  271. height: .16rem;
  272. border-radius: 50%;
  273. background: #767676;
  274. display: inline-block;
  275. position: absolute;
  276. top: .15rem;
  277. left: -0.3rem;
  278. }
  279. }
  280. p {
  281. font-size: .28rem;
  282. color: #424242;
  283. margin: .2rem 0;
  284. }
  285. }
  286. .baseMsg {
  287. font-size: 0.32rem;
  288. color: #000000;
  289. letter-spacing: 0;
  290. text-align: justify;
  291. font-weight: bold;
  292. margin-bottom: 0.13rem;
  293. }
  294. table {
  295. width: 100%;
  296. font-size: 0.26rem;
  297. color: #333333;
  298. letter-spacing: 0;
  299. text-align: justify;
  300. line-height: 0.44rem /* 44/100 */;
  301. td.fst {
  302. width: 40%;
  303. }
  304. td.sec {
  305. width: 60%;
  306. }
  307. }
  308. .line {
  309. opacity: 0.3;
  310. background: #d8d8d8;
  311. margin: 0.2rem 0;
  312. height: 1px;
  313. }
  314. }
  315. </style>