Explorar o código

病例上传增加参数

小欧追 hai 1 ano
pai
achega
c44df5c77e
Modificáronse 1 ficheiros con 190 adicións e 90 borrados
  1. 190 90
      pages/doctor/upload.vue

+ 190 - 90
pages/doctor/upload.vue

@@ -54,12 +54,16 @@
 			</view>
 			<view class="box">
 				<view class="tit">患者信息</view>
+				<view class="input flex" @click="showtime = true">
+					<view class="icon">访视日期<text style="color: red;">*</text></view>
+					<input type="text" placeholder="请选择时间" v-model="FormData.subTime" placeholder-style="color:rgba(0, 0, 0, 0.35)" :disabled="true">
+				</view>
 				<view class="input flex">
-					<view class="icon">姓名</view>
+					<view class="icon">姓名<text style="color: red;">*</text></view>
 					<u-input v-model="FormData.name" :disabled="ishtmlType" :clearable="false" type="text" :border="border" placeholder="患者姓名" />
 				</view>
 				<view class="input flex">
-					<view class="icon">省份</view>
+					<view class="icon">省份<text style="color: red;">*</text></view>
 					<view class="text" :style="FormData.province?'flex: 1;':'flex: 1;color:rgba(0, 0, 0, 0.35);'" @click="provinceMet()">
 						{{FormData.province?FormData.province:'请选择省份'}}
 					</view>
@@ -67,20 +71,28 @@
 					<!-- <u-input v-model="FormData.province" :disabled="ishtmlType" :clearable="false" type="text" :border="border" placeholder="请输入省份" /> -->
 				</view>
 				<view class="input flex">
-					<view class="icon">城市</view>
+					<view class="icon">城市<text style="color: red;">*</text></view>
 					<view class="text" @click="cityMet()" :style="FormData.city?'flex: 1;':'flex: 1;color:rgba(0, 0, 0, 0.35);'">
 						{{FormData.city?FormData.city:'请选择城市'}}
 					</view>
 					<u-select v-model="cityType" :list="cityList" @confirm="cityConfirm"></u-select>
 					<!-- <u-input v-model="FormData.city" :disabled="ishtmlType" :clearable="false" type="text" :border="border" placeholder="请输入城市" /> -->
 				</view>
-				<view class="input flex inputBorNode">
-					<view class="icon">医院</view>
+				<view class="input flex">
+					<view class="icon">医院<text style="color: red;">*</text></view>
 					<u-input v-model="FormData.hospital" :disabled="ishtmlType" :clearable="false" type="text" :border="border" placeholder="目前所处医院名称" />
 				</view>
+				<view class="input">
+					<view class="icon">诊断结果<text style="color: red;">*</text></view>
+					<textarea v-model="FormData.diagnostic" style="width: 100%;height: 200rpx;margin-top: 20rpx;" :disabled="ishtmlType" placeholder="请输入诊断结果" placeholder-style="color:rgba(0, 0, 0, 0.35)"></textarea>
+				</view>
+				<view class="input inputBorNode">
+					<view class="icon">解决方案<text style="color: red;">*</text></view>
+					<textarea v-model="FormData.treatment" style="width: 100%;height: 200rpx;margin-top: 20rpx;" :disabled="ishtmlType" placeholder="请输入解决方案" placeholder-style="color:rgba(0, 0, 0, 0.35)"></textarea>
+				</view>
 			</view>
 			<view class="box">
-				<view class="tit">病例详情</view>
+				<view class="tit">病例详情<text style="color: red;">*</text></view>
 				<view class="input flex" v-if="wisBllx == '1'">
 					<view class="icon">病例类型</view>
 					<view class="classType" v-if="FormData.caseName!=''" style="color:#167FFF;" @click.stop="!ishtmlType?selectType=true:''">{{FormData.caseName}}</view>
@@ -96,9 +108,20 @@
 					<u-input v-model="FormData.remark" :disabled="ishtmlType" :clearable="false" type="text" :border="border" placeholder="详细信息" />
 				</view>
 				<view class="input">
