|
@@ -5,18 +5,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.data.ABehospitalInfoDTO;
|
|
|
-import com.diagbot.entity.BehospitalInfo;
|
|
|
-import com.diagbot.entity.MedicalRecord;
|
|
|
-import com.diagbot.entity.QcType;
|
|
|
+import com.diagbot.dto.data.ABelowDTO;
|
|
|
+import com.diagbot.entity.*;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
-import com.diagbot.facade.QcAbnormalFacade;
|
|
|
+import com.diagbot.facade.MedAppealInfoManagementFacade;
|
|
|
import com.diagbot.facade.QcTypeFacade;
|
|
|
import com.diagbot.service.impl.BehospitalInfoServiceImpl;
|
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
-import com.diagbot.util.DateUtil;
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
-import com.diagbot.util.TZDBConn;
|
|
|
+import com.diagbot.util.*;
|
|
|
import com.diagbot.vo.data.ABehospitalInfoVO;
|
|
|
+import com.diagbot.vo.data.ABelowVO;
|
|
|
import com.diagbot.vo.data.ADeleteFlagVO;
|
|
|
import com.diagbot.vo.data.APlaceFileVO;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -25,6 +22,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -37,6 +35,9 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
private QcTypeFacade qcTypeFacade;
|
|
|
@Autowired
|
|
|
private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private MedAppealInfoManagementFacade appealInfoManagementFacade;
|
|
|
+
|
|
|
@Value("${log_switch.enable}")
|
|
|
private boolean logSwitch;
|
|
|
|
|
@@ -47,7 +48,7 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
*/
|
|
|
public void executeBehospital() {
|
|
|
//String sql="select * from br_inpatientinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
- String sql="select * from br_inpatientinfo where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)) ORDER BY cjcxrq DESC";
|
|
|
+ String sql = "select * from br_inpatientinfo where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)) ORDER BY cjcxrq DESC";
|
|
|
List<BehospitalInfo> behospitalInfoList = tzDBConn.getBehospitalInfo(sql);
|
|
|
execute(behospitalInfoList);
|
|
|
}
|
|
@@ -56,7 +57,7 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* 同步前一天的入院记录
|
|
|
*/
|
|
|
public void executeBehospitalPast() {
|
|
|
- String sql="select * from br_inpatientinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
+ String sql = "select * from br_inpatientinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
List<BehospitalInfo> behospitalInfoList = tzDBConn.getBehospitalInfo(sql);
|
|
|
execute(behospitalInfoList);
|
|
|
}
|
|
@@ -64,39 +65,40 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 通过接口更新病人住院记录信息
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
public RespDTO<List<ABehospitalInfoDTO>> executeBehospital(List<ABehospitalInfoVO> list) {
|
|
|
try {
|
|
|
- if(list!=null && list.size()>0) {
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
//循环验证数据有效性
|
|
|
- for (ABehospitalInfoVO behospitalInfo:list) {
|
|
|
- if("".equals(behospitalInfo.getBehospitalCode())) {
|
|
|
+ for (ABehospitalInfoVO behospitalInfo : list) {
|
|
|
+ if ("".equals(behospitalInfo.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
- }else if(behospitalInfo.getHospitalId()==null){
|
|
|
+ } else if (behospitalInfo.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else if("".equals(behospitalInfo.getBehDeptId())){
|
|
|
+ } else if ("".equals(behospitalInfo.getBehDeptId())) {
|
|
|
return RespDTO.onError("请输入住院科室编码!");
|
|
|
- }else if("".equals(behospitalInfo.getBehDeptName())){
|
|
|
+ } else if ("".equals(behospitalInfo.getBehDeptName())) {
|
|
|
return RespDTO.onError("请输入住院科室名称!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<BehospitalInfo> behospitalInfoList = Lists.newArrayList();
|
|
|
- list.stream().forEach(s->{
|
|
|
- BehospitalInfo behospitalInfo=new BehospitalInfo();
|
|
|
- BeanUtil.copyProperties(s,behospitalInfo);
|
|
|
- if(StringUtil.isNotBlank(s.getBirthday())) {
|
|
|
+ list.stream().forEach(s -> {
|
|
|
+ BehospitalInfo behospitalInfo = new BehospitalInfo();
|
|
|
+ BeanUtil.copyProperties(s, behospitalInfo);
|
|
|
+ if (StringUtil.isNotBlank(s.getBirthday())) {
|
|
|
behospitalInfo.setBirthday(DateUtil.parseDate(s.getBirthday()));
|
|
|
}
|
|
|
- if(StringUtil.isNotBlank(s.getLeaveHospitalDate())) {
|
|
|
+ if (StringUtil.isNotBlank(s.getLeaveHospitalDate())) {
|
|
|
behospitalInfo.setLeaveHospitalDate(DateUtil.parseDateTime(s.getLeaveHospitalDate()));
|
|
|
}
|
|
|
- if(StringUtil.isNotBlank(s.getBehospitalDate())){
|
|
|
+ if (StringUtil.isNotBlank(s.getBehospitalDate())) {
|
|
|
behospitalInfo.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));
|
|
|
}
|
|
|
- if(StringUtil.isNotBlank(s.getPlacefileDate())){
|
|
|
+ if (StringUtil.isNotBlank(s.getPlacefileDate())) {
|
|
|
behospitalInfo.setPlacefileDate(DateUtil.parseDateTime(s.getPlacefileDate()));
|
|
|
}
|
|
|
behospitalInfoList.add(behospitalInfo);
|
|
@@ -104,30 +106,30 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
});
|
|
|
|
|
|
execute(behospitalInfoList);
|
|
|
- if(logSwitch){
|
|
|
- behospitalInfoList.forEach(s->{
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-正常","", JSON.toJSONString(list),"","");
|
|
|
+ if (logSwitch) {
|
|
|
+ behospitalInfoList.forEach(s -> {
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-正常", "", JSON.toJSONString(list), "", "");
|
|
|
});
|
|
|
}
|
|
|
return RespDTO.onSuc("操作正常!");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-异常","", JSON.toJSONString(list),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-异常", "", JSON.toJSONString(list), "", e.getMessage());
|
|
|
return RespDTO.onError("数据处理异常,详情查看日志表");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void execute(List<BehospitalInfo> behospitalInfoList){
|
|
|
+ public void execute(List<BehospitalInfo> behospitalInfoList) {
|
|
|
List<BehospitalInfo> addE = Lists.newLinkedList();
|
|
|
List<BehospitalInfo> updateE = Lists.newLinkedList();
|
|
|
behospitalInfoList.stream().forEach(s -> {
|
|
|
BehospitalInfo behospitalInfo = this.getOne(new QueryWrapper<BehospitalInfo>()
|
|
|
.eq("behospital_code", s.getBehospitalCode())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("is_deleted",IsDeleteEnum.N), false);
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N), false);
|
|
|
if (behospitalInfo != null) {
|
|
|
s.setGmtModified(new Date());
|
|
|
s.setQcTypeId(initQcTypeId(s));
|
|
@@ -138,16 +140,17 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
addE.add(s);
|
|
|
}
|
|
|
});
|
|
|
- if(addE.size()>0){
|
|
|
+ if (addE.size() > 0) {
|
|
|
behospitalInfoService.saveBatch(addE);
|
|
|
}
|
|
|
- if(updateE.size()>0){
|
|
|
+ if (updateE.size() > 0) {
|
|
|
behospitalInfoService.updateBatchByKey(updateE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 初始化QcTypeId
|
|
|
+ *
|
|
|
* @param s
|
|
|
* @return
|
|
|
*/
|
|
@@ -158,71 +161,97 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
.eq("beh_dept_id", s.getBehDeptId())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
.eq("default_module", 0)
|
|
|
- .eq("sex",s.getSex())
|
|
|
+ .eq("sex", s.getSex())
|
|
|
.eq("is_deleted", IsDeleteEnum.N));
|
|
|
- if(qcTypeList == null){
|
|
|
+ if (qcTypeList == null) {
|
|
|
//无质控类型时,新增后初始化
|
|
|
QcType qcType = qcTypeFacade.getOne(new QueryWrapper<QcType>()
|
|
|
.eq("default_module", 1)
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("sex",s.getSex())
|
|
|
+ .eq("sex", s.getSex())
|
|
|
.eq("is_deleted", IsDeleteEnum.N));
|
|
|
- if(qcType!=null){
|
|
|
+ if (qcType != null) {
|
|
|
qcTypeId = qcType.getId();
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
qcTypeId = qcTypeList.getId();
|
|
|
}
|
|
|
return qcTypeId;
|
|
|
}
|
|
|
|
|
|
- public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO){
|
|
|
+ public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO) {
|
|
|
try {
|
|
|
//验证数据是否存在
|
|
|
- if(StringUtil.isEmpty(aDeleteFlagVO.getBehospitalCode())){
|
|
|
+ if (StringUtil.isEmpty(aDeleteFlagVO.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
- }else if(aDeleteFlagVO.getHospitalId()==null){
|
|
|
+ } else if (aDeleteFlagVO.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else {
|
|
|
- UpdateWrapper<BehospitalInfo> updateWrapper=new UpdateWrapper<>();
|
|
|
+ } else {
|
|
|
+ UpdateWrapper<BehospitalInfo> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.eq("behospital_code", aDeleteFlagVO.getBehospitalCode())
|
|
|
.eq("hospital_id", aDeleteFlagVO.getHospitalId())
|
|
|
- .eq("is_deleted",IsDeleteEnum.N)
|
|
|
- .set("is_deleted",IsDeleteEnum.Y)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N)
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y)
|
|
|
.set("gmt_modified", DateUtil.now());
|
|
|
|
|
|
- Boolean flag=update(new BehospitalInfo(),updateWrapper);
|
|
|
+ Boolean flag = update(new BehospitalInfo(), updateWrapper);
|
|
|
//aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-删除",JSON.toJSONString(aDeleteFlagVO),"","删除成功!");
|
|
|
return RespDTO.onSuc(flag);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-删除","",JSON.toJSONString(aDeleteFlagVO),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-删除", "", JSON.toJSONString(aDeleteFlagVO), "", e.getMessage());
|
|
|
return RespDTO.onError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public RespDTO placeFileFlag(APlaceFileVO aPlaceFileVO){
|
|
|
+ public RespDTO placeFileFlag(APlaceFileVO aPlaceFileVO) {
|
|
|
try {
|
|
|
//验证数据是否存在
|
|
|
- if(StringUtil.isBlank(aPlaceFileVO.getBehospitalCode())){
|
|
|
+ if (StringUtil.isBlank(aPlaceFileVO.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
- }else if(aPlaceFileVO.getHospitalId()==null){
|
|
|
+ } else if (aPlaceFileVO.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else{
|
|
|
- UpdateWrapper<BehospitalInfo> updateWrapper=new UpdateWrapper<>();
|
|
|
+ } else {
|
|
|
+ UpdateWrapper<BehospitalInfo> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.eq("behospital_code", aPlaceFileVO.getBehospitalCode())
|
|
|
.eq("hospital_id", aPlaceFileVO.getHospitalId())
|
|
|
- .eq("is_deleted",IsDeleteEnum.N)
|
|
|
- .set("is_placefile","1")
|
|
|
- .set("placefile_date",aPlaceFileVO.getPlaceFileDate().isEmpty()?DateUtil.formatDateTime(DateUtil.now()):DateUtil.parseDateTime(aPlaceFileVO.getPlaceFileDate()))
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N)
|
|
|
+ .set("is_placefile", "1")
|
|
|
+ .set("placefile_date", aPlaceFileVO.getPlaceFileDate().isEmpty() ? DateUtil.formatDateTime(DateUtil.now()) : DateUtil.parseDateTime(aPlaceFileVO.getPlaceFileDate()))
|
|
|
.set("gmt_modified", DateUtil.now());
|
|
|
|
|
|
- Boolean flag=update(new BehospitalInfo(),updateWrapper);
|
|
|
+ Boolean flag = update(new BehospitalInfo(), updateWrapper);
|
|
|
return RespDTO.onSuc(flag);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-归档","",JSON.toJSONString(aPlaceFileVO),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-归档", "", JSON.toJSONString(aPlaceFileVO), "", e.getMessage());
|
|
|
return RespDTO.onError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public List<ABelowDTO> belowHospitalList(ABelowVO aBelowVO) {
|
|
|
+ //查询甲级以下病历
|
|
|
+ List<ABelowDTO> belowHospitalList = getBelowHospital(aBelowVO);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(belowHospitalList)) {
|
|
|
+ return belowHospitalList;
|
|
|
+ }
|
|
|
+ List<String> behospitalCodeList = new ArrayList<>();
|
|
|
+ belowHospitalList.forEach(behospitalCode -> {
|
|
|
+ behospitalCodeList.add(behospitalCode.getBehospitalCode());
|
|
|
+ });
|
|
|
+ //查询是否存在被驳回情况
|
|
|
+ List<ABelowDTO> exampleStatusList = appealInfoManagementFacade.getBaseMapper().getExampleStatus(behospitalCodeList);
|
|
|
+ //同步驳回状态
|
|
|
+ if (ListUtil.isNotEmpty(exampleStatusList)) {
|
|
|
+ exampleStatusList.forEach(exampleStatus -> {
|
|
|
+ for (ABelowDTO aBelowDTO : belowHospitalList) {
|
|
|
+ if (aBelowDTO.getBehospitalCode().equals(exampleStatus.getBehospitalCode())) {
|
|
|
+ aBelowDTO.setExampleStatus(exampleStatus.getExampleStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return belowHospitalList;
|
|
|
+ }
|
|
|
}
|