Merge remote-tracking branch 'origin/master'

This commit is contained in:
gaowdong 2025-02-14 18:19:50 +08:00
commit e873191063
30 changed files with 2113 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package com.bonus.sharedstation.api;
import com.bonus.sharedstation.api.vo.DictDataInfoDO;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Tag(name = "RPC 服务 - 字典数据")
public interface DictDataApi {
List<DictDataInfoDO> getDictionaryInfo(@RequestParam("dataType") String dataType);
/**
* 单个返回值
* @param dataType
* @return
*/
DictDataInfoDO getDictionaryData(@RequestParam("dataType") String dataType);
/**
* 单个返回值
* @param dataType
* @return
*/
DictDataInfoDO getDictionaryDataByCondition(@RequestParam("dataType") String dataType, @RequestParam("dataCode") String dataCode);
}

View File

@ -0,0 +1,15 @@
package com.bonus.sharedstation.api.dto;
import lombok.Data;
@Data
public class DictDataRespDTO {
private String dataType;
private String dataCode;
private String dataValue;
private Long tenantId;
}

View File

@ -0,0 +1,12 @@
package com.bonus.sharedstation.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.sharedstation.api.vo.DictDataInfoDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author ASUS
*/
@Mapper
public interface DictMapper extends BaseMapper<DictDataInfoDO> {
}

View File

@ -0,0 +1,25 @@
package com.bonus.sharedstation.api.service;
import com.bonus.sharedstation.api.dto.DictDataRespDTO;
import com.bonus.sharedstation.api.vo.DictDataInfoDO;
import java.util.List;
/**
* 字典类型 Service 接口
*
* @author roof
*/
public interface DictService {
List<DictDataInfoDO> getDataByType(String dataType);
List<DictDataInfoDO> queryDictDataByCode(String dataType, String dataCode, long parseLong);
List<DictDataInfoDO> getDictionaryInfo(String dataType);
DictDataInfoDO getDictionaryData(String dataType);
DictDataInfoDO getDictionaryDataByCondition(String dataType, String dataCode);
}

View File

@ -0,0 +1,46 @@
package com.bonus.sharedstation.api.service.impl;
import com.bonus.sharedstation.api.DictDataApi;
import com.bonus.sharedstation.api.service.DictService;
import com.bonus.sharedstation.api.vo.DictDataInfoDO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController // 提供 RESTful API 接口 Feign 调用
@Validated
public class DictDataApiImpl implements DictDataApi {
@Resource
private DictService dictService;
@Override
public List<DictDataInfoDO> getDictionaryInfo(String dataType) {
return dictService.getDictionaryInfo(dataType);
}
/**
* 单个返回值
*
* @param dataType
* @return
*/
@Override
public DictDataInfoDO getDictionaryData(String dataType) {
return dictService.getDictionaryData(dataType);
}
/**
* 单个返回值 多个参数查询
*
* @param dataType
* @param dataCode
* @return
*/
@Override
public DictDataInfoDO getDictionaryDataByCondition(String dataType, String dataCode) {
return dictService.getDictionaryDataByCondition(dataType, dataCode);
}
}

View File

@ -0,0 +1,77 @@
package com.bonus.sharedstation.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bonus.sharedstation.api.dto.DictDataRespDTO;
import com.bonus.sharedstation.api.mapper.DictMapper;
import com.bonus.sharedstation.api.service.DictService;
import com.bonus.sharedstation.api.vo.DictDataInfoDO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 字典类型 Service 实现类
*
* @author roof
*/
@Service
public class DictServiceImpl implements DictService {
@Resource
private DictMapper dictMapper;
/**
* 查询字典数据
*
* @param dataType
* @return
*/
@Override
public List<DictDataInfoDO> getDataByType(String dataType) {
if (dataType != null && !"".equals(dataType)) {
return dictMapper.selectList(new LambdaQueryWrapper<DictDataInfoDO>().eq(DictDataInfoDO::getDataType, dataType));
}
return null;
}
@Override
public List<DictDataInfoDO> queryDictDataByCode(String dataType, String dataCode, long tenantId) {
if (dataType != null && !"".equals(dataType)) {
return dictMapper.selectList(new LambdaQueryWrapper<DictDataInfoDO>()
.eq(DictDataInfoDO::getDataType, dataType)
.eq(DictDataInfoDO::getDataCode, dataCode)
.eq(DictDataInfoDO::getTenantId, tenantId));
}
return null;
}
@Override
public List<DictDataInfoDO> getDictionaryInfo(String dataType) {
if (dataType != null && !"".equals(dataType)) {
return dictMapper.selectList(new LambdaQueryWrapper<DictDataInfoDO>()
.eq(DictDataInfoDO::getDataType, dataType));
}
return null;
}
@Override
public DictDataInfoDO getDictionaryData(String dataType) {
if (dataType != null && !"".equals(dataType)) {
return dictMapper.selectOne(new LambdaQueryWrapper<DictDataInfoDO>()
.eq(DictDataInfoDO::getDataType, dataType));
}
return null;
}
@Override
public DictDataInfoDO getDictionaryDataByCondition(String dataType, String dataCode) {
if (dataType != null && !"".equals(dataType)) {
return dictMapper.selectOne(new LambdaQueryWrapper<DictDataInfoDO>()
.eq(DictDataInfoDO::getDataType, dataType)
.eq(DictDataInfoDO::getDataType, dataCode));
}
return null;
}
}