-					<view class="label flex numbers">相关照片<view class="msg" style="margin: 0; padding: 0 12rpx 0;">最多可上传十张图片</view>
-					</view>
-					<u-upload ref="uUpload1" width="160rpx" height="160rpx" :show-progress="true" :deletable="htmlType == 0 ? true : false" :action="action" @on-change="progress1" upload-text=" " :max-count="maxCount" :file-list="fileList"></u-upload>
+					<view class="label flex numbers">相关照片<text style="color: red;">*</text><view class="msg" style="margin: 0 0 10rpx 0; padding: 0 12rpx 0;">最多可上传十张图片</view>
+					</view>
+					
+					<view class="u-flex u-flex-wrap">
+						<view class="u-flex" v-for="(item,index) in fileList" :key="index" style="width: 150rpx;height: 150rpx;border-radius: 20rpx;margin: 0 5rpx 5rpx 0;background-color: #f4f5f6;position: relative;">
+							<image :src="item.url" mode="aspectFill" @click="lookimage(index)" style="width: 150rpx;height: 150rpx;border-radius: 20rpx;"></image>
+							<u-icon name="close-circle-fill" color="red" style="position: absolute;top: 0;right: 0;" size="36" @click="del(index)" v-if="htmlType == 0 ? true : false"></u-icon>
+						</view>
+						<view v-if="fileList.length < 10 && !ishtmlType" @click="changeimage" class="u-flex u-row-center" style="width: 150rpx;height: 150rpx;border-radius: 10rpx;margin: 0 5rpx 5rpx 0;background-color: #f4f5f6;">
+							<image style="width: 48rpx;height: 48rpx;" src="../../static/img/Frame@2x(6).png" mode=""></image>
+						</view>
+					</view>
+					
+					<!-- <u-upload ref="uUpload1" width="160rpx" height="160rpx" :show-progress="true" :deletable="htmlType == 0 ? true : false" :action="action" @on-change="progress1" upload-text=" " :max-count="maxCount" :file-list="fileList"></u-upload> -->
 				</view>
 				<view class="input">
 					<view class="label flex numbers">相关文件<view class="msg" style="margin: 0; padding: 0 12rpx 0;">PPT、视频</view>
@@ -135,6 +158,7 @@
 			<view class="yes" v-if="yesType==1" @click="patientQuide()">提交案例</view>
 			<view class="yes" v-else @click="patientQuide()">重新提交</view>
 		</view>
+		<u-picker v-model="showtime" mode="time" @confirm="changetime"></u-picker>
 	</view>
 </template>
 
