123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <template>
- <view class="subseqcuentVisit">
- <view class="subseqcuentVisit-container">
- <view class="addImage">
- <view class="title">添加医学影像</view>
- <view class="tip">支持各类图片,文件不大于10M</view>
- <view class="upload" @click="uploadBt">
- <view class="icon"></view>
- <view class="word">点击上传</view>
- </view>
- </view>
- <textarea class="textarea therapySchedule" v-model="subseqcuentVisitForm.therapySchedule" placeholder="治疗方案" />
- <view class="submit-BT" @click="subsequentVisitSubmit" >
- <text>提交</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {parseTime,deepClone,notEmpty} from '@/libs/index';
- import {upload} from '@/api';
- import {treatmentInfo, updateTreatmentInfo} from '@/api/doctor'
- export default{
- data(){
- return{
- diseaseDesc:"",
- illnessType:"",
- treatmentId:"",
- aiDiagnosisDesc:"",
- subseqcuentVisitForm:{
- therapySchedule:'',
- image:null
- }
- }
- },
- onLoad({id}) {
- this.treatmentId=id;
- this.getTreatmentInfoById(id);
- },
- methods:{
- subsequentVisitSubmit() {
- try {
- var diseaseImgDesc = []
- var therapeuticDrugs = ''
- /** 参数 */
- const diseaseDesc = this.diseaseDesc
- const illnessType = this.illnessType
- const treatmentId = this.treatmentId
- const aiDiagnosisDesc = this.aiDiagnosisDesc
- var defaultDiseaseImgDesc = this.diseaseImgDesc
-
- const subseqcuentVisitForm = deepClone(this.subseqcuentVisitForm)
- const diagnosedescInfo = subseqcuentVisitForm.therapySchedule// 诊断信息
- const time = parseTime(new Date())
- if (!notEmpty(diagnosedescInfo)) {
- uni.showToast({
- title:"请填写复诊信息!",
- icon:"none"
- })
- return
- }
- if(notEmpty(this.diseaseImgDesc)){
- defaultDiseaseImgDesc=JSON.parse(this.diseaseImgDesc);
- if (defaultDiseaseImgDesc.length > 0) {
- defaultDiseaseImgDesc = deepClone(defaultDiseaseImgDesc)
- if (defaultDiseaseImgDesc[0].time) {
- diseaseImgDesc = defaultDiseaseImgDesc
- } else {
- diseaseImgDesc[0]={
- time,
- images: defaultDiseaseImgDesc
- }
- }
- }
- }
- let uploadImages = subseqcuentVisitForm.image
- if(notEmpty(uploadImages)){
- uploadImages = {
- time,
- images: deepClone(uploadImages)
- }
- diseaseImgDesc.push(uploadImages)
- }
- let doctorDiagnosis = this.doctorDiagnosis// 我的诊断
- doctorDiagnosis += `<div class="item"> <p class="time">${time}</p><p class="info">${diagnosedescInfo}</p></div>`
-
- // 最终ai影像数据
- diseaseImgDesc = JSON.stringify(diseaseImgDesc)
- const formData = {
- treatmentId, diseaseDesc,
- doctorTreatment: doctorDiagnosis, aiDiagnosisDesc,
- illnessType, diseaseImgDesc
- }
- updateTreatmentInfo(formData).then((res) => {
- uni.navigateTo({
- url:`/views/detail/index?type=therapy&user=doctor&id=${treatmentId}`
- })
- })
- } catch (err) {
- uni.showToast({
- title:"提交失败!"
- })
- }
- },
- getTreatmentInfoById(id){
- treatmentInfo(id).then((res)=>{
- this.treatmentId =id;
- this.aiDiagnosisDesc=res.data.aiDiagnosisDesc;
- this. diseaseDesc = res.data.diseaseDesc
- this.illnessType=res.data.illnessType
- this.doctorDiagnosis=res.data.doctorTreatment;
- this.diseaseImgDesc=res.data.diseaseImgDesc;
- })
- },
- uploadBt(){
- uni.chooseImage({
- success: (chooseImageRes) => {
- const tempFilePaths = chooseImageRes.tempFilePaths;
- this.uploadSubmit(tempFilePaths[0])
- }
- });
- },
- uploadSubmit(filePath){
- upload({filePath}).then((res)=>{
- uni.showToast({
- title:"上传成功!"
- })
- let cont=JSON.parse(res);
- let image=[];
- image.push({
- path:cont.data.path
- })
- this.$set(this.subseqcuentVisitForm,'image',image);
- }).catch((msg)=>{
- uni.showToast({
- title:"上传失败!"
- })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .subseqcuentVisit{
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #fff;
- overflow-y: auto;
- z-index:999;
- .tip-head{
- background-color: orange;
- color: #fff;
- font-size: 12upx;
- padding: 4upx 0;
- text-align: center;
- }
- .subseqcuentVisit-container{
- padding: 40upx 24upx 200upx 44upx;
- .inp-name{
- height: 100upx;
- text-indent: 24upx;
- }
- .textarea{
- width: 100%;
- display: block;
- height: 240upx;
- border:1px solid #ccc;
- padding: 30upx 24upx;
- box-sizing: border-box;
- }
- .addImage{
- padding: 30upx 0;
- .title{
- color: #333;
- font-size:28upx;
- }
- .tip{
- padding: 8upx 0 16upx 0;
- color: #3584FF;
- font-size:24upx;
- }
- .upload{
- &{
- width: 150upx;
- height: 150upx;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- background-color: #F1F1F1;
- }
- .icon{
- width: 50upx;
- height:50upx;
- position: relative;
- &::after{
- width: 50upx;
- height: 4upx;
- display: block;
- content: "";
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%,-50%);
- background-color: #ccc;
- }
- &::before{
- width: 4upx;
- height: 50upx;
- display: block;
- content: "";
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%,-50%);
- background-color: #ccc;
- }
- }
- .word{
- font-size: 24upx;
- padding-top: 4upx;
- }
- }
- }
- .submit-BT{
- width: 700rpx;
- height: 80upx;
- line-height: 80upx;
- text-align: center;
- background-color: #3384FF;
- position: fixed;
- bottom: 50upx;
- left: 50%;
- transform: translateX(-50%);
- color: #fff;
- border-radius: 8upx;
- }
- }
- }
- </style>
|