|
@@ -1,5 +1,6 @@
|
|
|
package com.diagbot.facade.data;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.data.ABehospitalInfoDTO;
|
|
@@ -34,6 +35,9 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
@Autowired
|
|
|
private AMedicalRecordFacade aMedicalRecordFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
|
|
|
+
|
|
|
@Autowired
|
|
|
private QcAbnormalFacade qcAbnormalFacade;
|
|
|
|
|
@@ -65,73 +69,81 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public RespDTO<List<ABehospitalInfoDTO>> executeBehospital(List<ABehospitalInfoVO> list) {
|
|
|
- if(list!=null && list.size()>0) {
|
|
|
- List<BehospitalInfo> behospitalInfoList = Lists.newArrayList();
|
|
|
- List<ABehospitalInfoDTO> behospitalInfoDtoList = Lists.newArrayList();
|
|
|
- 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())) {
|
|
|
- behospitalInfo.setLeaveHospitalDate(DateUtil.parseDateTime(s.getLeaveHospitalDate()));
|
|
|
- }
|
|
|
- if(StringUtil.isNotBlank(s.getBehospitalDate())){
|
|
|
- behospitalInfo.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));
|
|
|
- }
|
|
|
- if(StringUtil.isNotBlank(s.getPlacefileDate())){
|
|
|
- behospitalInfo.setPlacefileDate(DateUtil.parseDateTime(s.getPlacefileDate()));
|
|
|
- }
|
|
|
- behospitalInfoList.add(behospitalInfo);
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- //循环验证数据有效性
|
|
|
- for (BehospitalInfo behospitalInfo:behospitalInfoList) {
|
|
|
- if("".equals(behospitalInfo.getBehospitalCode())) {
|
|
|
- return RespDTO.onError("请输入病人住院编码!");
|
|
|
- }else if(behospitalInfo.getHospitalId()==null){
|
|
|
- return RespDTO.onError("请输入医院编码!");
|
|
|
- }else if("".equals(behospitalInfo.getBehDeptId())){
|
|
|
- return RespDTO.onError("请输入住院科室编码!");
|
|
|
- }else if("".equals(behospitalInfo.getBehDeptName())){
|
|
|
- return RespDTO.onError("请输入住院科室名称!");
|
|
|
+ try {
|
|
|
+ if(list!=null && list.size()>0) {
|
|
|
+ List<BehospitalInfo> behospitalInfoList = Lists.newArrayList();
|
|
|
+ List<ABehospitalInfoDTO> behospitalInfoDtoList = Lists.newArrayList();
|
|
|
+ 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())) {
|
|
|
+ behospitalInfo.setLeaveHospitalDate(DateUtil.parseDateTime(s.getLeaveHospitalDate()));
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotBlank(s.getBehospitalDate())){
|
|
|
+ behospitalInfo.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotBlank(s.getPlacefileDate())){
|
|
|
+ behospitalInfo.setPlacefileDate(DateUtil.parseDateTime(s.getPlacefileDate()));
|
|
|
+ }
|
|
|
+ behospitalInfoList.add(behospitalInfo);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ //循环验证数据有效性
|
|
|
+ for (BehospitalInfo behospitalInfo:behospitalInfoList) {
|
|
|
+ if("".equals(behospitalInfo.getBehospitalCode())) {
|
|
|
+ return RespDTO.onError("请输入病人住院编码!");
|
|
|
+ }else if(behospitalInfo.getHospitalId()==null){
|
|
|
+ return RespDTO.onError("请输入医院编码!");
|
|
|
+ }else if("".equals(behospitalInfo.getBehDeptId())){
|
|
|
+ return RespDTO.onError("请输入住院科室编码!");
|
|
|
+ }else if("".equals(behospitalInfo.getBehDeptName())){
|
|
|
+ return RespDTO.onError("请输入住院科室名称!");
|
|
|
+ }
|
|
|
}
|
|
|
+ execute(behospitalInfoList);
|
|
|
+ behospitalInfoDtoList = BeanUtil.listCopyTo(list, ABehospitalInfoDTO.class);
|
|
|
+ return RespDTO.onSuc(behospitalInfoDtoList);
|
|
|
+ }else{
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo(JSON.toJSONString(list),"","未接收到数据!");
|
|
|
+ return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
- execute(behospitalInfoList);
|
|
|
- behospitalInfoDtoList = BeanUtil.listCopyTo(list, ABehospitalInfoDTO.class);
|
|
|
- return RespDTO.onSuc(behospitalInfoDtoList);
|
|
|
- }else{
|
|
|
- return RespDTO.onError("未接收到数据!");
|
|
|
+ }catch (Exception e){
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo(JSON.toJSONString(list),"",e.getMessage());
|
|
|
+ return RespDTO.onError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
- if (behospitalInfo != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- s.setQcTypeId(initQcTypeId(s));
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- s.setQcTypeId(initQcTypeId(s));
|
|
|
- addE.add(s);
|
|
|
+ try{
|
|
|
+ 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()), false);
|
|
|
+ if (behospitalInfo != null) {
|
|
|
+ s.setGmtModified(new Date());
|
|
|
+ s.setQcTypeId(initQcTypeId(s));
|
|
|
+ updateE.add(s);
|
|
|
+ } else {
|
|
|
+ s.setGmtCreate(new Date());
|
|
|
+ s.setQcTypeId(initQcTypeId(s));
|
|
|
+ addE.add(s);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(addE.size()>0){
|
|
|
+ behospitalInfoService.saveBatch(addE);
|
|
|
}
|
|
|
- });
|
|
|
- if(addE.size()>0){
|
|
|
- behospitalInfoService.saveBatch(addE);
|
|
|
- }
|
|
|
- if(updateE.size()>0){
|
|
|
- behospitalInfoService.updateBatchByKey(updateE);
|
|
|
+ if(updateE.size()>0){
|
|
|
+ behospitalInfoService.updateBatchByKey(updateE);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo(JSON.toJSONString(behospitalInfoList),"",e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|