medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/StaticsController.java
@@ -1,8 +1,6 @@ package com.sinata.web.controller.backend; import com.sinata.common.core.domain.R; import com.sinata.system.domain.MedicalWasteStaticsVO; import com.sinata.system.domain.SysDepartment; import com.sinata.system.domain.query.DisposalReportQuery; import com.sinata.system.domain.query.HospitalReportQuery; import com.sinata.system.domain.query.TransformQuery; @@ -10,10 +8,7 @@ import com.sinata.system.service.biz.StaticsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -21,7 +16,6 @@ import javax.validation.Valid; import java.io.IOException; import java.util.List; /** * @author mitao @@ -34,23 +28,6 @@ public class StaticsController { private final StaticsService staticsService; /** * 机构分布-获取机构列表 * * @param type 1:全部 2:医院 3:处置单位 * @return */ //@ApiOperation("机构分布-获取机构列表 1:全部 2:医院 3:处置单位") @GetMapping(value = "/departmentList/{type}") public R<List<SysDepartment>> departmentList(@ApiParam(name = "type", value = "机构类型", required = true) @PathVariable(value = "type") Integer type) { return R.ok(staticsService.departmentList(type)); } //@ApiOperation("医疗监管-医废统计") @GetMapping("/medicalWaste") public R<MedicalWasteStaticsVO> medicalWaste() { return R.ok(staticsService.medicalWaste()); } /** * 医院报表 medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysAgreementController.java
@@ -2,10 +2,14 @@ import com.sinata.common.core.domain.R; import com.sinata.system.domain.dto.SysAgreementDTO; import com.sinata.system.domain.vo.SysAgreementVO; import com.sinata.system.service.SysAgreementService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -29,14 +33,26 @@ private final SysAgreementService sysAgreementService; /** * 根据类型获取协议内容 * * @param type * @return */ @ApiOperation("根据类型获取协议内容") @GetMapping("/{type}") public R<SysAgreementVO> getAgreementByType(@ApiParam(name = "type", value = "协议类型 1:用户注册协议;2:用户隐私协议") @PathVariable("type") Integer type) { return R.ok(sysAgreementService.getAgreementByType(type)); } /** * 保存用户注册协议 * @param dto * @return */ @ApiOperation("保存用户注册协议") @ApiOperation("保存协议") @PostMapping("/save") public R<?> save(@Valid @RequestBody SysAgreementDTO dto){ sysAgreementService.saveAgreement(dto); return R.ok(); } } medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysMenuController.java
@@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** @@ -47,24 +48,34 @@ if (menus.size() == 0) { return AjaxResult.success(new ArrayList<>()); } // 第三级 List<SysMenu> s3 = menus.stream().filter(e -> e.getMenuType().equals("F")).collect(Collectors.toList()); // 第二级 List<SysMenu> s2 = menus.stream().filter(e -> e.getMenuType().equals("C")).collect(Collectors.toList()); // 第一级 List<SysMenu> s1 = menus.stream().filter(e -> e.getMenuType().equals("M")).collect(Collectors.toList()); for (SysMenu menu : s2) { List<SysMenu> collect = s3.stream().filter(e -> e.getParentId().equals(menu.getMenuId())).collect(Collectors.toList()); menu.setChildren(collect); } for (SysMenu menu : s1) { List<SysMenu> collect = s2.stream().filter(e -> e.getParentId().equals(menu.getMenuId())).collect(Collectors.toList()); menu.setChildren(collect); } List<SysMenu> s1 = menus.stream().filter(e -> e.getMenuType().equals("M") && e.getParentId().equals(0L)).collect(Collectors.toList()); // 构建以 parentId 为键的 Map Map<Long, List<SysMenu>> menuMap = menus.stream() .collect(Collectors.groupingBy(SysMenu::getParentId)); // 构建树形结构 buildMenuTree(menuMap, s1); return AjaxResult.success(s1); } /** * 封装树形层级 * * @param menuMap * @param s1 */ public void buildMenuTree(Map<Long, List<SysMenu>> menuMap, List<SysMenu> s1) { for (SysMenu sysMenu : s1) { // 获取当前菜单的子级 List<SysMenu> children = menuMap.getOrDefault(sysMenu.getMenuId(), new ArrayList<>()); sysMenu.setChildren(children); //移除当前菜单 menuMap.remove(sysMenu.getMenuId()); // 递归设置子级菜单 buildMenuTree(menuMap, children); } } /** * 获取菜单列表 */ medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysRoleController.java
@@ -139,6 +139,11 @@ return R.ok(roleService.getManageRoleList(getLoginUser())); } /** * 角色列表 * * @return */ @ApiOperation("角色列表") @GetMapping("/list") public R<List<SysRoleVO>> queryList() { medicalWaste-admin/src/main/java/com/sinata/web/controller/screen/ScreenController.java
New file @@ -0,0 +1,77 @@ package com.sinata.web.controller.screen; import com.sinata.common.core.domain.R; import com.sinata.system.domain.MedicalWasteStaticsVO; import com.sinata.system.domain.vo.ScreenDepartmentVO; import com.sinata.system.domain.vo.TodayMedicalWastePieVO; import com.sinata.system.domain.vo.TotalCollectWeightByTypeVO; import com.sinata.system.service.biz.ScreenService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @author mitao * @date 2025/1/1 */ @Validated @Api(tags = {"数据大屏相关接口"}) @RestController @RequiredArgsConstructor @RequestMapping("/screen") public class ScreenController { private final ScreenService screenService; /** * 获取单位列表 * * @return */ @ApiOperation(value = "获取单位列表", notes = "展示单位分布") @GetMapping(value = "/departmentList") public R<List<ScreenDepartmentVO>> departmentList() { return R.ok(screenService.departmentList()); } /** * 预警数据统计 * * @return */ @ApiOperation("预警数据统计") @GetMapping("/medicalWaste") public R<MedicalWasteStaticsVO> medicalWasteStatics() { return R.ok(screenService.medicalWasteStatics()); } /** * 今日医废类型占比 * * @return */ @ApiOperation("今日医废类型统计占比") @GetMapping("/todayMedicalWastePie") public R<List<TodayMedicalWastePieVO>> todayMedicalWastePie() { return R.ok(screenService.todayMedicalWastePie()); } /** * 各类型医废收集总量 * * @param type * @return */ @ApiOperation("各类型医废收集总量") @GetMapping("/totalCollectWeightByType/{type}") public R<TotalCollectWeightByTypeVO> totalCollectWeightByType(@ApiParam(name = "type", value = "统计类型 1:按周统计 2:按月统计") @PathVariable("type") Integer type) { return R.ok(screenService.totalCollectWeightByType(type)); } } medicalWaste-admin/src/test/java/MybatisPlusGeneraotr.java
@@ -48,7 +48,7 @@ builder // 在这里添加数据库表名 //.addInclude("MW_BOX") .addInclude("MW_DISPOSAL_HANDLE_RECORD_ITEM")// 设置需要生成的表名,多个表之间可以用逗号隔开 .addInclude("MW_TRANSIT_CAR_COLLECT_POINT")// 设置需要生成的表名,多个表之间可以用逗号隔开 // .addExclude("BBZQ_USER","BBZQ_USER_LOG") .controllerBuilder().enableRestStyle() // controller配置策略 .serviceBuilder().formatServiceFileName("%sService") // service配置策略 medicalWaste-common/src/main/java/com/sinata/common/core/domain/entity/SysRole.java
@@ -72,14 +72,30 @@ /** 角色菜单权限 */ @TableField(exist = false) private Set<String> permissions; /** * 可管理角色id */ @TableField("MANAGE_ROLE_ID_STR") private String manageRoleIdStr; /** * 小程序角色标志 */ @TableField("APPLET_FLAG") private Integer appletFlag; public SysRole() { } public Integer getAppletFlag() { return appletFlag; } public void setAppletFlag(Integer appletFlag) { this.appletFlag = appletFlag; } public String getManageRoleIdStr() { return manageRoleIdStr; } medicalWaste-common/src/main/java/com/sinata/common/utils/DateUtils.java
@@ -5,11 +5,14 @@ import java.lang.management.ManagementFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -36,6 +39,7 @@ "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); /** * 获取当前Date型日期 @@ -279,4 +283,136 @@ return result; } // 获得本周一0点时间 public static Date getTimesWeekmorning() { Calendar cal = Calendar.getInstance(); cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return cal.getTime(); } // 获得本周日24点时间 public static Date getTimesWeeknight() { Calendar cal = Calendar.getInstance(); cal.setTime(getTimesWeekmorning()); cal.add(Calendar.DAY_OF_WEEK, 7); return cal.getTime(); } // 获得本月第一天0点时间 public static Date getTimesMonthmorning() { Calendar cal = Calendar.getInstance(); cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); return cal.getTime(); } // 获得本月最后一天24点时间 public static Date getTimesMonthnight() { Calendar cal = Calendar.getInstance(); cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.HOUR_OF_DAY, 24); return cal.getTime(); } /** * 获取本月所有日期字符串列表 * * @param format 日期格式,例如 "yyyy-MM-dd" * @return 本月所有日期的字符串列表 */ public static List<String> getAllDatesOfCurrentMonth(String format) { // 当前日期 LocalDate now = LocalDate.now(); // 本月的第一天 LocalDate firstDayOfMonth = now.withDayOfMonth(1); // 本月的最后一天 LocalDate lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth()); // 日期格式化器 DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); // 结果列表 List<String> dates = new ArrayList<>(); // 从第一天开始循环到最后一天 LocalDate currentDate = firstDayOfMonth; while (!currentDate.isAfter(lastDayOfMonth)) { dates.add(currentDate.format(formatter)); // 格式化为字符串并添加到列表 currentDate = currentDate.plusDays(1); // 日期加一天 } return dates; } /** * 获取本周所有日期字符串列表 * * @param format 日期格式,例如 "yyyy-MM-dd" * @return 本周所有日期的字符串列表 */ public static List<String> getAllDatesOfCurrentWeek(String format) { // 当前日期 LocalDate now = LocalDate.now(); // 本周的星期一(获取当前日期所在周的第一天) LocalDate firstDayOfWeek = now.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY)); // 本周的星期日(获取当前日期所在周的最后一天) LocalDate lastDayOfWeek = firstDayOfWeek.plusDays(6); // 日期格式化器 DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); // 结果列表 List<String> dates = new ArrayList<>(); // 从星期一到星期日循环 LocalDate currentDate = firstDayOfWeek; while (!currentDate.isAfter(lastDayOfWeek)) { dates.add(currentDate.format(formatter)); // 格式化为字符串并添加到列表 currentDate = currentDate.plusDays(1); // 日期加一天 } return dates; } /** * 获取本月月初第一天0点时间,并返回 Date 类型 * * @return 本月月初第一天0点时间(Date 类型) */ public static Date getFirstDayOfCurrentMonthAtMidnight() { // 获取当前日期 LocalDate now = LocalDate.now(); // 获取本月的第一天 LocalDate firstDayOfMonth = now.withDayOfMonth(1); // 将第一天与0点时间合并 LocalDateTime firstDayAtMidnight = firstDayOfMonth.atTime(LocalTime.MIDNIGHT); // 将 LocalDateTime 转换为 Date return Date.from(firstDayAtMidnight.atZone(ZoneId.systemDefault()).toInstant()); } /** * 获取本周初第一天(周一)0点时间,并返回 Date 类型 * * @return 本周初第一天0点时间(Date 类型) */ public static Date getFirstDayOfCurrentWeekAtMidnight() { // 获取当前日期 LocalDate now = LocalDate.now(); // 获取本周的第一天(星期一) LocalDate firstDayOfWeek = now.with(DayOfWeek.MONDAY); // 将星期一与0点时间合并 LocalDateTime firstDayAtMidnight = firstDayOfWeek.atTime(LocalTime.MIDNIGHT); // 将 LocalDateTime 转换为 Date return Date.from(firstDayAtMidnight.atZone(ZoneId.systemDefault()).toInstant()); } } medicalWaste-system/src/main/java/com/sinata/system/domain/MedicalWasteStaticsVO.java
@@ -20,4 +20,40 @@ @ApiModelProperty("今日收集-袋数") private Integer todayCollectBagNum; @ApiModelProperty("今日出库-重量") private BigDecimal todayCheckoutWeight; @ApiModelProperty("今日出库-袋数") private Integer todayCheckoutBagNum; @ApiModelProperty("待转运-重量") private BigDecimal toBeTransportedWeight; @ApiModelProperty("待转运-袋数") private Integer toBeTransportedBagNum; @ApiModelProperty("待转运-重量") private BigDecimal inTransitWeight; @ApiModelProperty("待转运-袋数") private Integer inTransitBagNum; @ApiModelProperty("已入场-重量") private BigDecimal enteredAlreadyWeight; @ApiModelProperty("已入场-袋数") private Integer enteredAlreadyBagNum; @ApiModelProperty("待处置-重量") private BigDecimal toBeDisposedOfWeight; @ApiModelProperty("待处置-袋数") private Integer toBeDisposedOfBagNum; @ApiModelProperty("已处置-重量") private BigDecimal disposedWeight; @ApiModelProperty("已处置-袋数") private Integer disposedBagNum; } medicalWaste-system/src/main/java/com/sinata/system/domain/MwTransitCarCollectPoint.java
New file @@ -0,0 +1,62 @@ package com.sinata.system.domain; import com.baomidou.mybatisplus.annotation.FieldFill; 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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.io.Serializable; import java.util.Date; /** * <p> * 转运车辆已收集路线 * </p> * * @author mitao * @since 2025-01-01 */ @Getter @Setter @TableName("MW_TRANSIT_CAR_COLLECT_POINT") @ApiModel(value = "MwTransitCarCollectPoint对象", description = "转运车辆已收集路线") public class MwTransitCarCollectPoint implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("主键id") @TableId(value = "ID", type = IdType.AUTO) private Long id; @ApiModelProperty("车辆ID") @TableField("CAR_ID") private Long carId; @ApiModelProperty("线路ID") @TableField("ROUTE_ID") private Long routeId; @ApiModelProperty("线路列表 存储单位ID[1,2,3]") @TableField("POINT_LIST") private String pointList; @ApiModelProperty("运输日期") @TableField("TRANSIT_DATE") private Date transitDate; @ApiModelProperty(value = "记录创建时间,前端忽略") @TableField(value = "CREATE_TIME", fill = FieldFill.INSERT) private Date createTime; @ApiModelProperty(value = "记录修改时间,前端忽略") @TableField(value = "UPDATE_TIME", fill = FieldFill.INSERT_UPDATE) private Date updateTime; } medicalWaste-system/src/main/java/com/sinata/system/domain/SysAgreement.java
@@ -37,7 +37,7 @@ @TableField("CONTENT") private String content; @ApiModelProperty("协议类型(1:注册协议)") @ApiModelProperty("协议类型(1:注册协议2:隐私协议)") @TableField("TYPE") private Integer type; medicalWaste-system/src/main/java/com/sinata/system/domain/dto/SysAgreementDTO.java
@@ -12,8 +12,8 @@ @ApiModel("协议数据传输对象") public class SysAgreementDTO { @ApiModelProperty("主键") private Long id; @ApiModelProperty("协议类型 1:用户注册协议;2:用户隐私协议") private Integer type; @ApiModelProperty("内容") private String content; medicalWaste-system/src/main/java/com/sinata/system/domain/vo/MwWarningRecordVO.java
@@ -1,5 +1,6 @@ package com.sinata.system.domain.vo; import cn.idev.excel.annotation.ExcelIgnore; import cn.idev.excel.annotation.ExcelProperty; import com.sinata.system.annotation.FastExcel; import com.sinata.system.conveter.EConverter; @@ -20,6 +21,7 @@ public class MwWarningRecordVO { @ApiModelProperty("预警记录id") @ExcelIgnore private Long id; @ApiModelProperty("预警时间") @@ -27,6 +29,7 @@ private Date warnTime; @ApiModelProperty("预警对象id") @ExcelIgnore private Long warningTargetId; @ApiModelProperty("预警对象") @@ -48,9 +51,11 @@ private Integer status; @ApiModelProperty("单位id") @ExcelIgnore private Long departmentId; @ApiModelProperty("单位名称") @ExcelIgnore private String departmentName; } medicalWaste-system/src/main/java/com/sinata/system/domain/vo/ScreenDepartmentVO.java
New file @@ -0,0 +1,30 @@ package com.sinata.system.domain.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @author mitao * @date 2025/1/1 */ @Data @ApiModel("大屏单位视图对象") public class ScreenDepartmentVO { @ApiModelProperty("区域id") private Long id; @ApiModelProperty("区域名称") private String departmentName; @ApiModelProperty("机构类型 1:区域 2:医疗机构 3:处置单位 4:监管单位") private Integer orgType; @ApiModelProperty("经度") private Double longitude; @ApiModelProperty("纬度") private Double latitude; } medicalWaste-system/src/main/java/com/sinata/system/domain/vo/SysAgreementVO.java
New file @@ -0,0 +1,23 @@ package com.sinata.system.domain.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @author mitao * @date 2025/1/1 */ @Data @ApiModel("用户协议视图对象") public class SysAgreementVO { @ApiModelProperty("主键") private Long id; @ApiModelProperty("协议类型 1:用户注册协议;2:用户隐私协议") private Integer type; @ApiModelProperty("内容") private String content; } medicalWaste-system/src/main/java/com/sinata/system/domain/vo/SysRoleVO.java
@@ -38,4 +38,7 @@ @ApiModelProperty("菜单id列表") private List<Long> menuIds; @ApiModelProperty("小程序角色标志") private Integer appletFlag; } medicalWaste-system/src/main/java/com/sinata/system/domain/vo/TodayMedicalWastePieVO.java
New file @@ -0,0 +1,25 @@ package com.sinata.system.domain.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; /** * @author mitao * @date 2025/1/1 */ @Data @ApiModel("今日医废类型统计占比视图对象") public class TodayMedicalWastePieVO { @ApiModelProperty("医废类型名称") private String medicalWasteStr; @ApiModelProperty("数量") private Integer count; @ApiModelProperty("比例") private BigDecimal proportion; } medicalWaste-system/src/main/java/com/sinata/system/domain/vo/TotalCollectWeightByTypeVO.java
New file @@ -0,0 +1,27 @@ package com.sinata.system.domain.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * @author mitao * @date 2025/1/1 */ @Data @ApiModel("各类型医废收集总量视图对象") public class TotalCollectWeightByTypeVO { @ApiModelProperty("日期列表") private List<String> dateList; @ApiModelProperty("医废类型列表") private List<String> wasteTypeList = new ArrayList<>(); @ApiModelProperty("各日期各类型医废收集总量列表") private List<List<BigDecimal>> totalCollectWeightList = new ArrayList<>(); } medicalWaste-system/src/main/java/com/sinata/system/mapper/MwCollectRecordMapper.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.sinata.system.domain.MedicalWasteStaticsVO; import com.sinata.system.domain.MwCollectRecord; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.sinata.system.domain.dto.CollectCarTotalUpDto; @@ -94,4 +95,12 @@ * @return */ List<MwCollectRecordWarningVO> queryListGroupByDepartment(); /** * 预警数据统计 * * @param id * @return */ MedicalWasteStaticsVO queryMedicalWasteStatics(String treeCode); } medicalWaste-system/src/main/java/com/sinata/system/mapper/MwTransitCarCollectPointMapper.java
New file @@ -0,0 +1,18 @@ package com.sinata.system.mapper; import com.sinata.system.domain.MwTransitCarCollectPoint; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** * <p> * 转运车辆已收集路线 Mapper 接口 * </p> * * @author mitao * @since 2025-01-01 */ @Mapper public interface MwTransitCarCollectPointMapper extends BaseMapper<MwTransitCarCollectPoint> { } medicalWaste-system/src/main/java/com/sinata/system/mapper/xml/MwTransitCarCollectPointMapper.xml
New file @@ -0,0 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.sinata.system.mapper.MwTransitCarCollectPointMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.sinata.system.domain.MwTransitCarCollectPoint"> <id column="ID" property="id" /> <result column="CREATE_TIME" property="createTime" /> <result column="UPDATE_TIME" property="updateTime" /> <result column="CAR_ID" property="carId" /> <result column="ROUTE_ID" property="routeId" /> <result column="POINT_LIST" property="pointList" /> <result column="TRANSIT_DATE" property="transitDate" /> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> CREATE_TIME, UPDATE_TIME, ID, CAR_ID, ROUTE_ID, POINT_LIST, TRANSIT_DATE </sql> </mapper> medicalWaste-system/src/main/java/com/sinata/system/service/MwCollectRecordService.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.sinata.common.entity.PageDTO; import com.sinata.system.domain.MedicalWasteStaticsVO; import com.sinata.system.domain.MwCollectRecord; import com.sinata.system.domain.dto.CollectCarTotalUpDto; import com.sinata.system.domain.dto.CollectDto; @@ -103,4 +104,12 @@ * @return */ List<MwCollectRecordWarningVO> queryListGroupByDepartment(); /** * 预警数据统计 * * @param id * @return */ MedicalWasteStaticsVO queryMedicalWasteStatics(String treeCode); } medicalWaste-system/src/main/java/com/sinata/system/service/MwTransitCarCollectPointService.java
New file @@ -0,0 +1,16 @@ package com.sinata.system.service; import com.sinata.system.domain.MwTransitCarCollectPoint; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 转运车辆已收集路线 服务类 * </p> * * @author mitao * @since 2025-01-01 */ public interface MwTransitCarCollectPointService extends IService<MwTransitCarCollectPoint> { } medicalWaste-system/src/main/java/com/sinata/system/service/SysAgreementService.java
@@ -3,6 +3,7 @@ import com.sinata.system.domain.SysAgreement; import com.baomidou.mybatisplus.extension.service.IService; import com.sinata.system.domain.dto.SysAgreementDTO; import com.sinata.system.domain.vo.SysAgreementVO; /** * <p> @@ -18,4 +19,12 @@ * @param dto */ void saveAgreement(SysAgreementDTO dto); /** * 根据类型获取协议内容 * * @param type * @return */ SysAgreementVO getAgreementByType(Integer type); } medicalWaste-system/src/main/java/com/sinata/system/service/biz/ScreenService.java
New file @@ -0,0 +1,163 @@ package com.sinata.system.service.biz; import cn.hutool.core.date.DateUtil; import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; import com.sinata.common.utils.CollUtils; import com.sinata.common.utils.DateUtils; import com.sinata.system.domain.MedicalWasteStaticsVO; import com.sinata.system.domain.MwCollectRecord; import com.sinata.system.domain.SysDepartment; import com.sinata.system.domain.vo.ScreenDepartmentVO; import com.sinata.system.domain.vo.SysDictDataVO; import com.sinata.system.domain.vo.TodayMedicalWastePieVO; import com.sinata.system.domain.vo.TotalCollectWeightByTypeVO; import com.sinata.system.enums.DepartmentEnum; import com.sinata.system.service.ISysDictDataService; import com.sinata.system.service.MwCollectRecordService; import com.sinata.system.service.SysDepartmentService; import lombok.RequiredArgsConstructor; import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** * @author mitao * @date 2025/1/1 */ @Service @RequiredArgsConstructor public class ScreenService { private final SysDepartmentService sysDepartmentService; private final MwCollectRecordService mwCollectRecordService; private final ISysDictDataService sysDictDataService; /** * 机构分布-获取机构列表 * * @return */ public List<ScreenDepartmentVO> departmentList() { SysDepartment department = getNanNingDepartment(); List<SysDepartment> list = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, department.getTreeCode()).in(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode(), DepartmentEnum.DISPOSAL_UNIT.getCode()).list(); return BeanUtils.copyToList(list, ScreenDepartmentVO.class); } /** * 预警数据统计 * * @return */ public MedicalWasteStaticsVO medicalWasteStatics() { SysDepartment department = getNanNingDepartment(); return mwCollectRecordService.queryMedicalWasteStatics(department.getTreeCode()); } /** * 查询南宁市 * * @return */ @NotNull private SysDepartment getNanNingDepartment() { SysDepartment department = sysDepartmentService.lambdaQuery().eq(SysDepartment::getDepartmentName, "南宁市").one(); if (Objects.isNull(department)) { throw new ServiceException("南宁市不存在!"); } return department; } /** * 今日医废类型统计占比 * * @return */ public List<TodayMedicalWastePieVO> todayMedicalWastePie() { SysDepartment nanNingDepartment = getNanNingDepartment(); //查询南宁市下面的医疗机构 List<SysDepartment> list = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, nanNingDepartment.getTreeCode()).eq(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode()).list(); List<Long> departmentIdList = list.stream().map(SysDepartment::getId).collect(Collectors.toList()); List<TodayMedicalWastePieVO> todayMedicalWastePieVOList = new ArrayList<>(); if (CollUtils.isEmpty(departmentIdList)) { return todayMedicalWastePieVOList; } //查询收集记录 List<MwCollectRecord> collectRecordList = mwCollectRecordService.lambdaQuery() .in(MwCollectRecord::getDepartmentId, departmentIdList).list(); if (CollUtils.isEmpty(collectRecordList)) { return todayMedicalWastePieVOList; } int total = collectRecordList.size(); // 分组并统计每个 wasteTypeStr 对应的记录数 Map<String, Long> resultMap = collectRecordList.stream() .collect(Collectors.groupingBy(MwCollectRecord::getWasteTypeStr, Collectors.counting())); todayMedicalWastePieVOList = resultMap.entrySet().stream().map(entry -> { TodayMedicalWastePieVO todayMedicalWastePieVO = new TodayMedicalWastePieVO(); todayMedicalWastePieVO.setMedicalWasteStr(entry.getKey()); todayMedicalWastePieVO.setCount(entry.getValue().intValue()); todayMedicalWastePieVO.setProportion(BigDecimal.valueOf(entry.getValue()).divide(BigDecimal.valueOf(total), RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100))); return todayMedicalWastePieVO; }).collect(Collectors.toList()); return todayMedicalWastePieVOList; } /** * 各类型医废收集总量 * * @param type * @return */ public TotalCollectWeightByTypeVO totalCollectWeightByType(Integer type) { SysDepartment nanNingDepartment = getNanNingDepartment(); TotalCollectWeightByTypeVO vo = new TotalCollectWeightByTypeVO(); Date startTime = DateUtils.getNowDate(); Date endTime = DateUtils.getNowDate(); if (type.equals(1)) { //获取最本周的日期 vo.setDateList(DateUtils.getAllDatesOfCurrentWeek("MM-dd")); startTime = DateUtils.getFirstDayOfCurrentWeekAtMidnight(); } else { //最近一个月的日期 vo.setDateList(DateUtils.getAllDatesOfCurrentMonth("MM-dd")); startTime = DateUtils.getFirstDayOfCurrentMonthAtMidnight(); } //查询医废类型 List<SysDictDataVO> medicalWasteTypeList = sysDictDataService.medicalWasteTypeList(); //查询南宁市下面的医疗机构 List<SysDepartment> list = sysDepartmentService.lambdaQuery() .likeRight(SysDepartment::getTreeCode, nanNingDepartment.getTreeCode()) .eq(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode()).list(); List<Long> departmentIdList = list.stream().map(SysDepartment::getId).collect(Collectors.toList()); if (CollUtils.isEmpty(departmentIdList)) { return vo; } //查询医废收集记录 List<MwCollectRecord> collectRecordList = mwCollectRecordService.lambdaQuery() .in(MwCollectRecord::getDepartmentId, departmentIdList).between(MwCollectRecord::getCollectTime, startTime, endTime).list(); if (CollUtils.isEmpty(collectRecordList)) { return vo; } //封装数据 for (SysDictDataVO sysDictDataVO : medicalWasteTypeList) { List<BigDecimal> totalCollectWeightList = new ArrayList<>(); for (String date : vo.getDateList()) { BigDecimal totalWeight = collectRecordList.stream().filter(record -> DateUtil.format(record.getCollectTime(), "MM-dd").equals(date) && record.getWasteType().equals(sysDictDataVO.getDictCode())).map(MwCollectRecord::getWeight).reduce(BigDecimal.ZERO, BigDecimal::add); totalCollectWeightList.add(totalWeight); } vo.getTotalCollectWeightList().add(totalCollectWeightList); } return vo; } } medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java
@@ -61,19 +61,7 @@ private final MwDisposalRecordService mwDisposalRecordService; private final MwDisposalHandleRecordService mwDisposalHandleRecordService; /** * 机构分布-获取机构列表 * * @param type 1:全部 2:医院 3:处置单位 * @return */ public List<SysDepartment> departmentList(Integer type) { return sysDepartmentService.lambdaQuery().eq(type != 1, SysDepartment::getOrgType, type).list(); } public MedicalWasteStaticsVO medicalWaste() { return null; } /** * 医院报表 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwCollectRecordServiceImpl.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.entity.PageDTO; import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.MedicalWasteStaticsVO; import com.sinata.system.domain.MwCollectRecord; import com.sinata.system.domain.dto.CollectCarTotalUpDto; import com.sinata.system.domain.dto.CollectDto; @@ -174,8 +175,24 @@ return baseMapper.queryListTimeType(2); } /** * 医疗机构存储量预警 * * @return */ @Override public List<MwCollectRecordWarningVO> queryListGroupByDepartment() { return baseMapper.queryListGroupByDepartment(); } /** * 预警数据统计 * * @param id * @return */ @Override public MedicalWasteStaticsVO queryMedicalWasteStatics(String treeCode) { return baseMapper.queryMedicalWasteStatics(treeCode); } } medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwTransitCarCollectPointServiceImpl.java
New file @@ -0,0 +1,20 @@ package com.sinata.system.service.impl; import com.sinata.system.domain.MwTransitCarCollectPoint; import com.sinata.system.mapper.MwTransitCarCollectPointMapper; import com.sinata.system.service.MwTransitCarCollectPointService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** * <p> * 转运车辆已收集路线 服务实现类 * </p> * * @author mitao * @since 2025-01-01 */ @Service public class MwTransitCarCollectPointServiceImpl extends ServiceImpl<MwTransitCarCollectPointMapper, MwTransitCarCollectPoint> implements MwTransitCarCollectPointService { } medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysAgreementServiceImpl.java
@@ -1,12 +1,16 @@ package com.sinata.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.utils.BeanUtils; import com.sinata.system.domain.SysAgreement; import com.sinata.system.domain.dto.SysAgreementDTO; import com.sinata.system.domain.vo.SysAgreementVO; import com.sinata.system.mapper.SysAgreementMapper; import com.sinata.system.service.SysAgreementService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Optional; /** * <p> @@ -18,12 +22,34 @@ */ @Service public class SysAgreementServiceImpl extends ServiceImpl<SysAgreementMapper, SysAgreement> implements SysAgreementService { /** * @param type * @return */ @Override public SysAgreementVO getAgreementByType(Integer type) { Optional<SysAgreement> sysAgreement = lambdaQuery().eq(SysAgreement::getType, type).oneOpt(); SysAgreementVO sysAgreementVO = null; if (sysAgreement.isPresent()) { SysAgreement item = sysAgreement.get(); sysAgreementVO = BeanUtils.copyBean(item, SysAgreementVO.class); return sysAgreementVO; } return sysAgreementVO; } /** * 保存协议 * * @param dto */ @Override @Transactional(rollbackFor = Exception.class) public void saveAgreement(SysAgreementDTO dto) { SysAgreement sysAgreement = lambdaQuery().eq(SysAgreement::getType, 1).oneOpt().orElse(new SysAgreement()); sysAgreement.setContent(dto.getContent()); sysAgreement.setType(1); SysAgreement sysAgreement = BeanUtils.copyBean(dto, SysAgreement.class); lambdaQuery().eq(SysAgreement::getType, dto.getType()).oneOpt().ifPresent(item -> sysAgreement.setId(item.getId())); saveOrUpdate(sysAgreement); } } medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysRoleServiceImpl.java
@@ -13,6 +13,7 @@ import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; import com.sinata.common.utils.CollUtils; import com.sinata.common.utils.DateUtils; import com.sinata.common.utils.SecurityUtils; import com.sinata.common.utils.StringUtils; import com.sinata.common.utils.spring.SpringUtils; @@ -466,14 +467,19 @@ @Override public void saveRole(SysRoleDTO dto) { SysRole sysRole = BeanUtils.copyBean(dto, SysRole.class); if (!this.checkRoleNameUnique(sysRole)) { throw new ServiceException("保存角色'" + sysRole.getRoleName() + "'失败,角色名称已存在"); } if (Objects.isNull(sysRole.getRoleId())) { sysRole.setCreateBy(SecurityUtils.getUserId().toString()); sysRole.setCreateTime(DateUtils.getNowDate()); baseMapper.insert(sysRole); } else { // 删除角色与菜单关联 roleMenuMapper.deleteRoleMenuByRoleId(sysRole.getRoleId()); sysRole.setUpdateBy(SecurityUtils.getUserId().toString()); sysRole.setUpdateTime(DateUtils.getNowDate()); baseMapper.updateById(sysRole); } insertRoleMenu(sysRole); medicalWaste-system/src/main/resources/mapper/system/MwCollectRecordMapper.xml
@@ -404,5 +404,48 @@ </where> GROUP BY MCR.DEPARTMENT_ID </select> <select id="queryMedicalWasteStatics" resultType="com.sinata.system.domain.MedicalWasteStaticsVO" parameterType="java.lang.Long"> SELECT -- 今日收集 COALESCE(SUM(CASE WHEN TRUNC(MCR.COLLECT_TIME) = TRUNC(SYSDATE) THEN MCR.WEIGHT ELSE 0 END), 0) AS todayCollectWeight, COALESCE(COUNT(CASE WHEN TRUNC(MCR.COLLECT_TIME) = TRUNC(SYSDATE) THEN MCR.ID ELSE NULL END), 0) AS todayCollectBagNum, -- 今日出库 COALESCE(SUM(CASE WHEN TRUNC(MCR.CHECKOUT_TIME) = TRUNC(SYSDATE) THEN MCR.WEIGHT ELSE 0 END), 0) AS todayCheckoutWeight, COALESCE(COUNT(CASE WHEN TRUNC(MCR.CHECKOUT_TIME) = TRUNC(SYSDATE) THEN MCR.ID ELSE NULL END), 0) AS todayCheckoutBagNum, -- 待转运(状态为 1 暂存中) COALESCE(SUM(CASE WHEN MCR.STATUS = 1 THEN MCR.WEIGHT ELSE 0 END), 0) AS toBeTransportedWeight, COALESCE(COUNT(CASE WHEN MCR.STATUS = 1 THEN MCR.ID ELSE NULL END), 0) AS toBeTransportedBagNum, -- 运输中(状态为 2 运输中) COALESCE(SUM(CASE WHEN MCR.STATUS = 2 THEN MCR.WEIGHT ELSE 0 END), 0) AS inTransitWeight, COALESCE(COUNT(CASE WHEN MCR.STATUS = 2 THEN MCR.ID ELSE NULL END), 0) AS inTransitBagNum, -- 已入场(状态为 3 已接收) COALESCE(SUM(CASE WHEN MCR.STATUS = 3 THEN MCR.WEIGHT ELSE 0 END), 0) AS enteredAlreadyWeight, COALESCE(COUNT(CASE WHEN MCR.STATUS = 3 THEN MCR.ID ELSE NULL END), 0) AS enteredAlreadyBagNum, -- 待处置(状态为 4 待处置) COALESCE(SUM(CASE WHEN MCR.STATUS = 4 THEN MCR.WEIGHT ELSE 0 END), 0) AS toBeDisposedOfWeight, COALESCE(COUNT(CASE WHEN MCR.STATUS = 4 THEN MCR.ID ELSE NULL END), 0) AS toBeDisposedOfBagNum, -- 已处置(状态为 5 已处置) COALESCE(SUM(CASE WHEN MCR.STATUS = 5 THEN MCR.WEIGHT ELSE 0 END), 0) AS disposedWeight, COALESCE(COUNT(CASE WHEN MCR.STATUS = 5 THEN MCR.ID ELSE NULL END), 0) AS disposedBagNum FROM MW_COLLECT_RECORD MCR LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MCR.DEPARTMENT_ID <where> MCR.DEL_FLAG = 0 <if test="treeCode != null and treeCode != ''"> AND SD.TREE_CODE LIKE CONCAT(#{treeCode},'%') </if> </where> </select> </mapper> medicalWaste-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -27,7 +27,8 @@ r.del_flag, r.create_time, r.remark, r.manage_role_id_str r.manage_role_id_str, r.applet_flag from sys_role r left join sys_user_role ur on ur.role_id = r.role_id left join sys_user u on u.user_id = ur.user_id @@ -118,6 +119,7 @@ SYS_ROLE r2 ON INSTR(r.MANAGE_ROLE_ID_STR, TO_CHAR(r2.ROLE_ID)) > 0 LEFT JOIN SYS_USER u ON r.CREATE_BY = u.USER_ID <where> r.DEL_FLAG =0 AND r.APPLET_FLAG = 0 <if test="keyword != null and keyword != ''"> AND r.ROLE_NAME LIKE CONCAT('%', #{keyword}, '%') </if>