private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract) { CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo(); referral.setPatient(patientShort); referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0)); CatsReferralStatusVo referralStatus = new CatsReferralStatusVo(); referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED); referralStatus.setStatusDateTime(new DateTime()); referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referral.setCurrentStatus(referralStatus); referral.setStatusHistory(new CATSReferralStatusRefVoCollection()); referral.getStatusHistory().add(referralStatus); String codeCCG = getCCGCode(patient); referral.setContract(contract); referral.setHasAppointments(false); referral.setAdmissions(new AdmissionDetailVoCollection()); referral.getAdmissions().add(admission); ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo(); referralDetails.setService(form.cmbService().getValue()); referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue())); referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referralDetails.setAuthoringDateTime(new DateTime()); referralDetails.setDateReferralReceived(new Date()); referralDetails.setDateOfReferral(new Date()); referralDetails.setEnd18WW(calculateEnd18WW(contract)); referralDetails.setPCT(codeCCG); referralDetails.setGPName(patient.getGp()); referralDetails.setPractice(getPatientGpDefaultPractice(patient)); referral.setReferralDetails(referralDetails); return referral; }
private CatsReferralEmergencyAdmissionVo createCatsReferral(PatientLite_IdentifiersVo patient, AdmissionDetailVo admission, CareSpellAdmitVo careSpell) { if (careSpell == null || careSpell.getEpisodes() == null || careSpell.getEpisodes().size() < 1 || careSpell.getEpisodes().get(0).getCareContexts() == null) throw new CodingRuntimeException("Invalid care spell created."); CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo(); referral.setPatient(patient); for (CareContextAdmitVo careContext : careSpell.getEpisodes().get(0).getCareContexts()) { if (ContextType.REFERRAL.equals(careContext.getContext())) { referral.setCareContext(careContext); referral.setEpisodeOfCare(careSpell.getEpisodes().get(0)); break; } } //WDEV-22214 PatientWithGPForCCGVo patientWithGP = domain.getPatientForCCG(patient); String codeCCG = getCCGCode(patientWithGP); CatsReferralStatusVo referralStatus = new CatsReferralStatusVo(); referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED); referralStatus.setStatusDateTime(new DateTime()); referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referral.setCurrentStatus(referralStatus); referral.setStatusHistory(new CATSReferralStatusRefVoCollection()); referral.getStatusHistory().add(referralStatus); referral.setContract(null); referral.setHasAppointments(false); referral.setAdmissions(new AdmissionDetailVoCollection()); referral.getAdmissions().add(admission); ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo(); referralDetails.setReferrerType(form.cmbSourceOfReferral().getValue() != null ? form.cmbSourceOfReferral().getValue() : SourceOfReferral.ED); referralDetails.setService(admission.getService()); referralDetails.setConsultant(domain.getHcpFromIMos(admission.getConsultant())); referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referralDetails.setAuthoringDateTime(new DateTime()); //referralDetails.setDateReferralReceived(new Date());WDEV-22688 referralDetails.setDateOfReferral(new Date()); referralDetails.setEnd18WW(null); referralDetails.setPCT(codeCCG); referral.setReferralDetails(referralDetails); referral.setIsEmergencyReferral(Boolean.TRUE); referral.setUrgency(ReferralUrgency.EMERGENCY); //WDEV-22229 return referral; }
private CatsReferralEmergencyAdmissionVo createCatsReferral(PatientLite_IdentifiersVo patient, AdmissionDetailVo admission, CareSpellAdmitVo careSpell) { if (careSpell == null || careSpell.getEpisodes() == null || careSpell.getEpisodes().size() < 1 || careSpell.getEpisodes().get(0).getCareContexts() == null) throw new CodingRuntimeException("Invalid care spell created."); CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo(); referral.setPatient(patient); for (CareContextAdmitVo careContext : careSpell.getEpisodes().get(0).getCareContexts()) { if (ContextType.REFERRAL.equals(careContext.getContext())) { referral.setCareContext(careContext); referral.setEpisodeOfCare(careSpell.getEpisodes().get(0)); break; } } PatientWithGPForCCGVo patientWithGP = domain.getPatientForCCG(patient); String codeCCG = getCCGCode(patientWithGP); CatsReferralStatusVo referralStatus = new CatsReferralStatusVo(); referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED); referralStatus.setStatusDateTime(new DateTime()); referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referral.setCurrentStatus(referralStatus); referral.setStatusHistory(new CATSReferralStatusRefVoCollection()); referral.getStatusHistory().add(referralStatus); referral.setContract(null); referral.setHasAppointments(false); referral.setAdmissions(new AdmissionDetailVoCollection()); referral.getAdmissions().add(admission); ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo(); referralDetails.setReferrerType(form.cmbSourceOfReferral().getValue() != null ? form.cmbSourceOfReferral().getValue() : SourceOfReferral.ED); referralDetails.setService(admission.getService()); referralDetails.setConsultant(domain.getHcpFromIMos(admission.getConsultant())); referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referralDetails.setAuthoringDateTime(new DateTime()); //referralDetails.setDateReferralReceived(new Date());//WDEV-22688 referralDetails.setDateOfReferral(new Date()); referralDetails.setEnd18WW(null); referralDetails.setPCT(codeCCG); referral.setReferralDetails(referralDetails); referral.setIsEmergencyReferral(Boolean.TRUE); referral.setUrgency(ReferralUrgency.EMERGENCY); //WDEV-22229 return referral; }