View File

@ -0,0 +1,95 @@
package com.bonus.sharedstation.api.vo;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.io.Serializable;
import java.util.Date;
/**
* 字典类型表
*
* @author zhangzheng
*/
@TableName("green_dictionary_info")
@KeySequence("green_dictionary_info_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DictDataInfoDO implements Serializable {
/**
* 序列化
*/
private static final long serialVersionUID = 6197622378439437176L;
/**
* 字典主键
*/
@TableId
private Long id;
/**
* 字典类型
*/
private String dataType;
/**
* 字典编码
*/
private String dataCode;
/**
* 字典数据
*/
private String dataValue;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer dataSort;
/**
* 是否删除
*/
@TableLogic(value = "N")
private String isDeleted;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date gmtCreated;
/**
* 最后更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date gmtModified;
/**
* 创建者目前使用 SysUser id 编号
*/
private String creator;
/**
* 更新者目前使用 SysUser id 编号
*/
private String modifier;
/**
* 租户编码
*/
private Long tenantId;
}

View File

@ -0,0 +1,39 @@
package com.bonus.sharedstation.app.controller;
import com.alibaba.nacos.common.model.RestResult;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.web.dto.EmergencyEquipmentDTO;
import com.bonus.sharedstation.web.service.IEmergencyEquipmentService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Tag(name = "app-设备位置")
@RestController
@RequestMapping("/information/emergencyequipmentApp")
public class EmergencyEquipmentAppController {
@Resource
private IEmergencyEquipmentService emergencyEquipmentService;
/**
* 分页查询App
* @param emergencyEquipmentDTO
* @return
*/
@ApiOperation("查询急救设备位置")
@PostMapping("/getList")
public AjaxResult getListApp(@RequestBody EmergencyEquipmentDTO emergencyEquipmentDTO){
return emergencyEquipmentService.getEmergencyEquipmentListApp(emergencyEquipmentDTO);
}
}

View File

@ -0,0 +1,51 @@
package com.bonus.sharedstation.app.controller;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.web.dto.FirstAidInfoDTO;
import com.bonus.sharedstation.web.service.IFirstAidService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Tag(name = "Web - 急救知识")
@RestController
@RequestMapping("/information/firstaidapp")
public class FirstAidAppController {
private static final Logger log = LoggerFactory.getLogger(FirstAidAppController.class);
@Resource
private IFirstAidService formService;
@ApiOperation("查询订单列表")
@PostMapping("/getOrderList")
public AjaxResult getFirstAidInfoList(@RequestBody FirstAidInfoDTO firstAidInfoDTO) {
try {
return formService.getFirstAidInfoList(firstAidInfoDTO);
} catch (Exception e) {
log.error("查询订单列表", e);
return AjaxResult.error("查询失败");
}
}
@ApiOperation("查询急救全部数据")
@PostMapping(value = "selectAll", produces = "application/json; charset=utf-8")
public AjaxResult selectAll(@RequestBody FirstAidInfoDTO firstAidInfoDTO) {
return AjaxResult.success(formService.selectAll(firstAidInfoDTO));
}
@PostMapping(value = "selectById", produces = "application/json; charset=utf-8")
@ApiOperation("查询急救详情")
public AjaxResult selectInfoById(@RequestBody FirstAidInfoDTO firstAidInfoDTO) {
return AjaxResult.success(formService.selectInfoById(firstAidInfoDTO));
}
}

View File

@ -0,0 +1,61 @@
package com.bonus.sharedstation.app.controller;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.app.domain.MlMedicalInformation;
import com.bonus.sharedstation.app.dto.MlMedicalInformationDTO;
import com.bonus.sharedstation.app.service.IMlMedicalInformationService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 名流预约医院信息表(MlMedicalInformation)表控制层
*
* @author makejava
* @since 2024-12-09 17:12:29
*/
@RestController
@RequestMapping("information/mlMedicalInformation")
@Tag(name = "App - 名流就医预约信息")
@Validated
@Slf4j
public class MlMedicalInformationController {
/**
* 服务对象
*/
@Resource
private IMlMedicalInformationService mlMedicalInformationService;
/**
* 通过主键查询单条数据
*
* @param mlMedicalInformation 主键
* @return 单条数据
*/
@PostMapping(value = "/selectById", produces = "application/json; charset=utf-8")
@ApiOperation("根据ID查询名流就医预约信息")
public AjaxResult queryById(@RequestBody MlMedicalInformation mlMedicalInformation) {
return AjaxResult.success(this.mlMedicalInformationService.queryById(mlMedicalInformation));
}
/**
* 分页查询
* @param dto
* @return
*/
@ApiOperation("查询名流就医预约信息")
@PostMapping("/getList")
public AjaxResult getList(@RequestBody MlMedicalInformationDTO dto){
return AjaxResult.success(mlMedicalInformationService.getListPage(dto));
}
}

View File

