Package ke.go.moh.oec.reception.controller

Examples of ke.go.moh.oec.reception.controller.PersonWrapper


        altCompoundHeadsLastNameTextField.setText(personWrapper.getCompoundHeadLastName());
        altHdssDataConsentTextField.setText(mainViewHelper.getConsentSignedString(personWrapper.getConsentSigned()));
    }

    private void unhideNecessaryAlternativeFields() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        if (mpiMatchPersonWrapper != null
                && lpiMatchPersonWrapper != null) {
            boolean clinicIdVisible = lpiMatchPersonWrapper.getClinicId().equals(mpiMatchPersonWrapper.getClinicId());
            altClinicIdTextField.setVisible(!clinicIdVisible);
            clinicIdAcceptRadioButton.setVisible(!clinicIdVisible);
            clinicIdRejectRadioButton.setVisible(!clinicIdVisible);
            boolean firstNameVisible = lpiMatchPersonWrapper.getFirstName().equals(mpiMatchPersonWrapper.getFirstName());
            altFirstNameTextField.setVisible(!firstNameVisible);
            firstNameAcceptRadioButton.setVisible(!firstNameVisible);
            firstNameRejectRadioButton.setVisible(!firstNameVisible);
            boolean middleNameVisible = lpiMatchPersonWrapper.getMiddleName().equals(mpiMatchPersonWrapper.getMiddleName());
            altMiddleNameTextField.setVisible(!middleNameVisible);
            middleNameAcceptRadioButton.setVisible(!middleNameVisible);
            middleNameRejectRadioButton.setVisible(!middleNameVisible);
            boolean lastNameVisible = lpiMatchPersonWrapper.getLastName().equals(mpiMatchPersonWrapper.getLastName());
            altLastNameTextField.setVisible(!lastNameVisible);
            lastNameAcceptRadioButton.setVisible(!lastNameVisible);
            lastNameRejectRadioButton.setVisible(!lastNameVisible);

            if (lpiMatchPersonWrapper.getSex() != null
                    && mpiMatchPersonWrapper.getSex() != null) {
                boolean sexVisible = lpiMatchPersonWrapper.getSex().equals(mpiMatchPersonWrapper.getSex());
                altSexTextField.setVisible(!sexVisible);
                sexAcceptRadioButton.setVisible(!sexVisible);
                sexRejectRadioButton.setVisible(!sexVisible);
            }

            if (lpiMatchPersonWrapper.getBirthdate() != null
                    && mpiMatchPersonWrapper.getBirthdate() != null) {
                try {
                    Date mainBirthdate = new SimpleDateFormat("dd/MM/yyyy").parse(new SimpleDateFormat("dd/MM/yyyy").format(lpiMatchPersonWrapper.getBirthdate()));
                    Date altBirthdate = new SimpleDateFormat("dd/MM/yyyy").parse(new SimpleDateFormat("dd/MM/yyyy").format(mpiMatchPersonWrapper.getBirthdate()));
                    boolean dateVisible = mainBirthdate.equals(altBirthdate);
                    altBirthDateTextField.setVisible(!dateVisible);
                    birthDateAcceptRadioButton.setVisible(!dateVisible);
                    birthDateRejectRadioButton.setVisible(!dateVisible);






                } catch (ParseException ex) {
                    Logger.getLogger(MainView.class.getName()).log(Level.INFO, null, ex);
                }
            }

            if (lpiMatchPersonWrapper.getMaritalStatus() != null
                    && mpiMatchPersonWrapper.getMaritalStatus() != null) {
                boolean maritalStatusVisible = lpiMatchPersonWrapper.getMaritalStatus().equals(mpiMatchPersonWrapper.getMaritalStatus());
                altMaritalStatusTextField.setVisible(!maritalStatusVisible);
                maritalStatusAcceptRadioButton.setVisible(!maritalStatusVisible);
                maritalStatusRejectRadioButton.setVisible(!maritalStatusVisible);
            }
            boolean otherNameVisible = lpiMatchPersonWrapper.getOtherName().equals(mpiMatchPersonWrapper.getOtherName());
            altOtherNameTextField.setVisible(!otherNameVisible);
            otherNameAcceptRadioButton.setVisible(!otherNameVisible);
            otherNameRejectRadioButton.setVisible(!otherNameVisible);
            boolean clanVisible = lpiMatchPersonWrapper.getClanName().equals(mpiMatchPersonWrapper.getClanName());
            altClanTextField.setVisible(!clanVisible);
            clanAcceptRadioButton.setVisible(!clanVisible);
            clanRejectRadioButton.setVisible(!clanVisible);
            boolean villageVisible = lpiMatchPersonWrapper.getVillageName().equals(mpiMatchPersonWrapper.getVillageName());
            altVillageTextField.setVisible(!villageVisible);
            villageAcceptRadioButton.setVisible(!villageVisible);
            villageRejectRadioButton.setVisible(!villageVisible);
            boolean fathersFirstNameVisible = lpiMatchPersonWrapper.getFathersFirstName().equals(mpiMatchPersonWrapper.getFathersFirstName());
            altFathersFirstNameTextField.setVisible(!fathersFirstNameVisible);
            fathersFirstNameAcceptRadioButton.setVisible(!fathersFirstNameVisible);
            fathersFirstNameRejectRadioButton.setVisible(!fathersFirstNameVisible);
            boolean fathersMiddleNameVisible = lpiMatchPersonWrapper.getFathersMiddleName().equals(mpiMatchPersonWrapper.getFathersMiddleName());
            altFathersMiddleNameTextField.setVisible(!fathersMiddleNameVisible);
            fathersMiddleNameAcceptRadioButton.setVisible(!fathersMiddleNameVisible);
            fathersMiddleNameRejectRadioButton.setVisible(!fathersMiddleNameVisible);
            boolean fathersLastNameVisible = lpiMatchPersonWrapper.getFathersLastName().equals(mpiMatchPersonWrapper.getFathersLastName());
            altFathersLastNameTextField.setVisible(!fathersLastNameVisible);
            fathersLastNameAcceptRadioButton.setVisible(!fathersLastNameVisible);
            fathersLastNameRejectRadioButton.setVisible(!fathersLastNameVisible);
            boolean mothersFirstNameVisible = lpiMatchPersonWrapper.getMothersFirstName().equals(mpiMatchPersonWrapper.getMothersFirstName());
            altMothersFirstNameTextField.setVisible(!mothersFirstNameVisible);
            mothersFirstNameAcceptRadioButton.setVisible(!mothersFirstNameVisible);
            mothersFirstNameRejectRadioButton.setVisible(!mothersFirstNameVisible);
            boolean mothersMiddleNameVisible = lpiMatchPersonWrapper.getMothersMiddleName().equals(mpiMatchPersonWrapper.getMothersMiddleName());
            altMothersMiddleNameTextField.setVisible(!mothersMiddleNameVisible);
            mothersMiddleNameAcceptRadioButton.setVisible(!mothersMiddleNameVisible);
            mothersMiddleNameRejectRadioButton.setVisible(!mothersMiddleNameVisible);
            boolean mothersLastNameVisible = lpiMatchPersonWrapper.getMothersLastName().equals(mpiMatchPersonWrapper.getMothersLastName());
            altMothersLastNameTextField.setVisible(!mothersLastNameVisible);
            mothersLastNameAcceptRadioButton.setVisible(!mothersLastNameVisible);
            mothersLastNameRejectRadioButton.setVisible(!mothersLastNameVisible);
            boolean compoundHeadsFirstNameVisible = lpiMatchPersonWrapper.getCompoundHeadFirstName().equals(mpiMatchPersonWrapper.getCompoundHeadFirstName());
            altCompoundHeadsFirstNameTextField.setVisible(!compoundHeadsFirstNameVisible);
            compoundHeadsFirstNameAcceptRadioButton.setVisible(!compoundHeadsFirstNameVisible);
            compoundHeadsFirstNameRejectRadioButton.setVisible(!compoundHeadsFirstNameVisible);
            boolean compoundHeadsMiddleNameVisible = lpiMatchPersonWrapper.getCompoundHeadMiddleName().equals(mpiMatchPersonWrapper.getCompoundHeadMiddleName());
            altCompoundHeadsMiddleNameTextField.setVisible(!compoundHeadsMiddleNameVisible);
            compoundHeadsMiddleNameAcceptRadioButton.setVisible(!compoundHeadsMiddleNameVisible);
            compoundHeadsMiddleNameRejectRadioButton.setVisible(!compoundHeadsMiddleNameVisible);
            boolean compoundHeadsLastNameVisible = lpiMatchPersonWrapper.getCompoundHeadLastName().equals(mpiMatchPersonWrapper.getCompoundHeadLastName());
            altCompoundHeadsLastNameTextField.setVisible(!compoundHeadsLastNameVisible);
            compoundHeadsLastNameAcceptRadioButton.setVisible(!compoundHeadsLastNameVisible);
            compoundHeadsLastNameRejectRadioButton.setVisible(!compoundHeadsLastNameVisible);

            if (lpiMatchPersonWrapper.getConsentSigned() != null
                    && mpiMatchPersonWrapper.getConsentSigned() != null) {
                boolean hdssDataConsentVisible = lpiMatchPersonWrapper.getConsentSigned().equals(mpiMatchPersonWrapper.getConsentSigned());
                altHdssDataConsentTextField.setVisible(!hdssDataConsentVisible);
                hdssDataConsentAcceptRadioButton.setVisible(!hdssDataConsentVisible);
                hdssDataConsentRejectRadioButton.setVisible(!hdssDataConsentVisible);
            }
        }
