Can Registration date default to visit and collection date?
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Can Registration date default to visit and collection date?

Introduction

Yes. This can be achieved through the workflow defaultValues section.

Use Case:

  • In many cases, patient registration and visits happen on the same day.

  • To avoid manually entering the same date twice, we can automatically set the visit and collection date based on the registration date.

  • This is especially useful in blood drives or screening camps, where samples are collected right after registration.

Please refer to the code below.

Visit Date defaults to Registration Date:

Code:

defaultValues: ({ cpr }) => { return [{ visitDate: cpr.registrationDate }]; },

Screenshot:

image-20250718-061400.png

Collection Date defaults to Visit date:

Code:

defaultValues: ({visit}) => { let collDate = visit.visitDate; return [{ status:'Collected', extensionDetail: { attrsMap: { condition_received: 'Adequate' } }, collectionEvent: { time: collDate }, receivedEvent: { time: new Date().getTime() } }]; },

Screenshot:

image-20250718-092914.png

 

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com