不可重复召回

master
hujl 4 years ago
parent 1531014c94
commit 55368ede57

@ -107,54 +107,69 @@ public class MedicalRecallController {
if (!flag) {
return "请不要重复提交!";
}
String inpatientNo = emrFaultDetail.getContent();
if(StringUtils.isBlank(inpatientNo)){
return "0";
}
response.setCharacterEncoding("utf-8");
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
String handleName = user.getUserPosition();//姓名
String username = user.getUserName();//获取登录的用户名
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = format1.format(new Date());
emrFaultDetail.setUpdater(username);
emrFaultDetail.setUpdateTime(nowTime);
if(emrFaultDetail.getRecallReason()==null ||emrFaultDetail.getRecallReason()==""){
//医院需要这份病案
emrFaultDetail.setRecallReason( new String(recallReason.getBytes("iso-8859-1"),"utf-8"));
}
Archive_Master archiveMaster=new Archive_Master();
archiveMaster.setId(emrFaultDetail.getArchiveDetailId());
archiveMaster.setCmtNurse(1);
archiveMaster.setCmtDoctor(1);
archiveMaster.setArchivestate("初审");
int bol=archiveMasterService.updateByClo(archiveMaster);
if (bol == 1) {
//删除该病案号和state不为空的记录
bol = emrFaultDetailService.delByArchiveId(emrFaultDetail);
//重新插入一条记录
//emrFaultDetail.setArchiveDetailId(null);+
if (bol == 1|| bol==0) {
emrFaultDetail.setCreater(username);
emrFaultDetail.setCreateTime(nowTime);
emrFaultDetail.setFirstTrial(null);
bol = emrFaultDetailService.insertSel(emrFaultDetail);
}
String lgFlag = inpatientNo.substring(0,2);
if(!"LG".equals(lgFlag)) {
//2021-01-30 初审成功日志
Archive_Master_Following archiveMasterFollowing = new Archive_Master_Following();
archiveMasterFollowing.setMasterId(emrFaultDetail.getArchiveDetailId());
//following表中添加病案室审核操作记录
archiveMasterFollowing.setFollowingType("10");
archiveMasterFollowing.setFollowingContent("病案召回");
archiveMasterFollowing.setHandleTime(nowTime);
archiveMasterFollowing.setHandleId(username);
archiveMasterFollowing.setHandleName(handleName);
archive_master_followingService.insertSelective(archiveMasterFollowing);
int bol=0;
//判断是否已经召回
if(StringUtils.isNotBlank(emrFaultDetail.getArchiveDetailId())){
//判断病案是否已经召回
Archive_Master_Following followingLastInfo=new Archive_Master_Following();
followingLastInfo.setFollowingType("10");
followingLastInfo.setMasterId(emrFaultDetail.getArchiveDetailId());
List<Archive_Master_Following> followingLastList=archive_master_followingService.selLastByType(followingLastInfo);
if(followingLastList==null || followingLastList.size()<=0){
//最后一次存在召回
String inpatientNo = emrFaultDetail.getContent();
if(StringUtils.isBlank(inpatientNo)){
return "0";
}
response.setCharacterEncoding("utf-8");
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
String handleName = user.getUserPosition();//姓名
String username = user.getUserName();//获取登录的用户名
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = format1.format(new Date());
emrFaultDetail.setUpdater(username);
emrFaultDetail.setUpdateTime(nowTime);
if(emrFaultDetail.getRecallReason()==null ||emrFaultDetail.getRecallReason()==""){
//医院需要这份病案
emrFaultDetail.setRecallReason( new String(recallReason.getBytes("iso-8859-1"),"utf-8"));
}
Archive_Master archiveMaster=new Archive_Master();
archiveMaster.setId(emrFaultDetail.getArchiveDetailId());
archiveMaster.setCmtNurse(1);
archiveMaster.setCmtDoctor(1);
archiveMaster.setArchivestate("初审");
bol=archiveMasterService.updateByClo(archiveMaster);
if (bol == 1) {
//删除该病案号和state不为空的记录
bol = emrFaultDetailService.delByArchiveId(emrFaultDetail);
//重新插入一条记录
//emrFaultDetail.setArchiveDetailId(null);+
if (bol == 1|| bol==0) {
emrFaultDetail.setCreater(username);
emrFaultDetail.setCreateTime(nowTime);
emrFaultDetail.setFirstTrial(null);
bol = emrFaultDetailService.insertSel(emrFaultDetail);
}
String lgFlag = inpatientNo.substring(0,2);
if(!"LG".equals(lgFlag)) {
//2021-01-30 初审成功日志
Archive_Master_Following archiveMasterFollowing = new Archive_Master_Following();
archiveMasterFollowing.setMasterId(emrFaultDetail.getArchiveDetailId());
//following表中添加病案室审核操作记录
archiveMasterFollowing.setFollowingType("10");
archiveMasterFollowing.setFollowingContent("病案召回");
archiveMasterFollowing.setHandleTime(nowTime);
archiveMasterFollowing.setHandleId(username);
archiveMasterFollowing.setHandleName(handleName);
archive_master_followingService.insertSelective(archiveMasterFollowing);
}else{
//留观号召回推送第三方
archiveMasterService.requestObservationRecord(inpatientNo,"RETURNED",emrFaultDetail.getRecallReason());
}
}
}else{
//留观号召回推送第三方
archiveMasterService.requestObservationRecord(inpatientNo,"RETURNED",emrFaultDetail.getRecallReason());
return "请不要重复召回!";
}
}
return bol + "";

@ -62,4 +62,11 @@ public interface Archive_Master_FollowingMapper {
*/
List<Archive_Master_Following> selByCol(Archive_Master_Following archiveMasterFollowing);
/**
* following_type master_id
* @param archiveMasterFollowing
* @return
*/
List<Archive_Master_Following> selLastByType(Archive_Master_Following archiveMasterFollowing);
}

@ -16,4 +16,11 @@ public interface Archive_Master_FollowingService {
* @return
*/
List<Archive_Master_Following> selByCol(Archive_Master_Following archiveMasterFollowing);
/**
* following_type master_id
* @param archiveMasterFollowing
* @return
*/
List<Archive_Master_Following> selLastByType(Archive_Master_Following archiveMasterFollowing);
}

@ -37,5 +37,10 @@ public class Archive_Master_FollowingServiceImpl implements Archive_Master_Follo
return archive_master_followingMapper.selByCol(archiveMasterFollowing);
}
@Override
public List<Archive_Master_Following> selLastByType(Archive_Master_Following archiveMasterFollowing) {
return archive_master_followingMapper.selLastByType(archiveMasterFollowing);
}
}

@ -165,4 +165,32 @@
</if>
</where>
</select>
<select id="selLastByType" parameterType="com.emr.entity.Archive_Master_Following" resultMap="BaseResultMap">
select * from (
select ROW_NUMBER() over(partition by master_id order by handle_time desc) RowNum
,Archive_Master_Following.*
from Archive_Master_Following where 1=1
) as t1
<where> 1=1 and RowNum = 1
<if test="masterId != null and masterId != ''">
and master_id = #{masterId,jdbcType=NVARCHAR}
</if>
<if test="followingType!= null and followingType!= ''">
and following_type in
<foreach item="item" collection="followingType.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="handleTime != null and handleTime != ''">
and CONVERT(VARCHAR(20),handle_time,23) = #{handleTime,jdbcType=NVARCHAR}
</if>
<if test="handleId != null and handleId != ''">
and CONVERT(VARCHAR(20),handle_id,23) = #{handleId,jdbcType=NVARCHAR}
</if>
<if test="handleName != null and handleName != ''">
and CONVERT(VARCHAR(20),handle_name,23) = #{handleName,jdbcType=NVARCHAR}
</if>
</where>
</select>
</mapper>

@ -789,16 +789,17 @@
formToken: $("#formToken").val()
},
success: function (result) {
$('#table').bootstrapTable('refresh');
//刷新
if (parseInt(result) >= 1) {
toastr.success("召回成功!");
$('#table').bootstrapTable('refresh');
// 因为实际返回值会出现大于2但是实际召回是成功的情况故修改成大于1均为召回成功限定了其他情况下返回的错误提示统一都为召回失败
// }else if(result == '2'){
// toastr.error("召回失败!");
} else {
toastr.error("召回失败!");
toastr.warning(result);
}
}, error: function () {
//刷新
// $('#table').bootstrapTable('refresh');

Loading…
Cancel
Save