病人同步

This commit is contained in:
ryoeiken 2020-12-24 17:07:37 +08:00
parent ff11bbb16f
commit f84ce6e13f
13 changed files with 726 additions and 53 deletions

View File

@ -1,31 +1,26 @@
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
@ -35,31 +30,50 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/
@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<FtNotifyDao> wrapper = new QueryWrapper<>();
wrapper.eq("read_flag", 0);
wrapper.eq("message_type",1);
List<FtNotifyDao> list = iFtNotifyDaoService.list(wrapper);
int size = list.size();
String msgBody = "";
if (list.size() > 0) {
msgBody = "" + list.size() + " 条病患冲突消息待处理";
}
Map<String, Object> 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<FtNotifyDao> 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<FtNotifyDao> 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<FtNotifyDao> lqw = new LambdaQueryWrapper<FtNotifyDao>(ftNotifyDao);
List<FtNotifyDao> list = iFtNotifyDaoService.list(lqw);
ExcelUtil<FtNotifyDao> util = new ExcelUtil<FtNotifyDao>(FtNotifyDao. class);
return util.exportExcel(list, "notify" );
ExcelUtil<FtNotifyDao> util = new ExcelUtil<FtNotifyDao>(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);
}

View File

@ -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<FtSyncConflictGenDao> 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<FtSyncConflictGenDao> 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<FtSyncConflictGenDao> lqw = new LambdaQueryWrapper<FtSyncConflictGenDao>(ftSyncConflictGenDao);
List<FtSyncConflictGenDao> list = iFtSyncConflictGenDaoService.list(lqw);
ExcelUtil<FtSyncConflictGenDao> util = new ExcelUtil<FtSyncConflictGenDao>(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);
}
}

View File

@ -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;
}

View File

@ -40,6 +40,9 @@ public interface FtPatientDaoMapper extends BaseMapper<FtPatientDao> {
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<ftSyncConflictVo> 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<ftSyncConflictVo> syncConflictOtherAllEqual();
}

View File

@ -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<FtSyncConflictGenDao> {
}

View File

@ -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<FtSyncConflictGenDao> {
}

View File

@ -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<FtSyncConflictGenDaoMapper, FtSyncConflictGenDao> implements IFtSyncConflictGenDaoService {
}

View File

@ -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;
}

View File

@ -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.*;
@ -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<ftSyncConflictVo> 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<ftSyncConflictVo> 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();

View File

@ -0,0 +1,24 @@
<?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.ruoyi.system.fantang.mapper.FtSyncConflictGenDaoMapper">
<resultMap type="FtSyncConflictGenDao" id="FtSyncConflictGenDaoResult">
<result property="id" column="id"/>
<result property="hospitalId" column="hospital_id"/>
<result property="name" column="name"/>
<result property="departName" column="depart_name"/>
<result property="bedId" column="bed_id"/>
<result property="oldHospitalId" column="old_hospital_id"/>
<result property="oldName" column="old_name"/>
<result property="oldDepartName" column="old_depart_name"/>
<result property="oldBedId" column="old_bed_id"/>
<result property="departId" column="depart_id"/>
<result property="oldDepartId" column="old_depart_id"/>
<result property="patientId" column="patient_id"/>
<result property="isSolve" column="is_solve"/>
</resultMap>
</mapper>

View File

@ -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({

View File

@ -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
})
}

View File

