|
@@ -1,10 +1,17 @@
|
|
|
package com.diagbot.facade.data;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.AnalyzeRunDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.data.AHomePageDTO;
|
|
|
import com.diagbot.entity.HomePage;
|
|
|
+import com.diagbot.entity.shaoyifu.request.HomePageRequest;
|
|
|
+import com.diagbot.entity.shaoyifu.request.PatientListRequest;
|
|
|
+import com.diagbot.entity.shaoyifu.response.HomePageResponse;
|
|
|
+import com.diagbot.entity.shaoyifu.response.PatientListResponse;
|
|
|
+import com.diagbot.entity.shaoyifu.util.HttpApi;
|
|
|
+import com.diagbot.entity.shaoyifu.util.SYFNlRequest;
|
|
|
import com.diagbot.facade.BehospitalInfoFacade;
|
|
|
import com.diagbot.service.impl.HomePageServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
@@ -21,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -45,6 +53,9 @@ public class AHomePageFacade extends HomePageServiceImpl{
|
|
|
@Autowired
|
|
|
private ReadProperties readProperties;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private APatientListFacade aPatientListFacade;
|
|
|
+
|
|
|
private TZDBConn tzDBConn = new TZDBConn();
|
|
|
|
|
|
/*public static void main(String[] args){
|
|
@@ -63,20 +74,211 @@ public class AHomePageFacade extends HomePageServiceImpl{
|
|
|
* 同步前一天病案首页
|
|
|
*/
|
|
|
public void executeHomePage() {
|
|
|
- //String sql="select * from br_rechome where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
|
|
|
- //同步前一天的数据
|
|
|
- String sql="select * from br_rechome where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23))";
|
|
|
- List<HomePage> homePageList = tzDBConn.getHomePage(sql);
|
|
|
- /*
|
|
|
- int mod=Math.floorMod(homePageList.size(),500);
|
|
|
- int div=Math.floorDiv(homePageList.size(),500);
|
|
|
- for (int i = 0; i <= homePageList.size(); i++) {
|
|
|
- System.out.println((i-1)*500+"---"+(i*500));
|
|
|
- homePageList=homePageList.subList((i*500),(i+1)*500);
|
|
|
- execute(homePageList);
|
|
|
+ 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));*/
|
|
|
+ patientListRequest.setDATESTART("2020-04-01 00:00:00");
|
|
|
+ patientListRequest.setDATEEND("2020-04-08 00:00:00");
|
|
|
+ PatientListResponse patientListResponse = aPatientListFacade.getPatientList(patientListRequest);
|
|
|
+
|
|
|
+ for (int i = 0; i < patientListResponse.getData().size(); i++) {
|
|
|
+
|
|
|
+ SYFNlRequest<HomePageRequest> request = new SYFNlRequest<>();
|
|
|
+ HomePageRequest homePageRequest = new HomePageRequest();
|
|
|
+ homePageRequest.setRdn(patientListResponse.getData().get(i).getRDN());
|
|
|
+ request.setData(homePageRequest);
|
|
|
+
|
|
|
+ HttpApi<HomePageResponse> httpApi = new HttpApi<>();
|
|
|
+ String a = httpApi.doPost("http://192.1.5.162:8088/api/NlService/GetEMRFIRST", request);
|
|
|
+ HomePageResponse homePageResponse = JSON.parseObject(a, HomePageResponse.class);
|
|
|
+
|
|
|
+ List<HomePage> homePageList = Lists.newLinkedList();
|
|
|
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd HH");
|
|
|
+ SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH");
|
|
|
+ if (homePageResponse.getData() != null) {
|
|
|
+ HomePage homePage = new HomePage();
|
|
|
+ homePage.setHomePageId(homePageResponse.getData().getRdn());
|
|
|
+ homePage.setHospitalId(Long.parseLong("2"));
|
|
|
+ homePage.setBehospitalCode(patientListResponse.getData().get(i).getMRN() + "_" + patientListResponse.getData().get(i).getSERIES());
|
|
|
+ homePage.setHospitalCode("A001");
|
|
|
+ homePage.setHospitalName("邵逸夫");
|
|
|
+ homePage.setOrgCode("A001");
|
|
|
+ homePage.setPayType(homePageResponse.getData().getChargetype());
|
|
|
+ homePage.setHealthCard(homePageResponse.getData().getHealthcard());
|
|
|
+ homePage.setBehospitalNum(homePageResponse.getData().getSeries());
|
|
|
+ homePage.setFileCode(homePageResponse.getData().getMrn());
|
|
|
+ homePage.setName(homePageResponse.getData().getPname());
|
|
|
+ switch (homePageResponse.getData().getPsex()) {
|
|
|
+ case "男":
|
|
|
+ homePage.setSex("男");
|
|
|
+ break;
|
|
|
+ case "女":
|
|
|
+ homePage.setSex("女");
|
|
|
+ break;
|
|
|
+ case "M":
|
|
|
+ homePage.setSex("男");
|
|
|
+ break;
|
|
|
+ case "F":
|
|
|
+ homePage.setSex("女");
|
|
|
+ break;
|
|
|
+ case "?":
|
|
|
+ homePage.setSex("");
|
|
|
+ break;
|
|
|
+ case "B":
|
|
|
+ homePage.setSex("");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (homePageResponse.getData().getPbirthday() != null && homePageResponse.getData().getPbirthday().length() > 0) {
|
|
|
+ homePage.setBirthday(sdf1.parse(homePageResponse.getData().getPbirthday()));
|
|
|
+ }
|
|
|
+ homePage.setAge(homePageResponse.getData().getAge());
|
|
|
+ homePage.setAgeUnit(homePageResponse.getData().getAgeunit());
|
|
|
+ homePage.setNationality(homePageResponse.getData().getCitizenship());
|
|
|
+ homePage.setNewbornMonth(homePageResponse.getData().getBabyage_month());
|
|
|
+ homePage.setNewbornWeight(homePageResponse.getData().getBaby_weight());
|
|
|
+ homePage.setNewbornBehospitalWeight(homePageResponse.getData().getBaby_inhosweight());
|
|
|
+ homePage.setBornAddress((homePageResponse.getData().getBornadress_province() == null ? "" : homePageResponse.getData().getBornadress_province()) + (homePageResponse.getData().getBornadress_city() == null ? "" : homePageResponse.getData().getBornadress_city()) + (homePageResponse.getData().getBornadress_county() == null ? "" : homePageResponse.getData().getBornadress_county()));
|
|
|
+ homePage.setBornPlace((homePageResponse.getData().getHometown_province() == null ? "" : homePageResponse.getData().getHometown_province()) + (homePageResponse.getData().getHometown_city() == null ? "" : homePageResponse.getData().getHometown_city()));
|
|
|
+ homePage.setNation(homePageResponse.getData().getNation());
|
|
|
+ homePage.setIdentityCardNo(homePageResponse.getData().getIcd());
|
|
|
+ homePage.setJobType(homePageResponse.getData().getOccupation());
|
|
|
+ homePage.setMarriage(homePageResponse.getData().getMarital_status());
|
|
|
+ homePage.setCurAddress((homePageResponse.getData().getNowadress_province() == null ? "" : homePageResponse.getData().getNowadress_province()) + (homePageResponse.getData().getNowadress_city() == null ? "" : homePageResponse.getData().getNowadress_city()) + (homePageResponse.getData().getNowadress_county() == null ? "" : homePageResponse.getData().getNowadress_county()));
|
|
|
+ homePage.setCurPhone(homePageResponse.getData().getTelephone());
|
|
|
+ homePage.setCurPostCode(homePageResponse.getData().getNowadress_postcode());
|
|
|
+ homePage.setResidenceAddress((homePageResponse.getData().getCensus_province() == null ? "" : homePageResponse.getData().getCensus_province()) + (homePageResponse.getData().getCensus_city() == null ? "" : homePageResponse.getData().getCensus_city()) + (homePageResponse.getData().getCensus_county() == null ? "" : homePageResponse.getData().getCensus_county()));
|
|
|
+ homePage.setResidencePostCode(homePageResponse.getData().getCensus_postcode());
|
|
|
+ homePage.setWorkAddress(homePageResponse.getData().getWork_adress());
|
|
|
+ homePage.setWorkPhone(homePageResponse.getData().getWork_phone());
|
|
|
+ homePage.setWorkPostCode(homePageResponse.getData().getWork_postcode());
|
|
|
+ homePage.setContactName(homePageResponse.getData().getConcatperson());
|
|
|
+ homePage.setContactRelation(homePageResponse.getData().getConcatperson_relation());
|
|
|
+ homePage.setContactAddress(homePageResponse.getData().getConcatperson_adress());
|
|
|
+ homePage.setContactPhone(homePageResponse.getData().getConcatperson_phone());
|
|
|
+ homePage.setBehospitalWay(homePageResponse.getData().getInhos_way());
|
|
|
+ if (homePageResponse.getData().getAdmid() != null && homePageResponse.getData().getAdmid().length() > 0) {
|
|
|
+ if (homePageResponse.getData().getAdmid().indexOf("-") != -1) {
|
|
|
+ homePage.setBehospitalDate(sdf3.parse(homePageResponse.getData().getAdmid()));
|
|
|
+ } else if (homePageResponse.getData().getAdmid().indexOf("/") != -1) {
|
|
|
+ homePage.setBehospitalDate(sdf2.parse(homePageResponse.getData().getAdmid()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ homePage.setBehospitalWard(homePageResponse.getData().getInhosward());
|
|
|
+ homePage.setBehospitalBedCode(homePageResponse.getData().getBedid_in());
|
|
|
+ homePage.setChangeDept(homePageResponse.getData().getTransferdept());
|
|
|
+ if (homePageResponse.getData().getDiscd() != null && homePageResponse.getData().getDiscd().length() > 0) {
|
|
|
+ if (homePageResponse.getData().getDiscd().indexOf("-") != -1) {
|
|
|
+ homePage.setLeaveHospitalDate(sdf3.parse(homePageResponse.getData().getDiscd()));
|
|
|
+ } else if (homePageResponse.getData().getDiscd().indexOf("/") != -1) {
|
|
|
+ homePage.setLeaveHospitalDate(sdf2.parse(homePageResponse.getData().getDiscd()));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ homePage.setLeaveHospitalDept(homePageResponse.getData().getOuthosdept());
|
|
|
+ homePage.setLeaveHospitalWard(homePageResponse.getData().getOuthosward());
|
|
|
+ homePage.setBehospitalDayNum(homePageResponse.getData().getInhosday());
|
|
|
+ homePage.setOutpatientEmrDiagnose(homePageResponse.getData().getOutpatientEmrDiagnose());
|
|
|
+ homePage.setOutpatientEmrDiagnoseCode(homePageResponse.getData().getOutpatientEmrDiagnoseCode());
|
|
|
+ homePage.setPoisonFactor(homePageResponse.getData().getPoisonFactor());
|
|
|
+ homePage.setPoisonFactorCode(homePageResponse.getData().getPoisonFactorCode());
|
|
|
+ homePage.setPathologyDiagnoseId(homePageResponse.getData().getPathology_number());
|
|
|
+ homePage.setMedAllergyName(homePageResponse.getData().getDrug_allergy());
|
|
|
+ homePage.setAutopsy(homePageResponse.getData().getAutopsy());
|
|
|
+ homePage.setBloodType(homePageResponse.getData().getBloodtype());
|
|
|
+ homePage.setRh(homePageResponse.getData().getRh());
|
|
|
+ homePage.setDeptDirector(homePageResponse.getData().getChief_doctor());
|
|
|
+ homePage.setDirectorDoctor(homePageResponse.getData().getChief_doctor());
|
|
|
+ homePage.setAttendingDoctor(homePageResponse.getData().getAttend_doctor());
|
|
|
+ homePage.setBehospitalDoctor(homePageResponse.getData().getResident_doctor());
|
|
|
+ homePage.setResponseNurse(homePageResponse.getData().getCharge_nurse());
|
|
|
+ homePage.setStudyDoctor(homePageResponse.getData().getPhysician_doctor());
|
|
|
+ homePage.setPracticeDoctor(homePageResponse.getData().getTrainee_doctor());
|
|
|
+ homePage.setEncodeMan(homePageResponse.getData().getCoder());
|
|
|
+ homePage.setHomePageQuality(homePageResponse.getData().getMedical_quality());
|
|
|
+ homePage.setQcDoctor(homePageResponse.getData().getQc_doctor());
|
|
|
+ homePage.setQcNurse(homePageResponse.getData().getQc_nurse());
|
|
|
+ if (homePageResponse.getData().getQc_date() != null && homePageResponse.getData().getQc_date().length() > 0) {
|
|
|
+ homePage.setQcDate(sdf1.parse(homePageResponse.getData().getQc_date()));
|
|
|
+ }
|
|
|
+ homePage.setLeaveHospitalType(homePageResponse.getData().getLeavehos_type());
|
|
|
+ homePage.setAcceptOrgCode(homePageResponse.getData().getAcceptOrgCode());
|
|
|
+ homePage.setAgainBehospitalPlan(homePageResponse.getData().getAgaininhosplan());
|
|
|
+ homePage.setAgainBehospitalGoal(homePageResponse.getData().getAgainBehospitalGoal());
|
|
|
+ homePage.setTbiBeforeDay(homePageResponse.getData().getBraininjurybefore_day());
|
|
|
+ homePage.setTbiBeforeHour(homePageResponse.getData().getBraininjurybefore_hour());
|
|
|
+ homePage.setTbiBeforeMinute(homePageResponse.getData().getBraininjurybefore_minute());
|
|
|
+ homePage.setTbiAfterDay(homePageResponse.getData().getBraininjuryafter_day());
|
|
|
+ homePage.setTbiAfterHour(homePageResponse.getData().getBraininjuryafter_hour());
|
|
|
+ homePage.setTbiAfterMinute(homePageResponse.getData().getBraininjuryafter_minute());
|
|
|
+ homePage.setTotalFee(homePageResponse.getData().getTotalcost());
|
|
|
+ homePage.setOwnFee(homePageResponse.getData().getOwnpaycost());
|
|
|
+ homePage.setGeneralFee(homePageResponse.getData().getGeneralcost_medicalservice());
|
|
|
+ homePage.setServiceFee(homePageResponse.getData().getTreatcost_medicalservice());
|
|
|
+ homePage.setNurseFee(homePageResponse.getData().getNursecost_medicalservice());
|
|
|
+ homePage.setOtherFee(homePageResponse.getData().getOthercost_medicalservice());
|
|
|
+ homePage.setPathologyFee(homePageResponse.getData().getBlcost_diagnosis());
|
|
|
+ homePage.setLabFee(homePageResponse.getData().getLabcost_diagnosis());
|
|
|
+ homePage.setPacsFee(homePageResponse.getData().getExamcost_diagnosis());
|
|
|
+ homePage.setClinicDiagnoseFee(homePageResponse.getData().getClinicalcost_diagnosis());
|
|
|
+ homePage.setNotOperationFee(homePageResponse.getData().getNoopscost_treat());
|
|
|
+ homePage.setClinicPhysicFee(homePageResponse.getData().getClinicalcost_treat());
|
|
|
+ homePage.setOperationTreatFee(homePageResponse.getData().getOpscost_treat());
|
|
|
+ homePage.setAnaesthesiaFee(homePageResponse.getData().getAnesthesiacost_treat());
|
|
|
+ homePage.setOperationFee(homePageResponse.getData().getSurgicacost_trear());
|
|
|
+ homePage.setHealthTypeFee(homePageResponse.getData().getKfcost());
|
|
|
+ homePage.setChnTreatFee(homePageResponse.getData().getCmtreatcost());
|
|
|
+ homePage.setWesternMedFee(homePageResponse.getData().getWmmedicine());
|
|
|
+ homePage.setAntibiosisFee(homePageResponse.getData().getAntibacterial());
|
|
|
+ homePage.setChnMedFee(homePageResponse.getData().getMedicine_cpm());
|
|
|
+ homePage.setChnHerbFee(homePageResponse.getData().getMedicine_chm());
|
|
|
+ homePage.setBloodFee(homePageResponse.getData().getBloodcost());
|
|
|
+ homePage.setAlbumenFee(homePageResponse.getData().getProductcost_bdb());
|
|
|
+ homePage.setGlobulinFee(homePageResponse.getData().getProductcost_qdb());
|
|
|
+ homePage.setBloodFactorFee(homePageResponse.getData().getProductcost_nxyz());
|
|
|
+ homePage.setCellFactorFee(homePageResponse.getData().getProductcost_xbyz());
|
|
|
+ homePage.setCheckMaterialFee(homePageResponse.getData().getConsumables_exam());
|
|
|
+ homePage.setTreatMaterialFee(homePageResponse.getData().getConsumables_treat());
|
|
|
+ homePage.setOperationMaterialFee(homePageResponse.getData().getConsumables_ops());
|
|
|
+ homePage.setOtherTypeFee(homePageResponse.getData().getOthercost());
|
|
|
+ homePage.setSingleDiagManage(homePageResponse.getData().getSingleDiagManage());
|
|
|
+ homePage.setClinicPathwayManage(homePageResponse.getData().getClinicPathwayManage());
|
|
|
+ homePage.setIsOutpatientBehospital(homePageResponse.getData().getIsOutpatientBehospital());
|
|
|
+ homePage.setIsLeaveBehospital(homePageResponse.getData().getIsLeaveBehospital());
|
|
|
+ homePage.setIsOperationBeforeAfter(homePageResponse.getData().getIsOperationBeforeAfter());
|
|
|
+ homePage.setIsClinicPathology(homePageResponse.getData().getIsClinicPathology());
|
|
|
+ homePage.setIsRadiatePathology(homePageResponse.getData().getIsRadiatePathology());
|
|
|
+ homePage.setRescueNum(homePageResponse.getData().getRescueNum());
|
|
|
+ homePage.setRescueSuccessNum(homePageResponse.getData().getRescueSuccessNum());
|
|
|
+ homePage.setIsAutoLeavehospital(homePageResponse.getData().getIsAutoLeavehospital());
|
|
|
+ homePage.setReturnToType(homePageResponse.getData().getReturnToType());
|
|
|
+ homePage.setPathologyDiagnoseCode(homePageResponse.getData().getPathologyDiagnoseCode());
|
|
|
+ homePageList.add(homePage);
|
|
|
+
|
|
|
+ execute(homePageList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- */
|
|
|
- execute(homePageList);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|