|
@@ -5,14 +5,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.data.ADoctorAdviceDTO;
|
|
|
import com.diagbot.entity.DoctorAdvice;
|
|
|
+import com.diagbot.entity.shaoyifu.entity.PatientInfo;
|
|
|
import com.diagbot.entity.shaoyifu.entity.SYFDoctorAdvice;
|
|
|
import com.diagbot.entity.shaoyifu.request.DoctorAdviceRequest;
|
|
|
-import com.diagbot.entity.shaoyifu.request.PatientListRequest;
|
|
|
import com.diagbot.entity.shaoyifu.response.DoctorAdviceResponse;
|
|
|
-import com.diagbot.entity.shaoyifu.response.PatientListResponse;
|
|
|
import com.diagbot.entity.shaoyifu.util.HttpApi;
|
|
|
import com.diagbot.entity.shaoyifu.util.SYFNlRequest;
|
|
|
import com.diagbot.service.impl.DoctorAdviceServiceImpl;
|
|
|
+import com.diagbot.service.impl.PatientInfoServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
@@ -28,7 +28,7 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Component
|
|
|
-public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
+public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl {
|
|
|
|
|
|
@Autowired
|
|
|
@Qualifier("doctorAdviceServiceImpl")
|
|
@@ -37,6 +37,12 @@ public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
@Autowired
|
|
|
private APatientListFacade aPatientListFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PatientInfoServiceImpl patientInfoServiceImpl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DateFacade dateFacade;
|
|
|
+
|
|
|
private TZDBConn tzDBConn = new TZDBConn();
|
|
|
|
|
|
/**
|
|
@@ -45,34 +51,24 @@ public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
public void executeDoctorAdvice() {
|
|
|
|
|
|
try {
|
|
|
- /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Calendar start = Calendar.getInstance();
|
|
|
- start.setTime(new Date());
|
|
|
- start.set(Calendar.DATE, start.get(Calendar.DATE) - 1);
|
|
|
- start.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- start.set(Calendar.MINUTE, 0);
|
|
|
- start.set(Calendar.SECOND, 0);
|
|
|
- Date startTime = start.getTime();
|
|
|
- Calendar end = Calendar.getInstance();
|
|
|
- end.setTime(new Date());
|
|
|
- end.set(Calendar.DATE, end.get(Calendar.DATE));
|
|
|
- end.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- end.set(Calendar.MINUTE, 0);
|
|
|
- end.set(Calendar.SECOND, 0);
|
|
|
- Date endTime = end.getTime();*/
|
|
|
- PatientListRequest patientListRequest = new PatientListRequest();
|
|
|
- /*patientListRequest.setDATESTART(sdf.format(startTime));
|
|
|
- patientListRequest.setDATEEND(sdf.format(endTime));*/
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
+ /*PatientListRequest patientListRequest = new PatientListRequest();
|
|
|
+ *//*patientListRequest.setDATESTART(sdf.format(dateFacade.getStartDate()));
|
|
|
+ patientListRequest.setDATEEND(sdf.format(dateFacade.getEndDate()));*//*
|
|
|
patientListRequest.setDATESTART("2020-04-01 00:00:00");
|
|
|
patientListRequest.setDATEEND("2020-04-08 00:00:00");
|
|
|
- PatientListResponse patientListResponse = aPatientListFacade.getPatientList(patientListRequest);
|
|
|
+ PatientListResponse patientListResponse = aPatientListFacade.getPatientList(patientListRequest);*/
|
|
|
|
|
|
- for (int i = 0; i < patientListResponse.getData().size(); i++) {
|
|
|
+ List<PatientInfo> patientInfoList = patientInfoServiceImpl.list();
|
|
|
+
|
|
|
+ for (int i = 0; i < patientInfoList.size(); i++) {
|
|
|
|
|
|
SYFNlRequest<DoctorAdviceRequest> request = new SYFNlRequest<>();
|
|
|
DoctorAdviceRequest doctorAdviceRequest = new DoctorAdviceRequest();
|
|
|
- doctorAdviceRequest.setMrn(patientListResponse.getData().get(i).getMRN());
|
|
|
- doctorAdviceRequest.setSeries(patientListResponse.getData().get(i).getSERIES());
|
|
|
+ doctorAdviceRequest.setMrn(patientInfoList.get(i).getMrn());
|
|
|
+ doctorAdviceRequest.setSeries(patientInfoList.get(i).getSeries());
|
|
|
+ /*doctorAdviceRequest.setMrn(patientListResponse.getData().get(i).getMRN());
|
|
|
+ doctorAdviceRequest.setSeries(patientListResponse.getData().get(i).getSERIES());*/
|
|
|
request.setData(doctorAdviceRequest);
|
|
|
|
|
|
HttpApi<DoctorAdviceResponse> httpApi = new HttpApi<>();
|
|
@@ -82,12 +78,13 @@ public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
|
|
|
List<SYFDoctorAdvice> sYFDoctorAdviceList = doctorAdviceResponse.getData();
|
|
|
List<DoctorAdvice> doctorAdviceList = Lists.newLinkedList();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
+
|
|
|
for (int j = 0; j < sYFDoctorAdviceList.size(); j++) {
|
|
|
DoctorAdvice doctorAdvice = new DoctorAdvice();
|
|
|
doctorAdvice.setDoctorAdviceId(sYFDoctorAdviceList.get(j).getOrderno());
|
|
|
doctorAdvice.setHospitalId(Long.parseLong("2"));
|
|
|
- doctorAdvice.setBehospitalCode(patientListResponse.getData().get(i).getMRN() + "_" + patientListResponse.getData().get(i).getSERIES());
|
|
|
+ doctorAdvice.setBehospitalCode(patientInfoList.get(i).getMrn() + "_" + patientInfoList.get(i).getSeries());
|
|
|
+ //doctorAdvice.setBehospitalCode(patientListResponse.getData().get(i).getMRN() + "_" + patientListResponse.getData().get(i).getSERIES());
|
|
|
doctorAdvice.setOrderDoctorName(sYFDoctorAdviceList.get(j).getDr_name());
|
|
|
doctorAdvice.setFrequency(sYFDoctorAdviceList.get(j).getFrequency_name());
|
|
|
doctorAdvice.setDoctorAdviceType(sYFDoctorAdviceList.get(j).getOrdertype());
|
|
@@ -122,50 +119,52 @@ public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
}
|
|
|
|
|
|
public void executeDoctorAdvicePast() {
|
|
|
- String sql="select * from br_doctadvice where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
+ String sql = "select * from br_doctadvice where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
List<DoctorAdvice> doctorAdviceList = tzDBConn.getDoctorAdvice(sql);
|
|
|
execute(doctorAdviceList);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 数据引擎-通过接口更新医生医嘱信息
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
public RespDTO<List<ADoctorAdviceDTO>> executeDoctorAdvice(List<ADoctorAdviceVO> list) {
|
|
|
- if(list!=null && list.size()>0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
//循环验证数据有效性
|
|
|
- for (ADoctorAdviceVO doctorAdvice:list) {
|
|
|
- if("".equals(doctorAdvice.getDoctorAdviceId())) {
|
|
|
+ for (ADoctorAdviceVO doctorAdvice : list) {
|
|
|
+ if ("".equals(doctorAdvice.getDoctorAdviceId())) {
|
|
|
return RespDTO.onError("请输入病人医嘱编码!");
|
|
|
- }else if(doctorAdvice.getHospitalId()==null){
|
|
|
+ } else if (doctorAdvice.getHospitalId() == null) {
|
|
|
return RespDTO.onError("请输入医院编码!");
|
|
|
- }else if("".equals(doctorAdvice.getBehospitalCode())){
|
|
|
+ } else if ("".equals(doctorAdvice.getBehospitalCode())) {
|
|
|
return RespDTO.onError("请输入病人住院编码!");
|
|
|
}
|
|
|
}
|
|
|
//初始、格式化数据
|
|
|
- List<DoctorAdvice> doctorAdviceList=Lists.newArrayList();
|
|
|
- List<ADoctorAdviceDTO> doctorAdviceDtoList=Lists.newArrayList();
|
|
|
- list.stream().forEach(s->{
|
|
|
- DoctorAdvice doctorAdvice=new DoctorAdvice();
|
|
|
- BeanUtil.copyProperties(s,doctorAdvice);
|
|
|
- if(StringUtil.isNotBlank(s.getDaStartDate())){
|
|
|
+ List<DoctorAdvice> doctorAdviceList = Lists.newArrayList();
|
|
|
+ List<ADoctorAdviceDTO> doctorAdviceDtoList = Lists.newArrayList();
|
|
|
+ list.stream().forEach(s -> {
|
|
|
+ DoctorAdvice doctorAdvice = new DoctorAdvice();
|
|
|
+ BeanUtil.copyProperties(s, doctorAdvice);
|
|
|
+ if (StringUtil.isNotBlank(s.getDaStartDate())) {
|
|
|
doctorAdvice.setDaStartDate(DateUtil.parseDateTime(s.getDaStartDate()));
|
|
|
}
|
|
|
- if(StringUtil.isNotBlank(s.getDaStopDate())){
|
|
|
+ if (StringUtil.isNotBlank(s.getDaStopDate())) {
|
|
|
doctorAdvice.setDaStopDate(DateUtil.parseDateTime(s.getDaStopDate()));
|
|
|
}
|
|
|
doctorAdviceList.add(doctorAdvice);
|
|
|
});
|
|
|
execute(doctorAdviceList);
|
|
|
- doctorAdviceDtoList=BeanUtil.listCopyTo(list,ADoctorAdviceDTO.class);
|
|
|
+ doctorAdviceDtoList = BeanUtil.listCopyTo(list, ADoctorAdviceDTO.class);
|
|
|
return RespDTO.onSuc(doctorAdviceDtoList);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return RespDTO.onError("未接收到数据!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void execute(List<DoctorAdvice> doctorAdviceList){
|
|
|
+ public void execute(List<DoctorAdvice> doctorAdviceList) {
|
|
|
List<DoctorAdvice> addE = Lists.newLinkedList();
|
|
|
List<DoctorAdvice> updateE = Lists.newLinkedList();
|
|
|
if (doctorAdviceList != null && doctorAdviceList.size() > 0) {
|
|
@@ -173,7 +172,7 @@ public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
DoctorAdvice doctorAdvice = this.getOne(new QueryWrapper<DoctorAdvice>()
|
|
|
.eq("doctor_advice_id", s.getDoctorAdviceId())
|
|
|
.eq("hospital_id", s.getHospitalId())
|
|
|
- .eq("behospital_code",s.getBehospitalCode()), false);
|
|
|
+ .eq("behospital_code", s.getBehospitalCode()), false);
|
|
|
if (doctorAdvice != null) {
|
|
|
s.setGmtModified(new Date());
|
|
|
updateE.add(s);
|
|
@@ -183,10 +182,10 @@ public class ADoctorAdviceFacade extends DoctorAdviceServiceImpl{
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if(addE.size()>0){
|
|
|
+ if (addE.size() > 0) {
|
|
|
doctorAdviceService.saveBatch(addE);
|
|
|
}
|
|
|
- if(updateE.size()>0){
|
|
|
+ if (updateE.size() > 0) {
|
|
|
doctorAdviceService.updateBatchByKey(updateE);
|
|
|
}
|
|
|
}
|