@ -0,0 +1,131 @@
package com.bonus.sharedstation.app.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 名流预约医院信息表(MlMedicalInformation)实体类
*
* @author makejava
* @since 2024-12-09 17:01:55
*/
@Data
public class MlMedicalInformation implements Serializable {
private static final long serialVersionUID = -43322889469584228L;
private Integer id;
/**
* 预约人姓名
*/
private String name;
/**
* 预约人 id
*/
private String userId;
/**
* 手机号
*/
private String phone;
/**
* 所在单位
*/
private String unit;
/**
* 预约时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date appointmentTime;
/**
* 就诊医院名称
*/
private String hospitalName;
/**
* 预约科室名称
*/
private String officesName;
/**
* 预约医生名称
*/
private String doctorName;
/**
* 手术类型
*/
private String surgicalType;
/**
* 预约类型 1医院预约 2门诊预约 3手术预约
*/
private String type;
/**
* 备注200字以内
*/
private String remarks;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedTime;
/**
* 修改人
*/
private String updatedBy;
/**
* 逻辑删除标识1表示已删除0表示未删除
*/
private String isDeleted;
private Integer tenantId;
/**
* 预约 状态 0 已预约 1 取消预约
*/
private String status;
/**
* 名流返回状态 如果成功, 新增 ,不成功不新增
*/
@TableField(exist = false)
private String mlReturnStatus;
private String orderId;
private String custId;
@Override
public String toString() {
return "MlMedicalInformation{" +
"id=" + id +
", name='" + name + '\'' +
", userId='" + userId + '\'' +
", phone='" + phone + '\'' +
", unit='" + unit + '\'' +
", appointmentTime=" + appointmentTime +
", hospitalName='" + hospitalName + '\'' +
", officesName='" + officesName + '\'' +
", doctorName='" + doctorName + '\'' +
", surgicalType='" + surgicalType + '\'' +
", type='" + type + '\'' +
", remarks='" + remarks + '\'' +
", createdBy='" + createdBy + '\'' +
", createdTime=" + createdTime +
", updatedTime=" + updatedTime +
", updatedBy='" + updatedBy + '\'' +
", isDeleted='" + isDeleted + '\'' +
", tenantId=" + tenantId +
", status='" + status + '\'' +
", mlReturnStatus='" + mlReturnStatus + '\'' +
", orderId='" + orderId + '\'' +
'}';
}
}

View File

@ -0,0 +1,100 @@
package com.bonus.sharedstation.app.dto;
import com.bonus.sharedstation.common.pojo.PageDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* 名流预约医院信息表(MlMedicalInformation)实体类
*
* @author makejava
* @since 2024-12-09 17:01:55
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class MlMedicalInformationDTO extends PageDTO implements Serializable {
private static final long serialVersionUID = -43322889469584228L;
private Integer id;
/**
* 预约人姓名
*/
private String name;
/**
* 预约人 id
*/
private String userId;
/**
* 手机号
*/
private String phone;
/**
* 所在单位
*/
private String unit;
/**
* 预约时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date appointmentTime;
/**
* 就诊医院名称
*/
private String hospitalName;
/**
* 预约科室名称
*/
private String officesName;
/**
* 预约医生名称
*/
private String doctorName;
/**
* 手术类型
*/
private String surgicalType;
/**
* 预约类型 1医院预约 2门诊预约 3手术预约
*/
private String type;
/**
* 备注200字以内
*/
private String remarks;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedTime;
/**
* 修改人
*/
private String updatedBy;
/**
* 逻辑删除标识1表示已删除0表示未删除
*/
private String isDeleted;
private Integer tenantId;
private String orderId;
//预约 状态 0 已预约 1 取消预约
private String status;
private String custId;
}

View File

@ -0,0 +1,17 @@
package com.bonus.sharedstation.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.sharedstation.app.domain.MlMedicalInformation;
import org.apache.ibatis.annotations.Mapper;
/**
* 名流预约医院信息表(MlMedicalInformation)表数据库访问层
*
* @author makejava
* @since 2024-12-09 17:03:39
*/
@Mapper
public interface MlMedicalInformationMapper extends BaseMapper<MlMedicalInformation> {
MlMedicalInformation queryById(MlMedicalInformation mlMedicalInformation);
}

View File

@ -0,0 +1,29 @@
package com.bonus.sharedstation.app.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.sharedstation.app.domain.MlMedicalInformation;
import com.bonus.sharedstation.app.dto.MlMedicalInformationDTO;
import java.util.List;
/**
* 名流预约医院信息表(MlMedicalInformation)表服务接口
*
* @author makejava
* @since 2024-12-09 17:10:03
*/
public interface IMlMedicalInformationService extends IService<MlMedicalInformation> {
/**
* 通过ID查询单条数据
*
* @param mlMedicalInformation 主键
* @return 实例对象
*/
MlMedicalInformation queryById(MlMedicalInformation mlMedicalInformation);
Page<MlMedicalInformation> getListPage(MlMedicalInformationDTO dto);
}

View File