@@ -161,10 +185,13 @@
 				FormData: {
 					title: '', //标题
 					uploadingName: '', //分类名称	
+					subTime: '', //日期
 					name: '', //姓名
 					city: '', //城市
 					province: '', //省份
 					hospital: '', //医院名称
+					diagnostic: '', // 诊断结果*
+					treatment: '', // 治疗方案*
 					caseName: '', //病历类型	
 					remark: '', //备注
 					pic: [], //上传图片
@@ -185,11 +212,12 @@
 				provinceList: [],
 				cityType: false,
 				cityList: [],
-				wisBllx: ''
+				wisBllx: '',
+				showtime: false
 			}
 		},
 		onLoad(option) {
-			console.log(cityData.data)
+			// console.log(cityData.data)
 			this.provinceList = cityData.data;
 
 			uni.setNavigationBarTitle({
@@ -236,9 +264,80 @@
 			this.configInfo()
 			// console.log(JSON.parse(uni.getStorageSync('uploadData')))
 		},
-		methods: {
+		methods: {
+			lookimage(index) {
+				let values = this.fileList.map(item => item.url)
+				uni.previewImage({
+					urls: values,
+					current: index
+				})
+				
+			},
+			del(index) {
+				uni.showModal({
+					content: "确定删除吗",
+					success: (e) => {
+						if (e.confirm) {
+							this.fileList.splice(index, 1)
+						}
+					}
+				})
+			},
+			changeimage() {
+				uni.chooseImage({
+					count: 10 - this.fileList.length,
+					success: (res) => {
+						this.afterRead(res.tempFilePaths)
+					}
+				})
+			},
+			// 新增图片
+			async afterRead(lists) {
+				uni.showLoading({
+					mask: true,
+					title: "上传中"
+				})
+				for (let i = 0; i < lists.length; i++) {
+					const result = await this.uploadFilePromise(lists[i])
+					if (result.url) {
+						this.fileList.push({
+							url: result.url
+						})
+					}
+				}
+				uni.hideLoading()
+			},
+			uploadFilePromise(url) {
+				return new Promise((resolve, reject) => {
+					let a = uni.uploadFile({
+						url: this.action, // 仅为示例,非真实的接口地址
+						filePath: url,
+						// header: this.header,
+						name: 'file',
+						success: (res) => {
+							// console.log(res);
+							setTimeout(() => {
+								if (JSON.parse(res.data).code == 200) {
+									resolve({
+										url: JSON.parse(res.data).result
+									})
+								} else {
+									resolve({
+										url: ''
+									})
+									this.$u.toast(res.message)
+								}
+							}, 1000)
+						}
+					});
+				})
+			},
+			changetime(e) {
+				// console.log(e);
+				this.FormData.subTime = `${e.year}-${e.month}-${e.day}`
+			},
 			provinceConfirm(e) {
-				console.log(e);
+				// console.log(e);
 				this.FormData.province = e[0].label
 				this.cityList = e[0].value
 			},
@@ -274,7 +373,7 @@
 			// 二次上传赋值
 			initDataTwo() {
 				console.log(this.FormData, this.uploadData);
-				for (let key in this.FormData) {
+				for (let key in this.FormData) {
 					if (key == 'pic') {
 						if (this.uploadData[key] == '') {
 							return
@@ -288,10 +387,10 @@
 								url: item
 							})
 						})
-					} else if (key == 'mhFile') {
+					} else if (key == 'mhFile') {
 						if (this.uploadData[key] != '' && this.uploadData[key] != null) {
 							if (this.uploadData.secondaryUploadFile != '' && this.uploadData.secondaryUploadFile != null) {
-								this.FormData[key] = this.uploadData[key].split(',').concat(this.uploadData.secondaryUploadFile.split(','))
+								this.FormData[key] = this.uploadData[key].split(',').concat(this.uploadData.secondaryUploadFile.split(','))
 							} else {
 								// 相关文件处理
 								this.FormData[key] = this.uploadData[key].split(',')
@@ -371,7 +470,7 @@
 			},
 			// 上传接口
 			patientQuide() {
-				console.log(this.$refs.uUpload1.lists);
+				// console.log(this.$refs.uUpload1.lists);
 				if (this.optionId == '') {
 					// 第一次上传
 					if (this.FormData.title == '') {
@@ -388,7 +487,13 @@
 						})
 						return;
 					}
-
+					if (this.FormData.subTime == '') {
+						this.$refs.uToast.show({
+							title: '请选择访视日期',
+							type: 'error ',
+						})
+						return;
+					}
 					if (this.FormData.name == '') {
 						this.$refs.uToast.show({
 							title: '请输入姓名',
@@ -416,6 +521,20 @@
 							type: 'error ',
 						})
 						return;
+					}
+					if (this.FormData.diagnostic == '') {
+						this.$refs.uToast.show({
+							title: '请输入诊断结果',
+							type: 'error ',
+						})
+						return;
+					}
+					if (this.FormData.treatment == '') {
+						this.$refs.uToast.show({
+							title: '请输入治疗方案',
+							type: 'error ',
+						})
+						return;
 					}
 					if (this.wisBllx == 1) {
 						if (this.FormData.caseName == '') {
@@ -427,29 +546,14 @@
 						}
 					}
 
-					let files1 = [];
-					// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
-					files1 = this.$refs.uUpload1.lists.filter(val => {
-						return val.progress == 100;
-					})
-					console.log(files1)
-					if (files1.length == 0) {
-						this.$refs.uToast.show({
-							title: '请上传相关照片',
-							type: 'error ',
-						})
-						return;
-					}
-					let values = []
-					files1.forEach(item => {
-						if (item.response) {
-							values.push(item.response.result)
-						} else {
-							values.push(item.url)
-						}
-					})
-
-					// let values = files1.map(item => item.response.result)
+					if (this.fileList.length == 0) {
+						this.$refs.uToast.show({
+							title: '请上传相关照片',
+							type: 'error ',
+						})
+						return;
+					}
+					let values = this.fileList.map(item => item.url)
 					this.FormData.pic = values.join(',')
 					if (this.FormData.mhFile instanceof Array) {
 						this.FormData.mhFile = this.FormData.mhFile.join(',')
@@ -459,7 +563,7 @@
 					}
 					uni.showLoading({
 						mask: true,
-						title:'请稍后'
+						title: '请稍后'
 					})
 					this.$http.patientQuide(this.FormData).then(res => {
 						uni.hideLoading()
@@ -503,6 +607,13 @@
 							})
 							return;
 						}
+						if (data.subTime == '') {
+							this.$refs.uToast.show({
+								title: '请选择访视日期',
+								type: 'error ',
+							})
+							return;
+						}
 						if (data.name == '') {
 							this.$refs.uToast.show({
 								title: '请输入姓名',
@@ -531,6 +642,20 @@
 							})
 							return;
 						}
+						if (data.diagnostic == '') {
+							this.$refs.uToast.show({
+								title: '请输入诊断结果',
+								type: 'error ',
+							})
+							return;
+						}
+						if (data.treatment == '') {
+							this.$refs.uToast.show({
+								title: '请输入治疗方案',
+								type: 'error ',
+							})
+							return;
+						}
 						if (this.wisBllx == 1) {
 							if (data.caseName == '') {
 								this.$refs.uToast.show({
@@ -541,28 +666,14 @@
 							}
 						}
 
-						let files1 = [];
-						// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
-						files1 = this.$refs.uUpload1.lists.filter(val => {
-							return val.progress == 100;
-						})
-						console.log(files1)
-						if (files1.length == 0) {
-							this.$refs.uToast.show({
-								title: '请上传相关照片',
-								type: 'error ',
-							})
-							return;
-						}
-						let values = []
-						files1.forEach(item => {
-							if (item.response) {
-								values.push(item.response.result)
-							} else {
-								values.push(item.url)
-							}
-						})
-						// let values = files1.map(item => item.response.result)
+						if (this.fileList.length == 0) {
+							this.$refs.uToast.show({
+								title: '请上传相关照片',
+								type: 'error ',
+							})
+							return;
+						}
+						let values = this.fileList.map(item => item.url)
 						data.pic = values.join(',')
 						data.picTwo = values.join(',')
 						if (data.mhFile instanceof Array) {
@@ -573,7 +684,7 @@
 						}
 						uni.showLoading({
 							mask: true,
-							title:'请稍后'
+							title: '请稍后'
 						})
 						this.$http.patientQuideEdit(data).then(res => {
 							console.log(res)
@@ -601,28 +712,14 @@
 							})
 							return;
 						}
-						let files1 = [];
-						// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
-						files1 = this.$refs.uUpload1.lists.filter(val => {
-							return val.progress == 100;
-						})
-						console.log(files1)
-						if (files1.length == 0) {
-							this.$refs.uToast.show({
-								title: '请上传相关照片',
-								type: 'error ',
-							})
-							return;
-						}
-						let values = []
-						files1.forEach(item => {
-							if (item.response) {
-								values.push(item.response.result)
-							} else {
-								values.push(item.url)
-							}
-						})
-						// let values = files1.map(item => item.response.result)
+						if (this.fileList.length == 0) {
+							this.$refs.uToast.show({
+								title: '请上传相关照片',
+								type: 'error ',
+							})
+							return;
+						}
+						let values = this.fileList.map(item => item.url)
 						this.FormData.pic = values.join(',')
 						this.FormData.picTwo = values.join(',')
 						if (this.FormData.mhFile instanceof Array) {
@@ -642,7 +739,7 @@
 							console.log(datas)
 							uni.showLoading({
 								mask: true,
-								title:'请稍后'
+								title: '请稍后'
 							})
 							this.$http.patientQuideEdit(datas).then(res => {
 								uni.hideLoading()
@@ -683,14 +780,17 @@
 				this.show = false
 
 				this.fileList = []
-				this.$refs.uUpload1.clear()
+				// this.$refs.uUpload1.clear()
 				this.FormData = {
 					title: '', //标题
 					uploadingName: '', //分类名称	
 					name: '', //姓名
+					subTime: '',
 					city: '', //城市
 					province: '', //省份
 					hospital: '', //医院名称
+					diagnostic: '',
+					treatment: '',
 					caseName: '', //病历类型	
 					remark: '', //备注
 					pic: [], //上传图片
@@ -727,7 +827,7 @@
 				this.$http.configInfo()
 					.then(res => {
 						if (res.data.code == 200) {
-							console.log(res)
+							// console.log(res)
 							// console.log(this.data)
 							this.ppt = res.data.result.ppt
 							this.wisBllx = res.data.result.wisBllx