subsequentVisitSubmit.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="subseqcuentVisit">
  3. <view class="subseqcuentVisit-container">
  4. <view class="addImage">
  5. <view class="title">添加医学影像</view>
  6. <view class="tip">支持各类图片,文件不大于10M</view>
  7. <view class="upload" @click="uploadBt">
  8. <view class="icon"></view>
  9. <view class="word">点击上传</view>
  10. </view>
  11. </view>
  12. <textarea class="textarea therapySchedule" v-model="subseqcuentVisitForm.therapySchedule" placeholder="治疗方案" />
  13. <view class="submit-BT" @click="subsequentVisitSubmit" >
  14. <text>提交</text>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {parseTime,deepClone,notEmpty} from '@/libs/index';
  21. import {upload} from '@/api';
  22. import {treatmentInfo, updateTreatmentInfo} from '@/api/doctor'
  23. export default{
  24. data(){
  25. return{
  26. diseaseDesc:"",
  27. illnessType:"",
  28. treatmentId:"",
  29. aiDiagnosisDesc:"",
  30. subseqcuentVisitForm:{
  31. therapySchedule:'',
  32. image:null
  33. }
  34. }
  35. },
  36. onLoad({id}) {
  37. this.treatmentId=id;
  38. this.getTreatmentInfoById(id);
  39. },
  40. methods:{
  41. subsequentVisitSubmit() {
  42. try {
  43. var diseaseImgDesc = []
  44. var therapeuticDrugs = ''
  45. /** 参数 */
  46. const diseaseDesc = this.diseaseDesc
  47. const illnessType = this.illnessType
  48. const treatmentId = this.treatmentId
  49. const aiDiagnosisDesc = this.aiDiagnosisDesc
  50. var defaultDiseaseImgDesc = this.diseaseImgDesc
  51. const subseqcuentVisitForm = deepClone(this.subseqcuentVisitForm)
  52. const diagnosedescInfo = subseqcuentVisitForm.therapySchedule// 诊断信息
  53. const time = parseTime(new Date())
  54. if (!notEmpty(diagnosedescInfo)) {
  55. uni.showToast({
  56. title:"请填写复诊信息!",
  57. icon:"none"
  58. })
  59. return
  60. }
  61. if(notEmpty(this.diseaseImgDesc)){
  62. defaultDiseaseImgDesc=JSON.parse(this.diseaseImgDesc);
  63. if (defaultDiseaseImgDesc.length > 0) {
  64. defaultDiseaseImgDesc = deepClone(defaultDiseaseImgDesc)
  65. if (defaultDiseaseImgDesc[0].time) {
  66. diseaseImgDesc = defaultDiseaseImgDesc
  67. } else {
  68. diseaseImgDesc[0]={
  69. time,
  70. images: defaultDiseaseImgDesc
  71. }
  72. }
  73. }
  74. }
  75. let uploadImages = subseqcuentVisitForm.image
  76. if(notEmpty(uploadImages)){
  77. uploadImages = {
  78. time,
  79. images: deepClone(uploadImages)
  80. }
  81. diseaseImgDesc.push(uploadImages)
  82. }
  83. let doctorDiagnosis = this.doctorDiagnosis// 我的诊断
  84. doctorDiagnosis += `<div class="item"> <p class="time">${time}</p><p class="info">${diagnosedescInfo}</p></div>`
  85. // 最终ai影像数据
  86. diseaseImgDesc = JSON.stringify(diseaseImgDesc)
  87. const formData = {
  88. treatmentId, diseaseDesc,
  89. doctorTreatment: doctorDiagnosis, aiDiagnosisDesc,
  90. illnessType, diseaseImgDesc
  91. }
  92. updateTreatmentInfo(formData).then((res) => {
  93. uni.navigateTo({
  94. url:`/views/detail/index?type=therapy&user=doctor&id=${treatmentId}`
  95. })
  96. })
  97. } catch (err) {
  98. uni.showToast({
  99. title:"提交失败!"
  100. })
  101. }
  102. },
  103. getTreatmentInfoById(id){
  104. treatmentInfo(id).then((res)=>{
  105. this.treatmentId =id;
  106. this.aiDiagnosisDesc=res.data.aiDiagnosisDesc;
  107. this. diseaseDesc = res.data.diseaseDesc
  108. this.illnessType=res.data.illnessType
  109. this.doctorDiagnosis=res.data.doctorTreatment;
  110. this.diseaseImgDesc=res.data.diseaseImgDesc;
  111. })
  112. },
  113. uploadBt(){
  114. uni.chooseImage({
  115. success: (chooseImageRes) => {
  116. const tempFilePaths = chooseImageRes.tempFilePaths;
  117. this.uploadSubmit(tempFilePaths[0])
  118. }
  119. });
  120. },
  121. uploadSubmit(filePath){
  122. upload({filePath}).then((res)=>{
  123. uni.showToast({
  124. title:"上传成功!"
  125. })
  126. let cont=JSON.parse(res);
  127. let image=[];
  128. image.push({
  129. path:cont.data.path
  130. })
  131. this.$set(this.subseqcuentVisitForm,'image',image);
  132. }).catch((msg)=>{
  133. uni.showToast({
  134. title:"上传失败!"
  135. })
  136. })
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .subseqcuentVisit{
  143. position: fixed;
  144. top: 0;
  145. left: 0;
  146. right: 0;
  147. bottom: 0;
  148. background-color: #fff;
  149. overflow-y: auto;
  150. z-index:999;
  151. .tip-head{
  152. background-color: orange;
  153. color: #fff;
  154. font-size: 12upx;
  155. padding: 4upx 0;
  156. text-align: center;
  157. }
  158. .subseqcuentVisit-container{
  159. padding: 40upx 24upx 200upx 44upx;
  160. .inp-name{
  161. height: 100upx;
  162. text-indent: 24upx;
  163. }
  164. .textarea{
  165. width: 100%;
  166. display: block;
  167. height: 240upx;
  168. border:1px solid #ccc;
  169. padding: 30upx 24upx;
  170. box-sizing: border-box;
  171. }
  172. .addImage{
  173. padding: 30upx 0;
  174. .title{
  175. color: #333;
  176. font-size:28upx;
  177. }
  178. .tip{
  179. padding: 8upx 0 16upx 0;
  180. color: #3584FF;
  181. font-size:24upx;
  182. }
  183. .upload{
  184. &{
  185. width: 150upx;
  186. height: 150upx;
  187. display: flex;
  188. justify-content: center;
  189. align-items: center;
  190. flex-direction: column;
  191. background-color: #F1F1F1;
  192. }
  193. .icon{
  194. width: 50upx;
  195. height:50upx;
  196. position: relative;
  197. &::after{
  198. width: 50upx;
  199. height: 4upx;
  200. display: block;
  201. content: "";
  202. position: absolute;
  203. left: 50%;
  204. top: 50%;
  205. transform: translate(-50%,-50%);
  206. background-color: #ccc;
  207. }
  208. &::before{
  209. width: 4upx;
  210. height: 50upx;
  211. display: block;
  212. content: "";
  213. position: absolute;
  214. left: 50%;
  215. top: 50%;
  216. transform: translate(-50%,-50%);
  217. background-color: #ccc;
  218. }
  219. }
  220. .word{
  221. font-size: 24upx;
  222. padding-top: 4upx;
  223. }
  224. }
  225. }
  226. .submit-BT{
  227. width: 700rpx;
  228. height: 80upx;
  229. line-height: 80upx;
  230. text-align: center;
  231. background-color: #3384FF;
  232. position: fixed;
  233. bottom: 50upx;
  234. left: 50%;
  235. transform: translateX(-50%);
  236. color: #fff;
  237. border-radius: 8upx;
  238. }
  239. }
  240. }
  241. </style>