|
@@ -3,6 +3,7 @@ package com.diagbot.facade.str;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.data.ColumnZhAndChDTO;
|
|
@@ -17,11 +18,7 @@ import com.diagbot.facade.data.AMedicalRecordContentFacade;
|
|
|
import com.diagbot.facade.data.AMedicalRecordFacade;
|
|
|
import com.diagbot.facade.data.ColumnFacade;
|
|
|
import com.diagbot.service.impl.StrOperativeNoteServiceImpl;
|
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
-import com.diagbot.util.DateUtil;
|
|
|
-import com.diagbot.util.EntityUtil;
|
|
|
-import com.diagbot.util.MapUtil;
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.util.*;
|
|
|
import com.diagbot.vo.data.ADeleteFlagVO;
|
|
|
import com.diagbot.vo.data.AStrOperativeNoteVO;
|
|
|
import com.diagbot.vo.data.FJStrAdmissionNoteVo;
|
|
@@ -50,86 +47,115 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
|
|
|
private AMedicalRecordContentFacade aMedicalRecordContentFacade;
|
|
|
@Autowired
|
|
|
private AMedicalRecordFacade aMedicalRecordFacade;
|
|
|
+
|
|
|
+ private FJTZDBConnHarp fjtzdbConnHarp = new FJTZDBConnHarp();
|
|
|
+
|
|
|
/**
|
|
|
* 把得到的list变成一个对象
|
|
|
+ *
|
|
|
* @param
|
|
|
*/
|
|
|
- public void getOneList(List<HisViewVo> hisViewVos,String modeId) {
|
|
|
+ public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
|
|
|
try {
|
|
|
- Map<String,Object> map =new HashMap<>();
|
|
|
- Map<String,Object> wholeData =new HashMap<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ Map<String, Object> wholeData = new HashMap<>();
|
|
|
String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
|
|
|
- Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
|
|
|
+ Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
|
|
|
//循环list根据咱字段的名称来跟得到的数据来做比较
|
|
|
- for (HisViewVo s: hisViewVos) {
|
|
|
- if (s.getKeyEn()!=null) {
|
|
|
+ for (HisViewVo s : hisViewVos) {
|
|
|
+ if (s.getKeyEn() != null) {
|
|
|
tableKey.forEach((k, v) -> {
|
|
|
if (s.getKeyEn().equals(v)) {
|
|
|
map.put(s.getKeyEn(), s.getDeValue());
|
|
|
wholeData.put(k, s.getDeValue());
|
|
|
}
|
|
|
});
|
|
|
- }else {
|
|
|
- wholeData.put(s.getKeyCN(),s.getDeValue());
|
|
|
+ } else {
|
|
|
+ wholeData.put(s.getKeyCN(), s.getDeValue());
|
|
|
}
|
|
|
}
|
|
|
- StrOperativeNote strOperativeNote =new StrOperativeNote();
|
|
|
+ StrOperativeNote strOperativeNote = new StrOperativeNote();
|
|
|
AStrOperativeNoteVO strOperativeNoteVO = (AStrOperativeNoteVO) MapUtil.mapToObject(map, AStrOperativeNoteVO.class);
|
|
|
- BeanUtils.copyProperties(strOperativeNoteVO,strOperativeNote);
|
|
|
+ BeanUtils.copyProperties(strOperativeNoteVO, strOperativeNote);
|
|
|
|
|
|
- strOperativeNote.setOperationDate(DateUtil.parseDate(strOperativeNoteVO.getOperationDate(),"yyyy-MM-dd"));//手术时间
|
|
|
- if (null!=strOperativeNoteVO.getStartTime()){
|
|
|
- String date = strOperativeNoteVO.getOperationDate()+" "+strOperativeNoteVO.getStartTime();
|
|
|
- strOperativeNote.setStartTime(DateUtil.parseDate(date,"yyyy-MM-dd HH:mm"));//开始时间
|
|
|
+ strOperativeNote.setOperationDate(DateUtil.parseDate(strOperativeNoteVO.getOperationDate(), "yyyy-MM-dd"));//手术时间
|
|
|
+ if (null != strOperativeNoteVO.getStartTime()) {
|
|
|
+ String date = strOperativeNoteVO.getOperationDate() + " " + strOperativeNoteVO.getStartTime();
|
|
|
+ strOperativeNote.setStartTime(DateUtil.parseDate(date, "yyyy-MM-dd HH:mm"));//开始时间
|
|
|
}
|
|
|
- if (null!=strOperativeNoteVO.getEndTime()){
|
|
|
- if (strOperativeNoteVO.getEndTime().length()>5){
|
|
|
+ if (null != strOperativeNoteVO.getEndTime()) {
|
|
|
+ if (strOperativeNoteVO.getEndTime().length() > 5) {
|
|
|
Calendar cal1 = Calendar.getInstance();
|
|
|
cal1.setTime(strOperativeNote.getOperationDate());
|
|
|
int year = cal1.get(Calendar.YEAR);
|
|
|
- String endDate= year+"-"+strOperativeNoteVO.getEndTime();
|
|
|
- strOperativeNote.setEndTime(DateUtil.parseDate(endDate,"yyyy-MM-dd HH:mm"));//结束时间
|
|
|
- }else {
|
|
|
- String endDate =strOperativeNoteVO.getOperationDate()+" "+strOperativeNoteVO.getEndTime();
|
|
|
- strOperativeNote.setEndTime(DateUtil.parseDate(endDate,"yyyy-MM-dd HH:mm"));//结束时间
|
|
|
+ String endDate = year + "-" + strOperativeNoteVO.getEndTime();
|
|
|
+ strOperativeNote.setEndTime(DateUtil.parseDate(endDate, "yyyy-MM-dd HH:mm"));//结束时间
|
|
|
+ } else {
|
|
|
+ String endDate = strOperativeNoteVO.getOperationDate() + " " + strOperativeNoteVO.getEndTime();
|
|
|
+ strOperativeNote.setEndTime(DateUtil.parseDate(endDate, "yyyy-MM-dd HH:mm"));//结束时间
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- BeanUtils.copyProperties(hisViewVos.get(0),strOperativeNote);
|
|
|
- strOperativeNote.setWholeData(JSON.toJSONString(wholeData));
|
|
|
|
|
|
+ BeanUtils.copyProperties(hisViewVos.get(0), strOperativeNote);
|
|
|
+ strOperativeNote.setWholeData(JSON.toJSONString(wholeData));
|
|
|
aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
|
|
|
- aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
|
|
|
|
|
|
- this.dealData(strOperativeNote);
|
|
|
+
|
|
|
+ List<String> names = fjtzdbConnHarp.getOpsName("select icd_name from kemr.kemr_dict_icd_ops where ops_level ='0'");
|
|
|
+ if (StringUtils.isNotEmpty(strOperativeNoteVO.getOperationName())) {
|
|
|
+ Boolean is = false;
|
|
|
+ //判断是否是有创操作
|
|
|
+ if (strOperativeNote.getOperationName().contains("+")) {
|
|
|
+ String[] opsNames = strOperativeNote.getOperationName().split("\\+");
|
|
|
+ for (int i = 0; i < opsNames.length; i++) {
|
|
|
+ if (names.contains(opsNames[i])) {
|
|
|
+ is = true;
|
|
|
+ } else {
|
|
|
+ is = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (names.contains(strOperativeNote.getOperationName())) {
|
|
|
+ is = true;
|
|
|
+ }
|
|
|
+ //根据is来判断入哪个表和modeId为多少
|
|
|
+ if (is) {
|
|
|
+ aMedicalRecordFacade.executeByView(hisViewVos.get(0), "59");
|
|
|
+
|
|
|
+ } else {
|
|
|
+ aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
|
|
|
+ this.dealData(strOperativeNote);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录多变一", hisViewVos.get(0).getRecId(), JSON.toJSONString(hisViewVos), "", e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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,"strOperativeNote");
|
|
|
+ Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
|
|
|
+ Boolean flag = columnFacade.createColumn(columnMap, "strOperativeNote");
|
|
|
|
|
|
//Map<String, String> map=columnFacade.getColumn("strConsultationNote");
|
|
|
- if(!flag){
|
|
|
+ if (!flag) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//手术记录
|
|
|
- public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
|
|
|
- StrOperativeNote strOperativeNote=new StrOperativeNote();
|
|
|
+ public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
|
|
|
+ StrOperativeNote strOperativeNote = new StrOperativeNote();
|
|
|
try {
|
|
|
- AStrOperativeNoteVO strOperativeNoteVO=(AStrOperativeNoteVO) MapUtil.mapToObject(entityMap, AStrOperativeNoteVO.class);
|
|
|
- BeanUtils.copyProperties(strOperativeNoteVO,strOperativeNote);
|
|
|
+ AStrOperativeNoteVO strOperativeNoteVO = (AStrOperativeNoteVO) MapUtil.mapToObject(entityMap, AStrOperativeNoteVO.class);
|
|
|
+ BeanUtils.copyProperties(strOperativeNoteVO, strOperativeNote);
|
|
|
strOperativeNote.setHospitalId(hospitalId);//医院编码
|
|
|
|
|
|
strOperativeNote.setAuditDate(DateUtil.parseDateTime(strOperativeNoteVO.getAuditDate()));//审核时间
|
|
@@ -141,55 +167,55 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
|
|
|
|
|
|
strOperativeNote.setWholeData(columnMap);
|
|
|
//判断数据库中是否存在,不存在insert
|
|
|
- if(isExist(strOperativeNote)){
|
|
|
+ if (isExist(strOperativeNote)) {
|
|
|
strOperativeNote.setGmtCreate(new Date());//记录创建时间
|
|
|
this.save(strOperativeNote);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
strOperativeNote.setGmtModified(new Date());//记录修改时间
|
|
|
- this.update(strOperativeNote,new QueryWrapper<StrOperativeNote>()
|
|
|
+ this.update(strOperativeNote, new QueryWrapper<StrOperativeNote>()
|
|
|
.eq("rec_id", strOperativeNote.getRecId())
|
|
|
.eq("hospital_id", strOperativeNote.getHospitalId())
|
|
|
.eq("behospital_code", strOperativeNote.getBehospitalCode()));
|
|
|
}
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", strOperativeNote.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", strOperativeNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void dealData(StrOperativeNote medDeathNote){
|
|
|
+ public void dealData(StrOperativeNote medDeathNote) {
|
|
|
|
|
|
try {
|
|
|
//判断数据库中是否存在,不存在insert
|
|
|
- if(isExist(medDeathNote)){
|
|
|
+ if (isExist(medDeathNote)) {
|
|
|
medDeathNote.setGmtCreate(new Date());//记录创建时间
|
|
|
this.save(medDeathNote);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
medDeathNote.setGmtModified(new Date());//记录修改时间
|
|
|
medDeathNote.setIsDeleted("N");
|
|
|
- this.update(medDeathNote,new QueryWrapper<StrOperativeNote>()
|
|
|
+ this.update(medDeathNote, new QueryWrapper<StrOperativeNote>()
|
|
|
.eq("rec_id", medDeathNote.getRecId())
|
|
|
.eq("hospital_id", medDeathNote.getHospitalId())
|
|
|
.eq("behospital_code", medDeathNote.getBehospitalCode()));
|
|
|
}
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- public Boolean isExist(StrOperativeNote strOperativeNote){
|
|
|
- Boolean flag=true;
|
|
|
+ public Boolean isExist(StrOperativeNote strOperativeNote) {
|
|
|
+ Boolean flag = true;
|
|
|
int count = this.baseMapper.selectCount(new QueryWrapper<StrOperativeNote>()
|
|
|
.eq("rec_id", strOperativeNote.getRecId())
|
|
|
.eq("hospital_id", strOperativeNote.getHospitalId())
|
|
|
.eq("behospital_code", strOperativeNote.getBehospitalCode()));
|
|
|
- if(count>0){
|
|
|
- flag=false;
|
|
|
+ if (count > 0) {
|
|
|
+ flag = false;
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
@@ -221,30 +247,30 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public RespDTO execDealData(List<StrOperativeNoteVO> list){
|
|
|
- if(list!=null && list.size()>0){
|
|
|
+ public RespDTO execDealData(List<StrOperativeNoteVO> list) {
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
//循环验证数据有效性
|
|
|
- for (StrOperativeNoteVO strOperativeNoteVO:list) {
|
|
|
- if("".equals(strOperativeNoteVO.getRecId())) {
|
|
|
+ for (StrOperativeNoteVO strOperativeNoteVO : list) {
|
|
|
+ if ("".equals(strOperativeNoteVO.getRecId())) {
|
|
|
return RespDTO.onError("请输入记录编号!");
|
|
|
- }else if(strOperativeNoteVO.getHospitalId()==null){
|
|
|
+ } else if (strOperativeNoteVO.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else if("".equals(strOperativeNoteVO.getBehospitalCode())){
|
|
|
+ } else if ("".equals(strOperativeNoteVO.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
}
|
|
|
}
|
|
|
//初始、格式化数据
|
|
|
- List<StrOperativeNote> strOperativeNoteList= Lists.newArrayList();
|
|
|
- strOperativeNoteList= BeanUtil.listCopyTo(list,StrOperativeNote.class);
|
|
|
+ List<StrOperativeNote> strOperativeNoteList = Lists.newArrayList();
|
|
|
+ strOperativeNoteList = BeanUtil.listCopyTo(list, StrOperativeNote.class);
|
|
|
execute(strOperativeNoteList);
|
|
|
|
|
|
return RespDTO.onSuc(strOperativeNoteList);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void execute(List<StrOperativeNote> list){
|
|
|
+ public void execute(List<StrOperativeNote> list) {
|
|
|
try {
|
|
|
List<StrOperativeNote> addE = Lists.newLinkedList();
|
|
|
List<StrOperativeNote> updateE = Lists.newLinkedList();
|
|
@@ -253,7 +279,7 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
|
|
|
StrOperativeNote strOperativeNote = this.getOne(new QueryWrapper<StrOperativeNote>()
|
|
|
.eq("rec_id", s.getRecId())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("behospital_code",s.getBehospitalCode()), false);
|
|
|
+ .eq("behospital_code", s.getBehospitalCode()), false);
|
|
|
if (strOperativeNote != null) {
|
|
|
s.setGmtModified(new Date());
|
|
|
updateE.add(s);
|
|
@@ -263,15 +289,15 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if(addE.size()>0){
|
|
|
+ if (addE.size() > 0) {
|
|
|
strOperativeNoteService.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());
|
|
|
}
|
|
|
}
|
|
|
}
|