@ -0,0 +1,61 @@
package com.bonus.sharedstation.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.sharedstation.app.domain.MlMedicalInformation;
import com.bonus.sharedstation.app.dto.MlMedicalInformationDTO;
import com.bonus.sharedstation.app.mapper.MlMedicalInformationMapper;
import com.bonus.sharedstation.app.service.IMlMedicalInformationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 名流预约医院信息表(MlMedicalInformation)表服务实现类
*
* @author makejava
* @since 2024-12-09 17:10:03
*/
@Service("mlMedicalInformationService")
@Slf4j
public class MlMedicalInformationServiceImpl extends ServiceImpl<MlMedicalInformationMapper, MlMedicalInformation> implements IMlMedicalInformationService {
@Resource
private MlMedicalInformationMapper mlMedicalInformationDao;
/**
* 通过ID查询单条数据
*
* @param mlMedicalInformation 主键
* @return 实例对象
*/
@Override
public MlMedicalInformation queryById(MlMedicalInformation mlMedicalInformation) {
return this.mlMedicalInformationDao.queryById(mlMedicalInformation);
}
/**
* 分页查询
*/
/**
* 分页查询
*
* @param dto
* @return
*/
@Override
public Page<MlMedicalInformation> getListPage(MlMedicalInformationDTO dto) {
log.info("查询 入参: {}", dto);
LambdaQueryWrapper<MlMedicalInformation> queryWrapper = new LambdaQueryWrapper<>();
// 获取userId
// 创建分页对象
Page<MlMedicalInformation> page = new Page<>(dto.getCurrentPage(), dto.getLimit());
queryWrapper
.eq(MlMedicalInformation::getCustId, dto.getCustId())
.eq(MlMedicalInformation::getIsDeleted, dto.getIsDeleted())
.orderByDesc(MlMedicalInformation::getCreatedTime);
//处理参数问题
return mlMedicalInformationDao.selectPage(page, queryWrapper);
}
}

View File

