|
@@ -1,6 +1,8 @@
|
|
|
package com.diagbot.facade.data;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.diagbot.dto.AnalyzeRunDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.data.AMedicalRecordDTO;
|
|
@@ -62,6 +64,9 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
@Autowired
|
|
|
private BasHospitalInfoFacade basHospitalInfoFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
|
|
|
+
|
|
|
@Value("${encrypt.enable}")
|
|
|
Boolean encryptFlag;
|
|
|
|
|
@@ -162,37 +167,42 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
* @param aMrContentVO
|
|
|
*/
|
|
|
public void splicingParam(AMrContentVO aMrContentVO) {
|
|
|
- QueryVo queryVo = new QueryVo();
|
|
|
- List<MedrecVo> medreclist = Lists.newArrayList();
|
|
|
-
|
|
|
- List<AColumnContentVO> content = Lists.newArrayList();
|
|
|
- aMrContentVO.getRecords().stream().forEach(s -> {
|
|
|
- queryVo.setHospitalId(s.getHospitalId().toString());
|
|
|
- queryVo.setCid(basHospitalInfoFacade.getHosCode(s.getHospitalId()));
|
|
|
-
|
|
|
- Long modeId = initModeId(s.getHospitalId(), s.getRecTitle());
|
|
|
- s.getContents().stream().forEach(item -> {
|
|
|
- //拼接入参用于结构化解析
|
|
|
- AColumnContentVO aColumnContentVO = new AColumnContentVO();
|
|
|
- aColumnContentVO.setModeId(modeId);
|
|
|
- aColumnContentVO.setStandModelName(ModeIdEnum.getName(Integer.parseInt(modeId.toString())));
|
|
|
- aColumnContentVO.setRecId(s.getRecId());
|
|
|
- aColumnContentVO.setRecTypeId(s.getRecTypeId());
|
|
|
- aColumnContentVO.setRecTitle(s.getRecTitle());
|
|
|
- aColumnContentVO.setXmlText(item.getXmlText());
|
|
|
-
|
|
|
- content.add(aColumnContentVO);
|
|
|
+ try{
|
|
|
+ QueryVo queryVo = new QueryVo();
|
|
|
+ List<MedrecVo> medreclist = Lists.newArrayList();
|
|
|
+
|
|
|
+ List<AColumnContentVO> content = Lists.newArrayList();
|
|
|
+ aMrContentVO.getRecords().stream().forEach(s -> {
|
|
|
+ queryVo.setHospitalId(s.getHospitalId().toString());
|
|
|
+ queryVo.setCid(basHospitalInfoFacade.getHosCode(s.getHospitalId()));
|
|
|
+
|
|
|
+ Long modeId = initModeId(s.getHospitalId(), s.getRecTitle());
|
|
|
+ s.getContents().stream().forEach(item -> {
|
|
|
+ //拼接入参用于结构化解析
|
|
|
+ AColumnContentVO aColumnContentVO = new AColumnContentVO();
|
|
|
+ aColumnContentVO.setModeId(modeId);
|
|
|
+ aColumnContentVO.setStandModelName(ModeIdEnum.getName(Integer.parseInt(modeId.toString())));
|
|
|
+ aColumnContentVO.setRecId(s.getRecId());
|
|
|
+ aColumnContentVO.setRecTypeId(s.getRecTypeId());
|
|
|
+ aColumnContentVO.setRecTitle(s.getRecTitle());
|
|
|
+ aColumnContentVO.setXmlText(item.getXmlText());
|
|
|
+
|
|
|
+ content.add(aColumnContentVO);
|
|
|
+ });
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("content", content);
|
|
|
+ MedrecVo medrecVo = new MedrecVo();
|
|
|
+ medrecVo.setTitle(ModeIdEnum.getName(Integer.parseInt(modeId.toString())));
|
|
|
+ medrecVo.setContent(map);
|
|
|
+ medreclist.add(medrecVo);
|
|
|
});
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- map.put("content", content);
|
|
|
- MedrecVo medrecVo = new MedrecVo();
|
|
|
- medrecVo.setTitle(ModeIdEnum.getName(Integer.parseInt(modeId.toString())));
|
|
|
- medrecVo.setContent(map);
|
|
|
- medreclist.add(medrecVo);
|
|
|
- });
|
|
|
- queryVo.setMedrec(medreclist);
|
|
|
+ queryVo.setMedrec(medreclist);
|
|
|
|
|
|
- columnFacade.analyseRec(queryVo);
|
|
|
+ columnFacade.analyseRec(queryVo);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("参数拼接", JSON.toJSONString(aMrContentVO),"",e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -299,61 +309,67 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
}
|
|
|
|
|
|
public void execute(List<MedicalRecord> medicalRecordList) {
|
|
|
- List<MedicalRecord> addE = Lists.newLinkedList();
|
|
|
- List<MedicalRecord> updateE = Lists.newLinkedList();
|
|
|
- List<BehospitalInfo> behospitalInfoList = Lists.newLinkedList();
|
|
|
- List<QcAbnormal> qcAbnormalList = Lists.newLinkedList();
|
|
|
- if (medicalRecordList != null && medicalRecordList.size() > 0) {
|
|
|
- medicalRecordList.stream().forEach(s -> {
|
|
|
- //初始化mode_id
|
|
|
- Long modeId = initModeId(s);
|
|
|
- if (modeId == Long.valueOf("0")) {
|
|
|
- //新增类型到监测表中
|
|
|
- QcAbnormal qcAbnormal = new QcAbnormal();
|
|
|
- qcAbnormal.setHospitalId(s.getHospitalId());
|
|
|
- qcAbnormal.setBehospitalCode(s.getBehospitalCode());
|
|
|
- qcAbnormal.setType(1);
|
|
|
- qcAbnormal.setDescription(s.getRecTitle());
|
|
|
- qcAbnormal.setGmtCreate(new Date());
|
|
|
- qcAbnormalList.add(qcAbnormal);
|
|
|
- } else if (modeId == Long.valueOf("1")) {
|
|
|
- BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
|
|
|
- .eq("behospital_code", s.getBehospitalCode())
|
|
|
- .eq("hospital_id", s.getHospitalId()), false);
|
|
|
- if (behospitalInfo != null) {
|
|
|
- //如果病人住院信息存在,更新对应的qc_type_id
|
|
|
- Long qcTypeId = initQcTypeId(s);
|
|
|
- behospitalInfo.setQcTypeId(qcTypeId);
|
|
|
- behospitalInfoList.add(behospitalInfo);
|
|
|
+ try{
|
|
|
+ List<MedicalRecord> addE = Lists.newLinkedList();
|
|
|
+ List<MedicalRecord> updateE = Lists.newLinkedList();
|
|
|
+ List<BehospitalInfo> behospitalInfoList = Lists.newLinkedList();
|
|
|
+ List<QcAbnormal> qcAbnormalList = Lists.newLinkedList();
|
|
|
+ if (medicalRecordList != null && medicalRecordList.size() > 0) {
|
|
|
+ medicalRecordList.stream().forEach(s -> {
|
|
|
+ //初始化mode_id
|
|
|
+ Long modeId = initModeId(s);
|
|
|
+ if (modeId == Long.valueOf("0")) {
|
|
|
+ //新增类型到监测表中
|
|
|
+ QcAbnormal qcAbnormal = new QcAbnormal();
|
|
|
+ qcAbnormal.setHospitalId(s.getHospitalId());
|
|
|
+ qcAbnormal.setBehospitalCode(s.getBehospitalCode());
|
|
|
+ qcAbnormal.setType(1);
|
|
|
+ qcAbnormal.setDescription(s.getRecTitle());
|
|
|
+ qcAbnormal.setGmtCreate(new Date());
|
|
|
+ qcAbnormalList.add(qcAbnormal);
|
|
|
+ } else if (modeId == Long.valueOf("1")) {
|
|
|
+ BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
|
|
|
+ .eq("behospital_code", s.getBehospitalCode())
|
|
|
+ .eq("hospital_id", s.getHospitalId()), false);
|
|
|
+ if (behospitalInfo != null) {
|
|
|
+ //如果病人住院信息存在,更新对应的qc_type_id
|
|
|
+ Long qcTypeId = initQcTypeId(s);
|
|
|
+ behospitalInfo.setQcTypeId(qcTypeId);
|
|
|
+ behospitalInfoList.add(behospitalInfo);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- s.setModeId(modeId);
|
|
|
- //新增或修改
|
|
|
- MedicalRecord mRecord = this.getOne(new QueryWrapper<MedicalRecord>()
|
|
|
- .eq("rec_id", s.getRecId())
|
|
|
- .eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("behospital_code", s.getBehospitalCode()), false);
|
|
|
- if (mRecord != null) {
|
|
|
- s.setGmtModified(new Date());
|
|
|
- updateE.add(s);
|
|
|
- } else {
|
|
|
- s.setGmtCreate(new Date());
|
|
|
- addE.add(s);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- if (addE.size() > 0) {
|
|
|
- medicalRecordService.saveBatch(addE);
|
|
|
- }
|
|
|
- if (updateE.size() > 0) {
|
|
|
- medicalRecordService.updateBatchByKey(updateE);
|
|
|
- }
|
|
|
- if (qcAbnormalList.size() > 0) {
|
|
|
- qcAbnormalService.saveBatch(qcAbnormalList);
|
|
|
- }
|
|
|
- if (behospitalInfoList.size() > 0) {
|
|
|
- behospitalInfoFacade.updateBatchByKey(behospitalInfoList);
|
|
|
+ s.setModeId(modeId);
|
|
|
+ //新增或修改
|
|
|
+ MedicalRecord mRecord = this.getOne(new QueryWrapper<MedicalRecord>()
|
|
|
+ .eq("rec_id", s.getRecId())
|
|
|
+ .eq("hospital_id", s.getHospitalId())
|
|
|
+ .eq("behospital_code", s.getBehospitalCode()), false);
|
|
|
+ if (mRecord != null) {
|
|
|
+ s.setGmtModified(new Date());
|
|
|
+ updateE.add(s);
|
|
|
+ } else {
|
|
|
+ s.setGmtCreate(new Date());
|
|
|
+ addE.add(s);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (addE.size() > 0) {
|
|
|
+ medicalRecordService.saveBatch(addE);
|
|
|
+ }
|
|
|
+ if (updateE.size() > 0) {
|
|
|
+ medicalRecordService.updateBatchByKey(updateE);
|
|
|
+ }
|
|
|
+ if (qcAbnormalList.size() > 0) {
|
|
|
+ qcAbnormalService.saveBatch(qcAbnormalList);
|
|
|
+ }
|
|
|
+ if (behospitalInfoList.size() > 0) {
|
|
|
+ behospitalInfoFacade.updateBatchByKey(behospitalInfoList);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("文书信息", JSON.toJSONString(medicalRecordList),"",e.getMessage());
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -404,8 +420,8 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 初始化模型ID
|
|
|
- *
|
|
|
- * @param medicalRecord
|
|
|
+ * @param hospitalId
|
|
|
+ * @param recTitle
|
|
|
* @return
|
|
|
*/
|
|
|
private Long initModeId(Long hospitalId, String recTitle) {
|
|
@@ -422,4 +438,43 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
return modeId;
|
|
|
}
|
|
|
|
|
|
+ public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO){
|
|
|
+ try {
|
|
|
+ //验证数据是否存在
|
|
|
+ if (StringUtil.isEmpty(aDeleteFlagVO.getRecId())) {
|
|
|
+ return RespDTO.onError("请输入文书序号!");
|
|
|
+ } else if (aDeleteFlagVO.getHospitalId() == null) {
|
|
|
+ return RespDTO.onError("请输入医院编码!");
|
|
|
+ } else if (StringUtil.isEmpty(aDeleteFlagVO.getBehospitalCode())) {
|
|
|
+ return RespDTO.onError("请输入病人住院编码!");
|
|
|
+ }else {
|
|
|
+ UpdateWrapper<MedicalRecord> updateWrapper=new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("rec_id", aDeleteFlagVO.getRecId())
|
|
|
+ .eq("hospital_id", aDeleteFlagVO.getHospitalId())
|
|
|
+ .eq("behospital_code", aDeleteFlagVO.getBehospitalCode())
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N)
|
|
|
+ .set("is_deleted",IsDeleteEnum.Y)
|
|
|
+ .set("gmt_modified", DateUtil.now());
|
|
|
+
|
|
|
+ Boolean flag=update(new MedicalRecord(),updateWrapper);
|
|
|
+ if(flag){
|
|
|
+ UpdateWrapper<MedicalRecordContent> updateWrapperContent=new UpdateWrapper<>();
|
|
|
+ updateWrapperContent.eq("rec_id", aDeleteFlagVO.getRecId())
|
|
|
+ .eq("hospital_id", aDeleteFlagVO.getHospitalId())
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N)
|
|
|
+ .set("is_deleted",IsDeleteEnum.Y)
|
|
|
+ .set("gmt_modified", DateUtil.now());
|
|
|
+
|
|
|
+ Boolean flagContent=aMedicalRecordContentFacade.update(new MedicalRecordContent(),updateWrapperContent);
|
|
|
+ //aMedAbnormalInfoFacade.saveAbnormalInfo("文书内容-删除",JSON.toJSONString(aDeleteFlagVO),JSON.toJSONString(RespDTO.onSuc(flagContent)),"操作成功!");
|
|
|
+ }
|
|
|
+ //aMedAbnormalInfoFacade.saveAbnormalInfo("文书信息-删除",JSON.toJSONString(aDeleteFlagVO),JSON.toJSONString(RespDTO.onSuc(flag)),"操作成功!");
|
|
|
+ return RespDTO.onSuc(flag);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ aMedAbnormalInfoFacade.saveAbnormalInfo("文书-删除", JSON.toJSONString(aDeleteFlagVO),"",e.getMessage());
|
|
|
+ return RespDTO.onError(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|