@ -1,19 +1,276 @@
<template>
<div class="app-container home">
<el-divider />
<!-- <el-divider />-->
<el-row :gutter="10">
<el-col :span="10">
<el-table v-loading="loading" :data="notifyList" border>
<!-- <el-table-column type="selection" width="55" align="center"/>-->
<el-table-column label="阅读标志" align="center" prop="id" v-if="false"/>
<el-table-column label="消息类型" align="center" prop="messageType"/>
<!-- <el-table-column label="消息范围" align="center" prop="scope"/>-->
<el-table-column label="消息内容" align="center" prop="messageBody"/>
<!-- <el-table-column label="创建时间" align="center" prop="createAt" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createAt, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="阅读标志" align="center" prop="readFlag" />-->
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['fantang:notify:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['fantang:notify:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-col>
<el-col :span="14">
<el-table v-loading="loading" :data="syncConflictList" border>
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="${comment}" align="center" prop="id" v-if="false"/>-->
<el-table-column label="住院号" align="center" prop="hospitalId"/>
<el-table-column label="姓名" align="center" prop="name"/>
<el-table-column label="科室" align="center" prop="departName"/>
<el-table-column label="床号" align="center" prop="bedId"/>
<el-table-column label="本地住院号" align="center" prop="oldHospitalId"/>
<el-table-column label="本地姓名" align="center" prop="oldName"/>
<el-table-column label="本地科室" align="center" prop="oldDepartName"/>
<el-table-column label="本地床号" align="center" prop="oldBedId"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['fantang:syncConflict:edit']"
>处理冲突
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['fantang:syncConflict:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<!-- 添加或修改同步冲突对话框 -->
<el-dialog title="处理冲突" :visible.sync="open" width="800px" append-to-body>
<el-form ref="ConflictForm" :model="ConflictForm" label-width="80px">
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="住院号" prop="hospitalId">
<el-input v-model="ConflictForm.hospitalId" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="本地住院号" prop="oldHospitalId" label-width="100px">
<el-input v-model="ConflictForm.oldHospitalId" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="姓名" prop="name">
<el-input v-model="ConflictForm.name" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="本地姓名" prop="oldName" label-width="100px">
<el-input v-model="ConflictForm.oldName" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="科室" prop="departName">
<el-input v-model="ConflictForm.departName" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="本地科室" prop="oldDepartName" label-width="100px">
<el-input v-model="ConflictForm.oldDepartName" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="床号" prop="bedId">
<el-input v-model="ConflictForm.bedId" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="本地床号" prop="oldBedId" label-width="100px">
<el-input v-model="ConflictForm.oldBedId" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="科室 id" prop="departId" v-if="false">
<el-input v-model="ConflictForm.departId"/>
</el-form-item>
<el-form-item label="本地科室 id" prop="oldDepartId" v-if="false">
<el-input v-model="ConflictForm.oldDepartId"/>
</el-form-item>
<el-form-item label="病人 id" prop="patientId" v-if="false">
<el-input v-model="ConflictForm.patientId"/>
</el-form-item>
<el-form-item label="解决方式" prop="patientFlag">
<el-select v-model="ConflictForm.patientFlag" placeholder="请选择正确的数据来源">
<el-option
v-for="item in patientFlagOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {isHaveNewMsg, listNotify, solveConflict} from "@/api/fantang/notify";
import {getSyncConflict, listSyncConflict} from "@/api/fantang/syncConflict";
export default {
name: "index",
data() {
return {
patientFlagOptions: [{
value: 1,
label: '以本系统为准'
}, {
value: 2,
label: '以 his 数据为准'
}],
open: false,
ConflictForm: {},
//
loading: true,
//
version: "3.2.1",
timer: '',
value: 0,
//
syncConflictList: [],
//
notifyList: [],
msgListSize: 0,
msgBody: null,
queryParams: {
messageType: 1,
},
queryConflictParams: {
isSolve: 0,
}
};
},
created() {
listNotify(this.queryParams).then(response => {
this.notifyList = response.rows;
this.loading = false;
});
listSyncConflict(this.queryConflictParams).then(response => {
this.syncConflictList = response.rows;
this.loading = false;
});
this.timer = setInterval(this.getNewMsg, 5000);
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getSyncConflict(id).then(response => {
this.ConflictForm = response.data;
this.open = true;
this.title = "修改同步冲突";
});
},
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.ConflictForm.id != null && this.ConflictForm.patientFlag != null) {
solveConflict(this.ConflictForm).then(response => {
this.msgSuccess("处理成功");
this.open = false;
this.getList();
});
}
}
});
},
cancel() {
this.open = false;
this.reset();
},
getNewMsg() {
isHaveNewMsg().then(response => {
console.log(response.data);
this.msgListSize = response.data.size;
this.msgBody = response.data.msgBody;
if (response.data.size > 0) {
this.$notify({
title: response.data.msgBody,
dangerouslyUseHTMLString: true,
message: '<a href="/">点击处理</a>'
});
}
})
},
reset() {
this.ConflictForm = {
id: undefined,
hospitalId: undefined,
name: undefined,
departName: undefined,
bedId: undefined,
oldHospitalId: undefined,
oldName: undefined,
oldDepartName: undefined,
oldBedId: undefined,
departId: undefined,
oldDepartId: undefined,
patientFlag: undefined,
patientId: undefined,
};
this.resetForm("form");
},
},
};
</script>
@ -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;
}