|
@@ -7,6 +7,7 @@ import com.diagbot.dto.data.ABehospitalInfoDTO;
|
|
|
import com.diagbot.entity.*;
|
|
|
import com.diagbot.entity.shaoyifu.entity.PatientInfo;
|
|
|
import com.diagbot.entity.shaoyifu.entity.SYFBeHospitalInfo;
|
|
|
+import com.diagbot.entity.shaoyifu.entity.SYFPatientList;
|
|
|
import com.diagbot.entity.shaoyifu.request.BeHospitalInfoRequest;
|
|
|
import com.diagbot.entity.shaoyifu.request.PatientListRequest;
|
|
|
import com.diagbot.entity.shaoyifu.response.BeHospitalInfoResponse;
|
|
@@ -59,18 +60,25 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
/**
|
|
|
* 终末质控-同步前一天的入院记录
|
|
|
*/
|
|
|
- public void executeBehospital() {
|
|
|
+ public void executeBehospital1(List<PatientInfo> patientInfo) {
|
|
|
|
|
|
try {
|
|
|
+ List<PatientInfo> patientInfoList = Lists.newLinkedList();
|
|
|
|
|
|
- /*PatientListRequest patientListRequest = new PatientListRequest();
|
|
|
- *//*patientListRequest.setDATESTART(sdf.format(startTime));
|
|
|
- patientListRequest.setDATEEND(sdf.format(endTime));*//*
|
|
|
- patientListRequest.setDATESTART("2020-04-01 00:00:00");
|
|
|
- patientListRequest.setDATEEND("2020-04-08 00:00:00");
|
|
|
- PatientListResponse patientListResponse = aPatientListFacade.savePatientList(patientListRequest);*/
|
|
|
+ if (patientInfo.size() > 0) {
|
|
|
+ aPatientListFacade.savePatientInfo(patientInfo);
|
|
|
+ patientInfoList.add(patientInfo.get(0));
|
|
|
+ } else {
|
|
|
+ /*PatientListRequest patientListRequest = new PatientListRequest();
|
|
|
+ *//*patientListRequest.setDATESTART(sdf.format(startTime));
|
|
|
+ patientListRequest.setDATEEND(sdf.format(endTime));*//*
|
|
|
+ patientListRequest.setDATESTART("2020-04-01 00:00:00");
|
|
|
+ patientListRequest.setDATEEND("2020-04-08 00:00:00");
|
|
|
+ PatientListResponse patientListResponse = aPatientListFacade.savePatientList(patientListRequest);*/
|
|
|
+
|
|
|
+ patientInfoList = patientInfoServiceImpl.list();
|
|
|
+ }
|
|
|
|
|
|
- List<PatientInfo> patientInfoList = patientInfoServiceImpl.list();
|
|
|
|
|
|
for (int i = 0; i < patientInfoList.size(); i++) {
|
|
|
BeHospitalInfoRequest beHospitalInfoRequest = new BeHospitalInfoRequest();
|
|
@@ -90,7 +98,7 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
|
|
|
SYFBeHospitalInfo sYFBeHospitalInfo = beHospitalInfoResponse.getResultJson();
|
|
|
|
|
|
- List<BehospitalInfo> behospitalInfoList =Lists.newLinkedList();
|
|
|
+ List<BehospitalInfo> behospitalInfoList = Lists.newLinkedList();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
if (sYFBeHospitalInfo != null) {
|
|
|
BehospitalInfo behospitalInfo = new BehospitalInfo();
|
|
@@ -137,7 +145,7 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
* 同步前一天的入院记录
|
|
|
*/
|
|
|
public void executeBehospitalPast() {
|
|
|
- String sql="select * from br_inpatientinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
+ String sql = "select * from br_inpatientinfo where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
List<BehospitalInfo> behospitalInfoList = tzDBConn.getBehospitalInfo(sql);
|
|
|
execute(behospitalInfoList);
|
|
|
}
|
|
@@ -145,26 +153,27 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 通过接口更新病人住院记录信息
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
public RespDTO<List<ABehospitalInfoDTO>> executeBehospital(List<ABehospitalInfoVO> list) {
|
|
|
- if(list!=null && list.size()>0) {
|
|
|
+ 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())) {
|
|
|
+ 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())) {
|
|
|
+ if (StringUtil.isNotBlank(s.getLeaveHospitalDate())) {
|
|
|
behospitalInfo.setLeaveHospitalDate(DateUtil.parseDateTime(s.getLeaveHospitalDate()));
|
|
|
}
|
|
|
- if(StringUtil.isNotBlank(s.getBehospitalDate())){
|
|
|
+ if (StringUtil.isNotBlank(s.getBehospitalDate())) {
|
|
|
behospitalInfo.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));
|
|
|
}
|
|
|
- if(StringUtil.isNotBlank(s.getPlacefileDate())){
|
|
|
+ if (StringUtil.isNotBlank(s.getPlacefileDate())) {
|
|
|
behospitalInfo.setPlacefileDate(DateUtil.parseDateTime(s.getPlacefileDate()));
|
|
|
}
|
|
|
behospitalInfoList.add(behospitalInfo);
|
|
@@ -172,33 +181,33 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
});
|
|
|
|
|
|
//循环验证数据有效性
|
|
|
- for (BehospitalInfo behospitalInfo:behospitalInfoList) {
|
|
|
- if("".equals(behospitalInfo.getBehospitalCode())) {
|
|
|
+ for (BehospitalInfo behospitalInfo : behospitalInfoList) {
|
|
|
+ if ("".equals(behospitalInfo.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
- }else if(behospitalInfo.getHospitalId()==null){
|
|
|
+ } else if (behospitalInfo.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else if("".equals(behospitalInfo.getBehDeptId())){
|
|
|
+ } else if ("".equals(behospitalInfo.getBehDeptId())) {
|
|
|
return RespDTO.onError("请输入住院科室编码!");
|
|
|
- }else if("".equals(behospitalInfo.getBehDeptName())){
|
|
|
+ } else if ("".equals(behospitalInfo.getBehDeptName())) {
|
|
|
return RespDTO.onError("请输入住院科室名称!");
|
|
|
}
|
|
|
}
|
|
|
execute(behospitalInfoList);
|
|
|
behospitalInfoDtoList = BeanUtil.listCopyTo(list, ABehospitalInfoDTO.class);
|
|
|
return RespDTO.onSuc(behospitalInfoDtoList);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void execute(List<BehospitalInfo> behospitalInfoList){
|
|
|
+ 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);
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N), false);
|
|
|
if (behospitalInfo != null) {
|
|
|
s.setGmtModified(new Date());
|
|
|
s.setQcTypeId(initQcTypeId(s));
|
|
@@ -209,10 +218,10 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
addE.add(s);
|
|
|
}
|
|
|
});
|
|
|
- if(addE.size()>0){
|
|
|
+ if (addE.size() > 0) {
|
|
|
behospitalInfoService.saveBatch(addE);
|
|
|
}
|
|
|
- if(updateE.size()>0){
|
|
|
+ if (updateE.size() > 0) {
|
|
|
behospitalInfoService.updateBatchByKey(updateE);
|
|
|
}
|
|
|
|
|
@@ -220,35 +229,36 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 初始化QcTypeId
|
|
|
+ *
|
|
|
* @param s
|
|
|
* @return
|
|
|
*/
|
|
|
- private Long initQcTypeId(BehospitalInfo s){
|
|
|
- Long qcTypeId=Long.valueOf("0");
|
|
|
+ private Long initQcTypeId(BehospitalInfo s) {
|
|
|
+ Long qcTypeId = Long.valueOf("0");
|
|
|
MedicalRecord medicalRecord = aMedicalRecordFacade.getOne(new QueryWrapper<MedicalRecord>()
|
|
|
.eq("behospital_code", s.getBehospitalCode())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
.eq("mode_id", Long.valueOf("1"))
|
|
|
- .eq("is_deleted",IsDeleteEnum.N), false);
|
|
|
- if(medicalRecord!=null){
|
|
|
- QcType qcType=qcTypeFacade.getOne(new QueryWrapper<QcType>()
|
|
|
- .eq("name",medicalRecord.getRecTitle())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N), false);
|
|
|
+ if (medicalRecord != null) {
|
|
|
+ QcType qcType = qcTypeFacade.getOne(new QueryWrapper<QcType>()
|
|
|
+ .eq("name", medicalRecord.getRecTitle())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("is_deleted",IsDeleteEnum.N), false);
|
|
|
- if(qcType!=null){
|
|
|
- qcTypeId=qcType.getId();
|
|
|
- }else{
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N), false);
|
|
|
+ if (qcType != null) {
|
|
|
+ qcTypeId = qcType.getId();
|
|
|
+ } else {
|
|
|
//新增类型到qc_type表中
|
|
|
- QcType qctype=new QcType();
|
|
|
+ QcType qctype = new QcType();
|
|
|
qctype.setHospitalId(s.getHospitalId());
|
|
|
qctype.setName(medicalRecord.getRecTitle());
|
|
|
qctype.setGmtCreate(new Date());
|
|
|
|
|
|
- Long id=qcTypeFacade.saveT(qctype);
|
|
|
- qcTypeId=id;
|
|
|
+ Long id = qcTypeFacade.saveT(qctype);
|
|
|
+ qcTypeId = id;
|
|
|
|
|
|
//新增类型到监测表中
|
|
|
- QcAbnormal qcAbnormal=new QcAbnormal();
|
|
|
+ QcAbnormal qcAbnormal = new QcAbnormal();
|
|
|
qcAbnormal.setHospitalId(s.getHospitalId());
|
|
|
qcAbnormal.setBehospitalCode(s.getBehospitalCode());
|
|
|
qcAbnormal.setType(2);
|