|
@@ -53,25 +53,25 @@ public class AStrCrisisNoteFacade extends StrCrisisNoteServiceImpl {
|
|
|
private AMedicalRecordFacade aMedicalRecordFacade;
|
|
|
|
|
|
|
|
|
- public void getColumnZhAndCh(){
|
|
|
- List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
|
|
|
- list.forEach(s->{
|
|
|
+ public void getColumnZhAndCh() {
|
|
|
+ List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
|
|
|
+ list.forEach(s -> {
|
|
|
s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
|
|
|
});
|
|
|
|
|
|
- Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
|
|
|
- Boolean flag=columnFacade.createColumn(columnMap,"strCrisisNote");
|
|
|
- if(!flag){
|
|
|
+ Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
|
|
|
+ Boolean flag = columnFacade.createColumn(columnMap, "strCrisisNote");
|
|
|
+ if (!flag) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
|
|
|
- StrCrisisNote strCrisisNote=new StrCrisisNote();
|
|
|
+ public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
|
|
|
+ StrCrisisNote strCrisisNote = new StrCrisisNote();
|
|
|
try {
|
|
|
- AStrCrisisNoteVO strCrisisNoteVO=(AStrCrisisNoteVO) MapUtil.mapToObject(entityMap, AStrCrisisNoteVO.class);
|
|
|
- BeanUtils.copyProperties(strCrisisNoteVO,strCrisisNote);
|
|
|
+ AStrCrisisNoteVO strCrisisNoteVO = (AStrCrisisNoteVO) MapUtil.mapToObject(entityMap, AStrCrisisNoteVO.class);
|
|
|
+ BeanUtils.copyProperties(strCrisisNoteVO, strCrisisNote);
|
|
|
strCrisisNote.setHospitalId(hospitalId);//医院编码
|
|
|
|
|
|
strCrisisNote.setAuditDate(DateUtil.parseDateTime(strCrisisNoteVO.getAuditDate()));//审核时间
|
|
@@ -84,32 +84,32 @@ public class AStrCrisisNoteFacade extends StrCrisisNoteServiceImpl {
|
|
|
|
|
|
|
|
|
//判断数据库中是否存在,不存在insert
|
|
|
- if(isExist(strCrisisNote)){
|
|
|
+ if (isExist(strCrisisNote)) {
|
|
|
strCrisisNote.setGmtCreate(new Date());//记录创建时间
|
|
|
this.save(strCrisisNote);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
strCrisisNote.setGmtModified(new Date());//记录修改时间
|
|
|
- this.update(strCrisisNote,new QueryWrapper<StrCrisisNote>()
|
|
|
+ this.update(strCrisisNote, new QueryWrapper<StrCrisisNote>()
|
|
|
.eq("rec_id", strCrisisNote.getRecId())
|
|
|
.eq("hospital_id", strCrisisNote.getHospitalId())
|
|
|
.eq("behospital_code", strCrisisNote.getBehospitalCode()));
|
|
|
}
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录",strCrisisNote.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录", strCrisisNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- public Boolean isExist(StrCrisisNote strCrisisNote){
|
|
|
- Boolean flag=true;
|
|
|
+ public Boolean isExist(StrCrisisNote strCrisisNote) {
|
|
|
+ Boolean flag = true;
|
|
|
int count = this.baseMapper.selectCount(new QueryWrapper<StrCrisisNote>()
|
|
|
.eq("rec_id", strCrisisNote.getRecId())
|
|
|
.eq("hospital_id", strCrisisNote.getHospitalId())
|
|
|
.eq("behospital_code", strCrisisNote.getBehospitalCode()));
|
|
|
- if(count>0){
|
|
|
- flag=false;
|
|
|
+ if (count > 0) {
|
|
|
+ flag = false;
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
@@ -142,105 +142,102 @@ public class AStrCrisisNoteFacade extends StrCrisisNoteServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void dealData(AStrCrisisNoteVO medCrisisNoteVo,String modeId){
|
|
|
+ public void dealData(AStrCrisisNoteVO medCrisisNoteVo, String modeId) {
|
|
|
try {
|
|
|
|
|
|
- Map<String,Object> listMap =this.objectToMap(medCrisisNoteVo);
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
+ Map<String, Object> listMap = this.objectToMap(medCrisisNoteVo);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
|
|
|
//得到表所对应的中文名和英文名
|
|
|
- Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName) );
|
|
|
- if (listMap.size()>0){
|
|
|
- listMap.forEach((k,v)->{
|
|
|
- tableKey.forEach((tableK,tableV)->{
|
|
|
- if (k.equals(tableV) && null!=v){
|
|
|
- map.put(tableK,v.toString());
|
|
|
+ Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
|
|
|
+ if (listMap.size() > 0) {
|
|
|
+ listMap.forEach((k, v) -> {
|
|
|
+ tableKey.forEach((tableK, tableV) -> {
|
|
|
+ if (k.equals(tableV) && null != v) {
|
|
|
+ map.put(tableK, v.toString());
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
- StrCrisisNote strCrisisNote =new StrCrisisNote();
|
|
|
- BeanUtils.copyProperties(medCrisisNoteVo,strCrisisNote);
|
|
|
+ StrCrisisNote strCrisisNote = new StrCrisisNote();
|
|
|
+ BeanUtils.copyProperties(medCrisisNoteVo, strCrisisNote);
|
|
|
strCrisisNote.setHospitalId(Long.valueOf(medCrisisNoteVo.getHospitalId()));
|
|
|
|
|
|
- strCrisisNote.setRecordDate(DateUtil.parseDate(medCrisisNoteVo.getRecordDate(),"yyyy-MM-dd HH:mm:ss"));//出生日期
|
|
|
- strCrisisNote.setRecieveDate(DateUtil.parseDate(medCrisisNoteVo.getRecieveDate(),"yyyy-MM-dd HH:mm:ss"));//病历日期
|
|
|
-
|
|
|
+ strCrisisNote.setRecordDate(DateUtil.parseDate(medCrisisNoteVo.getRecordDate(), "yyyy-MM-dd HH:mm:ss"));//出生日期
|
|
|
+ strCrisisNote.setRecieveDate(DateUtil.parseDate(medCrisisNoteVo.getRecieveDate(), "yyyy-MM-dd HH:mm:ss"));//病历日期
|
|
|
|
|
|
|
|
|
- HisViewVo hisViewVo =new HisViewVo();
|
|
|
- BeanUtils.copyProperties(strCrisisNote,hisViewVo);
|
|
|
-
|
|
|
+ HisViewVo hisViewVo = new HisViewVo();
|
|
|
+ BeanUtils.copyProperties(strCrisisNote, hisViewVo);
|
|
|
|
|
|
|
|
|
aMedicalRecordContentFacade.executeByView(hisViewVo);
|
|
|
- aMedicalRecordFacade.executeByView(hisViewVo,"23");
|
|
|
+ aMedicalRecordFacade.executeByView(hisViewVo, "23");
|
|
|
|
|
|
|
|
|
//判断数据库中是否存在,不存在insert
|
|
|
- if(isExist(strCrisisNote)){
|
|
|
+ if (isExist(strCrisisNote)) {
|
|
|
strCrisisNote.setGmtCreate(new Date());//记录创建时间
|
|
|
strCrisisNote.setWholeData(JSON.toJSONString(map));
|
|
|
this.save(strCrisisNote);
|
|
|
- }else{
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录", medCrisisNoteVo.getRecId(), JSON.toJSONString(medCrisisNoteVo), "", "新增危急值记录");
|
|
|
+ } else {
|
|
|
strCrisisNote.setGmtModified(new Date());//记录修改时间
|
|
|
strCrisisNote.setWholeData(JSON.toJSONString(map));
|
|
|
- this.update(strCrisisNote,new QueryWrapper<StrCrisisNote>()
|
|
|
+ this.update(strCrisisNote, new QueryWrapper<StrCrisisNote>()
|
|
|
.eq("rec_id", strCrisisNote.getRecId())
|
|
|
.eq("hospital_id", strCrisisNote.getHospitalId())
|
|
|
.eq("behospital_code", strCrisisNote.getBehospitalCode())
|
|
|
- .eq("is_deleted","N"));
|
|
|
+ .eq("is_deleted", "N"));
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录", medCrisisNoteVo.getRecId(), JSON.toJSONString(medCrisisNoteVo), "", "修改危急值记录");
|
|
|
}
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录",medCrisisNoteVo.getRecId(), JSON.toJSONString(medCrisisNoteVo),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录", medCrisisNoteVo.getRecId(), JSON.toJSONString(medCrisisNoteVo), "", "危急值记录出错:" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- private Map<String,Object> objectToMap(Object o) throws IllegalAccessException {
|
|
|
- if(null == o){
|
|
|
+ private Map<String, Object> objectToMap(Object o) throws IllegalAccessException {
|
|
|
+ if (null == o) {
|
|
|
return null;
|
|
|
}
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
Field[] declaredFields = o.getClass().getDeclaredFields();
|
|
|
- for (Field field :declaredFields) {
|
|
|
+ for (Field field : declaredFields) {
|
|
|
// (此处如果不设置 无法获取对象的私有属性)
|
|
|
field.setAccessible(true);
|
|
|
- map.put(field.getName(),field.get(o));
|
|
|
+ map.put(field.getName(), field.get(o));
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public RespDTO execDealData(List<StrCrisisNoteVO> list){
|
|
|
- if(list!=null && list.size()>0){
|
|
|
+ public RespDTO execDealData(List<StrCrisisNoteVO> list) {
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
//循环验证数据有效性
|
|
|
- for (StrCrisisNoteVO strCrisisNoteVO:list) {
|
|
|
- if("".equals(strCrisisNoteVO.getRecId())) {
|
|
|
+ for (StrCrisisNoteVO strCrisisNoteVO : list) {
|
|
|
+ if ("".equals(strCrisisNoteVO.getRecId())) {
|
|
|
return RespDTO.onError("请输入记录编号!");
|
|
|
- }else if(strCrisisNoteVO.getHospitalId()==null){
|
|
|
+ } else if (strCrisisNoteVO.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else if("".equals(strCrisisNoteVO.getBehospitalCode())){
|
|
|
+ } else if ("".equals(strCrisisNoteVO.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
}
|
|
|
}
|
|
|
//初始、格式化数据
|
|
|
- List<StrCrisisNote> strCrisisNoteList= Lists.newArrayList();
|
|
|
- strCrisisNoteList= BeanUtil.listCopyTo(list,StrCrisisNote.class);
|
|
|
+ List<StrCrisisNote> strCrisisNoteList = Lists.newArrayList();
|
|
|
+ strCrisisNoteList = BeanUtil.listCopyTo(list, StrCrisisNote.class);
|
|
|
execute(strCrisisNoteList);
|
|
|
|
|
|
return RespDTO.onSuc(strCrisisNoteList);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void execute(List<StrCrisisNote> list){
|
|
|
+ public void execute(List<StrCrisisNote> list) {
|
|
|
try {
|
|
|
List<StrCrisisNote> addE = Lists.newLinkedList();
|
|
|
List<StrCrisisNote> updateE = Lists.newLinkedList();
|
|
@@ -249,7 +246,7 @@ public class AStrCrisisNoteFacade extends StrCrisisNoteServiceImpl {
|
|
|
StrCrisisNote strCrisisNote = this.getOne(new QueryWrapper<StrCrisisNote>()
|
|
|
.eq("rec_id", s.getRecId())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("behospital_code",s.getBehospitalCode()), false);
|
|
|
+ .eq("behospital_code", s.getBehospitalCode()), false);
|
|
|
if (strCrisisNote != null) {
|
|
|
s.setGmtModified(new Date());
|
|
|
updateE.add(s);
|
|
@@ -259,15 +256,15 @@ public class AStrCrisisNoteFacade extends StrCrisisNoteServiceImpl {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if(addE.size()>0){
|
|
|
+ if (addE.size() > 0) {
|
|
|
strCrisisNoteService.saveBatch(addE);
|
|
|
}
|
|
|
- if(updateE.size()>0){
|
|
|
+ if (updateE.size() > 0) {
|
|
|
this.baseMapper.updateBatchByKey(updateE);
|
|
|
}
|
|
|
- }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());
|
|
|
}
|
|
|
}
|
|
|
}
|