View Full Code Here


                mainViewHelper.getSession().changeSessionClientType(Session.ClientType.NEW);
            } else if (transferInRadioButton.isSelected()) {
                mainViewHelper.getSession().changeSessionClientType(Session.ClientType.TRANSFER_IN);
            }
        }
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        boolean mpiMatched = mpiMatchPersonWrapper != null;
        boolean lpiMatched = lpiMatchPersonWrapper != null;
        PersonWrapper mpiUpdatePersonWrapper = null;
        PersonWrapper lpiUpdatePersonWrapper = null;
        if (mpiMatched) {
            mpiUpdatePersonWrapper = new PersonWrapper(mpiMatchPersonWrapper.unwrap());
        } else {
            mpiUpdatePersonWrapper = new PersonWrapper(new Person());
        }
        if (lpiMatched) {
            lpiUpdatePersonWrapper = new PersonWrapper(lpiMatchPersonWrapper.unwrap());
        } else {
            lpiUpdatePersonWrapper = new PersonWrapper(new Person());
        }
        List<Fingerprint> updatedFingerprintList = getUpdatedFingerprintList();
        if (updatedFingerprintList != null) {
            if (updatedFingerprintList.isEmpty()) {
                showWarningMessage("This person has no good fingerprints registered. "
                        + "Please take some now.", this.getFrame(), takeButton);
                return;
            }
            int numberOfFingerprintsTaken = updatedFingerprintList.size();
            if (numberOfFingerprintsTaken < OECReception.MINIMUM_FINGERPRINTS_FOR_REGISTRATION) {
                showWarningMessage("This person has taken " + numberOfFingerprintsTaken + " fingerprints instead of the "
                        + "required " + OECReception.MINIMUM_FINGERPRINTS_FOR_REGISTRATION + ". Please take"
                        + " the remaining " + (OECReception.MINIMUM_FINGERPRINTS_FOR_REGISTRATION - numberOfFingerprintsTaken)
                        + ".", this.getFrame(), takeButton);
                return;
            }
        }
        mpiUpdatePersonWrapper.setFingerprintList(updatedFingerprintList);
        lpiUpdatePersonWrapper.setFingerprintList(updatedFingerprintList);
        try {
            setUpUpdatePersonWrapper(mpiUpdatePersonWrapper);
            setUpUpdatePersonWrapper(lpiUpdatePersonWrapper);
        } catch (MalformedCliniIdException ex) {
            showWarningMessage(ex.getMessage(), finishButton, clinicIdTextField);
            showCard("reviewCard1");
            return;
        }
        //we do a last resort search if we have to and haven't done it already
        if (!mainViewHelper.hasLastResortSearchDone()
                && (mainViewHelper.noMPIMatchWasFound()
                || mainViewHelper.noLPIMatchWasFound())) {
            SearchProcessResult searchProcessResult = null;
            if (mainViewHelper.noMPIMatchWasFound()
                    && mainViewHelper.noLPIMatchWasFound()) {
                searchProcessResult = mainViewHelper.findPerson(Server.MPI_LPI, mpiUpdatePersonWrapper, true);
                if (searchProcessResult.getType() == SearchProcessResult.Type.LIST) {
                    showSearchResults(new SearchServerResponse(Server.MPI_LPI, searchProcessResult.getData().getPersonList()), true);
                    return;
                }
            } else if (mainViewHelper.noMPIMatchWasFound()
                    && !mainViewHelper.noLPIMatchWasFound()) {
                searchProcessResult = mainViewHelper.findPerson(Server.MPI, mpiUpdatePersonWrapper, true);
                if (searchProcessResult.getType() == SearchProcessResult.Type.LIST) {
                    showSearchResults(searchProcessResult.getData(), true);
                    return;
                }
            } else if (!mainViewHelper.noMPIMatchWasFound()
                    && mainViewHelper.noLPIMatchWasFound()) {
                searchProcessResult = mainViewHelper.findPerson(Server.LPI, lpiUpdatePersonWrapper, true);
                if (searchProcessResult.getType() == SearchProcessResult.Type.LIST) {
                    showSearchResults(new SearchServerResponse(Server.LPI, searchProcessResult.getData().getPersonList()), true);
                    return;
                }
            }
            mainViewHelper.setLastResortSearchDone(true);
        }
        //update person identifiers
        if (lpiUpdatePersonWrapper.getKisumuHdssId().isEmpty()
                || !lpiUpdatePersonWrapper.getKisumuHdssId().equalsIgnoreCase(mpiUpdatePersonWrapper.getKisumuHdssId())) {
            if (!mpiUpdatePersonWrapper.getKisumuHdssId().isEmpty()) {
                lpiUpdatePersonWrapper.setKisumuHdssId(mpiUpdatePersonWrapper.getKisumuHdssId());
            }
        }
        if (mpiUpdatePersonWrapper.getClinicId().isEmpty()
                || !mpiUpdatePersonWrapper.getClinicId().equalsIgnoreCase(lpiUpdatePersonWrapper.getClinicId())) {
            try {
                mpiUpdatePersonWrapper.setClinicId(mpiUpdatePersonWrapper.getClinicId());
            } catch (MalformedCliniIdException ex) {
                Logger.getLogger(MainView.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        if (!mpiMatched
                && !lpiMatched) {
            mainViewHelper.createPerson(Server.MPI, mpiUpdatePersonWrapper);
            mainViewHelper.createPerson(Server.LPI, lpiUpdatePersonWrapper);
        } else {
            if (!mpiMatched && lpiMatched) {
                mainViewHelper.createPerson(Server.MPI, mpiUpdatePersonWrapper);
                mainViewHelper.modifyPerson(Server.LPI, lpiUpdatePersonWrapper);
            } else if (mpiMatched && !lpiMatched) {
                lpiUpdatePersonWrapper.setMPIIdentifier(mpiUpdatePersonWrapper.getPersonGuid());
                mainViewHelper.modifyPerson(Server.MPI, mpiUpdatePersonWrapper);
                mainViewHelper.createPerson(Server.LPI, lpiUpdatePersonWrapper);
            } else {
                //link mpiMatch with lpiMatch if they have not been linked yet
                if (lpiUpdatePersonWrapper.getMPIIdentifier().isEmpty()) {
                    lpiUpdatePersonWrapper.setMPIIdentifier(mpiUpdatePersonWrapper.getPersonGuid());
                }
                mainViewHelper.modifyPerson(Server.MPI, mpiUpdatePersonWrapper);
                mainViewHelper.modifyPerson(Server.LPI, lpiUpdatePersonWrapper);
            }
        }
View Full Code Here

            return null;
        }
    }

    private List<Fingerprint> getMPIFingerprintList() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        List<Fingerprint> fingerprintList = new ArrayList<Fingerprint>();
        if (mpiMatchPersonWrapper != null
                && mpiMatchPersonWrapper.unwrap().getFingerprintList() != null
                && !mpiMatchPersonWrapper.unwrap().getFingerprintList().isEmpty()) {
            fingerprintList = mpiMatchPersonWrapper.unwrap().getFingerprintList();
            for (Fingerprint fingerprint : fingerprintList) {
                fingerprint.setDateChanged(new Date());
            }
        }
        return fingerprintList;
View Full Code Here

        }
        return fingerprintList;
    }

    private List<Fingerprint> getLPIFingerprintList() {
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        List<Fingerprint> fingerprintList = new ArrayList<Fingerprint>();
        if (lpiMatchPersonWrapper != null
                && lpiMatchPersonWrapper.unwrap().getFingerprintList() != null
                && !lpiMatchPersonWrapper.unwrap().getFingerprintList().isEmpty()) {
            fingerprintList = lpiMatchPersonWrapper.unwrap().getFingerprintList();
            for (Fingerprint fingerprint : fingerprintList) {
                fingerprint.setDateChanged(new Date());
            }
        }
        return fingerprintList;
View Full Code Here

        }
        return fingerprintList;
    }

    private List<Fingerprint> getUpdatedFingerprintList() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        boolean mpiMatched = (mpiMatchPersonWrapper != null);
        boolean lpiMatched = (lpiMatchPersonWrapper != null);
        if (!mpiMatched && !lpiMatched) {
            return getBrandNewFingerprintList();
        } else {
            if (mpiMatched && lpiMatched) {
                if (mpiMatchPersonWrapper.unwrap().isFingerprintMatched()
                        && lpiMatchPersonWrapper.unwrap().isFingerprintMatched()) {
                    return null;
                } else {
                    if (!mpiMatchPersonWrapper.unwrap().isFingerprintMatched()
                            && !lpiMatchPersonWrapper.unwrap().isFingerprintMatched()) {
                        return getBrandNewFingerprintList();
                    } else if (mpiMatchPersonWrapper.unwrap().isFingerprintMatched()
                            && !lpiMatchPersonWrapper.unwrap().isFingerprintMatched()) {
                        return getMPIFingerprintList();
                    } else if (!mpiMatchPersonWrapper.unwrap().isFingerprintMatched()
                            && lpiMatchPersonWrapper.unwrap().isFingerprintMatched()) {
                        return getLPIFingerprintList();
                    }
                }
            } else if (mpiMatched && !lpiMatched) {
                if (mpiMatchPersonWrapper.unwrap().isFingerprintMatched()) {
                    return getMPIFingerprintList();
                } else {
                    return getBrandNewFingerprintList();
                }
            } else if (!mpiMatched && lpiMatched) {
                if (lpiMatchPersonWrapper.unwrap().isFingerprintMatched()) {
                    return getLPIFingerprintList();
                } else {
                    return getBrandNewFingerprintList();
                }
            }
View Full Code Here

        }
    }

    @Action
    public void confirmClinicId() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        if (mpiMatchPersonWrapper != null) {
            if (clinicIdAcceptRadioButton.isSelected()) {
                clinicIdTextField.setText(mpiMatchPersonWrapper.getClinicId());
            } else if (clinicIdRejectRadioButton.isSelected()) {
                clinicIdTextField.setText(lpiMatchPersonWrapper.getClinicId());
            }
        }
    }
