How to make the reason mandatory in the Visit

I was asked to make the reason mandatory in the visit - ie in act.patientClinicalEvent

Piece of cake I thought - just change the min cardinality from 0 to 1.

Problem - if you do this, then you will have trouble creating invoices - because in many cases the invoice creation will create the visit in the medical records - and this will fail because there is no reason.

It works happily if the vet creates the visit - because s/he gets an error saying the reason is required but things don't work it the visit is 'auto-created'.

Any suggestions?

Regards, Tim G

Comment viewing options

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

Re: How to make the reason mandatory in the Visit

Maybe set a default value in the archetype??

I havent tested it Tim, but it depends on the contructor used on invoicing as to whether it will work.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: How to make the reason mandatory in the Visit

Tried that - didn't work. (ie having set the default in the archetype, if I do New|Visit, the reason is not set to the default). However, this (if it worked) is not a good solution because it would result in those visits that currently do not get a reason set, having the default reason.

However, I now have a solution - run the check when the visit status is set to completed - ie add the following to the status node:

<assertion name="expression">
    <property name="expression" value="string-length(reason)&gt;0 or status!='COMPLETED'"/>
    <errorMessage>Reason must be set if Visit status is Completed</errorMessage>
</assertion>

With this, when you finalise the invoice containing items in the visit, you get:

Regards, Tim G

Re: How to make the reason mandatory in the Visit

Make sure you quote the reason code e.g.:

<node name="reason" path="/reason" type="java.lang.String" minCardinality="1" defaultValue="'CHECKUP'">
    <assertion name="lookup">
        <property name="type" value="lookup"/>
        <property name="source" value="lookup.visitReason*"/>
        <errorMessage>Invalid Visit Reason</errorMessage>
    </assertion>
</node>

Re: How to make the reason mandatory in the Visit

Thanks Tim - the quotes did the trick. However, on reflection, this is not the full answer to getting the vet to put a real reason against the visit so that the stats reflect reality.

The other approach is to leave the reason at 0 min cardinality with no default and the add some validation code against the status to check that when the status is set to completed, that the reason code has been set.

I will see what the practice manager thinks.

Regards, Tim G

Syndicate content