Use of patient custom fields

I'm having trouble trying to implement a number of custom fields. Should it be possible to have multiple custom fields within the one custom field archetype? When I do it  and create a new patient it fails to save and I get an error that it fails to save a collection of objects. 

This is my custom field archetype:

<?xml version="1.0" encoding="UTF-8"?>
<archetypes>
    <archetype latest="true" primary="true"
        name="entity.customPatientArrivedinCare.1.0"
        displayName="Arrived into care" type="org.openvpms.component.business.domain.im.common.Entity">
        <node name="id" displayName="Id" type="java.lang.Long"
            path="/id" parentChild="false" minLength="0" maxLength="255"
            minCardinality="0" maxCardinality="1" readOnly="true"
            hidden="true" derived="false"/>
        <node name="description" displayName="Description"
            type="java.lang.String" path="/description"
            parentChild="false" minLength="0" maxLength="255"
            minCardinality="0" maxCardinality="1" readOnly="false"
            hidden="true" derived="false"/>
        <node name="name" displayName="Name" type="java.lang.String"
            path="/name" parentChild="false" minLength="0"
            maxLength="255" minCardinality="0" maxCardinality="1"
            readOnly="false" hidden="true" derived="false"/>
        <node name="ArrivedInCare"
            displayName="Arrived in Care Date" type="java.util.Date"
            path="/details/ArrivedInCareDate" parentChild="false"
            minLength="0" maxLength="255" minCardinality="0"
            maxCardinality="1" readOnly="false" hidden="false" derived="false"/>
         <node name="origin"
            displayName="Origin" type="java.lang.String"
            path="/details/Origin" parentChild="false"
            minLength="0" maxLength="255" minCardinality="0"
            maxCardinality="1" readOnly="false" hidden="false" derived="false"/>
    </archetype>
</archetypes>

Comment viewing options

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

Re: Use of patient custom fields

Matt - I think (if you are editing the archetype in the system) then this is a known problem [not sure of JIRA]. I always edit the adl and then use Import. I imported yours into the system and then enabled it for species Dog and got:

for the initial edit:

and then for the view:

Given the above display mode, I edited the adl file to change the 'Arrived in Care Date' display name and for a laugh added another field, then imported the adl, and got:

Regards, Tim G

Re: Use of patient custom fields

What happens if you create a new patient now Tim? That is where I'm running into trouble.

I can edit an existing patient OK but if I add a patient it throws an error.

Actually I'm not sure if I've tried adding a new patient to an existing client but it happens if I add a new patient while adding a new client.

i did find a JIRA for a similar issue but it was marked as resolved quite a while ago.

Re: Use of patient custom fields

You are correct Matt - there is a failure when you try to add a new patient to a customer or create a new patient.

However, it is not your 'arrived in care' problem - the problem also occurs with the standard entity.customPatientExample.

In fact there appears a second problem - at one stage I had both entity.customPatientExample and entity.customPatientArrivedinCare in the system with species Cat set to use the first and Dog to use the second.  When I tried to create a new cat, the tab name was correct but the fields were those from the customPatientArrivedinCare entity.  ie the system has problems if there are two different customPatient archetypes defined.

I am running 1.9 - I don't have a 1.8 system to hand, but I would not be surprised if these custom fields problems were in 1.8

The full log shows (in part):

16 Mar 2016 04:30:35,653 ERROR IMObjectEditorSaver,http-bio-8080-exec-10:210 - admin - Object not found: entity.customPatientExample:-1:95f49010-ead3-11e5-8556-6d9cb0fc419d
    object=party.patientpet:-1:9048894e-ead3-11e5-8556-6d9cb0fc419d, editor=org.openvpms.web.workspace.patient.PatientEditor, user=admin
org.openvpms.component.business.dao.im.common.IMObjectDAOException: Object not found: entity.customPatientExample:-1:95f49010-ead3-11e5-8556-6d9cb0fc419d
    at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.saveDeferred(IMObjectDAOHibernate.java:949)
    at org.openvpms.component.business.dao.hibernate.im.IMObjectDAOHibernate.preCommit(IMObjectDAOHibernate.java:527)
    at org.openvpms.component.business.dao.hibernate.im.common.Context$ContextSynchronization.beforeCommit(Context.java:530)
    at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:925)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:738)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:148)
    at org.openvpms.web.component.im.edit.IMObjectEditorSaver.save(IMObjectEditorSaver.java:64)
    at org.openvpms.web.component.im.edit.AbstractEditDialog.save(AbstractEditDialog.java:176)
    at org.openvpms.web.component.im.edit.AbstractEditDialog.onOK(AbstractEditDialog.java:252)
...... lots more trace stuff
16 Mar 2016 04:30:35,669  WARN RelationshipCollectionTargetPropertyEditor,http-bio-8080-exec-10:275 - admin - Target object=entity.customPatientExample:-1:95f49010-ead3-11e5-8556-6d9cb0fc419d doesn't exist. Referred to by relationship=org.openvpms.component.business.domain.im.common.EntityRelationship@82e0b76[identity=<null>]
16 Mar 2016 04:30:35,685 ERROR DialogErrorHandler,http-bio-8080-exec-10:69 - admin - An error was encountered saving the Patient (Pet).

Your changes have been reverted.

Note that at the time the above log was generated there was only the standard entity.customPatientExample archetype in the system and I had restarted Tomcat.

Regards, Tim G

Re: Use of patient custom fields

Can you outline the steps to reproduce this?

In 1.9 there are some rendering issues, but otherwise I can't reproduce the problem.

Syndicate content