New Patient Rules / Demographic updates

I'm not familiar enough with eclipse and following the developer docs I get build fails of the unmodified latest revision , so I wasnt sure how to go about suggesting some additions. That being said I am quite comfortable with code.

I didnt try committing changes because I wasnt able to testbuild.

I wanted to add a new demographic update that would set a patient as inactive.

My reasons for requiring such a change are as follows.

In some cases a patient will be set as inactive following a visit and charge.  

 1.  The patient has completed a course of treatment and is returning to his regular vet.  

 2.  The patient is undergoing export to another country and is undergoing a final export check.  In this instance the update would occur as the patient was charged the final export visit.

 

Having a demographic update to set patients as inactive would support this.  

 

my additions to code were as follows:

note:I wasnt sure whether a testcase was needed for invoice creation I didnt see one for setDeceased


svn://svn.openvpms.org/openvpms/archetypes/trunk/src/java/org/openvpms/archetype/function/party/PartyFunctions.java

changes

Addition at Line 273

 

    /**
     * Marks a patient as being inactive.
     *
     * @param patient the patient
     */
    public void setPatientInactive(Party patient) {
        getPatientRules().setInactive(patient);
    }

svn://svn.openvpms.org/openvpms/archetypes/trunk/src/java/org/openvpms/archetype/rules/patient/PatientRules.java

 

changes:

Addition at Line 320

 

/**
     * Marks a patient as being inactive.
     *
     * @param patient the patient
     * @throws ArchetypeServiceException for any archetype service error
     */
    public void setInactive(Party patient) {
        IMObjectBean bean = factory.createBean(patient);
        if (bean.getBoolean("active")) {
            bean.setValue("active", false);
            bean.save();
        }
    }
 

 


adding patient testcase
 
svn://svn.openvpms.org/openvpms/archetypes/trunk/src/test/java/org/openvpms/archetype/rules/patient/PatientRulesTestCase.java
 
 /**
 
     * Tests the {@link PatientRules#setInactive(Party)} methods.
     */
    public void testInactive() {
        Party patient = TestHelper.createPatient(false);
        assertTrue(bean.getBoolean("active"));
        rules.setInactive(patient);
        assertTrue(bean.getBoolean("active"));
    }

added to base.xml in svn://svn.openvpms.org/openvpms/release/trunk/src/import/data/base.xml

<data archetype="lookup.demographicUpdate" code="PATIENT_INACTIVE" name="Patient Inactive" expression="party:setPatientInactive(.)" nodeName="party.entity" />

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: New Patient Rules / Demographic updates

I've raised this as https://openvpms.atlassian.net/browse/ARCH-56 . I'll apply the changes it in the next week.

We do all development tracking via JIRA.  You can request an account at https://openvpms.atlassian.net/secure/ContactAdministrators!default.jspa. This will enable you raise your own JIRAs, and track existing ones.

I've added a page describing how patches should be submitted here: http://www.openvpms.org/documentation/creating-and-submitting-patch

Regards,

-Tim

Syndicate content