View Full Code Here

        }
    }

    @Action
    public void confirmFirstName() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        if (mpiMatchPersonWrapper != null) {
            if (firstNameAcceptRadioButton.isSelected()) {
                firstNameTextField.setText(mpiMatchPersonWrapper.getFirstName());
            } else if (firstNameRejectRadioButton.isSelected()) {
                firstNameTextField.setText(lpiMatchPersonWrapper.getFirstName());
            }
        }
    }
View Full Code Here

        }
    }

    @Action
    public void confirmMiddleName() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        if (mpiMatchPersonWrapper != null) {
            if (middleNameAcceptRadioButton.isSelected()) {
                middleNameTextField.setText(mpiMatchPersonWrapper.getMiddleName());
            } else if (middleNameRejectRadioButton.isSelected()) {
                middleNameTextField.setText(lpiMatchPersonWrapper.getMiddleName());
            }
        }
    }
View Full Code Here

        }
    }

    @Action
    public void confirmLastName() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        if (mpiMatchPersonWrapper != null) {
            if (lastNameAcceptRadioButton.isSelected()) {
                lastNameTextField.setText(mpiMatchPersonWrapper.getLastName());
            } else if (lastNameRejectRadioButton.isSelected()) {
                lastNameTextField.setText(lpiMatchPersonWrapper.getLastName());
            }
        }
    }
View Full Code Here

        }
    }

    @Action
    public void confirmSex() {
        PersonWrapper mpiMatchPersonWrapper = mainViewHelper.getSession().getMpiMatchPersonWrapper();
        PersonWrapper lpiMatchPersonWrapper = mainViewHelper.getSession().getLpiMatchPersonWrapper();
        if (mpiMatchPersonWrapper != null) {
            if (sexAcceptRadioButton.isSelected()) {
                maleRadioButton.setSelected(mpiMatchPersonWrapper.getSex() == Person.Sex.M);
                femaleRadioButton.setSelected(mpiMatchPersonWrapper.getSex() == Person.Sex.F);
            } else if (sexRejectRadioButton.isSelected()) {
                maleRadioButton.setSelected(lpiMatchPersonWrapper.getSex() == Person.Sex.M);
                femaleRadioButton.setSelected(lpiMatchPersonWrapper.getSex() == Person.Sex.F);
            }
        }
    }
View Full Code Here

TOP

Related Classes of ke.go.moh.oec.reception.controller.PersonWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.