diff --git a/src/main/java/com/glxp/api/controller/basic/YbNotCodeController.java b/src/main/java/com/glxp/api/controller/basic/YbNotCodeController.java new file mode 100644 index 000000000..24be35cee --- /dev/null +++ b/src/main/java/com/glxp/api/controller/basic/YbNotCodeController.java @@ -0,0 +1,119 @@ +package com.glxp.api.controller.basic; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import com.alibaba.excel.EasyExcel; +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.dao.system.ThrYbSetupMapper; +import com.glxp.api.entity.basic.YbNotCode; +import com.glxp.api.entity.system.ThrYbSetup; +import com.glxp.api.req.basic.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.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; + +@Slf4j +@RestController +public class YbNotCodeController { + @Resource + YbNotCodeServiceImpl ybNotCodeService; + @Resource + private ThrYbSetupMapper thrYbSetupMapper; + @PostMapping("/udi/ybNotCode/page") + public BaseResponse page(@RequestBody YbNotCodeQuery query) { + List 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("/udi/ybNotCode/add") + public BaseResponse add(@RequestBody YbNotCode ybNotCode) { + return ResultVOUtils.success(ybNotCodeService.add(ybNotCode)); + } + @PostMapping("/udi/ybNotCode/update") + public BaseResponse update(@RequestBody YbNotCode ybNotCode) { + return ResultVOUtils.success(ybNotCodeService.update(ybNotCode)); + } + @PostMapping("/udi/ybNotCode/delete") + public BaseResponse delete(@RequestBody YbNotCode ybNotCode) { + return ResultVOUtils.success(ybNotCodeService.delete(ybNotCode)); + } + @GetMapping("/udi/ybNotCode/export") + public void export( YbNotCodeQuery query,HttpServletResponse response) throws IOException { + List list; + if(query.getExcelType() !=null && query.getExcelType() == 1 + ){ + list = ybNotCodeService.pageList( query ); + + }else { + list = ybNotCodeService.list( new QueryWrapper<>()); + + } + + + List 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); + + } + + @GetMapping("/udi/ybNotCode/getOrganizationCode") + public BaseResponse getOrganizationCode() { + ThrYbSetup thrYbSetup = thrYbSetupMapper.selectOne( + new QueryWrapper() + .last("limit 1") + ); + String appId = ""; + if(thrYbSetup!=null && StringUtils.isNotEmpty(thrYbSetup.getAppId())){ + appId = thrYbSetup.getAppId(); + + } + return ResultVOUtils.success(appId); + } +} diff --git a/src/main/java/com/glxp/api/dao/basic/YbNotCodeMapper.java b/src/main/java/com/glxp/api/dao/basic/YbNotCodeMapper.java index 45d368f32..b8cc6af93 100644 --- a/src/main/java/com/glxp/api/dao/basic/YbNotCodeMapper.java +++ b/src/main/java/com/glxp/api/dao/basic/YbNotCodeMapper.java @@ -1,19 +1,14 @@ package com.glxp.api.dao.basic; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.glxp.api.entity.basic.YbNotCode; +import com.glxp.api.req.basic.YbNotCodeQuery; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; -@Mapper -public interface YbNotCodeMapper { - int deleteByPrimaryKey(String ybbm); - - int insert(YbNotCode record); - - int insertSelective(YbNotCode record); +import java.util.List; - YbNotCode selectByPrimaryKey(String ybbm); - - int updateByPrimaryKeySelective(YbNotCode record); - - int updateByPrimaryKey(YbNotCode record); -} \ No newline at end of file +@Mapper +public interface YbNotCodeMapper extends BaseMapper { + List pageList(@Param("vo") YbNotCodeQuery ybNotCodeQuery); +} diff --git a/src/main/java/com/glxp/api/dao/system/ThrYbSetupMapper.java b/src/main/java/com/glxp/api/dao/system/ThrYbSetupMapper.java new file mode 100644 index 000000000..8d8edc208 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/system/ThrYbSetupMapper.java @@ -0,0 +1,9 @@ +package com.glxp.api.dao.system; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.glxp.api.entity.system.ThrYbSetup; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ThrYbSetupMapper extends BaseMapper { +} diff --git a/src/main/java/com/glxp/api/entity/basic/YbNotCode.java b/src/main/java/com/glxp/api/entity/basic/YbNotCode.java index 4ebabf0f6..fe665b715 100644 --- a/src/main/java/com/glxp/api/entity/basic/YbNotCode.java +++ b/src/main/java/com/glxp/api/entity/basic/YbNotCode.java @@ -1,5 +1,9 @@ package com.glxp.api.entity.basic; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -8,26 +12,25 @@ import lombok.NoArgsConstructor; * 医保无码信息表 */ @Data -@AllArgsConstructor -@NoArgsConstructor +@TableName(value = "yb_not_code") public class YbNotCode { /** * 国家医保目录编码 */ + @TableId(value = "ybbm", type = IdType.INPUT) private String ybbm; /** * 机构编码 */ - private String organizationcode; + @TableField(value = "organizationCode") + private String organizationCode; /** - * 无码类型 - * 1、部分早期未赋予追溯码 - * 5、最小包装无追溯码 - * 6、无追溯码 - * 7、其他原因 - * 0、默认不是无码类型 + * 无码类型 1、部分早期未赋予追溯码 5、最小包装无追溯码 6、无追溯码 7、其他原因 0、默认不是无码类型 */ - private Integer notcodetype; + @TableField(value = "notCodeType") + private Integer notCodeType; + @TableField(exist = false) + private String notCodeTypeName; } diff --git a/src/main/java/com/glxp/api/entity/system/ThrYbSetup.java b/src/main/java/com/glxp/api/entity/system/ThrYbSetup.java new file mode 100644 index 000000000..ea6501637 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/system/ThrYbSetup.java @@ -0,0 +1,98 @@ +package com.glxp.api.entity.system; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +@Data +@TableName(value = "thr_yb_setup") +public class ThrYbSetup implements Serializable { + @TableId(value = "id", type = IdType.INPUT) + private Integer id; + + @TableField(value = "url") + private String url; + + @TableField(value = "appId") + private String appId; + + @TableField(value = "appSecret") + private String appSecret; + + @TableField(value = "signKey") + private String signKey; + + @TableField(value = "encKey") + private String encKey; + /** + * 就医地医保区划 + */ + @TableField(value = "mdtrtarea_admvs") + private String mdtrtarea_admvs; + + /** + * 参保地医保区划 + */ + @TableField(value = "insuplc_admdvs") + private String insuplc_admdvs; + + /** + * 操作人 + */ + @TableField(value = "opter") + private String opter; + + /** + * 操作时间 + */ + @TableField(value = "opter_name") + private String opter_name; + + /** + * 定点医药机构编号 + */ + @TableField(value = "fixmedins_code") + private String fixmedins_code; + + /** + * 定点医药机构名称 + */ + @TableField(value = "fixmedins_name") + private String fixmedins_name; + + /** + * 接口版本号 + */ + @TableField(value = "infver") + private String infver; + + /** + * 接收方系统代码 + */ + @TableField(value = "recer_sys_code") + private String recer_sys_code; + /** + * 经办人类别 + */ + @TableField(value = "opter_type") + private String opter_type; + @TableField(value = "sequenceNum") + private String sequenceNum; + @TableField(value = "opter_no") + private String opter_no; + @TableField(value = "mac") + private String mac; + @TableField(value = "ip") + private String ip; + + @TableField(value = "signNo") + private String signNo; + + @TableField(value = "signData") + private String signData; + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/glxp/api/req/basic/YbNotCodeQuery.java b/src/main/java/com/glxp/api/req/basic/YbNotCodeQuery.java new file mode 100644 index 000000000..98592c350 --- /dev/null +++ b/src/main/java/com/glxp/api/req/basic/YbNotCodeQuery.java @@ -0,0 +1,31 @@ +package com.glxp.api.req.basic; + +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; +} diff --git a/src/main/java/com/glxp/api/res/basic/YbNotCodeResponse.java b/src/main/java/com/glxp/api/res/basic/YbNotCodeResponse.java new file mode 100644 index 000000000..448befa26 --- /dev/null +++ b/src/main/java/com/glxp/api/res/basic/YbNotCodeResponse.java @@ -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; + + + +} diff --git a/src/main/java/com/glxp/api/service/auth/YbNotCodeService.java b/src/main/java/com/glxp/api/service/auth/YbNotCodeService.java deleted file mode 100644 index e26990317..000000000 --- a/src/main/java/com/glxp/api/service/auth/YbNotCodeService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.glxp.api.service.auth; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import com.glxp.api.entity.basic.YbNotCode; -import com.glxp.api.dao.basic.YbNotCodeMapper; -@Service -public class YbNotCodeService{ - - @Resource - private YbNotCodeMapper ybNotCodeMapper; - - - public int deleteByPrimaryKey(String ybbm) { - return ybNotCodeMapper.deleteByPrimaryKey(ybbm); - } - - - public int insert(YbNotCode record) { - return ybNotCodeMapper.insert(record); - } - - - public int insertSelective(YbNotCode record) { - return ybNotCodeMapper.insertSelective(record); - } - - - public YbNotCode selectByPrimaryKey(String ybbm) { - return ybNotCodeMapper.selectByPrimaryKey(ybbm); - } - - - public int updateByPrimaryKeySelective(YbNotCode record) { - return ybNotCodeMapper.updateByPrimaryKeySelective(record); - } - - - public int updateByPrimaryKey(YbNotCode record) { - return ybNotCodeMapper.updateByPrimaryKey(record); - } - -} diff --git a/src/main/java/com/glxp/api/service/basic/YbNotCodeService.java b/src/main/java/com/glxp/api/service/basic/YbNotCodeService.java new file mode 100644 index 000000000..b8bf3490b --- /dev/null +++ b/src/main/java/com/glxp/api/service/basic/YbNotCodeService.java @@ -0,0 +1,20 @@ +package com.glxp.api.service.basic; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.glxp.api.entity.basic.YbNotCode; +import com.glxp.api.req.basic.YbNotCodeQuery; + +import java.util.List; + +public interface YbNotCodeService extends IService{ + List pageList(YbNotCodeQuery query); + + Boolean add(YbNotCode ybNotCode); + + Boolean update(YbNotCode ybNotCode); + + Boolean delete(YbNotCode ybNotCode); + + + +} diff --git a/src/main/java/com/glxp/api/service/basic/impl/YbNotCodeServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/YbNotCodeServiceImpl.java new file mode 100644 index 000000000..f9e5418dc --- /dev/null +++ b/src/main/java/com/glxp/api/service/basic/impl/YbNotCodeServiceImpl.java @@ -0,0 +1,44 @@ +package com.glxp.api.service.basic.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.basic.YbNotCodeMapper; +import com.glxp.api.entity.basic.YbNotCode; + +import com.glxp.api.req.basic.YbNotCodeQuery; +import com.glxp.api.service.basic.YbNotCodeService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class YbNotCodeServiceImpl extends ServiceImpl implements YbNotCodeService { + @Resource + private YbNotCodeMapper ybNotCodeMapper; + + @Override + public List 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; + } + + +} diff --git a/src/main/resources/com/glxp/api/dao/basic/YbNotCodeMapper.xml b/src/main/resources/com/glxp/api/dao/basic/YbNotCodeMapper.xml index 3b956e971..d879dd111 100644 --- a/src/main/resources/com/glxp/api/dao/basic/YbNotCodeMapper.xml +++ b/src/main/resources/com/glxp/api/dao/basic/YbNotCodeMapper.xml @@ -12,69 +12,25 @@ ybbm, organizationCode, notCodeType - + select *,CASE + WHEN notCodeType = 1 THEN '部分早期未赋予追溯码' + WHEN notCodeType = 5 THEN '最小包装无追溯码' + WHEN notCodeType = 6 THEN '无追溯码' + WHEN notCodeType = 7 THEN '其他原因' + WHEN notCodeType = 0 THEN '默认不是无码类型' + ELSE '默认不是无码类型' + END AS notCodeTypeName from yb_not_code + + + and ybbm = #{vo.ybbm} + + + and organizationCode = #{vo.organizationCode} + + + and notCodeType = #{vo.notCodeType} + + - - - delete from yb_not_code - where ybbm = #{ybbm,jdbcType=VARCHAR} - - - - insert into yb_not_code (ybbm, organizationCode, notCodeType - ) - values (#{ybbm,jdbcType=VARCHAR}, #{organizationcode,jdbcType=VARCHAR}, #{notcodetype,jdbcType=VARCHAR} - ) - - - - insert into yb_not_code - - - ybbm, - - - organizationCode, - - - notCodeType, - - - - - #{ybbm,jdbcType=VARCHAR}, - - - #{organizationcode,jdbcType=VARCHAR}, - - - #{notcodetype,jdbcType=VARCHAR}, - - - - - - update yb_not_code - - - organizationCode = #{organizationcode,jdbcType=VARCHAR}, - - - notCodeType = #{notcodetype,jdbcType=VARCHAR}, - - - where ybbm = #{ybbm,jdbcType=VARCHAR} - - - - update yb_not_code - set organizationCode = #{organizationcode,jdbcType=VARCHAR}, - notCodeType = #{notcodetype,jdbcType=VARCHAR} - where ybbm = #{ybbm,jdbcType=VARCHAR} - - \ No newline at end of file + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 5dc73a376..bbe1f7760 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -5448,27 +5448,31 @@ CALL Pro_Temp_ColumnWork('io_collect_set', 'drugDealConfirm', + CALL Pro_Temp_ColumnWork('basic_udirel', 'manuReview', 'tinyint NULL DEFAULT b''0'' COMMENT ''是否已人工审核''', 1); CALL Pro_Temp_ColumnWork('basic_udirel', 'notCodeType', - ' tinyint NULL DEFAULT b''0''COMMENT ''无码类型''', + ' tinyint NULL DEFAULT b''0''COMMENT ''无码类型 0、默认不是无码类型;1、部分早期未赋予追溯码;5、最小包装无追溯码;6、无追溯码;7、其他原因''', 1); + + + CALL Pro_Temp_ColumnWork('basic_udirel', 'drugSellingPrice', ' decimal(10, 2) DEFAULT NULL COMMENT ''药品售价''', 1); CALL Pro_Temp_ColumnWork('basic_udirel', 'drugSellingPriceTime', - ' datetime DEFAULT NULL COMMENT ''药品售价''', + ' datetime DEFAULT NULL COMMENT ''售价开始时间''', 1); CALL Pro_Temp_ColumnWork('basic_udirel', 'hangingNetType', - ' tinyint DEFAULT NULL COMMENT ''是否挂网''', + ' tinyint DEFAULT NULL COMMENT ''是否挂网 0 否 1 是''', 1); CREATE TABLE IF NOT EXISTS `yb_not_code` ( `ybbm` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '国家医保目录编码', `organizationCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '机构编码', - `notCodeType` tinyint DEFAULT NULL COMMENT '无码类型 1、部分早期未赋予追溯码 5、最小包装无追溯码 6、无追溯码 7、其他原因 0、默认不是无码类型', + `notCodeType` tinyint DEFAULT NULL COMMENT '无码类型 0、默认不是无码类型;1、部分早期未赋予追溯码;5、最小包装无追溯码;6、无追溯码;7、其他原因', PRIMARY KEY (`ybbm`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='医保无码信息表';