无码信息申报功能
parent
efede9e2cf
commit
67e6fdacae
@ -0,0 +1,107 @@
|
|||||||
|
package com.glxp.api.controller.basic;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.write.handler.WriteHandler;
|
||||||
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||||
|
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||||
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.entity.basic.YbNotCode;
|
||||||
|
import com.glxp.api.req.dev.YbNotCodeQuery;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.res.basic.YbNotCodeResponse;
|
||||||
|
import com.glxp.api.service.basic.impl.YbNotCodeServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||||
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class YbNotCodeController {
|
||||||
|
@Resource
|
||||||
|
YbNotCodeServiceImpl ybNotCodeService;
|
||||||
|
@PostMapping("/udispms/ybNotCode/page")
|
||||||
|
public BaseResponse page(@RequestBody YbNotCodeQuery query) {
|
||||||
|
List<YbNotCode> list = ybNotCodeService.pageList(query);
|
||||||
|
PageInfo pageInfo = new PageInfo<>(list);
|
||||||
|
PageSimpleResponse page = new PageSimpleResponse();
|
||||||
|
page.setTotal(pageInfo.getTotal());
|
||||||
|
page.setList(pageInfo.getList());
|
||||||
|
return ResultVOUtils.success(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/udispms/ybNotCode/add")
|
||||||
|
public BaseResponse add(@RequestBody YbNotCode ybNotCode) {
|
||||||
|
return ResultVOUtils.success(ybNotCodeService.add(ybNotCode));
|
||||||
|
}
|
||||||
|
@PostMapping("/udispms/ybNotCode/update")
|
||||||
|
public BaseResponse update(@RequestBody YbNotCode ybNotCode) {
|
||||||
|
return ResultVOUtils.success(ybNotCodeService.update(ybNotCode));
|
||||||
|
}
|
||||||
|
@PostMapping("/udispms/ybNotCode/delete")
|
||||||
|
public BaseResponse delete(@RequestBody YbNotCode ybNotCode) {
|
||||||
|
return ResultVOUtils.success(ybNotCodeService.delete(ybNotCode));
|
||||||
|
}
|
||||||
|
@GetMapping("/udispms/ybNotCode/export")
|
||||||
|
public void export( YbNotCodeQuery query,HttpServletResponse response) throws IOException {
|
||||||
|
List<YbNotCode> list;
|
||||||
|
if(query.getExcelType() !=null && query.getExcelType() == 1
|
||||||
|
){
|
||||||
|
list = ybNotCodeService.pageList( query );
|
||||||
|
|
||||||
|
}else {
|
||||||
|
list = ybNotCodeService.list( new QueryWrapper<>());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<YbNotCodeResponse> splitCodeEntities = BeanUtil.copyToList(list, YbNotCodeResponse.class);
|
||||||
|
|
||||||
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
|
response.setHeader("content-Type", "application/vnd.ms-excel");
|
||||||
|
response.setHeader("Content-Disposition",
|
||||||
|
"attachment;filename=" + URLEncoder.encode("无码药品信息管理模板" + DateUtil.format(new Date(), "yyyy-MM-dd") + ".xlsx", StandardCharsets.UTF_8.name()));
|
||||||
|
|
||||||
|
// 定义表头样式
|
||||||
|
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||||
|
// 设置表头背景颜色为淡蓝色
|
||||||
|
headWriteCellStyle.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex()); // 淡蓝色对应的索引值
|
||||||
|
WriteFont headWriteFont = new WriteFont();
|
||||||
|
headWriteFont.setFontHeightInPoints((short) 11);
|
||||||
|
|
||||||
|
headWriteCellStyle.setWriteFont(headWriteFont);
|
||||||
|
// 定义内容样式
|
||||||
|
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||||
|
|
||||||
|
|
||||||
|
// 构建样式策略
|
||||||
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy =
|
||||||
|
new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||||
|
|
||||||
|
EasyExcel.write(response.getOutputStream(), YbNotCodeResponse.class).registerWriteHandler(horizontalCellStyleStrategy) .// 注册自定义样式处理器
|
||||||
|
sheet("无码药品申报导入").doWrite(splitCodeEntities);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.glxp.api.req.dev;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class YbNotCodeQuery extends ListPageRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国家医保目录编码
|
||||||
|
*/
|
||||||
|
@TableId(value = "ybbm", type = IdType.INPUT)
|
||||||
|
private String ybbm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "organizationCode")
|
||||||
|
private String organizationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无码类型 1、部分早期未赋予追溯码 5、最小包装无追溯码 6、无追溯码 7、其他原因 0、默认不是无码类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "notCodeType")
|
||||||
|
private Integer notCodeType;
|
||||||
|
|
||||||
|
private Integer excelType;
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.glxp.api.res.basic;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@HeadRowHeight(16) // 设置表头 高度 为 40
|
||||||
|
public class YbNotCodeResponse {
|
||||||
|
|
||||||
|
@ExcelProperty(value = "机构编码", index = 0)
|
||||||
|
@ColumnWidth(32)
|
||||||
|
private String ybbm;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "国家医保目录编码", index = 1)
|
||||||
|
@ColumnWidth(28)
|
||||||
|
private String organizationCode;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "无码类型(仅填数字即可)", index = 2)
|
||||||
|
@ColumnWidth(54)
|
||||||
|
private String notCodeType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.glxp.api.service;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.basic.YbNotCode;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.glxp.api.req.dev.DeviceCheckQuery;
|
||||||
|
import com.glxp.api.req.dev.YbNotCodeQuery;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface YbNotCodeService extends IService<YbNotCode>{
|
||||||
|
List<YbNotCode> pageList(YbNotCodeQuery query);
|
||||||
|
Integer add(YbNotCode ybNotCode);
|
||||||
|
Integer update(YbNotCode ybNotCode);
|
||||||
|
Integer delete(YbNotCode ybNotCode);
|
||||||
|
Integer export(YbNotCode ybNotCode);
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,23 @@
|
|||||||
package com.glxp.api.service.basic;
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
import com.glxp.api.entity.basic.YbNotCode;
|
import com.glxp.api.entity.basic.YbNotCode;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.glxp.api.req.dev.YbNotCodeQuery;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface YbNotCodeService extends IService<YbNotCode>{
|
public interface YbNotCodeService extends IService<YbNotCode>{
|
||||||
|
List<YbNotCode> pageList(YbNotCodeQuery query);
|
||||||
|
|
||||||
|
Boolean add(YbNotCode ybNotCode);
|
||||||
|
|
||||||
|
Boolean update(YbNotCode ybNotCode);
|
||||||
|
|
||||||
|
Boolean delete(YbNotCode ybNotCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,60 @@
|
|||||||
package com.glxp.api.service.basic.impl;
|
package com.glxp.api.service.basic.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.req.dev.YbNotCodeQuery;
|
||||||
import com.glxp.api.service.basic.YbNotCodeService;
|
import com.glxp.api.service.basic.YbNotCodeService;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.glxp.api.entity.basic.YbNotCode;
|
import com.glxp.api.entity.basic.YbNotCode;
|
||||||
import com.glxp.api.dao.basic.YbNotCodeMapper;
|
import com.glxp.api.dao.basic.YbNotCodeMapper;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class YbNotCodeServiceImpl extends ServiceImpl<YbNotCodeMapper, YbNotCode> implements YbNotCodeService {
|
public class YbNotCodeServiceImpl extends ServiceImpl<YbNotCodeMapper, YbNotCode> implements YbNotCodeService {
|
||||||
|
@Resource
|
||||||
|
private YbNotCodeMapper ybNotCodeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<YbNotCode> pageList(YbNotCodeQuery query) {
|
||||||
|
if (query.getPage() != null) {
|
||||||
|
PageHelper.startPage(query.getPage(), query.getLimit());
|
||||||
|
}
|
||||||
|
return ybNotCodeMapper.pageList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(YbNotCode ybNotCode) {
|
||||||
|
return ybNotCodeMapper.insert(ybNotCode) > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(YbNotCode ybNotCode) {
|
||||||
|
return ybNotCodeMapper.updateById(ybNotCode) > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(YbNotCode ybNotCode) {
|
||||||
|
return ybNotCodeMapper.deleteById(ybNotCode) > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue