|
@@ -7,13 +7,11 @@ import com.diagbot.dto.AnalyzeRunDTO;
|
|
import com.diagbot.dto.RecordContentDTO;
|
|
import com.diagbot.dto.RecordContentDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.dto.data.AMedicalRecordDTO;
|
|
import com.diagbot.dto.data.AMedicalRecordDTO;
|
|
-import com.diagbot.dto.data.AMrContentDTO;
|
|
|
|
import com.diagbot.entity.*;
|
|
import com.diagbot.entity.*;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.ModeIdEnum;
|
|
import com.diagbot.enums.ModeIdEnum;
|
|
import com.diagbot.facade.*;
|
|
import com.diagbot.facade.*;
|
|
import com.diagbot.service.impl.MedicalRecordServiceImpl;
|
|
import com.diagbot.service.impl.MedicalRecordServiceImpl;
|
|
-import com.diagbot.service.impl.QcAbnormalServiceImpl;
|
|
|
|
import com.diagbot.util.*;
|
|
import com.diagbot.util.*;
|
|
import com.diagbot.vo.AnalyzeRunVO;
|
|
import com.diagbot.vo.AnalyzeRunVO;
|
|
import com.diagbot.vo.MedrecVo;
|
|
import com.diagbot.vo.MedrecVo;
|
|
@@ -46,10 +44,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
@Autowired
|
|
@Autowired
|
|
private BehospitalInfoFacade behospitalInfoFacade;
|
|
private BehospitalInfoFacade behospitalInfoFacade;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- @Qualifier("qcAbnormalServiceImpl")
|
|
|
|
- private QcAbnormalServiceImpl qcAbnormalService;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private QcTypeFacade qcTypeFacade;
|
|
private QcTypeFacade qcTypeFacade;
|
|
|
|
|
|
@@ -76,16 +70,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
|
|
|
|
private TZDBConn tzDBConn = new TZDBConn();
|
|
private TZDBConn tzDBConn = new TZDBConn();
|
|
|
|
|
|
- /**
|
|
|
|
- * 终末质控-同步前一天的病历记录
|
|
|
|
- */
|
|
|
|
- public void executeMrRecord() {
|
|
|
|
- //String sql="select * from mr_medicalrecords where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
|
- String sql = "select * from mr_medicalrecords where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)) ORDER BY cjcxrq DESC";
|
|
|
|
- List<MedicalRecord> medicalRecordList = tzDBConn.getMedicalRecord(sql);
|
|
|
|
- execute(medicalRecordList);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 终末质控-通过接口更新病历记录
|
|
* 终末质控-通过接口更新病历记录
|
|
*
|
|
*
|
|
@@ -262,7 +246,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
*/
|
|
*/
|
|
public RespDTO<Map<String, Object>> executeMrRecordIng(AMrContentVO aMrContentVO) {
|
|
public RespDTO<Map<String, Object>> executeMrRecordIng(AMrContentVO aMrContentVO) {
|
|
if (aMrContentVO.getRecords() != null && aMrContentVO.getRecords().size() > 0) {
|
|
if (aMrContentVO.getRecords() != null && aMrContentVO.getRecords().size() > 0) {
|
|
- AMrContentDTO aMrContentDTO = new AMrContentDTO();
|
|
|
|
//循环验证数据有效性
|
|
//循环验证数据有效性
|
|
for (AMedicalRecordVO aMedicalRecordVO : aMrContentVO.getRecords()) {
|
|
for (AMedicalRecordVO aMedicalRecordVO : aMrContentVO.getRecords()) {
|
|
if ("".equals(aMedicalRecordVO.getRecId())) {
|
|
if ("".equals(aMedicalRecordVO.getRecId())) {
|
|
@@ -310,7 +293,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
Long hospitalId = aMrContentVO.getRecords().get(0).getHospitalId();
|
|
Long hospitalId = aMrContentVO.getRecords().get(0).getHospitalId();
|
|
MedicalRecord medicalRecord = new MedicalRecord();
|
|
MedicalRecord medicalRecord = new MedicalRecord();
|
|
BeanUtil.copyProperties(aMrContentVO.getRecords().get(0), medicalRecord);
|
|
BeanUtil.copyProperties(aMrContentVO.getRecords().get(0), medicalRecord);
|
|
- Long modeId = initModeId(medicalRecord);
|
|
|
|
|
|
+ Long modeId = initModeId(medicalRecord.getHospitalId(),medicalRecord.getRecTypeId());
|
|
if (aMrContentVO.getDockModeType().equals("0")) {
|
|
if (aMrContentVO.getDockModeType().equals("0")) {
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
List<AMedicalRecordDTO> medicalRecordDTOList = BeanUtil.listCopyTo(aMrContentVO.getRecords(), AMedicalRecordDTO.class);
|
|
List<AMedicalRecordDTO> medicalRecordDTOList = BeanUtil.listCopyTo(aMrContentVO.getRecords(), AMedicalRecordDTO.class);
|
|
@@ -363,21 +346,20 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
List<MedicalRecord> addE = Lists.newLinkedList();
|
|
List<MedicalRecord> addE = Lists.newLinkedList();
|
|
List<MedicalRecord> updateE = Lists.newLinkedList();
|
|
List<MedicalRecord> updateE = Lists.newLinkedList();
|
|
List<BehospitalInfo> behospitalInfoList = Lists.newLinkedList();
|
|
List<BehospitalInfo> behospitalInfoList = Lists.newLinkedList();
|
|
- List<QcAbnormal> qcAbnormalList = Lists.newLinkedList();
|
|
|
|
|
|
+ List<ModelHospital> modelHospitalList = Lists.newLinkedList();
|
|
if (medicalRecordList != null && medicalRecordList.size() > 0) {
|
|
if (medicalRecordList != null && medicalRecordList.size() > 0) {
|
|
medicalRecordList.stream().forEach(s -> {
|
|
medicalRecordList.stream().forEach(s -> {
|
|
//初始化mode_id
|
|
//初始化mode_id
|
|
- Long modeId = initModeId(s);
|
|
|
|
|
|
+ Long modeId = initModeId(s.getHospitalId(),s.getRecTypeId());
|
|
if (modeId == Long.valueOf("0")) {
|
|
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);
|
|
|
|
|
|
+ //未匹配到模板的进行记录,后续可跟进
|
|
|
|
+ ModelHospital modelHospital = new ModelHospital();
|
|
|
|
+ modelHospital.setHospitalId(s.getHospitalId());
|
|
|
|
+ modelHospital.setHospitalModelName(s.getRecTitle());
|
|
|
|
+ modelHospital.setRemark(s.getRecTypeId());
|
|
|
|
+ modelHospitalList.add(modelHospital);
|
|
} else if (modeId == Long.valueOf("1")) {
|
|
} else if (modeId == Long.valueOf("1")) {
|
|
|
|
+ //入院记录保存时,同步调整住院病人的质控类型,即qc_type_id
|
|
BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
|
|
BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
|
|
.eq("behospital_code", s.getBehospitalCode())
|
|
.eq("behospital_code", s.getBehospitalCode())
|
|
.eq("hospital_id", s.getHospitalId()), false);
|
|
.eq("hospital_id", s.getHospitalId()), false);
|
|
@@ -396,6 +378,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
.eq("behospital_code", s.getBehospitalCode()), false);
|
|
.eq("behospital_code", s.getBehospitalCode()), false);
|
|
if (mRecord != null) {
|
|
if (mRecord != null) {
|
|
s.setGmtModified(new Date());
|
|
s.setGmtModified(new Date());
|
|
|
|
+ s.setIsDeleted(IsDeleteEnum.N.getKey());
|
|
updateE.add(s);
|
|
updateE.add(s);
|
|
} else {
|
|
} else {
|
|
s.setGmtCreate(new Date());
|
|
s.setGmtCreate(new Date());
|
|
@@ -409,8 +392,8 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
if (updateE.size() > 0) {
|
|
if (updateE.size() > 0) {
|
|
medicalRecordService.updateBatchByKey(updateE);
|
|
medicalRecordService.updateBatchByKey(updateE);
|
|
}
|
|
}
|
|
- if (qcAbnormalList.size() > 0) {
|
|
|
|
- qcAbnormalService.saveBatch(qcAbnormalList);
|
|
|
|
|
|
+ if (modelHospitalList.size() > 0) {
|
|
|
|
+ modelHospitalFacade.saveBatch(modelHospitalList);
|
|
}
|
|
}
|
|
if (behospitalInfoList.size() > 0) {
|
|
if (behospitalInfoList.size() > 0) {
|
|
behospitalInfoFacade.updateBatchByKey(behospitalInfoList);
|
|
behospitalInfoFacade.updateBatchByKey(behospitalInfoList);
|
|
@@ -453,27 +436,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
|
|
return qcTypeId;
|
|
return qcTypeId;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 初始化模型ID
|
|
|
|
- *
|
|
|
|
- * @param medicalRecord
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private Long initModeId(MedicalRecord medicalRecord) {
|
|
|
|
- Long modeId = Long.valueOf("0");
|
|
|
|
- QueryWrapper<ModelHospital> wrapper = new QueryWrapper<>();
|
|
|
|
- wrapper.eq("hospital_id", medicalRecord.getHospitalId());
|
|
|
|
- //wrapper.eq("hospital_model_name", medicalRecord.getRecTitle());
|
|
|
|
- wrapper.eq("remark", medicalRecord.getRecTypeId());
|
|
|
|
- ModelHospital mode = modelHospitalFacade.getOne(wrapper, false);
|
|
|
|
- if (mode != null) {
|
|
|
|
- modeId = mode.getStandModelId();
|
|
|
|
- } else {
|
|
|
|
- modeId = Long.valueOf("0");
|
|
|
|
- }
|
|
|
|
- return modeId;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 初始化模型ID
|
|
* 初始化模型ID
|
|
*
|
|
*
|