|
|
|
@ -689,6 +689,92 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
return archiveMasterMapper.selectByPrimaryKey(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 插入第三方oracle库
|
|
|
|
|
* @param flowInfo
|
|
|
|
|
*/
|
|
|
|
|
private void backInsertOracle(Integer code,ArchiveFlowInfo flowInfo){
|
|
|
|
|
//查询是否存在记录
|
|
|
|
|
String masterId = flowInfo.getMasterId();
|
|
|
|
|
String selectSql = "SELECT count(1) FROM ARCHIVE_FLOW_INFO where master_id = '"+masterId+"'";
|
|
|
|
|
List<String> counts = null;
|
|
|
|
|
try {
|
|
|
|
|
counts = OracleConnect.selectList(selectSql);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new RuntimeException("审核时查询oracle记录失败");
|
|
|
|
|
}
|
|
|
|
|
if(code == 1 || !"0".equals(counts.get(0))) {
|
|
|
|
|
Archive_Master master = archiveMasterMapper.selectByPrimaryKey(masterId);
|
|
|
|
|
String patientId = master.getPatientId();
|
|
|
|
|
String sql = "insert all into archive_flow_info (" +
|
|
|
|
|
"master_id, " +
|
|
|
|
|
"step_index," +
|
|
|
|
|
"start_step_id, " +
|
|
|
|
|
"start_step, " +
|
|
|
|
|
"sumbit_name," +
|
|
|
|
|
"target_step_id, " +
|
|
|
|
|
"target_step, " +
|
|
|
|
|
"oper_role," +
|
|
|
|
|
"use_seconds, " +
|
|
|
|
|
"remark, " +
|
|
|
|
|
"user_name," +
|
|
|
|
|
"sumbit_time, " +
|
|
|
|
|
"createtime," +
|
|
|
|
|
"jzh," +
|
|
|
|
|
"is_available," +
|
|
|
|
|
"return," +
|
|
|
|
|
"return_time" +
|
|
|
|
|
")" +
|
|
|
|
|
"values ("
|
|
|
|
|
+ "'" + flowInfo.getMasterId() + "',"
|
|
|
|
|
+ flowInfo.getStepIndex() + ","
|
|
|
|
|
+ flowInfo.getStartStepId() + ","
|
|
|
|
|
+ "'" + flowInfo.getStartStep() + "',"
|
|
|
|
|
+ "'" + flowInfo.getSumbitName() + "',"
|
|
|
|
|
+ flowInfo.getTargetStepId() + ","
|
|
|
|
|
+ "'" + flowInfo.getTargetStep() + "',"
|
|
|
|
|
+ flowInfo.getOperRole() + ","
|
|
|
|
|
+ "'" + flowInfo.getUseSeconds() + "',"
|
|
|
|
|
+ "'" + flowInfo.getRemark() + "',"
|
|
|
|
|
+ "'" + flowInfo.getUserName() + "',"
|
|
|
|
|
+ "SYSDATE,"
|
|
|
|
|
+ "SYSDATE,"
|
|
|
|
|
+ "'" + patientId + "',"
|
|
|
|
|
+ "'" + "否" + "',"
|
|
|
|
|
+ "'" + "是" + "',"
|
|
|
|
|
+ "SYSDATE"
|
|
|
|
|
+ ") select * from dual";
|
|
|
|
|
try {
|
|
|
|
|
OracleConnect.insert(sql);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new RuntimeException("审核信息插入oracle失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 退回,修改oracle信息 将该支线的所有可用都改为'否',并修改是否退回为''和退回时间
|
|
|
|
|
* @param roleIndex
|
|
|
|
|
* @param archiveDetailId
|
|
|
|
|
*/
|
|
|
|
|
private void updateOracle(String roleIndex, String archiveDetailId) {
|
|
|
|
|
//修改语句
|
|
|
|
|
String sql = "update ARCHIVE_FLOW_INFO set is_available = '否' where master_id = '"+archiveDetailId+"'";
|
|
|
|
|
if(StringUtils.isNotBlank(roleIndex)){
|
|
|
|
|
//修改单条支线
|
|
|
|
|
sql += " and OPER_ROLE in ("+roleIndex+",4)";
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
OracleConnect.update(sql);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new RuntimeException("退回修改oracle失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 退回操作
|
|
|
|
|
* */
|
|
|
|
@ -725,6 +811,8 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
//修改复审内容
|
|
|
|
|
emrFaultDetail.setCreater(username);
|
|
|
|
|
emrFaultDetail.setCreateTime(nowTime);
|
|
|
|
|
//定义修改支线
|
|
|
|
|
String roleIndex = "";
|
|
|
|
|
switch (returntoRole) {
|
|
|
|
|
//退回给医生
|
|
|
|
|
case "DOCTOR":
|
|
|
|
@ -732,11 +820,13 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
status = EnumVerify.DocState.backToDoctor(Integer.valueOf(emrFaultDetail.getStatus()),archiveFlowRoles);
|
|
|
|
|
//退回的状态码
|
|
|
|
|
backToCodeList.add(EnumVerify.DocState.DortorBack.getCode());
|
|
|
|
|
roleIndex = "1";
|
|
|
|
|
break;
|
|
|
|
|
//退回给护士
|
|
|
|
|
case "NURSE":
|
|
|
|
|
status = EnumVerify.DocState.backToNurse(Integer.valueOf(emrFaultDetail.getStatus()),archiveFlowRoles);
|
|
|
|
|
backToCodeList.add(EnumVerify.DocState.NurseBack.getCode());
|
|
|
|
|
roleIndex = "2";
|
|
|
|
|
break;
|
|
|
|
|
//退回给医生和护士
|
|
|
|
|
case "ALL":
|
|
|
|
@ -751,8 +841,12 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
//获取当前节点和下个节点对象集合
|
|
|
|
|
List<ArchiveFlowRole> currentRoleAndNextRole = flowInfoService.getCurrentRoleAndNextRole(targetCode, backToCode,archiveFlowRoles);
|
|
|
|
|
//添加进流转记录
|
|
|
|
|
Integer flowInfoId = flowInfoService.insertFlowInfo(masterId,remark,currentRoleAndNextRole.get(0),currentRoleAndNextRole.get(1),new Date());
|
|
|
|
|
emrFaultDetail.setParentId(flowInfoId);
|
|
|
|
|
ArchiveFlowInfo flowInfo = flowInfoService.insertFlowInfo(masterId,remark,currentRoleAndNextRole.get(0),currentRoleAndNextRole.get(1),new Date());
|
|
|
|
|
//插入退回信息
|
|
|
|
|
backInsertOracle(0,flowInfo);
|
|
|
|
|
//修改退回信息
|
|
|
|
|
updateOracle(roleIndex,emrFaultDetail.getArchiveDetailId());
|
|
|
|
|
emrFaultDetail.setParentId(flowInfo.getId());
|
|
|
|
|
//添加缺陷记录
|
|
|
|
|
emrFaultDetailService.insertSel(emrFaultDetail);
|
|
|
|
|
}
|
|
|
|
@ -867,6 +961,72 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 插入第三方oracle库
|
|
|
|
|
* @param flowInfo
|
|
|
|
|
*/
|
|
|
|
|
private void insertOracle(Integer code,ArchiveFlowInfo flowInfo){
|
|
|
|
|
//查询是否存在记录
|
|
|
|
|
String masterId = flowInfo.getMasterId();
|
|
|
|
|
String selectSql = "SELECT count(1) FROM ARCHIVE_FLOW_INFO where master_id = '"+masterId+"'";
|
|
|
|
|
List<String> counts = null;
|
|
|
|
|
try {
|
|
|
|
|
counts = OracleConnect.selectList(selectSql);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new RuntimeException("审核时查询oracle记录失败");
|
|
|
|
|
}
|
|
|
|
|
log.info("masterId查询结果:"+counts.get(0));
|
|
|
|
|
if(code == 1 || !"0".equals(counts.get(0))) {
|
|
|
|
|
Archive_Master master = archiveMasterMapper.selectByPrimaryKey(masterId);
|
|
|
|
|
String patientId = master.getPatientId();
|
|
|
|
|
String sql = "insert all into archive_flow_info (" +
|
|
|
|
|
"master_id, " +
|
|
|
|
|
"step_index," +
|
|
|
|
|
"start_step_id, " +
|
|
|
|
|
"start_step, " +
|
|
|
|
|
"sumbit_name," +
|
|
|
|
|
"target_step_id, " +
|
|
|
|
|
"target_step, " +
|
|
|
|
|
"oper_role," +
|
|
|
|
|
"use_seconds, " +
|
|
|
|
|
"remark, " +
|
|
|
|
|
"user_name," +
|
|
|
|
|
"sumbit_time, " +
|
|
|
|
|
"createtime," +
|
|
|
|
|
"jzh," +
|
|
|
|
|
"is_available" +
|
|
|
|
|
")" +
|
|
|
|
|
"values ("
|
|
|
|
|
+ "'" + flowInfo.getMasterId() + "',"
|
|
|
|
|
+ flowInfo.getStepIndex() + ","
|
|
|
|
|
+ flowInfo.getStartStepId() + ","
|
|
|
|
|
+ "'" + flowInfo.getStartStep() + "',"
|
|
|
|
|
+ "'" + flowInfo.getSumbitName() + "',"
|
|
|
|
|
+ flowInfo.getTargetStepId() + ","
|
|
|
|
|
+ "'" + flowInfo.getTargetStep() + "',"
|
|
|
|
|
+ flowInfo.getOperRole() + ","
|
|
|
|
|
+ "'" + flowInfo.getUseSeconds() + "',"
|
|
|
|
|
+ "'" + flowInfo.getRemark() + "',"
|
|
|
|
|
+ "'" + flowInfo.getUserName() + "',"
|
|
|
|
|
+ "SYSDATE,"
|
|
|
|
|
+ "SYSDATE,"
|
|
|
|
|
+ "'" + patientId + "',"
|
|
|
|
|
+ "'" + "是" + "'"
|
|
|
|
|
+ ") select * from dual";
|
|
|
|
|
log.info("sql:"+sql);
|
|
|
|
|
try {
|
|
|
|
|
OracleConnect.insert(sql);
|
|
|
|
|
log.info("成功");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
log.info("失败");
|
|
|
|
|
throw new RuntimeException("审核信息插入oracle失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当次初审
|
|
|
|
|
* @param remark
|
|
|
|
@ -890,7 +1050,9 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
//获取当前节点和下个节点对象集合
|
|
|
|
|
List<ArchiveFlowRole> currentRoleAndNextRole = flowInfoService.getCurrentRoleAndNextRole(roleCode, null,archiveFlowRoles);
|
|
|
|
|
//添加进流转记录
|
|
|
|
|
flowInfoService.insertFlowInfo(masterId,remark,currentRoleAndNextRole.get(0),currentRoleAndNextRole.get(1),new Date());
|
|
|
|
|
ArchiveFlowInfo flowInfo = flowInfoService.insertFlowInfo(masterId,remark,currentRoleAndNextRole.get(0),currentRoleAndNextRole.get(1),new Date());
|
|
|
|
|
//处于初始状态的添加进第三方oracle库里
|
|
|
|
|
insertOracle(code,flowInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1000,7 +1162,8 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
//获取当前节点和下个节点对象集合
|
|
|
|
|
List<ArchiveFlowRole> currentRoleAndNextRole = flowInfoService.getCurrentRoleAndNextRole(currentStatus, EnumVerify.DocState.MedicalRoomCheck.getCode(),archiveFlowRoles);
|
|
|
|
|
//添加流转节点
|
|
|
|
|
flowInfoService.insertFlowInfo(master.getId(), master.getRemark(), currentRoleAndNextRole.get(0), currentRoleAndNextRole.get(1), sumbitDate);
|
|
|
|
|
ArchiveFlowInfo flowInfo = flowInfoService.insertFlowInfo(master.getId(), master.getRemark(), currentRoleAndNextRole.get(0), currentRoleAndNextRole.get(1), sumbitDate);
|
|
|
|
|
insertOracle(0,flowInfo);
|
|
|
|
|
//添加纸质位置
|
|
|
|
|
paperPostionService.savePaperPostion(master);
|
|
|
|
|
}
|
|
|
|
|