diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtNotifyDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtNotifyDaoController.java index 8917234e0..d3df8eaee 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtNotifyDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtNotifyDaoController.java @@ -1,65 +1,79 @@ package com.ruoyi.system.fantang.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; - -import java.util.List; -import java.util.Arrays; - -import com.ruoyi.common.utils.StringUtils; -import lombok.RequiredArgsConstructor; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.fantang.domain.FtNotifyDao; import com.ruoyi.system.fantang.service.IFtNotifyDaoService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 系统信息Controller - * + * * @author ft * @date 2020-12-17 */ @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController -@RequestMapping("/fantang/notify" ) +@RequestMapping("/fantang/notify") public class FtNotifyDaoController extends BaseController { private final IFtNotifyDaoService iFtNotifyDaoService; + + @GetMapping("/isHaveNewMsg") + public AjaxResult isHaveNewMsg() { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("read_flag", 0); + wrapper.eq("message_type",1); + List list = iFtNotifyDaoService.list(wrapper); + int size = list.size(); + String msgBody = ""; + if (list.size() > 0) { + msgBody = "有 " + list.size() + " 条病患冲突消息待处理"; + } + Map messageData = new HashMap<>(); + messageData.put("size", size); + messageData.put("msgBody", msgBody); + + return AjaxResult.success(messageData); + } + + /** * 查询系统信息列表 */ @PreAuthorize("@ss.hasPermi('fantang:notify:list')") @GetMapping("/list") - public TableDataInfo list(FtNotifyDao ftNotifyDao) - { + public TableDataInfo list(FtNotifyDao ftNotifyDao) { startPage(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(ftNotifyDao); - if (ftNotifyDao.getMessageType() != null){ - lqw.eq(FtNotifyDao::getMessageType ,ftNotifyDao.getMessageType()); + if (ftNotifyDao.getMessageType() != null) { + lqw.eq(FtNotifyDao::getMessageType, ftNotifyDao.getMessageType()); } - if (ftNotifyDao.getScope() != null){ - lqw.eq(FtNotifyDao::getScope ,ftNotifyDao.getScope()); + if (ftNotifyDao.getScope() != null) { + lqw.eq(FtNotifyDao::getScope, ftNotifyDao.getScope()); } - if (StringUtils.isNotBlank(ftNotifyDao.getMessageBody())){ - lqw.eq(FtNotifyDao::getMessageBody ,ftNotifyDao.getMessageBody()); + if (StringUtils.isNotBlank(ftNotifyDao.getMessageBody())) { + lqw.eq(FtNotifyDao::getMessageBody, ftNotifyDao.getMessageBody()); } - if (ftNotifyDao.getReadFlag() != null){ - lqw.eq(FtNotifyDao::getReadFlag ,ftNotifyDao.getReadFlag()); + if (ftNotifyDao.getReadFlag() != null) { + lqw.eq(FtNotifyDao::getReadFlag, ftNotifyDao.getReadFlag()); } List list = iFtNotifyDaoService.list(lqw); return getDataTable(list); @@ -68,30 +82,30 @@ public class FtNotifyDaoController extends BaseController { /** * 导出系统信息列表 */ - @PreAuthorize("@ss.hasPermi('fantang:notify:export')" ) - @Log(title = "系统信息" , businessType = BusinessType.EXPORT) - @GetMapping("/export" ) + @PreAuthorize("@ss.hasPermi('fantang:notify:export')") + @Log(title = "系统信息", businessType = BusinessType.EXPORT) + @GetMapping("/export") public AjaxResult export(FtNotifyDao ftNotifyDao) { LambdaQueryWrapper lqw = new LambdaQueryWrapper(ftNotifyDao); List list = iFtNotifyDaoService.list(lqw); - ExcelUtil util = new ExcelUtil(FtNotifyDao. class); - return util.exportExcel(list, "notify" ); + ExcelUtil util = new ExcelUtil(FtNotifyDao.class); + return util.exportExcel(list, "notify"); } /** * 获取系统信息详细信息 */ - @PreAuthorize("@ss.hasPermi('fantang:notify:query')" ) - @GetMapping(value = "/{id}" ) - public AjaxResult getInfo(@PathVariable("id" ) Long id) { + @PreAuthorize("@ss.hasPermi('fantang:notify:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(iFtNotifyDaoService.getById(id)); } /** * 新增系统信息 */ - @PreAuthorize("@ss.hasPermi('fantang:notify:add')" ) - @Log(title = "系统信息" , businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('fantang:notify:add')") + @Log(title = "系统信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody FtNotifyDao ftNotifyDao) { return toAjax(iFtNotifyDaoService.save(ftNotifyDao) ? 1 : 0); @@ -100,8 +114,8 @@ public class FtNotifyDaoController extends BaseController { /** * 修改系统信息 */ - @PreAuthorize("@ss.hasPermi('fantang:notify:edit')" ) - @Log(title = "系统信息" , businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('fantang:notify:edit')") + @Log(title = "系统信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody FtNotifyDao ftNotifyDao) { return toAjax(iFtNotifyDaoService.updateById(ftNotifyDao) ? 1 : 0); @@ -110,9 +124,9 @@ public class FtNotifyDaoController extends BaseController { /** * 删除系统信息 */ - @PreAuthorize("@ss.hasPermi('fantang:notify:remove')" ) - @Log(title = "系统信息" , businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}" ) + @PreAuthorize("@ss.hasPermi('fantang:notify:remove')") + @Log(title = "系统信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(iFtNotifyDaoService.removeByIds(Arrays.asList(ids)) ? 1 : 0); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSyncConflictGenDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSyncConflictGenDaoController.java new file mode 100644 index 000000000..276688f0e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSyncConflictGenDaoController.java @@ -0,0 +1,167 @@ +package com.ruoyi.system.fantang.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.fantang.domain.FtPatientDao; +import com.ruoyi.system.fantang.domain.FtSyncConflictGenDao; +import com.ruoyi.system.fantang.service.IFtPatientDaoService; +import com.ruoyi.system.fantang.service.IFtSyncConflictGenDaoService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +/** + * 同步冲突Controller + * + * @author ft + * @date 2020-12-24 + */ +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/fantang/syncConflict") +public class FtSyncConflictGenDaoController extends BaseController { + + private final IFtSyncConflictGenDaoService iFtSyncConflictGenDaoService; + + private final IFtPatientDaoService iFftPatientDaoService; + + + /** + * 处理冲突 + */ + @PostMapping("/solveConflict") + public AjaxResult solveConflict(@RequestBody FtSyncConflictGenDao syncConflictGenDao) { + + Integer patientFlag = syncConflictGenDao.getPatientFlag(); + Long patientId = syncConflictGenDao.getPatientId(); + + if (patientFlag==2){ + if (syncConflictGenDao.getHospitalId().equals(syncConflictGenDao.getOldHospitalId())){ + FtPatientDao patientDao = iFftPatientDaoService.getById(patientId); + patientDao.setDepartId(syncConflictGenDao.getDepartId()); + patientDao.setBedId(syncConflictGenDao.getBedId()); + patientDao.setName(syncConflictGenDao.getName()); + iFftPatientDaoService.updateById(patientDao); + }else { + FtPatientDao ftPatientDao = new FtPatientDao(); + ftPatientDao.setDepartId(syncConflictGenDao.getDepartId()); + ftPatientDao.setBedId(syncConflictGenDao.getBedId()); + ftPatientDao.setName(syncConflictGenDao.getName()); + iFftPatientDaoService.save(ftPatientDao); + } + } + + syncConflictGenDao.setIsSolve(1); + iFtSyncConflictGenDaoService.updateById(syncConflictGenDao); + + return AjaxResult.success("已处理"); + } + + /** + * 查询同步冲突列表 + */ + @PreAuthorize("@ss.hasPermi('fantang:syncConflict:list')") + @GetMapping("/list") + public TableDataInfo list(FtSyncConflictGenDao ftSyncConflictGenDao) { + startPage(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(ftSyncConflictGenDao); + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getHospitalId())) { + lqw.eq(FtSyncConflictGenDao::getHospitalId, ftSyncConflictGenDao.getHospitalId()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getName())) { + lqw.like(FtSyncConflictGenDao::getName, ftSyncConflictGenDao.getName()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getDepartName())) { + lqw.like(FtSyncConflictGenDao::getDepartName, ftSyncConflictGenDao.getDepartName()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getBedId())) { + lqw.eq(FtSyncConflictGenDao::getBedId, ftSyncConflictGenDao.getBedId()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getOldHospitalId())) { + lqw.eq(FtSyncConflictGenDao::getOldHospitalId, ftSyncConflictGenDao.getOldHospitalId()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getOldName())) { + lqw.like(FtSyncConflictGenDao::getOldName, ftSyncConflictGenDao.getOldName()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getOldDepartName())) { + lqw.like(FtSyncConflictGenDao::getOldDepartName, ftSyncConflictGenDao.getOldDepartName()); + } + if (StringUtils.isNotBlank(ftSyncConflictGenDao.getOldBedId())) { + lqw.eq(FtSyncConflictGenDao::getOldBedId, ftSyncConflictGenDao.getOldBedId()); + } + if (ftSyncConflictGenDao.getDepartId() != null) { + lqw.eq(FtSyncConflictGenDao::getDepartId, ftSyncConflictGenDao.getDepartId()); + } + if (ftSyncConflictGenDao.getOldDepartId() != null) { + lqw.eq(FtSyncConflictGenDao::getOldDepartId, ftSyncConflictGenDao.getOldDepartId()); + } + if (ftSyncConflictGenDao.getIsSolve()!=null){ + lqw.eq(FtSyncConflictGenDao::getIsSolve,ftSyncConflictGenDao.getIsSolve()); + } + List list = iFtSyncConflictGenDaoService.list(lqw); + return getDataTable(list); + } + + /** + * 导出同步冲突列表 + */ + @PreAuthorize("@ss.hasPermi('fantang:syncConflict:export')") + @Log(title = "同步冲突", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(FtSyncConflictGenDao ftSyncConflictGenDao) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper(ftSyncConflictGenDao); + List list = iFtSyncConflictGenDaoService.list(lqw); + ExcelUtil util = new ExcelUtil(FtSyncConflictGenDao.class); + return util.exportExcel(list, "syncConflict"); + } + + /** + * 获取同步冲突详细信息 + */ + @PreAuthorize("@ss.hasPermi('fantang:syncConflict:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(iFtSyncConflictGenDaoService.getById(id)); + } + + /** + * 新增同步冲突 + */ + @PreAuthorize("@ss.hasPermi('fantang:syncConflict:add')") + @Log(title = "同步冲突", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FtSyncConflictGenDao ftSyncConflictGenDao) { + return toAjax(iFtSyncConflictGenDaoService.save(ftSyncConflictGenDao) ? 1 : 0); + } + + /** + * 修改同步冲突 + */ + @PreAuthorize("@ss.hasPermi('fantang:syncConflict:edit')") + @Log(title = "同步冲突", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FtSyncConflictGenDao ftSyncConflictGenDao) { + return toAjax(iFtSyncConflictGenDaoService.updateById(ftSyncConflictGenDao) ? 1 : 0); + } + + /** + * 删除同步冲突 + */ + @PreAuthorize("@ss.hasPermi('fantang:syncConflict:remove')") + @Log(title = "同步冲突", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(iFtSyncConflictGenDaoService.removeByIds(Arrays.asList(ids)) ? 1 : 0); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSyncConflictGenDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSyncConflictGenDao.java new file mode 100644 index 000000000..79f09d58e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSyncConflictGenDao.java @@ -0,0 +1,59 @@ +package com.ruoyi.system.fantang.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 同步冲突对象 ft_sync_conflict + * + * @author ft + * @date 2020-12-24 + */ +@Data +@ToString +@EqualsAndHashCode +@NoArgsConstructor +@Accessors(chain = true) +@TableName("ft_sync_conflict") +public class FtSyncConflictGenDao implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id") + private Long id; + + private String hospitalId; + + private String name; + + private String departName; + + private String bedId; + + private String oldHospitalId; + + private String oldName; + + private String oldDepartName; + + private String oldBedId; + + private Long departId; + + private Long oldDepartId; + + @TableField(exist = false) + private Integer patientFlag; + + private Long patientId; + + private Integer isSolve; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java index ed3d0324f..b1fb4d982 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java @@ -40,6 +40,9 @@ public interface FtPatientDaoMapper extends BaseMapper { public int updateDepartIDToNewPatient(); - @Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name != c.name") + @Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id, c.patient_id as patient_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name != c.name") List syncConflictOnlyHospitalEqual(); + + @Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id, c.patient_id as patient_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name = c.name and c.hospital_id!=a.hospital_id") + List syncConflictOtherAllEqual(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSyncConflictGenDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSyncConflictGenDaoMapper.java new file mode 100644 index 000000000..178d46066 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSyncConflictGenDaoMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.fantang.mapper; + +import com.ruoyi.system.fantang.domain.FtSyncConflictGenDao; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * 同步冲突Mapper接口 + * + * @author ft + * @date 2020-12-24 + */ +public interface FtSyncConflictGenDaoMapper extends BaseMapper { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSyncConflictGenDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSyncConflictGenDaoService.java new file mode 100644 index 000000000..26c75032b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSyncConflictGenDaoService.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.fantang.service; + +import com.ruoyi.system.fantang.domain.FtSyncConflictGenDao; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 同步冲突Service接口 + * + * @author ft + * @date 2020-12-24 + */ +public interface IFtSyncConflictGenDaoService extends IService { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSyncConflictGenDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSyncConflictGenDaoServiceImpl.java new file mode 100644 index 000000000..c8a1cf4b7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSyncConflictGenDaoServiceImpl.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.fantang.service.impl; + +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.system.fantang.mapper.FtSyncConflictGenDaoMapper; +import com.ruoyi.system.fantang.domain.FtSyncConflictGenDao; +import com.ruoyi.system.fantang.service.IFtSyncConflictGenDaoService; + +/** + * 同步冲突Service业务层处理 + * + * @author ft + * @date 2020-12-24 + */ +@Service +public class FtSyncConflictGenDaoServiceImpl extends ServiceImpl implements IFtSyncConflictGenDaoService { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/vo/ftSyncConflictVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/vo/ftSyncConflictVo.java index 601fde361..c38aa7f65 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/vo/ftSyncConflictVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/vo/ftSyncConflictVo.java @@ -19,7 +19,7 @@ import java.io.Serializable; */ @Data @ToString -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = false) @NoArgsConstructor @Accessors(chain = true) public class ftSyncConflictVo extends FtSyncPatientDao implements Serializable { @@ -49,4 +49,7 @@ private static final long serialVersionUID=1L; @TableField("old_depart_id") private String oldDepartId; + + @TableField("patient_id") + private Long patientId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SyncPatientServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SyncPatientServiceImpl.java index 0f19a3f78..7db404690 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SyncPatientServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SyncPatientServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.system.fantang.domain.FtNotifyDao; import com.ruoyi.system.fantang.domain.FtRemotePatientDao; import com.ruoyi.system.fantang.domain.FtSyncLogDao; import com.ruoyi.system.fantang.mapper.*; @@ -35,8 +36,8 @@ public class SyncPatientServiceImpl implements ISyncPatientService { /** * 从远程数据源插上病患数据 * 业务逻辑: - * 1、本地同步表将标志位置 0 等待同步状态; - * 2、 + * 1、本地同步表将标志位置 0 等待同步状态; + * 2、 * * @param remotePatientDaoList * @return @@ -56,21 +57,24 @@ public class SyncPatientServiceImpl implements ISyncPatientService { // 初始化本地病患表准备同步,将标志位置“0” int ret = patientDaoMapper.initForSync(); - syncMessage.append(String.format("本地初始化记录:%d 条",ret)); - + syncMessage.append(String.format("本地初始化记录:%d 条", ret)); + // 自动同步:住院号相同,姓名,科室,床号相同 // 同步逻辑1:更新住院号、科室、床号、姓名全部相同的记录,并标注flag=1 int syncCount = patientDaoMapper.syncEqual(); syncMessage.append(String.format("更新逻辑1: %d 条", syncCount)); + // 自动同步:住院号不相同,姓名相同,科室,床号不相同,该病患更换了其它的科室,例如:从一科换去二科 // 同步逻辑2:更新住院号、姓名相同的记录,并标注flag=1 syncCount = patientDaoMapper.syncEqualForHospitalAndName(); syncMessage.append(String.format("更新逻辑2: %d 条", syncCount)); + // 自动同步:住院号不同,科室,床号相同,姓名不同,认为是一个新增的病患记录 // 同步逻辑3:新增住院号、科室、床号相同的记录,作为新病患同步,并标注flag=2 syncCount = patientDaoMapper.syncNewHospitalId(); syncMessage.append(String.format("更新逻辑3: %d 条", syncCount)); + // 手动:住院号相同,科室、床号、姓名都不相同,无法判断这个住院号后面三个数据是什么原因发生了变化 // 冲突逻辑1:住院号相同、科室、床号、姓名都不相同的记录,作为冲突数据,并标注flag=3 List syncPatientVos = patientDaoMapper.syncConflictOnlyHospitalEqual(); syncMessage.append(String.format("冲突逻辑1: %d 条", syncPatientVos.size())); @@ -78,6 +82,31 @@ public class SyncPatientServiceImpl implements ISyncPatientService { syncConflictDaoMapper.insert(vo); } + // 手动:不知道该情况是按照新病患处理还是旧的病患更新住院号信息 + // 冲突逻辑2:住院号不相同、科室、床号、姓名都相同的记录,作为冲突数据,并标注flag=3 + List syncPatientVoList = patientDaoMapper.syncConflictOtherAllEqual(); + syncMessage.append(String.format("冲突逻辑2: %d 条", syncPatientVoList.size())); + for (ftSyncConflictVo ftSyncConflictVo : syncPatientVoList) { + syncConflictDaoMapper.insert(ftSyncConflictVo); + } + + int msgTotal = syncPatientVos.size() + syncPatientVoList.size(); + + // 如果有冲突发送一条消息 + if (msgTotal > 0) { + FtNotifyDao notifyDao = new FtNotifyDao(); + // 类型为病患同步冲突 + notifyDao.setMessageType(1); + // 广播类型 + notifyDao.setScope(0); + // 消息内容 + notifyDao.setMessageBody("有 " + msgTotal + " 条病患数据同步时发生冲突"); + notifyDao.setCreateAt(new Date()); + + notifyDaoMapper.insert(notifyDao); + + } + // 将没有同步的病患数据设置为出院状态, off_flag=1 patientDaoMapper.updateOffHospitalFlag(); diff --git a/ruoyi-system/src/main/resources/mapper/fantang/FtSyncConflictGenDaoMapper.xml b/ruoyi-system/src/main/resources/mapper/fantang/FtSyncConflictGenDaoMapper.xml new file mode 100644 index 000000000..f3517a2cd --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/fantang/FtSyncConflictGenDaoMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/fantang/notify.js b/ruoyi-ui/src/api/fantang/notify.js index 1ae32ab95..2c9f15967 100644 --- a/ruoyi-ui/src/api/fantang/notify.js +++ b/ruoyi-ui/src/api/fantang/notify.js @@ -17,6 +17,14 @@ export function getNotify(id) { }) } +// 查询是否有新消息 +export function isHaveNewMsg() { + return request({ + url: '/fantang/notify/isHaveNewMsg', + method: 'get' + }) +} + // 新增系统信息 export function addNotify(data) { return request({ @@ -26,6 +34,14 @@ export function addNotify(data) { }) } +export function solveConflict(data) { + return request({ + url: '/fantang/notify/solveConflict', + method: 'post', + data: data + }) +} + // 修改系统信息 export function updateNotify(data) { return request({ @@ -50,4 +66,4 @@ export function exportNotify(query) { method: 'get', params: query }) -} \ No newline at end of file +} diff --git a/ruoyi-ui/src/api/fantang/syncConflict.js b/ruoyi-ui/src/api/fantang/syncConflict.js new file mode 100644 index 000000000..3a95369ab --- /dev/null +++ b/ruoyi-ui/src/api/fantang/syncConflict.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询同步冲突列表 +export function listSyncConflict(query) { + return request({ + url: '/fantang/syncConflict/list', + method: 'get', + params: query + }) +} + +// 查询同步冲突详细 +export function getSyncConflict(id) { + return request({ + url: '/fantang/syncConflict/' + id, + method: 'get' + }) +} + +// 新增同步冲突 +export function addSyncConflict(data) { + return request({ + url: '/fantang/syncConflict', + method: 'post', + data: data + }) +} + +// 修改同步冲突 +export function updateSyncConflict(data) { + return request({ + url: '/fantang/syncConflict', + method: 'put', + data: data + }) +} + +// 删除同步冲突 +export function delSyncConflict(id) { + return request({ + url: '/fantang/syncConflict/' + id, + method: 'delete' + }) +} + +// 导出同步冲突 +export function exportSyncConflict(query) { + return request({ + url: '/fantang/syncConflict/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 0c2055ad7..f477d36d1 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -1,19 +1,276 @@ @@ -26,12 +283,14 @@ export default { font-size: 17.5px; border-left: 5px solid #eee; } + hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #eee; } + .col-item { margin-bottom: 20px; }