|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.emr.service.ipml;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.emr.dao.ArchiveOtherExtMapper;
|
|
|
|
|
import com.emr.dao.ArchiveOtherExtSubmittimeMapper;
|
|
|
|
|
import com.emr.dao.ArchiveOtherMapper;
|
|
|
|
@ -11,7 +12,6 @@ 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;
|
|
|
|
@ -52,8 +52,10 @@ public class ArchiveOtherExtService {
|
|
|
|
|
//查询护理的最新采集完成时间
|
|
|
|
|
String maxETime = archiveOtherExtMapper.selectMaxETimeByNursingAndJzh(archiveOtherExtVo.getJzh());
|
|
|
|
|
for(ArchiveOtherExtVo vo : list){
|
|
|
|
|
if(StringUtils.isNotBlank(maxETime)){
|
|
|
|
|
vo.setTempTime(maxETime);
|
|
|
|
|
if(vo.getSysflag().equals(1)) {
|
|
|
|
|
if (StringUtils.isNotBlank(maxETime)) {
|
|
|
|
|
vo.setNursingEndTime(maxETime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//presulit为Done转换为完成
|
|
|
|
|
String presult = vo.getPresult();
|
|
|
|
@ -107,14 +109,14 @@ public class ArchiveOtherExtService {
|
|
|
|
|
FileReader fileReader = new FileReader(jsonFile);
|
|
|
|
|
Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
|
|
|
|
|
int ch = 0;
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
while ((ch = reader.read()) != -1) {
|
|
|
|
|
sb.append((char) ch);
|
|
|
|
|
}
|
|
|
|
|
fileReader.close();
|
|
|
|
|
reader.close();
|
|
|
|
|
String jsonStr = sb.toString();
|
|
|
|
|
List<KeyValue> list = (List<KeyValue>) net.sf.json.JSONArray.toList(JSONArray.fromObject(jsonStr), KeyValue.class);
|
|
|
|
|
List<KeyValue> list = JSON.parseArray(jsonStr,KeyValue.class);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -126,7 +128,7 @@ public class ArchiveOtherExtService {
|
|
|
|
|
* @param masterId
|
|
|
|
|
* @param sysFlag
|
|
|
|
|
*/
|
|
|
|
|
public void updateSubmit(String ids,String notNursingIds, String detailIds,String jzh, String masterId, Integer sysFlag) throws Exception{
|
|
|
|
|
public void updateSubmit(String ids,String notNursingIds, String detailIds,String jzh, String masterId, Integer sysFlag,HttpServletRequest request) throws Exception{
|
|
|
|
|
String idsStr = splitString2String(ids);
|
|
|
|
|
String idsTemp = idsStr;
|
|
|
|
|
//存在护理记录则调用护理按需采集功能
|
|
|
|
@ -143,7 +145,7 @@ public class ArchiveOtherExtService {
|
|
|
|
|
updateCommomSubmit(idsTemp);
|
|
|
|
|
}
|
|
|
|
|
//操作提交信息表
|
|
|
|
|
operOtherExtSubmitInfo(ids,idsStr,detailIds);
|
|
|
|
|
operOtherExtSubmitInfo(ids,idsStr,detailIds,request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -245,9 +247,13 @@ public class ArchiveOtherExtService {
|
|
|
|
|
* @param ids 不带单引号的ext_id
|
|
|
|
|
* @param idsStr 带单引号的ext_id
|
|
|
|
|
*/
|
|
|
|
|
private void operOtherExtSubmitInfo(String ids,String idsStr,String detailIds) {
|
|
|
|
|
private void operOtherExtSubmitInfo(String ids,String idsStr,String detailIds,HttpServletRequest request) {
|
|
|
|
|
//查询ext_id在ext_info表中是否存在
|
|
|
|
|
List<ArchiveOtherExtSubmittime> infoList = archiveOtherExtSubmittimeMapper.selectAllByExtId(idsStr);
|
|
|
|
|
//根据ext_ids查询other_ext表的eTime
|
|
|
|
|
List<ArchiveOtherExtVo> archiveOtherExtVos = archiveOtherExtMapper.selectAllByIds(ids);
|
|
|
|
|
//获取用户名
|
|
|
|
|
String userName = commomService.getCurrentUserName(request);
|
|
|
|
|
//定义需要新增的集合
|
|
|
|
|
List<ArchiveOtherExtSubmittime> createList = new ArrayList<>();
|
|
|
|
|
//定义需要更新的集合
|
|
|
|
@ -260,21 +266,21 @@ public class ArchiveOtherExtService {
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
for(int i = 0;i < idArr.length;i++){
|
|
|
|
|
//定义需求操作的对象
|
|
|
|
|
String id = idArr[i];
|
|
|
|
|
ArchiveOtherExtSubmittime objTemp = new ArchiveOtherExtSubmittime();
|
|
|
|
|
objTemp.setCreateTime(fmt.format(date));
|
|
|
|
|
objTemp.setOtherExtId(id);
|
|
|
|
|
if(StringUtils.isNoneBlank(detailIdArr[i]) && !"null".equals(detailIdArr[i])) {
|
|
|
|
|
objTemp.setStr1(detailIdArr[i]);
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(id)) {
|
|
|
|
|
if(StringUtils.isNotBlank(idArr[i])){
|
|
|
|
|
//定义需求操作的对象
|
|
|
|
|
Long id = Long.valueOf(idArr[i]);
|
|
|
|
|
ArchiveOtherExtSubmittime objTemp = new ArchiveOtherExtSubmittime();
|
|
|
|
|
objTemp.setCreateTime(fmt.format(date));
|
|
|
|
|
objTemp.setOtherExtId(id);
|
|
|
|
|
if(StringUtils.isNoneBlank(detailIdArr[i]) && !"null".equals(detailIdArr[i])) {
|
|
|
|
|
objTemp.setStr1(detailIdArr[i]);
|
|
|
|
|
}
|
|
|
|
|
//定义是否存在
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
//判断存在
|
|
|
|
|
if(!CollectionUtils.isEmpty(infoList)){
|
|
|
|
|
for(ArchiveOtherExtSubmittime obj : infoList){
|
|
|
|
|
String otherExtId = obj.getOtherExtId();
|
|
|
|
|
Long otherExtId = obj.getOtherExtId();
|
|
|
|
|
if(id.equals(otherExtId)){
|
|
|
|
|
//存在赋值id
|
|
|
|
|
objTemp.setId(obj.getId());
|
|
|
|
@ -283,6 +289,15 @@ public class ArchiveOtherExtService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置最新时间
|
|
|
|
|
for(ArchiveOtherExt archiveOtherExt : archiveOtherExtVos){
|
|
|
|
|
if(archiveOtherExt.getId().equals(id)){
|
|
|
|
|
Date etime = archiveOtherExt.getEtime();
|
|
|
|
|
objTemp.setStr2(fmt.format(etime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置工号
|
|
|
|
|
objTemp.setStr3(userName);
|
|
|
|
|
//存在添加进updateStr,不存在添加进createStr
|
|
|
|
|
if(flag){
|
|
|
|
|
updateList.add(objTemp);
|
|
|
|
@ -301,6 +316,7 @@ public class ArchiveOtherExtService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据ids字段的查询与同步更新比较时间比较较晚时间的集合
|
|
|
|
|
* @param ids
|
|
|
|
|