@ -0,0 +1,149 @@
package com.bonus.sharedstation.common.pojo;
import java.util.List;
import java.util.Map;
public class PageDTO<T> {
//每页数量
private Integer limit = 10;
//每页第几個開始
private Integer offset;
//当前页数前端传的当前页
private Integer currentPage;
//查询的request对象前端传的参数
private T queryObj;
//start end 是id优化条件你选择是否用或者不用,仅限于ID连续自增的查询
private Integer start;
private Integer end;
//总条数(第一次第一页返回)
private Integer total;
//返回的response list对象
private List<Map<String,Object>> data;
private String StartTime;
private String EndtTime;
public String getStartTime() {
return StartTime;
}
public void setStartTime(String startTime) {
StartTime = startTime;
}
public String getEndtTime() {
return EndtTime;
}
public void setEndtTime(String endtTime) {
EndtTime = endtTime;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getOffset() {
if (currentPage != null && currentPage >= 1) {
return (currentPage - 1)*limit;
} else {
return 0;
}
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getStart() {
if (currentPage != null && currentPage >= 1) {
return (currentPage - 1)*limit;
} else {
return 0;
}
}
public void setStart(Integer start) {
this.start = start;
}
public Integer getEnd() {
if (currentPage != null && currentPage >= 1) {
return (currentPage - 1)*limit + limit;
} else {
return limit;
}
}
public void setEnd(Integer end) {
this.end = end;
}
public List<Map<String, Object>> getData() {
return data;
}
public void setData(List<Map<String, Object>> data) {
this.data = data;
}
public T getQueryObj() {
return queryObj;
}
public void setQueryObj(T queryObj) {
this.queryObj = queryObj;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
@Override
public String toString() {
return "PageDTO [limit=" + limit + ", offset=" + offset + ", currentPage=" + currentPage + ", queryObj="
+ queryObj + ", start=" + start + ", end=" + end + ", total=" + total + ", data=" + data + "]";
}
}

View File

@ -0,0 +1,206 @@
package com.bonus.sharedstation.web.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;
/**
* 存储急救设备信息的实体类
*/
@TableName("emergency_equipment")
public class EmergencyEquipment implements java.io.Serializable {
/**
* 序列化版本号
*/
private static final long serialVersionUID = -8270716895549511798L;
/**
* 唯一标识符
*/
private int id;
/**
* 设备名称
*/
private String equipmentName;
/**
* 存放位置
*/
private String storageLocation;
/**
* 设备图片URL
*/
private String equipmentImageUrl;
/**
* 设备类型存的是字典
*/
@NotBlank(message = "设备类型不能为空")
private String equipmentType;
@TableField(exist = false)
private String equipmentTypeName;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedTime;
/**
* 修改人
*/
private String updatedBy;
/**
* 逻辑删除标识1表示已删除0表示未删除
*/
private String isDeleted;
/**
* 租户ID
*/
/**
* 操作步骤
*/
@TableField(exist = false)
private List<LocationDetail> locationDetails;
public List<LocationDetail> getLocationDetails() {
return locationDetails;
}
public void setLocationDetails(List<LocationDetail> locationDetails) {
this.locationDetails = locationDetails;
}
public String getEquipmentTypeName() {
return equipmentTypeName;
}
public void setEquipmentTypeName(String equipmentTypeName) {
this.equipmentTypeName = equipmentTypeName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEquipmentName() {
return equipmentName;
}
public void setEquipmentName(String equipmentName) {
this.equipmentName = equipmentName;
}
public String getStorageLocation() {
return storageLocation;
}
public void setStorageLocation(String storageLocation) {
this.storageLocation = storageLocation;
}
public String getEquipmentImageUrl() {
return equipmentImageUrl;
}
public void setEquipmentImageUrl(String equipmentImageUrl) {
this.equipmentImageUrl = equipmentImageUrl;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
}
@Override
public String toString() {
return "EmergencyEquipment{" +
"id=" + id +
", equipmentName='" + equipmentName + '\'' +
", storageLocation='" + storageLocation + '\'' +
", equipmentImageUrl='" + equipmentImageUrl + '\'' +
", equipmentType='" + equipmentType + '\'' +
", equipmentTypeName='" + equipmentTypeName + '\'' +
", createdBy='" + createdBy + '\'' +
", createdTime=" + createdTime +
", updatedTime=" + updatedTime +
", updatedBy='" + updatedBy + '\'' +
", isDeleted=" + isDeleted +
", locationDetails=" + locationDetails +
'}';
}
}

View File

@ -0,0 +1,173 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
* 急救知识 实体类
*
* @author zhh
* @date 2024-11-14
*/
@TableName("first_aid_info")
public class FirstAidInfo implements java.io.Serializable {
/**
* 序列化版本号
*/
private static final long serialVersionUID = -8270716895549511778L;
private Integer id;
/**
* 急救知识信息
*/
private String firstAidName;
/**
* 视频 Url
*/
private String videoUrl;
/**
* 急救知识介绍
*/
private String instruction;
/**
* 发布状态1表示已发布0表示未发布
*/
private String publishStatus;
/**
* 图标地址
*/
private String logoAddress;
/**
* 背景图地址
*/
private String backGroundAddress;
/**
* 创建人
*/
private String createdBy; // 创建人
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime; // 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedTime; // 修改时间
private String updatedBy; // 修改人
private String isDeleted; // 逻辑删除标识1表示已删除0表示未删除
@TableField(exist = false)
private List<OperationStep> steps;
public List<OperationStep> getSteps() {
return steps;
}
public void setSteps(List<OperationStep> steps) {
this.steps = steps;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFirstAidName() {
return firstAidName;
}
public void setFirstAidName(String firstAidName) {
this.firstAidName = firstAidName;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getInstruction() {
return instruction;
}
public void setInstruction(String instruction) {
this.instruction = instruction;
}
public String getPublishStatus() {
return publishStatus;
}
public void setPublishStatus(String publishStatus) {
this.publishStatus = publishStatus;
}
public String getLogoAddress() {
return logoAddress;
}
public void setLogoAddress(String logoAddress) {
this.logoAddress = logoAddress;
}
public String getBackGroundAddress() {
return backGroundAddress;
}
public void setBackGroundAddress(String backGroundAddress) {
this.backGroundAddress = backGroundAddress;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.domain;
import lombok.Data;
/**
* 地址 详细地址
*
* @author zhh
* @date 2024-11-14
*/
@Data
public class LocationDetail implements java.io.Serializable {
private Integer id;
/**
* 序列化版本号
*/
private static final long serialVersionUID = -8270716895549511798L;
/**
* 地址
*/
private String location;
/**
* 地址详情
*/
private String detailLocation;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.domain;
import lombok.Data;
/**
* 急救知识 实体类
*
* @author zhh
* @date 2024-11-14
*/
@Data
public class OperationStep implements java.io.Serializable {
private Integer id;
/**
* 序列化版本号
*/
private static final long serialVersionUID = -8270716895549511778L;
private String title;
private String content;
}

View File

@ -0,0 +1,180 @@
package com.bonus.sharedstation.web.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bonus.sharedstation.common.pojo.PageDTO;
import com.bonus.sharedstation.web.domain.LocationDetail;
import java.util.Date;
import java.util.List;
/**
* 存储急救设备信息的实体类
*/
@TableName("emergency_equipment")
public class EmergencyEquipmentDTO extends PageDTO implements java.io.Serializable {
/**
* 序列化版本号
*/
private static final long serialVersionUID = -8270716895549511798L;
/**
* 唯一标识符
*/
private int id;
/**
* 设备名称
*/
private String equipmentName;
/**
* 存放位置
*/
private String storageLocation;
/**
* 设备图片URL
*/
private String equipmentImageUrl;
/**
* 设备类型存的是字典
*/
private String equipmentType;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改时间
*/
private Date updatedTime;
/**
* 修改人
*/
private String updatedBy;
/**
* 逻辑删除标识1表示已删除0表示未删除
*/
private char isDeleted;
@TableField(exist = false)
private List<LocationDetail> locationDetails;
public List<LocationDetail> getLocationDetails() {
return locationDetails;
}
public void setLocationDetails(List<LocationDetail> locationDetails) {
this.locationDetails = locationDetails;
}
/**
* 租户ID
*/
private int tenantId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEquipmentName() {
return equipmentName;
}
public void setEquipmentName(String equipmentName) {
this.equipmentName = equipmentName;
}
public String getStorageLocation() {
return storageLocation;
}
public void setStorageLocation(String storageLocation) {
this.storageLocation = storageLocation;
}
public String getEquipmentImageUrl() {
return equipmentImageUrl;
}
public void setEquipmentImageUrl(String equipmentImageUrl) {
this.equipmentImageUrl = equipmentImageUrl;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public char getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(char isDeleted) {
this.isDeleted = isDeleted;
}
public int getTenantId() {
return tenantId;
}
public void setTenantId(int tenantId) {
this.tenantId = tenantId;
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.dto;
import com.bonus.sharedstation.common.pojo.PageDTO;
import com.bonus.sharedstation.web.domain.OperationStep;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 急救知识 实体类
*
* @author zhh
* @date 2024-11-14
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class FirstAidInfoDTO extends PageDTO implements java.io.Serializable {
private static final long serialVersionUID = -6101716895947019269L;
private Integer id;
/**
* 急救知识信息
*/
private String firstAidName;
/**
* 视频 Url
*/
private String videoUrl;
/**
* 急救知识介绍
*/
private String instruction;
/**
* 发布状态1表示已发布0表示未发布
*/
private String publishStatus;
/**
* 图标地址
*/
private String logoAddress;
/**
* 背景图地址
*/
private String backGroundAddress;
private String tenantId;
/**
* 操作步骤
*/
private List<OperationStep> operationSteps;
/**
* 创建人
*/
private String createdBy; // 创建人
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime; // 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedTime; // 修改时间
private String updatedBy; // 修改人
private String isDeleted; // 逻辑删除标识1表示已删除0表示未删除
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.sharedstation.web.domain.EmergencyEquipment;
import org.apache.ibatis.annotations.Mapper;
/**
* 设备位置 Dao
*
* @author zhh
* @date 2024-11-15
*/
@Mapper
public interface EmergencyEquipmentMapper extends BaseMapper<EmergencyEquipment> {
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.sharedstation.web.domain.FirstAidInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* 急救知识 Dao
*
* @author zhh
* @date 2024-11-15
*/
@Mapper
public interface FirstAidMapper extends BaseMapper<FirstAidInfo> {
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.web.domain.EmergencyEquipment;
import com.bonus.sharedstation.web.dto.EmergencyEquipmentDTO;
/**
* 设备位置 Service
*
* @author zhh
* @date 2024-11-15
*/
public interface IEmergencyEquipmentService extends IService<EmergencyEquipment> {
/**
* app
* @param emergencyEquipment
* @return
*/
AjaxResult getEmergencyEquipmentListApp(EmergencyEquipmentDTO emergencyEquipment);
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.service;
import com.alibaba.nacos.common.model.RestResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.web.domain.FirstAidInfo;
import com.bonus.sharedstation.web.dto.FirstAidInfoDTO;
/**
* 急救知识 Service
*
* @author zhh
* @date 2024-11-15
*/
public interface IFirstAidService extends IService<FirstAidInfo> {
/**
* 分页查询列表
* @param firstAidInfoDTO
* @return
*/
AjaxResult getFirstAidInfoList(FirstAidInfoDTO firstAidInfoDTO);
AjaxResult selectAll(FirstAidInfoDTO firstAidInfoDTO);
/**
* 详情
* @param
* @return
*/
AjaxResult selectInfoById(FirstAidInfoDTO firstAidInfoDTO);
}

View File

@ -0,0 +1,115 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.service.impl;
import com.alibaba.nacos.common.model.RestResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.api.DictDataApi;
import com.bonus.sharedstation.api.dto.DictDataRespDTO;
import com.bonus.sharedstation.api.vo.DictDataInfoDO;
import com.bonus.sharedstation.web.domain.EmergencyEquipment;
import com.bonus.sharedstation.web.domain.LocationDetail;
import com.bonus.sharedstation.web.dto.EmergencyEquipmentDTO;
import com.bonus.sharedstation.web.mapper.EmergencyEquipmentMapper;
import com.bonus.sharedstation.web.service.IEmergencyEquipmentService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.type.TypeReference;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Service实现
*
* @author hyq
* @date 2024-03-15
*/
@Service
@Transactional(readOnly = true)
@Slf4j
public class EmergencyEquipmentServiceImpl extends ServiceImpl<EmergencyEquipmentMapper, EmergencyEquipment> implements IEmergencyEquipmentService {
/**
* Dao
*/
@Resource
private EmergencyEquipmentMapper emergencyEquipmentMapper;
@Resource
private DictDataApi dictDataApi;
/**
* 分页查询 App
*
* @param dto
* @return
*/
@Override
public AjaxResult getEmergencyEquipmentListApp(EmergencyEquipmentDTO dto) {
log.info("查询 入参: {}", dto);
LambdaQueryWrapper<EmergencyEquipment> queryWrapper = new LambdaQueryWrapper<>();
// 创建分页对象
Page<EmergencyEquipment> page = new Page<>(dto.getCurrentPage(), dto.getLimit());
queryWrapper
.like(EmergencyEquipment::getEquipmentName, dto.getEquipmentName())
.eq(EmergencyEquipment::getIsDeleted, dto.getIsDeleted())
.eq(EmergencyEquipment::getEquipmentType, dto.getEquipmentType())
.orderByDesc(EmergencyEquipment::getCreatedTime);
Page<EmergencyEquipment> result = emergencyEquipmentMapper.selectPage(page, queryWrapper);
List<EmergencyEquipment> records = result.getRecords();
if (StringUtils.isNotEmpty(records)) {
records.stream().forEach(firstAidInfo -> {
String instruction = firstAidInfo.getStorageLocation();
if (StringUtils.isNotEmpty(instruction)) {
try {
ObjectMapper objectMapper = new ObjectMapper();
List<LocationDetail> operationSteps = objectMapper.readValue(instruction, new TypeReference<List<LocationDetail>>() {
});
// 现在operationSteps包含了从JSON字符串转换回的OperationStep对象列表
if (StringUtils.isNotEmpty(operationSteps)) {
firstAidInfo.setLocationDetails(operationSteps);
}
} catch (IOException e) {
log.error("应急设备json 转换步骤失败 查询详情",e);
throw new RuntimeException("设备位置查询失败");
}
}
});
}
//拿到数据字典
List<DictDataInfoDO> equipmentTypeList = dictDataApi.getDictionaryInfo("equipment_type");
if (equipmentTypeList.isEmpty()) {
throw new ServiceException("请先配置设备数据字典");
}
// 将结果转换为 List<DictDataInfoDO>
// List<SysDictData> 转换为 Map<Long, String>假设 id Long 类型name String 类型
Map<String, String> map = equipmentTypeList.stream()
.collect(Collectors.toMap(DictDataInfoDO::getDataCode, DictDataInfoDO::getDataValue));
if (StringUtils.isNotEmpty(records)) {
records.stream().forEach(emergencyEquipment -> {
if (map.containsKey(emergencyEquipment.getEquipmentType())) {
emergencyEquipment.setEquipmentTypeName(map.get(emergencyEquipment.getEquipmentType()));
}
});
}
return AjaxResult.success(result);
}
}

View File

@ -0,0 +1,157 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.web.domain.FirstAidInfo;
import com.bonus.sharedstation.web.domain.OperationStep;
import com.bonus.sharedstation.web.dto.FirstAidInfoDTO;
import com.bonus.sharedstation.web.mapper.FirstAidMapper;
import com.bonus.sharedstation.web.service.IFirstAidService;
import com.bonus.sharedstation.web.vo.FirstAidInfoVO;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.type.TypeReference;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
/**
* 问卷调查答案 Service实现
*
* @author hyq
* @date 2024-03-15
*/
@Service
@Transactional(readOnly = true)
@Slf4j
public class FirstAidServiceImpl extends ServiceImpl<FirstAidMapper, FirstAidInfo> implements IFirstAidService {
/**
* 问卷调查答案 Dao
*/
@Resource
private FirstAidMapper firstAidMapper;
/**
* 分页查询
*
* @param firstAidInfoDTO
* @return
*/
@Override
public AjaxResult getFirstAidInfoList(FirstAidInfoDTO firstAidInfoDTO) {
log.info("查询 入参: {}", firstAidInfoDTO);
LambdaQueryWrapper<FirstAidInfo> queryWrapper = new LambdaQueryWrapper<>();
// 创建分页对象
Page<FirstAidInfo> page = new Page<>(firstAidInfoDTO.getCurrentPage(),firstAidInfoDTO.getLimit());
queryWrapper
.like(FirstAidInfo::getFirstAidName, firstAidInfoDTO.getFirstAidName())
.eq(FirstAidInfo::getPublishStatus, firstAidInfoDTO.getPublishStatus())
.eq(FirstAidInfo::getIsDeleted, firstAidInfoDTO.getIsDeleted())
.orderByDesc(FirstAidInfo::getCreatedTime);
Page<FirstAidInfo> firstAidInfoPage = firstAidMapper.selectPage(page, queryWrapper);
List<FirstAidInfo> records = firstAidInfoPage.getRecords();
if (StringUtils.isNotEmpty(records)) {
for (FirstAidInfo firstAidInfo : records) {
String instruction = firstAidInfo.getInstruction();
if (StringUtils.isNotEmpty(instruction)) {
try {
ObjectMapper objectMapper = new ObjectMapper();
List<OperationStep> operationSteps = objectMapper.readValue(instruction, new TypeReference<List<OperationStep>>() {
});
// 现在operationSteps包含了从JSON字符串转换回的OperationStep对象列表
if (StringUtils.isNotEmpty(operationSteps)) {
firstAidInfo.setSteps(operationSteps);
}
} catch (IOException e) {
log.error("应急知识json 转换步骤失败 查询详情", e);
throw new ServiceException("急救知识查询失败");
}
}
}
}
return AjaxResult.success(firstAidInfoPage);
}
/**
* 查询全部
*
* @param firstAidInfoDTO
* @return
*/
@Override
public AjaxResult selectAll(FirstAidInfoDTO firstAidInfoDTO) {
log.info("查询 入参: {}", firstAidInfoDTO);
LambdaQueryWrapper<FirstAidInfo> queryWrapper = new LambdaQueryWrapper<>();
// 创建分页对象
queryWrapper
.like(FirstAidInfo::getFirstAidName, firstAidInfoDTO.getFirstAidName())
.eq(FirstAidInfo::getPublishStatus, firstAidInfoDTO.getPublishStatus())
.eq(FirstAidInfo::getIsDeleted, firstAidInfoDTO.getIsDeleted())
.orderByDesc(FirstAidInfo::getCreatedTime);
List<FirstAidInfo> firstAidInfos = firstAidMapper.selectList(queryWrapper);
if (StringUtils.isNotEmpty(firstAidInfos)) {
for (FirstAidInfo firstAidInfo : firstAidInfos) {
String instruction = firstAidInfo.getInstruction();
if (StringUtils.isNotEmpty(instruction)) {
try {
ObjectMapper objectMapper = new ObjectMapper();
List<OperationStep> operationSteps = objectMapper.readValue(instruction, new TypeReference<List<OperationStep>>() {
});
// 现在operationSteps包含了从JSON字符串转换回的OperationStep对象列表
if (StringUtils.isNotEmpty(operationSteps)) {
firstAidInfo.setSteps(operationSteps);
}
} catch (IOException e) {
log.error("应急知识json 转换步骤失败 查询详情",e);
throw new ServiceException("急救知识查询失败");
}
}
}
}
return AjaxResult.success(firstAidInfos);
}
@Override
public AjaxResult selectInfoById(FirstAidInfoDTO firstAidInfoDTO) {
FirstAidInfoVO firstAidInfoVO = new FirstAidInfoVO();
FirstAidInfo firstAidInfo = firstAidMapper.selectById(firstAidInfoDTO.getId());
if (StringUtils.isNull(firstAidInfo)) {
throw new ServiceException("应急知识不存在");
}
BeanUtils.copyProperties(firstAidInfo, firstAidInfoVO);
//回参数 改造
String instruction = firstAidInfo.getInstruction();
if (StringUtils.isNotEmpty(instruction)) {
try {
ObjectMapper objectMapper = new ObjectMapper();
List<OperationStep> operationSteps = objectMapper.readValue(instruction, new TypeReference<List<OperationStep>>() {
});
// 现在operationSteps包含了从JSON字符串转换回的OperationStep对象列表
if (StringUtils.isNotEmpty(operationSteps)) {
firstAidInfoVO.setOperationSteps(operationSteps);
}
} catch (IOException e) {
log.error("应急知识json 转换步骤失败 查询详情",e);
throw new ServiceException("应急知识json 转换步骤失败 查询详情");
}
}
return AjaxResult.success(firstAidInfoVO);
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2021, orioc and/or its affiliates. All rights reserved.
* Use, Copy is subject to authorized license.
*/
package com.bonus.sharedstation.web.vo;
import com.bonus.sharedstation.common.pojo.PageDTO;
import com.bonus.sharedstation.web.domain.OperationStep;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 急救知识 实体类
*
* @author zhh
* @date 2024-11-14
*/
@Data
public class FirstAidInfoVO extends PageDTO implements java.io.Serializable {
private static final long serialVersionUID = -6101716895947019269L;
private Integer id;
/**
* 急救知识信息
*/
private String firstAidName;
/**
* 视频 Url
*/
private String videoUrl;
/**
* 急救知识介绍
*/
private String instruction;
/**
* 发布状态1表示已发布0表示未发布
*/
private String publishStatus;
/**
* 图标地址
*/
private String logoAddress;
/**
* 背景图地址
*/
private String backGroundAddress;
/**
* 操作步骤
*/
private List<OperationStep> operationSteps;
/**
* 创建人
*/
private String createdBy; // 创建人
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime; // 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedTime; // 修改时间
private String updatedBy; // 修改人
private String isDeleted; // 逻辑删除标识1表示已删除0表示未删除
}

View File

@ -0,0 +1,38 @@
<?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.bonus.sharedstation.app.mapper.MlMedicalInformationMapper">
<resultMap type="com.bonus.sharedstation.app.domain.MlMedicalInformation" id="MlMedicalInformationMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="unit" column="unit" jdbcType="VARCHAR"/>
<result property="appointmentTime" column="appointment_time" jdbcType="TIMESTAMP"/>
<result property="hospitalName" column="hospital_name" jdbcType="VARCHAR"/>
<result property="officesName" column="offices_name" jdbcType="VARCHAR"/>
<result property="doctorName" column="doctor_name" jdbcType="VARCHAR"/>
<result property="surgicalType" column="surgical_type" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="remarks" column="remarks" jdbcType="VARCHAR"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updatedTime" column="updated_time" jdbcType="TIMESTAMP"/>
<result property="updatedBy" column="updated_by" jdbcType="VARCHAR"/>
<result property="isDeleted" column="is_deleted" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="MlMedicalInformationMap">
select
id, name, user_id, phone, unit, appointment_time, hospital_name, offices_name,
doctor_name, surgical_type, type, remarks, created_by, created_time,
updated_time, updated_by, is_deleted, tenant_id,order_id,status
from ml_medical_information
where id = #{id}
</select>
</mapper>