健康报告删除

This commit is contained in:
limqhz
2021-03-08 17:30:58 +08:00
parent 8cad890c1b
commit 4247ae6e12
8 changed files with 146 additions and 37 deletions

View File

@@ -15,7 +15,7 @@ public class HealthDoc {
private String docPath;
private Date date;
private Date docDate;
private Integer platformId;
@@ -25,14 +25,14 @@ public class HealthDoc {
private Byte deleted;
public HealthDoc(Integer id, Integer memberId, String docName, String docType, String fileType, String docPath, Date date, Integer platformId, Date createdTime, Date modifiedTime, Byte deleted) {
public HealthDoc(Integer id, Integer memberId, String docName, String docType, String fileType, String docPath, Date docDate, Integer platformId, Date createdTime, Date modifiedTime, Byte deleted) {
this.id = id;
this.memberId = memberId;
this.docName = docName;
this.docType = docType;
this.fileType = fileType;
this.docPath = docPath;
this.date = date;
this.docDate = docDate;
this.platformId = platformId;
this.createdTime = createdTime;
this.modifiedTime = modifiedTime;
@@ -91,12 +91,12 @@ public class HealthDoc {
this.docPath = docPath == null ? null : docPath.trim();
}
public Date getDate() {
return date;
public Date getDocDate() {
return docDate;
}
public void setDate(Date date) {
this.date = date;
public void setDocDate(Date docDate) {
this.docDate = docDate;
}
public Integer getPlatformId() {

View File

@@ -15,7 +15,7 @@
</el-select>
</el-form-item>
<el-form-item label="报告日期" prop="date">
<el-date-picker class="filter-item" v-model="form.date" type="date" placeholder="选择报告日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd"></el-date-picker>
<el-date-picker class="filter-item" v-model="form.docDate" type="date" placeholder="选择报告日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="健康报告" prop="avatar">
<el-upload
@@ -47,7 +47,7 @@ export default {
memberId: undefined,
docName: '',
docType: '',
date: '',
docDate: '',
docPath: ''
},
options: {
@@ -70,7 +70,7 @@ export default {
docType: [
{ required: true, message: '请输入报告类型', trigger: 'blur' }
],
date: [
docDate: [
{ required: true, message: '请选择报告日期', trigger: 'blur' }
]
}

View File

@@ -33,13 +33,14 @@
<!-- 报告时间 -->
<el-table-column align="center" label="报告时间">
<template scope="scope">
<span>{{scope.row.date | parseTime('{y}-{m}-{d}')}}</span>
<span>{{scope.row.docDate | parseTime('{y}-{m}-{d}')}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150">
<template scope="scope">
<el-button size="small" type="text" @click="handleEdit(scope.row.docPath)">查看</el-button>
<el-button size="small" type="text" @click="showFile(scope.row.docPath)">查看</el-button>
<el-button size="small" type="text" @click="deleteFile(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</Pagination>
@@ -102,6 +103,24 @@ export default {
this.$router.push({ path: '/member/health/edit', query: { id: id }})
},
/**
* 编辑健康报告
*/
showFile(id) {
this.$router.push({ path: '/member/health/show', query: { docPath: id }})
},
/**
* 删除
*/
deleteFile(id) {
this.$confirm('确认删除该报告?').then(_ => {
remove(id).then(response => {
this.$refs.pagination.removeItem(id)
})
}).catch(_ => {})
},
/**
* 创建用户会员卡
*/

View File

@@ -1,14 +1,10 @@
<template>
<div class="app-container calendar-list-container">
<el-form class="small-space" :model="form" :rules="rules" ref="form" label-position="right">
<el-form-item>
<el-button style="float: right;margin-top: -25px;" @click="handleCancel">返回</el-button>
</el-form-item>
</el-form>
<div id="iframe-container">
<iframe :src="search_eq_docPath" scrolling="auto" frameborder="0" id="iframe"></iframe>
<div class="filter-container">
<el-button class="filter-item" type="primary" v-waves icon="search" @click="handleCancel">返回</el-button>
<div>
<iframe :src="docPath" scrolling="auto" frameborder="0" id="iframe"></iframe>
</div>
</div>
</div>
</template>
<script>
@@ -20,12 +16,22 @@ export default {
},
data() {
return {
search_eq_docPath: undefined
docPath: undefined
}
},
created() {
// 初始化
this.search_eq_docPath = this.$route.query.docPath
this.docPath = this.$route.query.docPath
},
mounted() {
/**
* iframe-宽高自适应显示
*/
const oIframe = document.getElementById('iframe')
const deviceWidth = document.documentElement.clientWidth
const deviceHeight = document.documentElement.clientHeight
oIframe.style.width = (Number(deviceWidth) - 220) + 'px'
oIframe.style.height = (Number(deviceHeight) - 120) + 'px'
},
methods: {
/**

View File

@@ -96,7 +96,7 @@
<el-button size="small" type="text" @click="showUploadFace(scope.row.id)">上传人脸</el-button>
<el-button size="small" type="text" @click="showimg(scope.row.id)">送卡</el-button>
<el-button size="small" type="text" @click="miniMoney(scope.row.id,scope.row.money)">扣费</el-button>
<el-button size="small" type="text" @click="handleHealthDocs(scope.row.id)">上传健康文档</el-button>
<el-button size="small" type="text" @click="handleHealthDocs(scope.row.id)">健康报告</el-button>
<el-button v-if="hasEditPermission() && scope.row.status === 0" size="small" type="text" @click="handleAddEdit(scope.row.id)">编辑</el-button>
</template>
</el-table-column>

View File

@@ -2,6 +2,7 @@ package com.sv.service.common;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.CannedAccessControlList;
import com.sv.service.utils.UUIDGenerator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -50,9 +51,11 @@ public class OSSClientUtil {
private String accessKeySecret;
//文件存储目录
@Value("${sv.file.store.image}")
private String imageDir = "image/";
private String imageDir;
@Value("${sv.file.store.video}")
private String videoDir = "video/";
private String videoDir;
@Value("${sv.file.store.health}")
private String healthDir;
@Value("${oss.url}")
private String url;
@@ -103,6 +106,47 @@ public class OSSClientUtil {
return backUrl;
}
/**
* 上传健康报告文档
* @param multipartFile
* @return
* @throws IOException
*/
public String uploadHealth(MultipartFile multipartFile) throws IOException {
String originalFilename = multipartFile.getOriginalFilename();
String backUrl = "";
try {
ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
String substring = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
String name = UUIDGenerator.randomUUID() + substring;
backUrl = healthDir + name;
// 上传文件
ossClient.putObject(bucketName, backUrl, multipartFile.getInputStream());
ossClient.setObjectAcl(bucketName, backUrl, CannedAccessControlList.PublicRead);
// 判断是否上传成功
boolean uploadResult = ossClient.doesObjectExist(bucketName, backUrl);
if (uploadResult) {
backUrl = getUploadUrl(name);
} else {
backUrl = "";
}
} finally {
if (ossClient != null) {
ossClient.shutdown();
}
}
return backUrl;
}
private String getUploadUrl(String fileUrl) {
if (!StringUtils.isEmpty(fileUrl)) {
String[] split = fileUrl.split("/");
return url + this.healthDir + split[split.length - 1];
}
return null;
}
/**
* 上传视频
*
@@ -240,4 +284,5 @@ public class OSSClientUtil {
public void setUrl(String url) {
this.url = url;
}
}

View File

@@ -0,0 +1,28 @@
package com.sv.service.utils;
import java.util.StringTokenizer;
import java.util.UUID;
/**
* @title UUIDGenerator
* @description 随机生成32位UUID格式如a11686c39a154cf2a5238fb14cf3d097
* <br>
* <br>
*/
public class UUIDGenerator {
/**
* 主键生成机制
* @return
*/
public static String randomUUID(){
String result="";
UUID uuid = UUID.randomUUID();
String temp=uuid.toString();
StringTokenizer token=new StringTokenizer(temp,"-");
while(token.hasMoreTokens()){
result+=token.nextToken();
}
return result;
}
}

View File

@@ -7,8 +7,9 @@
<arg column="member_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="doc_name" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="doc_type" jdbcType="CHAR" javaType="java.lang.String" />
<arg column="file_type" jdbcType="CHAR" javaType="java.lang.String" />
<arg column="file_type" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="doc_path" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="doc_date" jdbcType="DATE" javaType="java.util.Date" />
<arg column="platform_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="created_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
<arg column="modified_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
@@ -16,7 +17,7 @@
</constructor>
</resultMap>
<sql id="Base_Column_List" >
id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time,
id, member_id, doc_name, doc_type, file_type, doc_path, doc_date, platform_id, created_time,
modified_time, deleted
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
@@ -40,12 +41,12 @@
<insert id="insert" parameterType="com.sv.entity.HealthDoc" >
insert into sv_health_docs (id, member_id, doc_name,
doc_type, file_type, doc_path,
platform_id, created_time, modified_time,
deleted)
doc_date, platform_id, created_time,
modified_time, deleted)
values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR},
#{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR},
#{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=TINYINT})
#{docType,jdbcType=CHAR}, #{fileType,jdbcType=VARCHAR}, #{docPath,jdbcType=VARCHAR},
#{docDate,jdbcType=DATE}, #{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.sv.entity.HealthDoc" >
insert into sv_health_docs
@@ -68,6 +69,9 @@
<if test="docPath != null" >
doc_path,
</if>
<if test="docDate != null" >
doc_date,
</if>
<if test="platformId != null" >
platform_id,
</if>
@@ -95,11 +99,14 @@
#{docType,jdbcType=CHAR},
</if>
<if test="fileType != null" >
#{fileType,jdbcType=CHAR},
#{fileType,jdbcType=VARCHAR},
</if>
<if test="docPath != null" >
#{docPath,jdbcType=VARCHAR},
</if>
<if test="docDate != null" >
#{docDate,jdbcType=DATE},
</if>
<if test="platformId != null" >
#{platformId,jdbcType=INTEGER},
</if>
@@ -127,11 +134,14 @@
doc_type = #{docType,jdbcType=CHAR},
</if>
<if test="fileType != null" >
file_type = #{fileType,jdbcType=CHAR},
file_type = #{fileType,jdbcType=VARCHAR},
</if>
<if test="docPath != null" >
doc_path = #{docPath,jdbcType=VARCHAR},
</if>
<if test="docDate != null" >
doc_date = #{docDate,jdbcType=DATE},
</if>
<if test="platformId != null" >
platform_id = #{platformId,jdbcType=INTEGER},
</if>
@@ -152,8 +162,9 @@
set member_id = #{memberId,jdbcType=INTEGER},
doc_name = #{docName,jdbcType=VARCHAR},
doc_type = #{docType,jdbcType=CHAR},
file_type = #{fileType,jdbcType=CHAR},
file_type = #{fileType,jdbcType=VARCHAR},
doc_path = #{docPath,jdbcType=VARCHAR},
doc_date = #{docDate,jdbcType=DATE},
platform_id = #{platformId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},