|
|
|
@ -2,19 +2,23 @@ package com.emr.service.ipml;
|
|
|
|
|
|
|
|
|
|
import com.emr.dao.ArchiveOtherExtMapper;
|
|
|
|
|
import com.emr.dao.ArchiveOtherExtSubmittimeMapper;
|
|
|
|
|
import com.emr.entity.ArchiveOtherExt;
|
|
|
|
|
import com.emr.dao.ArchiveOtherMapper;
|
|
|
|
|
import com.emr.entity.ArchiveOther;
|
|
|
|
|
import com.emr.entity.ArchiveOtherExtSubmittime;
|
|
|
|
|
import com.emr.vo.ArchiveOtherExtVo;
|
|
|
|
|
import com.emr.vo.KeyValue;
|
|
|
|
|
import net.sf.json.JSONArray;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.shiro.util.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -26,6 +30,10 @@ public class ArchiveOtherExtService {
|
|
|
|
|
private ArchiveOtherExtSubmittimeMapper archiveOtherExtSubmittimeMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ArchiveOtherService archiveOtherService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ArchiveOtherMapper archiveOtherMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CommomService commomService;
|
|
|
|
|
/**查询任务详情列表
|
|
|
|
|
* @param request
|
|
|
|
|
* @param archiveOtherExtVo
|
|
|
|
@ -111,26 +119,106 @@ public class ArchiveOtherExtService {
|
|
|
|
|
* @param sysFlag
|
|
|
|
|
*/
|
|
|
|
|
public void updateSubmit(String ids,String notNursingIds, String jzh, String masterId, Integer sysFlag) throws Exception{
|
|
|
|
|
String idsStr = SplitString2String(ids);
|
|
|
|
|
String idsStr = splitString2String(ids);
|
|
|
|
|
String idsTemp = idsStr;
|
|
|
|
|
//存在护理记录则调用护理按需采集功能
|
|
|
|
|
if(null != sysFlag && sysFlag == 1) {
|
|
|
|
|
//调用护理按需采集功能
|
|
|
|
|
archiveOtherService.updateArchiveOther(jzh, masterId);
|
|
|
|
|
//ext表更新非护理记录
|
|
|
|
|
if(StringUtils.isNotBlank(notNursingIds)){
|
|
|
|
|
String tempIds = SplitString2String(notNursingIds);
|
|
|
|
|
archiveOtherExtMapper.updateSubmit(tempIds);
|
|
|
|
|
idsTemp = splitString2String(notNursingIds);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//全部更新ext表
|
|
|
|
|
archiveOtherExtMapper.updateSubmit(idsStr);
|
|
|
|
|
}
|
|
|
|
|
//ext表更新非护理记录
|
|
|
|
|
if(StringUtils.isNotBlank(notNursingIds)){
|
|
|
|
|
updateCommomSubmit(idsTemp);
|
|
|
|
|
//archiveOtherExtMapper.updateSubmit(idsTemp);
|
|
|
|
|
}
|
|
|
|
|
//操作提交信息表
|
|
|
|
|
OperOtherExtSubmitInfo(ids, idsStr);
|
|
|
|
|
operOtherExtSubmitInfo(ids, idsStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理护理,其余同步更新操作
|
|
|
|
|
* 1.按idsTemp记录查询archive_other表是否存在
|
|
|
|
|
* 2.存在将C1置为空串,批量更新
|
|
|
|
|
* 3.不存在按各自系统的标识插入数据
|
|
|
|
|
* @param idsTemp
|
|
|
|
|
*/
|
|
|
|
|
private void updateCommomSubmit(String idsTemp) throws Exception {
|
|
|
|
|
//根据other_ext的id查询存在c2字段值的集合
|
|
|
|
|
List<ArchiveOther> archiveOthers = archiveOtherService.selectAllByC2(idsTemp,null);
|
|
|
|
|
//定义需要新增的id集合
|
|
|
|
|
String notExistTemp = "";
|
|
|
|
|
if(!CollectionUtils.isEmpty(archiveOthers)){
|
|
|
|
|
String existTemp = "";
|
|
|
|
|
List<String> existOtherData = getExistOtherData(idsTemp, archiveOthers);
|
|
|
|
|
existTemp = existOtherData.get(0);
|
|
|
|
|
//批量更新
|
|
|
|
|
archiveOtherService.updateBatchC1ByC2s(existTemp);
|
|
|
|
|
notExistTemp = existOtherData.get(1);
|
|
|
|
|
}else{
|
|
|
|
|
notExistTemp = idsTemp;
|
|
|
|
|
}
|
|
|
|
|
//不存在的部门批量添加
|
|
|
|
|
//查询other_ext记录
|
|
|
|
|
if(StringUtils.isNotBlank(notExistTemp)) {
|
|
|
|
|
//定义批量新增的集合
|
|
|
|
|
List<ArchiveOther> batchInsertList = new ArrayList<>();
|
|
|
|
|
List<ArchiveOtherExtVo> archiveOtherExtVos = archiveOtherExtMapper.selectAllByIds(notExistTemp);
|
|
|
|
|
for (ArchiveOtherExtVo vo : archiveOtherExtVos){
|
|
|
|
|
batchInsertList.add(archiveOtherService.getArchiveOther(vo));
|
|
|
|
|
}
|
|
|
|
|
//批量新增
|
|
|
|
|
commomService.insertBatch("archive_other",batchInsertList,archiveOtherMapper);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* list.get(0)存在,list.get(1)不存在
|
|
|
|
|
* 组织是否存在other_ext表里记录的集合
|
|
|
|
|
* @param idsTemp
|
|
|
|
|
* @param archiveOthers
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<String> getExistOtherData(String idsTemp, List<ArchiveOther> archiveOthers) {
|
|
|
|
|
String[] idList = idsTemp.split(",");
|
|
|
|
|
//定义存在的id集合
|
|
|
|
|
StringBuilder existTemp = new StringBuilder();
|
|
|
|
|
//定义不存在的id集合
|
|
|
|
|
StringBuilder notExistTemp = new StringBuilder();
|
|
|
|
|
//重新组织需要增加的id
|
|
|
|
|
for(String str : idList){ //定义是否存在
|
|
|
|
|
boolean existFlag = false;
|
|
|
|
|
for(ArchiveOther other : archiveOthers) {
|
|
|
|
|
String id = "'" + other.getC2() + "'";
|
|
|
|
|
if (StringUtils.isNotBlank(str) && str.equals(id)) {
|
|
|
|
|
existFlag = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(existFlag){
|
|
|
|
|
if(StringUtils.isNotBlank(existTemp)){
|
|
|
|
|
existTemp.append(",");
|
|
|
|
|
}
|
|
|
|
|
existTemp.append(str);
|
|
|
|
|
}else{
|
|
|
|
|
if(StringUtils.isNotBlank(notExistTemp)){
|
|
|
|
|
notExistTemp.append(",");
|
|
|
|
|
}
|
|
|
|
|
notExistTemp.append(str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//定义返回集合
|
|
|
|
|
List<String> list = new LinkedList<>();
|
|
|
|
|
list.add(existTemp.toString());
|
|
|
|
|
list.add(notExistTemp.toString());
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//带逗号的字符串加单引号
|
|
|
|
|
private String SplitString2String(String notNursingIds) {
|
|
|
|
|
private String splitString2String(String notNursingIds) {
|
|
|
|
|
String[] notNursingIdsArr = notNursingIds.split(",");
|
|
|
|
|
//批量更新ext表的statusFlag字段值为0
|
|
|
|
|
StringBuilder notNursingIdsBuilder = new StringBuilder();
|
|
|
|
@ -150,7 +238,7 @@ public class ArchiveOtherExtService {
|
|
|
|
|
* @param ids
|
|
|
|
|
* @param idsStr
|
|
|
|
|
*/
|
|
|
|
|
private void OperOtherExtSubmitInfo(String ids, String idsStr) {
|
|
|
|
|
private void operOtherExtSubmitInfo(String ids, String idsStr) {
|
|
|
|
|
//查询ext_id在ext_info表中是否存在
|
|
|
|
|
List<ArchiveOtherExtSubmittime> infoList = archiveOtherExtSubmittimeMapper.selectAllByExtId(idsStr);
|
|
|
|
|
//定义需要新增的id集合
|
|
|
|
@ -195,8 +283,4 @@ public class ArchiveOtherExtService {
|
|
|
|
|
archiveOtherExtSubmittimeMapper.createInfo(createStr.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ArchiveOtherExtSubmittime> selectSuccessByExtIds(String ids) {
|
|
|
|
|
return archiveOtherExtSubmittimeMapper.selectSuccessByExtIds(ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|