Package ke.go.moh.oec

Examples of ke.go.moh.oec.PersonRequest


     *
     * @param m the message contents to fill in
     * @param e root node of the person message <code>Document</code> parsed from XML
     */
    private void unpackGenericPersonRequestMessage(Message m, Element e) {
        PersonRequest personRequest = new PersonRequest();
        m.setMessageData(personRequest);
        Person p = new Person();
        personRequest.setPerson(p);
        unpackHl7Header(m, e);
        Element ePerson = (Element) e.getElementsByTagName("patient").item(0);
        unpackPerson(p, ePerson);
        if (unpackTagValue(e, "acceptAckCode").equals("AL")) {
            personRequest.setResponseRequested(true);
        }
    }
View Full Code Here


     *
     * @param m the message contents to fill in
     * @param e root of the person message <code>Document</code> parsed from XML
     */
    private void unpackFindPersonMessage(Message m, Element e) {
        PersonRequest personRequest = new PersonRequest();
        m.setMessageData(personRequest);
        Person p = new Person();
        personRequest.setPerson(p);
        unpackHl7Header(m, e);
        Element q = (Element) e.getElementsByTagName("queryByParameter").item(0);

        Element el = (Element) q.getElementsByTagName("livingSubjectName").item(0);
        if (el != null) {
View Full Code Here

                String notifySql = "INSERT INTO cds_store(destination, message, voided, received_datetime) "
                        + " VALUES(" + Sql.quote(visitAddress) + "," + Sql.quote(xml) + ", 0, NOW())";
                //grab autogenerated key
                Integer autogeneratedKey = Sql.executeUpdate(notifyConn, notifySql);
                //immediately forward notification to reception
                PersonRequest pr = new PersonRequest();
                pr.setRequestReference(autogeneratedKey.toString());
                pr.setDestinationAddress(visitAddress);
                pr.setXml(xml);
                mediator.getData(RequestTypeId.NOTIFY_PERSON_CHANGED, pr);
            } else {
                Mediator.getLogger(Cds.class.getName()).log(Level.SEVERE, "null lastRegularVisit in person sent by mpi");
            }
        } else {
View Full Code Here

                /*
                 * Send notify to destination
                 * instantiate person request so that you can set the new
                 * information held in the record set
                 */
                PersonRequest prOut = new PersonRequest();
                prOut.setDestinationAddress(destinationAddress);
                prOut.setXml(message);
                prOut.setRequestReference(notificationId.toString());
                //Invoke the mediator to send out new person request changes (prout)
                mediator.getData(RequestTypeId.NOTIFY_PERSON_CHANGED, prOut);
            }
        } catch (SQLException ex) {
            Logger.getLogger(Cds.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

        m.setDestinationName(messageType.getDefaultDestinationName());
        String messageId = generateMessageId();
        m.setMessageId(messageId);
        m.setToBeQueued(messageType.isToBeQueued());
        if (requestData instanceof PersonRequest) {
            PersonRequest pr = (PersonRequest) requestData;
            if (pr.getDestinationAddress() != null) {
                m.setDestinationAddress(pr.getDestinationAddress());
            }
            if (pr.getDestinationName() != null) {
                m.setDestinationName(pr.getDestinationName());
            }
            m.setXml(pr.getXml());
            if (pr.getRequestReference() != null) {
                m.setMessageId(pr.getRequestReference()); // Overwrite the auto-generated message ID.
            }
            if (!pr.isResponseRequested()) {
                MessageType.TemplateType templateType = messageType.getTemplateType();
                if (templateType == MessageType.TemplateType.createPerson
                        || templateType == MessageType.TemplateType.modifyPerson) {
                    m.setResponseExpected(false);
                    m.setToBeQueued(true);
View Full Code Here

                if (m.getMessageData() == null) {
                    Logger.getLogger(Mediator.class.getName()).log(Level.SEVERE,
                            "Received message did not unpack into messageData: {0}", m.summarize());
                } else {
                    if (m.getMessageData().getClass() == PersonRequest.class) {
                        PersonRequest req = (PersonRequest) m.getMessageData();
                        req.setSourceAddress(m.getSourceAddress());
                        req.setSourceName(m.getSourceName());
                        req.setRequestReference(m.getMessageId());
                        req.setXml(m.getXml()); // Return raw XML through the API in case it is wanted.
                    } else if (m.getMessageData().getClass() == PersonResponse.class) {
                        PersonResponse rsp = (PersonResponse) m.getMessageData();
                        rsp.setSuccessful(true);
                        rsp.setRequestReference(m.getMessageId());
                    }
View Full Code Here

    @Ignore
    @Test
    public void testFindPerson() {
        MpiTest.logger.fine("testFindPerson");

        PersonRequest requestData = new PersonRequest();
        Person p = new Person();
        requestData.setPerson(p);
        Object result;
        PersonResponse pr;

        // Clan name that will not be found
        MpiTest.logger.fine("testFindPerson - Clan name that will not be found");
        p.setClanName("ThisClanNameWillNotBeFound");
        pr = callFindPerson(requestData);
        assertNull(pr.getPersonList());

        // Clan name from test person
        MpiTest.logger.fine("testFindPerson - Clan name returning 1 match");
        p.setClanName("Human");
        pr = callFindPerson(requestData);
        List<Person> pList = pr.getPersonList();
        assertNotNull(pList);
        int pCount = pList.size();
        assertEquals(1, pCount);
        Person p0 = pList.get(0);
        int score = p0.getMatchScore();
        assertTrue(score >= 80);

        // Birthdate alone (.4) or sex (.25) don't count as match
        // together they should meet the threshold
        MpiTest.logger.fine("testFindPerson - Search by sex & birthdate");
        p = new Person(); // Start fresh
        p.setBirthdate(parseDate("1986-06-15"));
        p.setSex(Person.Sex.M);
        String birthdate = p.getBirthdate().toString();
        requestData.setPerson(p);
        pr = callFindPerson(requestData);
        assertNotNull(pr.getPersonList());
        int listSize = pr.getPersonList().size();
        for (Person q : pr.getPersonList()) {
            score = q.getMatchScore();
            Date dq = q.getBirthdate();
            String ds = dq.toString();
            ds = "DOB: " + dq.toString();
        }

        // Search by a fake GUID should match nobody.
        p = new Person(); // Start fresh
        p.setPersonGuid("fake GUID");
        requestData.setPerson(p);
        pr = callFindPerson(requestData);
        assertNull(pr.getPersonList());
    }
View Full Code Here

     */
    @Test
    public void testFindSomePeople() {
        MpiTest.logger.fine("testFindSomePeople");

        PersonRequest requestData = new PersonRequest();
        Person p = new Person();
        requestData.setPerson(p);
        Object result;
        PersonResponse pr;

        // Clan name that will not be found
        PersonIdentifier pi = new PersonIdentifier();
        pi.setIdentifier("00007/2004");
        pi.setIdentifierType(PersonIdentifier.Type.cccLocalId);
        List<PersonIdentifier> piList = new ArrayList<PersonIdentifier>();
        piList.add(pi);
        p.setPersonIdentifierList(piList);
        p.setSiteName("Siaya");
        requestData.setPerson(p);
        pr = callFindPerson(requestData);
        // Inspect for results -- expect results if LPI data.
    }
View Full Code Here

    @Test
    public void testModifyPerson() {
        MpiTest.logger.fine("testModifyPerson");

        int requestTypeId;
        PersonRequest requestData = new PersonRequest();
        Person p;
        List<Person> pList;
        int pCount;
        Object result;
        PersonResponse pr;

        // Find the person to modify.
        p = new Person();
        requestData.setPerson(p);
        p.setVillageName("Eden");
        pr = callFindPerson(requestData);

        pList = pr.getPersonList();
        assertNotNull(pList);
        pCount = pList.size();
        assertEquals(1, pCount);
        Person p0 = pList.get(0);
        assertEquals("Cain", p0.getFirstName());
        assertEquals("Human", p0.getMiddleName());
        assertEquals("One", p0.getLastName());

        MpiTest.logger.fine("Modify the village name.");
        requestTypeId = RequestTypeId.MODIFY_PERSON_MPI;
        p0.setVillageName("OutOfEden");
        requestData.setPerson(p0);
        result = mpi.getData(requestTypeId, requestData);
        assertNull(result); // MODIFY PERSON returns no result object.

        MpiTest.logger.fine("Search for residents of village Eden -- should find none at 100%.");
        p = new Person();
        p.setVillageName("Eden");
        requestData.setPerson(p);
        pr = callFindPerson(requestData);
        pList = pr.getPersonList();
        if (pList != null) {
            for (Person per : pList) {
                assertTrue(per.getMatchScore() < 100);
            }
        }

        MpiTest.logger.fine("Search for residents of village OutOfEden -- should find one at 100%.");
        p = new Person();
        p.setVillageName("OutOfEden");
        requestData.setPerson(p);
        pr = callFindPerson(requestData);
        pList = pr.getPersonList();
        assertNotNull(pList);
        pCount = 0;
        for (Person per : pList) {
            if (per.getMatchScore() >= 80) {
                pCount++;
            }
        }
        assertEquals(1, pCount);

        MpiTest.logger.fine("Set marital status to single.");
        p0.setMaritalStatus(Person.MaritalStatus.single);
        requestData.setPerson(p0);
        result = mpi.getData(RequestTypeId.MODIFY_PERSON_MPI, requestData);

    }
View Full Code Here

     * @param notificationManager {@link NotificationManager} to handle incoming notifications.
     */
    public Object getData(int requestTypeId, Object requestData) {
        if (requestData != null) {
            if (requestTypeId == RequestTypeId.NOTIFY_PERSON_CHANGED) {
                PersonRequest personRequest = (PersonRequest) requestData;
                Person person = personRequest.getPerson();
                PersonWrapper personWrapper = new PersonWrapper(person);
                personWrapper.setReference(personRequest.getRequestReference());
                notificationManager.addNotifications(personWrapper.getNotificationList());
            } else {
                Logger.getLogger(NotificationListener.class.getName()).log(Level.SEVERE,
                        "getData() called with unepxected requestTypeId {0}", requestTypeId);
            }
View Full Code Here

TOP

Related Classes of ke.go.moh.oec.PersonRequest

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.