维护系统->检查方法、部位导出表格功能OK
This commit is contained in:
@@ -5,6 +5,7 @@ import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.CheckMethod;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 检查方法Service接口
|
||||
@@ -22,5 +23,7 @@ public interface ICheckMethodAppService{
|
||||
|
||||
R<?> removeCheckMethod(Integer checkMethodId);
|
||||
|
||||
R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName);
|
||||
R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName);
|
||||
|
||||
R<?> exportCheckMethod(String checkType, String name, String packageName, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.openhis.web.check.appservice;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.CheckPart;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public interface ICheckPartAppService {
|
||||
R<?> getCheckPartList();
|
||||
|
||||
@@ -12,5 +14,7 @@ public interface ICheckPartAppService {
|
||||
|
||||
R<?> updateCheckPart(CheckPart checkPart);
|
||||
|
||||
R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName);
|
||||
R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName);
|
||||
|
||||
R<?> exportCheckPart(String checkType, String name, String packageName, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,16 @@ import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.CheckMethod;
|
||||
import com.openhis.check.service.ICheckMethodService;
|
||||
import com.openhis.web.check.appservice.ICheckMethodAppService;
|
||||
import com.openhis.web.reportmanage.utils.ExcelFillerUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -26,10 +31,10 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName) {
|
||||
public R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName) {
|
||||
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<>();
|
||||
if (checkTpye != null && ObjectUtil.isNotEmpty(checkTpye)) {
|
||||
wrapper.eq(CheckMethod::getCheckType, checkTpye);
|
||||
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
|
||||
wrapper.eq(CheckMethod::getCheckType, checkType);
|
||||
}
|
||||
if (name != null && ObjectUtil.isNotEmpty(name)) {
|
||||
wrapper.like(CheckMethod::getName, name);
|
||||
@@ -80,4 +85,45 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
||||
boolean remove = checkMethodService.removeById(checkMethodId);
|
||||
return R.ok(remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> exportCheckMethod(String checkType, String name, String packageName, HttpServletResponse response) {
|
||||
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<>();
|
||||
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
|
||||
wrapper.eq(CheckMethod::getCheckType, checkType);
|
||||
}
|
||||
if (name != null && ObjectUtil.isNotEmpty(name)) {
|
||||
wrapper.like(CheckMethod::getName, name);
|
||||
}
|
||||
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
|
||||
wrapper.eq(CheckMethod::getPackageName, packageName);
|
||||
}
|
||||
List<CheckMethod> list = checkMethodService.list(wrapper);
|
||||
|
||||
if (list.isEmpty()) {
|
||||
return R.fail("导出Excel失败,无数据。");
|
||||
}
|
||||
|
||||
try {
|
||||
// 准备表头(key对应实体的字段名)
|
||||
Map<String, String> headers = new LinkedHashMap<>();
|
||||
headers.put("checkType", "检查类型");
|
||||
headers.put("code", "方法代码");
|
||||
headers.put("name", "方法名称");
|
||||
headers.put("packageName", "套餐名称");
|
||||
headers.put("exposureNum", "曝光次数");
|
||||
headers.put("orderNum", "序号");
|
||||
headers.put("remark", "备注");
|
||||
|
||||
// 文件名,只传文字部分
|
||||
String excelName = "检查方法列表";
|
||||
// 导出到Excel
|
||||
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
|
||||
} catch (IOException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return R.fail("导出Excel失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
return R.ok(null, "导出Excel成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,19 @@ package com.openhis.web.check.appservice.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.CheckMethod;
|
||||
import com.openhis.check.domain.CheckPart;
|
||||
import com.openhis.check.service.ICheckPartService;
|
||||
import com.openhis.web.check.appservice.ICheckPartAppService;
|
||||
import com.openhis.web.reportmanage.utils.ExcelFillerUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CheckPartAppServiceImpl implements ICheckPartAppService {
|
||||
@@ -24,10 +28,10 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName) {
|
||||
public R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkType, String name, String packageName) {
|
||||
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<>();
|
||||
if (checkTpye != null && ObjectUtil.isNotEmpty(checkTpye)) {
|
||||
wrapper.eq(CheckPart::getCheckType, checkTpye);
|
||||
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
|
||||
wrapper.eq(CheckPart::getCheckType, checkType);
|
||||
}
|
||||
if (name != null && ObjectUtil.isNotEmpty(name)) {
|
||||
wrapper.like(CheckPart::getName, name);
|
||||
@@ -59,4 +63,47 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
|
||||
boolean b = checkPartService.updateById(checkPart);
|
||||
return R.ok(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> exportCheckPart(String checkType, String name, String packageName, HttpServletResponse response) {
|
||||
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<>();
|
||||
if (checkType != null && ObjectUtil.isNotEmpty(checkType)) {
|
||||
wrapper.eq(CheckPart::getCheckType, checkType);
|
||||
}
|
||||
if (name != null && ObjectUtil.isNotEmpty(name)) {
|
||||
wrapper.like(CheckPart::getName, name);
|
||||
}
|
||||
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
|
||||
wrapper.eq(CheckPart::getPackageName, packageName);
|
||||
}
|
||||
List<CheckPart> list = checkPartService.list(wrapper);
|
||||
|
||||
if (list.isEmpty()) {
|
||||
return R.fail("导出Excel失败,无数据。");
|
||||
}
|
||||
|
||||
try {
|
||||
// 准备表头(key对应实体的字段名)
|
||||
Map<String, String> headers = new LinkedHashMap<>();
|
||||
headers.put("checkType", "检查类型");
|
||||
headers.put("code", "部位代码");
|
||||
headers.put("name", "部位名称");
|
||||
headers.put("packageName", "套餐名称");
|
||||
headers.put("exposureNum", "曝光次数");
|
||||
headers.put("price", "金额");
|
||||
headers.put("number", "序号");
|
||||
headers.put("serviceScope", "服务范围");
|
||||
headers.put("subType", "下级医技类型");
|
||||
headers.put("remark", "备注");
|
||||
|
||||
// 文件名,只传文字部分
|
||||
String excelName = "检查部位列表";
|
||||
// 导出到Excel
|
||||
ExcelFillerUtil.makeExcelFile(response, list, headers, excelName, null);
|
||||
} catch (IOException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return R.fail("导出Excel失败:" + e.getMessage());
|
||||
}
|
||||
return R.ok(null, "导出Excel成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
@RestController
|
||||
@@ -33,10 +34,10 @@ public class CheckMethodController {
|
||||
public R<?> searchCheckMethodList(
|
||||
@RequestParam(required = false) Integer pageNo,
|
||||
@RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam(required = false) String checkTpye,
|
||||
@RequestParam(required = false) String checkType,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String packageName) {
|
||||
return R.ok(checkMethodAppService.searchCheckMethodList(pageNo,pageSize,checkTpye,name,packageName));
|
||||
return R.ok(checkMethodAppService.searchCheckMethodList(pageNo,pageSize,checkType,name,packageName));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -65,4 +66,17 @@ public class CheckMethodController {
|
||||
public R<?> updateCheckMethod(@RequestBody CheckMethod checkMethod){
|
||||
return R.ok(checkMethodAppService.updateCheckMethod(checkMethod));
|
||||
}
|
||||
|
||||
/*
|
||||
* 导出检查方法列表
|
||||
* @Param
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
public void exportCheckMethod(
|
||||
@RequestParam(required = false) String checkType,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String packageName,
|
||||
HttpServletResponse response) {
|
||||
checkMethodAppService.exportCheckMethod(checkType, name, packageName, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@@ -31,10 +32,10 @@ public class CheckPartController {
|
||||
@GetMapping("/search")
|
||||
public R<?> searchCheckPartList(@RequestParam(required = false) Integer pageNo,
|
||||
@RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam(required = false) String checkTpye,
|
||||
@RequestParam(required = false) String checkType,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String packageName){
|
||||
return R.ok(checkPartAppService.searchCheckPartList(pageNo,pageSize,checkTpye,name,packageName));
|
||||
return R.ok(checkPartAppService.searchCheckPartList(pageNo,pageSize,checkType,name,packageName));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -63,4 +64,17 @@ public class CheckPartController {
|
||||
public R<?> updateCheckPart(@RequestBody CheckPart checkPart){
|
||||
return R.ok(checkPartAppService.updateCheckPart(checkPart));
|
||||
}
|
||||
|
||||
/*
|
||||
* 导出检查部位列表
|
||||
* @Param
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
public void exportCheckPart(
|
||||
@RequestParam(required = false) String checkType,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String packageName,
|
||||
HttpServletResponse response) {
|
||||
checkPartAppService.exportCheckPart(checkType, name, packageName, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.openhis.check.domain;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -87,6 +87,26 @@ export function delCheckMethod(checkMethodId) {
|
||||
})
|
||||
}
|
||||
|
||||
// 导出检查方法
|
||||
export function exportCheckMethod(query) {
|
||||
return request({
|
||||
url: '/check/method/export',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出检查部位
|
||||
export function exportCheckPart(query) {
|
||||
return request({
|
||||
url: '/check/part/export',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询检查部位列表
|
||||
export function listCheckPart(query) {
|
||||
return request({
|
||||
|
||||
@@ -506,7 +506,7 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { getDicts } from '@/api/system/dict/data';
|
||||
import { listCheckType, listCheckMethod, listCheckPart, listCheckPackage, searchCheckMethod, searchCheckPart, addCheckType, updateCheckType, delCheckType, addCheckMethod, updateCheckMethod, delCheckMethod, addCheckPart, updateCheckPart, delCheckPart } from '@/api/system/checkType';
|
||||
import { listCheckType, listCheckMethod, listCheckPart, listCheckPackage, searchCheckMethod, searchCheckPart, addCheckType, updateCheckType, delCheckType, addCheckMethod, updateCheckMethod, delCheckMethod, addCheckPart, updateCheckPart, delCheckPart, exportCheckMethod, exportCheckPart } from '@/api/system/checkType';
|
||||
import PackageSettings from './components/PackageSettings.vue';
|
||||
import PackageManagement from './components/PackageManagement.vue';
|
||||
|
||||
@@ -1269,10 +1269,51 @@ function handleReset() {
|
||||
// 处理导出表格功能
|
||||
function handleExport() {
|
||||
console.log('导出表格:', activeMenu.value);
|
||||
ElMessage.success(`正在导出${activeMenu.value}数据,请稍候...`);
|
||||
|
||||
// 这里可以实现实际的导出逻辑
|
||||
// 例如调用API或使用前端库生成Excel文件
|
||||
if (activeMenu.value === '检查方法') {
|
||||
// 调用检查方法导出API
|
||||
exportCheckMethod(searchParamsMethod).then(blobData => {
|
||||
// 直接使用blobData创建下载链接,因为response拦截器已经返回了res.data
|
||||
const blob = new Blob([blobData], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
// 设置文件名
|
||||
link.setAttribute('download', `检查方法数据_${new Date().toISOString().slice(0, 10)}.xlsx`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// 清理
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
ElMessage.success('检查方法数据导出成功');
|
||||
}).catch(error => {
|
||||
console.error('导出检查方法数据失败:', error);
|
||||
ElMessage.error('导出检查方法数据失败');
|
||||
});
|
||||
} else if (activeMenu.value === '检查部位') {
|
||||
// 调用检查部位导出API
|
||||
exportCheckPart(searchParamsPart).then(blobData => {
|
||||
// 直接使用blobData创建下载链接,因为response拦截器已经返回了res.data
|
||||
const blob = new Blob([blobData], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
// 设置文件名
|
||||
link.setAttribute('download', `检查部位数据_${new Date().toISOString().slice(0, 10)}.xlsx`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// 清理
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
ElMessage.success('检查部位数据导出成功');
|
||||
}).catch(error => {
|
||||
console.error('导出检查部位数据失败:', error);
|
||||
ElMessage.error('导出检查部位数据失败');
|
||||
});
|
||||
} else {
|
||||
// 其他菜单的导出逻辑可以在这里扩展
|
||||
ElMessage.warning('该功能尚未实现');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user