Merge remote-tracking branch 'origin/master'
| | |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | <finalName>yifei-nanning-admin-1.0.0</finalName> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | |
| | | /** |
| | | * 启动程序 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @EnableScheduling |
| | | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| | | public class RuoYiApplication |
| | | { |
| | |
| | | |
| | | import com.sinata.system.domain.MwWarningRecord; |
| | | import com.sinata.system.enums.WarningStatusEnum; |
| | | import com.sinata.system.service.MwCollectRecordService; |
| | | import com.sinata.system.service.MwContractService; |
| | | import com.sinata.system.service.MwProtectionEquipmentRecordService; |
| | | import com.sinata.system.service.MwProtectionEquipmentService; |
| | | import com.sinata.system.service.MwStaffService; |
| | | import com.sinata.system.service.MwStagingRoomService; |
| | | import com.sinata.system.service.MwWarningConfigItemService; |
| | | import com.sinata.system.service.MwWarningConfigService; |
| | | import com.sinata.system.service.MwWarningRecordService; |
| | | import com.sinata.system.service.biz.TaskService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class WarningTask { |
| | | private final MwWarningConfigService mwWarningConfigService; |
| | | private final MwWarningConfigItemService mwWarningConfigItemService; |
| | | private final MwCollectRecordService mwCollectRecordService; |
| | | private final MwWarningRecordService mwWarningRecordService; |
| | | private final MwStagingRoomService mwStagingRoomService; |
| | | private final MwContractService mwContractService; |
| | | private final MwStaffService mwStaffService; |
| | | private final MwProtectionEquipmentService mwProtectionEquipmentService; |
| | | private final MwProtectionEquipmentRecordService mwProtectionEquipmentRecordService; |
| | | private final TaskService taskService; |
| | | |
| | | /** |
| | |
| | | package com.sinata.web.controller.applet; |
| | | |
| | | import com.sinata.common.core.domain.AjaxResult; |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.core.redis.RedisCache; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.MwApplication; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.service.MwApplicationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | if (!mwApplication.getCode().equals(string)){ |
| | | return R.fail("验证码错误,请重试"); |
| | | } |
| | | mwApplication.setAuditStatus(1); |
| | | mwApplication.setCreateTime(new Date()); |
| | | mwApplicationService.save(mwApplication); |
| | | mwApplicationService.saveApplication(mwApplication); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | # 主库数据源 |
| | | master: |
| | | # url: jdbc:mysql://localhost:3306/medical_waste?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:dm://192.168.110.188:5236/MEDICAL_WASTE?schema=MEDICAL_WASTE |
| | | url: jdbc:dm://47.108.162.242:5326/MEDICAL_WASTE?schema=MEDICAL_WASTE |
| | | username: SYSDBA |
| | | password: SYSDBA |
| | | password: NanNingYiFei2025@ |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8080 |
| | | port: 8090 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 123456 |
| | | # password: 123456 |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | |
| | | # 主库数据源 |
| | | master: |
| | | # url: jdbc:mysql://localhost:3306/medical_waste?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:dm://192.168.110.188:5236/MEDICAL_WASTE?schema=MEDICAL_WASTE |
| | | url: jdbc:dm://47.108.162.242:5326/MEDICAL_WASTE?schema=MEDICAL_WASTE |
| | | username: SYSDBA |
| | | password: SYSDBA |
| | | password: NanNingYiFei2025@ |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | |
| | | debug: false |
| | | loginTemplateCode: SMS_246140477 |
| | | auditTemplateCode: SMS_476730213 |
| | | |
| | | medical: |
| | | crons: |
| | | checkout-over-time: 0 0/60 * * * ? # 每小时执行一次 |
| | | staging-room-capacity: 0 * */3 * * ? # 每三小时执行一次 |
| | | contract-expire: 0 0 0 * * ? # 每日0点执行 |
| | | health-vaccine-record: 0 0 1 * * ? # 每日1点执行 |
| | | protection-equipment-use-stock: 0 0 2 * * ? # 每日2点执行 |
| | | medical-institution-waste-day: 0 0 3 * * ? # 每日3点执行 |
| | | medical-institution-waste-month: 0 30 0 1 * ? # 每月1日0点30分执行 |
| | | medical-institution-waste-storage: 0 0 4 * * ? # 每日4点执行 |
| | | transit-car: 0 0 0/1 * * ? # 每小时执行一次 |
| | | disposal-unit-storage: 0 0 5 * * ? |
| | |
| | | .authorizeHttpRequests((requests) -> { |
| | | permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); |
| | | // 对于登录login 注册register 验证码captchaImage 允许匿名访问 |
| | | requests.antMatchers("/backend/login","/applet/mwApplication/set","/applet/file/upload","/applet/sysDepartment/departmentSearchTree","/applet/set/getCode","/applet/getCode","/applet/login", "/register", "/captchaImage").permitAll() |
| | | requests.antMatchers("/backend/login","/applet/mwApplication/set","/applet/file/upload","/applet/sysDepartment/departmentSearchTree","/applet/set/getCode","/applet/getCode","/applet/login", "/register", "/captchaImage", "/applet/sysAgreement/get", "/applet/sysAgreement/primary/get").permitAll() |
| | | // 静态资源,可匿名访问 |
| | | .antMatchers(HttpMethod.GET, "/", "/msg", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| | | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.sinata.common.entity.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @TableName("MW_WARNING_RECORD") |
| | | @ApiModel(value = "MwWarningRecord对象", description = "预警记录表") |
| | | public class MwWarningRecord extends BaseModel { |
| | | public class MwWarningRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @ApiModelProperty("正常范围") |
| | | @TableField("NORMAL_RANGE") |
| | | private String normalRange; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @ApiModelProperty(value = "记录创建人,前端忽略") |
| | | @TableField(value = "create_by") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value = "记录创建时间,前端忽略") |
| | | @TableField(value = "create_time") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @ApiModelProperty(value = "记录修改人,前端忽略") |
| | | @TableField(value = "update_by") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @ApiModelProperty(value = "记录修改时间,前端忽略") |
| | | @TableField(value = "update_time") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 是否删除 0未删除 1已删除 |
| | | */ |
| | | @TableField("del_flag") |
| | | @ApiModelProperty(value = "是否删除 0未删除 1已删除") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | } |
| | |
| | | @ApiModelProperty("医废类型") |
| | | private String wasteTypeStr; |
| | | |
| | | @ApiModelProperty("大屏统计颜色") |
| | | private String cssClass; |
| | | |
| | | @ApiModelProperty("袋数") |
| | | private Integer bagNum; |
| | | |
| | |
| | | @ApiModelProperty("运输-医院签名") |
| | | private String hospitalSignature; |
| | | |
| | | @ApiModelProperty("运输-车牌号") |
| | | private String licensePlateNumber; |
| | | |
| | | @ApiModelProperty("入库-入库时间") |
| | | private Date receiveTime; |
| | | |
| | |
| | | private Long departmentId; |
| | | |
| | | @ApiModelProperty("所属区域") |
| | | private String departmentName; |
| | | |
| | | @ApiModelProperty("所属区域") |
| | | private String region; |
| | | |
| | | @ApiModelProperty("单位类型 1:医疗机构 2:处置单位") |
| | |
| | | |
| | | @ApiModelProperty(value = "申请时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("层级关系") |
| | | private String relation; |
| | | } |
| | |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnore; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import com.sinata.system.annotation.FastExcel; |
| | | import com.sinata.system.conveter.EConverter; |
| | | import com.sinata.system.enums.MedicalWasteStatusEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private Long departmentId; |
| | | |
| | | @ApiModelProperty("医院名称") |
| | | @ExcelProperty(value = "医院", index = 2) |
| | | @ExcelProperty(value = "医院", index = 1) |
| | | private String hospitalName; |
| | | |
| | | @ApiModelProperty("暂存间id") |
| | |
| | | private Long stagingRoomId; |
| | | |
| | | @ApiModelProperty("医废编号") |
| | | @ExcelProperty(value = "医废编号", index = 3) |
| | | @ExcelProperty(value = "医废编号", index = 2) |
| | | private String medicalWasteNumber; |
| | | |
| | | @ApiModelProperty("转运箱id") |
| | |
| | | private Long boxId; |
| | | |
| | | @ApiModelProperty("箱子编号") |
| | | @ExcelProperty(value = "箱子编号", index = 4) |
| | | @ExcelProperty(value = "箱子编号", index = 3) |
| | | private String boxNumber; |
| | | |
| | | @ApiModelProperty("医废类型(数据字典id)") |
| | | @ExcelIgnore |
| | | private Long wasteType; |
| | | |
| | | @ApiModelProperty("医废类型名称") |
| | | @ExcelProperty(value = "医废类型", index = 5) |
| | | @ExcelProperty(value = "医废类型", index = 4) |
| | | private String wasteTypeStr; |
| | | |
| | | @ApiModelProperty("医废重量") |
| | | @ExcelProperty(value = "医废重量", index = 6) |
| | | @ExcelProperty(value = "医废重量", index = 5) |
| | | private BigDecimal weight; |
| | | |
| | | @ApiModelProperty("出库人员id") |
| | |
| | | private Date checkoutTime; |
| | | |
| | | @ApiModelProperty("医废状态 1:暂存中 2:运输中 3:已接收 4:已处置") |
| | | @ExcelProperty(value = "医废状态", index = 8) |
| | | @ExcelProperty(value = "医废状态", index = 7, converter = EConverter.class) |
| | | @FastExcel(type = MedicalWasteStatusEnum.class) |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("封箱时间") |
| | |
| | | private Long collectUserId; |
| | | |
| | | @ApiModelProperty("收集人姓名") |
| | | @ExcelProperty(value = "收集人", index = 7) |
| | | @ExcelProperty(value = "收集人", index = 6) |
| | | private String collectUserName; |
| | | |
| | | @ApiModelProperty("收集时间") |
| | | @ExcelProperty(value = "收集时间", index = 1) |
| | | @ExcelProperty(value = "收集时间", index = 0) |
| | | private Date collectTime; |
| | | } |
| | |
| | | @ApiModel("预警记录统计视图对象") |
| | | public class MwWarningRecordStaticsVO { |
| | | |
| | | @ApiModelProperty("预警类型 1:出库超时预警;2:暂存间使用率预警;3:合同到期预警;4:健康记录预警;5:疫苗记录预警;6:防护用品使用预警;7:医疗机构产废日预警;8:医疗机构产废月预警;9:医疗机构存储量预警;10:车辆转运异常预警;11:处置单位存储量预警") |
| | | @ApiModelProperty("预警类型 1:出库超时预警 2:暂存间使用率预警 3:合同到期预警 4:健康记录预警 \" +\n" + |
| | | " \"5:疫苗记录预警 6:防护用品使用预警 7:防护用品库存预警 8:医疗机构产废日预警 \" +\n" + |
| | | " \"9:医疗机构产废月预警 10:医疗机构存储量预警 11:车辆转运异常预警 12:处置单位存储量预警") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("预警类型名称") |
| | |
| | | @ExcelProperty(value = "预警对象", index = 2) |
| | | private String warningTargetName; |
| | | |
| | | @ApiModelProperty("预警类型 1:出库超时预警;2:暂存间使用率预警;3:合同到期预警;4:健康记录预警;5:疫苗记录预警;6:防护用品使用预警;7:医疗机构产废日预警;8:医疗机构产废月预警;9:医疗机构存储量预警;10:车辆转运异常预警;11:处置单位存储量预警") |
| | | @ApiModelProperty("预警类型 1:出库超时预警 2:暂存间使用率预警 3:合同到期预警 4:健康记录预警 \" +\n" + |
| | | " \"5:疫苗记录预警 6:防护用品使用预警 7:防护用品库存预警 8:医疗机构产废日预警 \" +\n" + |
| | | " \"9:医疗机构产废月预警 10:医疗机构存储量预警 11:车辆转运异常预警 12:处置单位存储量预警") |
| | | @ExcelProperty(value = "预警类型", index = 3, converter = EConverter.class) |
| | | @FastExcel(type = WarningTypeEnum.class) |
| | | private Integer type; |
| | |
| | | |
| | | @ApiModelProperty("字典类型") |
| | | private String dictType; |
| | | |
| | | @ApiModelProperty("字典类型名称") |
| | | private String dictTypeName; |
| | | |
| | | @ApiModelProperty("大屏统计颜色") |
| | | private String cssClass; |
| | | |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | |
| | | @ApiModelProperty("医废类型名称") |
| | | private String medicalWasteStr; |
| | | |
| | | @ApiModelProperty("大屏统计颜色") |
| | | private String cssClass; |
| | | |
| | | @ApiModelProperty("数量") |
| | | private Integer count; |
| | | |
| | |
| | | private List<String> dateList; |
| | | |
| | | @ApiModelProperty("医废类型列表") |
| | | private List<String> wasteTypeList = new ArrayList<>(); |
| | | private List<SysDictDataVO> wasteTypeList = new ArrayList<>(); |
| | | |
| | | @ApiModelProperty("各日期各类型医废收集总量列表") |
| | | private List<List<BigDecimal>> totalCollectWeightList = new ArrayList<>(); |
| | |
| | | * @return |
| | | */ |
| | | void audit(MwApplicationDTO dto); |
| | | |
| | | void saveApplication(MwApplication mwApplication); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.MwApplication; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.DisposalUnitDTO; |
| | | import com.sinata.system.domain.dto.MedicalInstitutionDTO; |
| | |
| | | List<DisposalUnitVO> getDisposalUnitListByParentId(Long id); |
| | | |
| | | /** |
| | | * 获取完整区域 |
| | | * |
| | | * @param department |
| | | * @return |
| | | */ |
| | | String getRegionName(SysDepartment department); |
| | | |
| | | /** |
| | | * 删除医疗机构 |
| | | * |
| | | * @param id |
| | |
| | | * @return |
| | | */ |
| | | List<MedicalInstitutionVO> getHospitalListByRouteId(Long id); |
| | | |
| | | /** |
| | | * 创建机构 |
| | | * |
| | | * @param mwApplication |
| | | */ |
| | | void createDepartment(MwApplication mwApplication); |
| | | } |
| | |
| | | package com.sinata.system.service.biz; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | 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.MwTransitCarCollectPoint; |
| | | import com.sinata.system.domain.MwWarningRecord; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.vo.CarDistributionVO; |
| | |
| | | */ |
| | | public DepartmentTagInfoVO getTagInfo(Long id) { |
| | | SysDepartment department = sysDepartmentService.getById(id); |
| | | DepartmentTagInfoVO vo = null; |
| | | DepartmentTagInfoVO vo = new DepartmentTagInfoVO(); |
| | | if (Objects.isNull(department)) { |
| | | throw new ServiceException("单位不存在"); |
| | | } |
| | |
| | | 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 -> { |
| | | //查询医废类型列表 |
| | | List<SysDictDataVO> sysDictDataVOS = sysDictDataService.medicalWasteTypeList(); |
| | | // 分组并统计每个 wasteType 对应的记录数 |
| | | Map<Long, Long> resultMap = collectRecordList.stream() |
| | | .collect(Collectors.groupingBy(MwCollectRecord::getWasteType, Collectors.counting())); |
| | | todayMedicalWastePieVOList = sysDictDataVOS.stream().map(sysDictDataVO -> { |
| | | Long count = resultMap.getOrDefault(sysDictDataVO.getDictCode(), 0L); |
| | | 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))); |
| | | todayMedicalWastePieVO.setMedicalWasteStr(sysDictDataVO.getDictLabel()); |
| | | todayMedicalWastePieVO.setCssClass(sysDictDataVO.getCssClass()); |
| | | todayMedicalWastePieVO.setCount(count.intValue()); |
| | | todayMedicalWastePieVO.setProportion(BigDecimal.valueOf(count).divide(BigDecimal.valueOf(total), 4, RoundingMode.FLOOR).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.FLOOR)); |
| | | return todayMedicalWastePieVO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | return todayMedicalWastePieVOList; |
| | | } |
| | | |
| | |
| | | } |
| | | //查询医废类型 |
| | | List<SysDictDataVO> medicalWasteTypeList = sysDictDataService.medicalWasteTypeList(); |
| | | |
| | | vo.setWasteTypeList(medicalWasteTypeList); |
| | | //查询南宁市下面的医疗机构 |
| | | List<SysDepartment> list = sysDepartmentService.lambdaQuery() |
| | | .likeRight(SysDepartment::getTreeCode, nanNingDepartment.getTreeCode()) |
| | |
| | | medicalWasteCollectVO.setWasteTypeStr(sysDictDataVO.getDictLabel()); |
| | | |
| | | // 获取当前类型的医废记录 |
| | | List<MwCollectRecord> mwCollectRecords = collectRecordGroupByWasteType.get(sysDictDataVO.getDictCode()); |
| | | if (CollUtils.isNotEmpty(mwCollectRecords)) { |
| | | medicalWasteCollectVO.setBagNum(mwCollectRecords.size()); |
| | | medicalWasteCollectVO.setWeight(mwCollectRecords.stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | } else { |
| | | medicalWasteCollectVO.setBagNum(0); |
| | | medicalWasteCollectVO.setWeight(BigDecimal.ZERO); |
| | | } |
| | | List<MwCollectRecord> mwCollectRecords = collectRecordGroupByWasteType.getOrDefault(sysDictDataVO.getDictCode(), CollUtils.emptyList()); |
| | | medicalWasteCollectVO.setCssClass(sysDictDataVO.getCssClass()); |
| | | medicalWasteCollectVO.setBagNum(mwCollectRecords.size()); |
| | | medicalWasteCollectVO.setWeight(mwCollectRecords.stream() |
| | | .map(MwCollectRecord::getWeight) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | return medicalWasteCollectVO; |
| | | } |
| | | |
| | |
| | | */ |
| | | public List<MwWarningRecordStaticsVO> warningRecordStaticsList() { |
| | | SysDepartment nanNingDepartment = getNanNingDepartment(); |
| | | List<MwWarningRecord> warningRecordList = mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId, nanNingDepartment.getId()).list(); |
| | | //查询南宁的所有单位 |
| | | List<SysDepartment> list = sysDepartmentService.lambdaQuery() |
| | | .likeRight(SysDepartment::getTreeCode, nanNingDepartment.getTreeCode()) |
| | | .in(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode(), DepartmentEnum.DISPOSAL_UNIT.getCode()).list(); |
| | | if (CollUtils.isEmpty(list)) { |
| | | return CollUtils.emptyList(); |
| | | } |
| | | List<Long> departmentIds = list.stream().map(SysDepartment::getId).collect(Collectors.toList()); |
| | | List<MwWarningRecord> warningRecordList = mwWarningRecordService.lambdaQuery().in(MwWarningRecord::getDepartmentId, departmentIds).list(); |
| | | if (CollUtils.isEmpty(warningRecordList)) { |
| | | return CollUtils.emptyList(); |
| | | } |
| | |
| | | */ |
| | | public List<MwWarningRecordVO> queryWarningRecordDetailByType(Integer type) { |
| | | SysDepartment nanNingDepartment = getNanNingDepartment(); |
| | | List<MwWarningRecord> warningRecordList = mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId, nanNingDepartment.getId()).eq(MwWarningRecord::getType, type).list(); |
| | | //查询南宁市所有单位信息 |
| | | List<SysDepartment> list = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, nanNingDepartment.getTreeCode()).list(); |
| | | if (CollUtils.isEmpty(list)) { |
| | | return CollUtils.emptyList(); |
| | | } |
| | | List<Long> departmentIds = list.stream().map(SysDepartment::getId).collect(Collectors.toList()); |
| | | List<MwWarningRecord> warningRecordList = mwWarningRecordService.lambdaQuery().in(MwWarningRecord::getDepartmentId, departmentIds).eq(MwWarningRecord::getType, type).list(); |
| | | return BeanUtils.copyToList(warningRecordList, MwWarningRecordVO.class); |
| | | } |
| | | |
| | |
| | | public List<CarDistributionVO> queryCarDistribution() { |
| | | SysDepartment nanNingDepartment = getNanNingDepartment(); |
| | | //查询车辆分布列表 |
| | | return mwTransitCarCollectPointService.queryCarListByTreeCode(nanNingDepartment.getTreeCode()); |
| | | List<CarDistributionVO> carDistributionVOS = mwTransitCarCollectPointService.queryCarListByTreeCode(nanNingDepartment.getTreeCode()); |
| | | if (CollUtils.isNotEmpty(carDistributionVOS)) { |
| | | for (CarDistributionVO carDistributionVO : carDistributionVOS) { |
| | | MwTransitCarCollectPoint point = mwTransitCarCollectPointService.lambdaQuery().eq(MwTransitCarCollectPoint::getCarId, carDistributionVO.getId()).eq(MwTransitCarCollectPoint::getTransitDate, DateUtil.format(DateUtil.date(), DatePattern.NORM_DATE_PATTERN)).last("LIMIT 1").one(); |
| | | if (Objects.nonNull(point)) { |
| | | String pointList = point.getPointList(); |
| | | List<Long> pointIdList = JSONArray.parseArray(pointList, Long.class); |
| | | if (CollUtils.isNotEmpty(pointIdList)) { |
| | | //查询最后一个点位 |
| | | SysDepartment department = sysDepartmentService.getById(pointIdList.get(pointIdList.size() - 1)); |
| | | carDistributionVO.setLatitude(department.getLatitude()); |
| | | carDistributionVO.setLongitude(department.getLongitude()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | return carDistributionVOS; |
| | | } |
| | | |
| | | /** |
| | |
| | | log.info("【出库超时预警】:没有暂存的医废记录,跳过定时任务执行"); |
| | | return; |
| | | } |
| | | |
| | | //查询所有出库超时预警 |
| | | List<MwWarningRecord> warningRecordList = mwWarningRecordService.lambdaQuery() |
| | | .eq(MwWarningRecord::getType, WarningTypeEnum.CHECKOUT_TIMEOUT_WARNING.getCode()) |
| | | .list(); |
| | | // 遍历配置项并处理预警 |
| | | for (MwWarningConfigItem configItem : configItems) { |
| | | // 过滤出需要预警的记录 |
| | |
| | | } |
| | | |
| | | // 创建预警记录并保存 |
| | | List<MwWarningRecord> warningRecordList = recordList.stream().map(item -> { |
| | | Long id = item.getId(); |
| | | String medicalWasteNumber = item.getMedicalWasteNumber(); |
| | | String hospitalName = item.getHospitalName(); |
| | | String msg = String.format("%s医废超过%d小时未出库", item.getWasteTypeStr(), configItem.getValue()); |
| | | String currentValue = String.valueOf(DateUtils.timeDistanceHour(new Date(), item.getCollectTime())); |
| | | Long departmentId = item.getDepartmentId(); |
| | | String configValue = configItem.getValue().toString(); |
| | | return getMwWarningRecord(WarningTypeEnum.CHECKOUT_TIMEOUT_WARNING.getCode(), id, medicalWasteNumber, hospitalName, msg, departmentId, currentValue, configValue); |
| | | }).collect(Collectors.toList()); |
| | | List<MwWarningRecord> warningRecordSaveList = recordList.stream().map(item -> { |
| | | long count = warningRecordList.stream().filter(record -> record.getWarningTargetId().equals(item.getId())).count(); |
| | | if (count == 0L) { |
| | | Long id = item.getId(); |
| | | String medicalWasteNumber = item.getMedicalWasteNumber(); |
| | | String hospitalName = item.getHospitalName(); |
| | | String msg = String.format("%s医废超过%d小时未出库", item.getWasteTypeStr(), configItem.getValue()); |
| | | String currentValue = String.valueOf(DateUtils.timeDistanceHour(new Date(), item.getCollectTime())); |
| | | Long departmentId = item.getDepartmentId(); |
| | | String configValue = configItem.getValue().toString(); |
| | | return getMwWarningRecord(WarningTypeEnum.CHECKOUT_TIMEOUT_WARNING.getCode(), id, medicalWasteNumber, hospitalName, msg, departmentId, currentValue, configValue); |
| | | } |
| | | return null; |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | |
| | | // 批量保存预警记录 |
| | | if (!warningRecordList.isEmpty()) { |
| | | mwWarningRecordService.saveBatch(warningRecordList); |
| | | if (!warningRecordSaveList.isEmpty()) { |
| | | mwWarningRecordService.saveBatch(warningRecordSaveList); |
| | | } |
| | | } |
| | | } |
| | |
| | | warningRecord.setNormalRange(normalRange); |
| | | warningRecord.setStatus(WarningStatusEnum.UNRESOLVED.getCode()); |
| | | warningRecord.setWarnTime(new Date()); |
| | | warningRecord.setCreateTime(new Date()); |
| | | return warningRecord; |
| | | } |
| | | |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | mwApplication.setAuditStatus(dto.getAuditStatus() == 1 ? 2 : 3); |
| | | mwApplication.setAuditOpinion(dto.getAuditOpinion()); |
| | | updateById(mwApplication); |
| | | //创建机构 |
| | | if (dto.getAuditStatus() == 1) { |
| | | sysDepartmentService.createDepartment(mwApplication); |
| | | } |
| | | //发送短信通知 |
| | | aliSmsService.sendAuditResult(mwApplication.getPhone(), dto.getAuditStatus() == 1 ? "已通过" : "未通过"); |
| | | } |
| | | |
| | | @Override |
| | | public void saveApplication(MwApplication mwApplication) { |
| | | mwApplication.setAuditStatus(1); |
| | | mwApplication.setCreateTime(new Date()); |
| | | if (Objects.nonNull(mwApplication.getDepartmentId())) { |
| | | mwApplication.setRegion(sysDepartmentService.getRegionName(sysDepartmentService.getById(mwApplication.getDepartmentId()))); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.utils.SecurityUtils; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.MwWarningRecord; |
| | | import com.sinata.system.domain.query.MwWarningRecordQuery; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void relieve(Long id) { |
| | | lambdaUpdate().set(MwWarningRecord::getStatus, WarningStatusEnum.RESOLVED.getCode()).eq(MwWarningRecord::getId, id).update(); |
| | | lambdaUpdate().set(MwWarningRecord::getStatus, WarningStatusEnum.RESOLVED.getCode()) |
| | | .set(MwWarningRecord::getUpdateTime, new Date()) |
| | | .set(MwWarningRecord::getUpdateBy, SecurityUtils.getUserId()) |
| | | .eq(MwWarningRecord::getId, id).update(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.sinata.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sinata.common.constant.CacheConstants; |
| | |
| | | import com.sinata.common.utils.CollUtils; |
| | | import com.sinata.common.utils.SecurityUtils; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.MwApplication; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.SysDepartmentInfo; |
| | | import com.sinata.system.domain.SysUserDepartment; |
| | |
| | | * @param department |
| | | * @return |
| | | */ |
| | | private String getRegionName(SysDepartment department) { |
| | | @Override |
| | | public String getRegionName(SysDepartment department) { |
| | | String region = department.getDepartmentName(); |
| | | SysDepartment sysDepartment = this.lambdaQuery().eq(SysDepartment::getId, department.getParentId()).ne(SysDepartment::getId, -1).one(); |
| | | if (Objects.nonNull(sysDepartment)) { |
| | |
| | | public List<MedicalInstitutionVO> getHospitalListByRouteId(Long id) { |
| | | return baseMapper.getHospitalListByRouteId(id); |
| | | } |
| | | |
| | | /** |
| | | * 创建机构 |
| | | * |
| | | * @param mwApplication |
| | | */ |
| | | @Override |
| | | public void createDepartment(MwApplication mwApplication) { |
| | | SysDepartment parent = this.getById(mwApplication.getDepartmentId()); |
| | | if (Objects.isNull(parent)) { |
| | | throw new ServiceException("找不到对应父级组织"); |
| | | } |
| | | SysDepartment department = new SysDepartment(); |
| | | department.setParentId(mwApplication.getDepartmentId()); |
| | | department.setDepartmentName(mwApplication.getUnitName()); |
| | | department.setContactPerson(mwApplication.getConcat()); |
| | | department.setContactPhone(mwApplication.getPhone()); |
| | | department.setOrgType(mwApplication.getUnitType().equals(1) ? DepartmentEnum.MEDICAL_INSTITUTION.getCode() : DepartmentEnum.DISPOSAL_UNIT.getCode()); |
| | | department.setRegion(mwApplication.getRegion()); |
| | | department.setRelation(mwApplication.getRelation()); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | department.setOrgCode(getOrgCode(parent.getId(), department.getOrgType())); |
| | | save(department); |
| | | } |
| | | } |
| | |
| | | Page<SysDictData> result = this.lambdaQuery().like(StringUtils.isNotBlank(query.getKeyword()), SysDictData::getDictLabel, query.getKeyword()).page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | List<String> dictTypeList = result.getRecords().stream().map(SysDictData::getDictType).distinct().collect(Collectors.toList()); |
| | | if (CollUtils.isNotEmpty(dictTypeList)) { |
| | | PageDTO<SysDictDataVO> sysDictDataVOPageDTO = PageDTO.of(result, SysDictDataVO.class); |
| | | List<SysDictType> sysDictTypes = dictTypeMapper.selectList(new LambdaQueryWrapper<SysDictType>().in(SysDictType::getDictType, dictTypeList)); |
| | | result.getRecords().forEach(sysDictData -> { |
| | | sysDictDataVOPageDTO.getList().forEach(vo -> { |
| | | sysDictTypes.forEach(sysDictType -> { |
| | | if (sysDictType.getDictType().equals(sysDictData.getDictType())) { |
| | | sysDictData.setDictType(sysDictType.getDictName()); |
| | | if (sysDictType.getDictType().equals(vo.getDictType())) { |
| | | vo.setDictTypeName(sysDictType.getDictName()); |
| | | } |
| | | }); |
| | | }); |
| | | return sysDictDataVOPageDTO; |
| | | } |
| | | return PageDTO.of(result, SysDictDataVO.class); |
| | | return PageDTO.empty(result); |
| | | } |
| | | |
| | | @Override |
| | |
| | | MA.AUDIT_OPINION, |
| | | MA.CREATE_TIME, |
| | | MA.REGION, |
| | | MA.RELATION, |
| | | SD.DEPARTMENT_NAME |
| | | FROM MW_APPLICATION MA |
| | | LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MA.DEPARTMENT_ID |
| | |
| | | mcr2.CHECKOUT_TIME, |
| | | su2.NICK_NAME AS DRIVER_NAME, |
| | | mcr2.HOSPITAL_SIGNATURE, |
| | | mtc.LICENSE_PLATE_NUMBER, |
| | | mdr.RECEIVE_TIME, |
| | | su3.NICK_NAME AS RECEIVER_NAME, |
| | | mdr.DISPOSAL_UNIT_NAME, |
| | |
| | | LEFT JOIN MW_DISPOSAL_HANDLE_RECORD mdhr ON mdhr.ID= mdhri.DISPOSAL_HANDLE_RECORD_ID |
| | | LEFT JOIN SYS_USER su3 ON su3.USER_ID = mdr.RECEIVER_ID |
| | | LEFT JOIN SYS_USER su4 ON su4.USER_ID = mdr.DISPOSAL_USER_ID |
| | | LEFT JOIN MW_TRANSIT_CAR mtc ON mtc.ID = mcr2.CAR_ID |
| | | <where> |
| | | mcr.ID = #{id} |
| | | </where> |
| | |
| | | <if test="query.collectTimeStart != null and query.collectTimeEnd != null"> |
| | | and mcr.COLLECT_TIME between #{query.collectTimeStart} and #{query.collectTimeEnd} |
| | | </if> |
| | | <if test="collectRecordIds != null and collectRecordIds.size() > 0"> |
| | | <if test="query.collectRecordIds != null and query.collectRecordIds.size() > 0"> |
| | | and mcr.ID in |
| | | <foreach collection="collectRecordIds" item="id" open="(" separator="," close=")"> |
| | | <foreach collection="query.collectRecordIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | |
| | | COALESCE(SUM(IF(TRUNC(MCR.COLLECT_TIME) = TRUNC(SYSDATE), MCR.WEIGHT, 0)), 0) AS |
| | | todayHandleWeight, |
| | | COALESCE(COUNT(IF(TRUNC(MCR.COLLECT_TIME) = TRUNC(SYSDATE), MCR.ID, NULL)), 0) AS |
| | | todayHandleBagNum FROM MW_COLLECT_RECORD MCR LEFT JOIN SYS_DEPARTMENT SD ON MCR.DEPARTMENT_ID |
| | | todayHandleBagNum FROM MW_COLLECT_RECORD MCR LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MCR.DEPARTMENT_ID |
| | | <where> |
| | | MCR.DEL_FLAG = 0, |
| | | MCR.DEPARTMENT_ID = #{id} |
| | | MCR.DEL_FLAG = 0 AND MCR.DEPARTMENT_ID = #{id} |
| | | </where> |
| | | GROUP BY MCR.DEPARTMENT_ID |
| | | </select> |
| | |
| | | todayHandleWeight, |
| | | COALESCE(COUNT(IF(TRUNC(MCR.DISPOSAL_TIME) = TRUNC(SYSDATE) AND MCR.STATUS = 4, MCR.ID, NULL)), 0) AS |
| | | todayHandleBagNum |
| | | FROM MW_DISPOSAL_RECORD MDR |
| | | FROM SYS_DEPARTMENT SD LEFT JOIN MW_DISPOSAL_RECORD MDR ON MDR.DEPARTMENT_ID = SD.ID |
| | | LEFT JOIN MW_DISPOSAL_RECORD_ITEM MDRI ON MDR.ID = MDRI.DISPOSAL_RECORD_ID |
| | | LEFT JOIN MW_COLLECT_RECORD MCR ON MCR.ID = MDRI.COLLECT_RECORD_ID |
| | | LEFT JOIN SYS_DEPARTMENT SD ON MDR.DEPARTMENT_ID |
| | | <where> |
| | | MDR.DEL_FLAG = 0 |
| | | AND MDR.DEPARTMENT_ID = #{id} |
| | | SD.ID = #{id} |
| | | </where> |
| | | GROUP BY MDR.DEPARTMENT_ID |
| | | </select> |
File was renamed from medicalWaste-system/src/main/java/com/sinata/system/mapper/xml/MwTransitCarCollectPointMapper.xml |
| | |
| | | </sql> |
| | | <select id="queryCarListByTreeCode" resultType="com.sinata.system.domain.vo.CarDistributionVO" |
| | | parameterType="java.lang.String"> |
| | | SELECT MTC.ID, |
| | | SELECT |
| | | MTC.ID, |
| | | MTC.LICENSE_PLATE_NUMBER, |
| | | SD.DEPARTMENT_NAME, |
| | | SUM(MCR.TOTAL_WEIGHT) AS currentLoad |
| | | FROM MW_TRANSIT_CAR_COLLECT_POINT MTCCP |
| | | LEFT JOIN MW_TRANSIT_CAR MTC ON MTC.ID = MTCCP.CAR_ID |
| | | LEFT JOIN SYS_DEPARTMENT SD ON MTC.DEPARTMENT_ID |
| | | LEFT JOIN SYS_DEPARTMENT SD ON MTC.DEPARTMENT_ID = SD.ID |
| | | LEFT JOIN MW_CHECKOUT_RECORD MCR ON MCR.CAR_ID = MTCCP.CAR_ID |
| | | <where> |
| | | SD.ORG_TYPE = 3 AND MTCCP.TRANSIT_DATE = CURDATE() AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%') AND |
| | | MCR.DEL_FLAG = 0 |
| | | </where> |
| | | ORDER BY MTC.ID |
| | | GROUP BY MTCCP.CAR_ID |
| | | </select> |
| | | <select id="queryCarDistributionDetail" resultType="com.sinata.system.domain.vo.CarDistributionVO" |
| | | parameterType="java.lang.Long"> |
| | | SELECT MTC.ID, |
| | | SD.DEPARTMENT_NAME, |
| | | MTC.LICENSE_PLATE_NUMBER,MTC.PERSON_IN_CHARGE,MTC.PHONE_NUMBER,MTC.MAXIMUM_LOAD, |
| | | MTC.LICENSE_PLATE_NUMBER,MTC.PERSON_IN_CHARGE,MTC.PHONE_NUMBER,MTC.MAXIMUM_LOAD,MTC.IMAGE_URL, |
| | | SUM(MCR.TOTAL_WEIGHT) AS currentLoad, |
| | | MTCCP.POINT_LIST |
| | | FROM MW_TRANSIT_CAR_COLLECT_POINT MTCCP |
| | | LEFT JOIN MW_TRANSIT_CAR MTC ON MTC.ID = MTCCP.CAR_ID |
| | | LEFT JOIN SYS_DEPARTMENT SD ON MTC.DEPARTMENT_ID |
| | | LEFT JOIN SYS_DEPARTMENT SD ON MTC.DEPARTMENT_ID = SD.ID |
| | | LEFT JOIN MW_CHECKOUT_RECORD MCR ON MCR.CAR_ID = MTCCP.CAR_ID |
| | | <where> |
| | | SD.ORG_TYPE = 3 AND MTCCP.TRANSIT_DATE = CURDATE() AND |
| | |
| | | <if test="query.status != null"> |
| | | AND MWR.STATUS = #{query.status} |
| | | </if> |
| | | <if test="query.startTime != null and query.endTime !=null"> |
| | | AND MWR.WARN_TIME BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY MWR.CREATE_TIME DESC |
| | | </select> |