Referral instead of Appointment in the Healthcare domain (possible?)

As I get more and more into ERPNext the number inquiries I’m posting here grows. Sorry for the many questions but I’m hooked. :slight_smile:

I need to be able to create a “referral” when patients are created (some patients) and would like to have the referral linked to a Healthcare Practitioner. I can’t make an appointment because the time/date will not/can not be specified. Is there any way to do this on ERPNext Healthcare out of the box? I suspect no but I’m learning that many things I thought were not possible without customization in fact are possible. :slight_smile:

Simply put, when the patient is created, I want to have a link to a Healthcare Practitioner and I want that link to subsequently be viewable from the perspective of the Healthcare Practitioner as a referral…such that it can be viewed via a report showing how many referrals were made on what day etc…much like the Patient Appointment Analytics Report.
Any advice will be much appreciated.

Jason

Welcome!

It depends by what you mean by “out of the box”. ERPNext comes with a slew of useful DocTypes (some more robust than others), but the real strength of the Frappe framework is the ability to define and automate new DocTypes to serve your needs.

I don’t have much experience with the Healthcare domain, but being able to build custom workflows is fundamental to what Frappe does. If you need a Patient → Referral flow, you can always create a new doctype called “Referral” (or whatever you want).

In the referral document, create a field of type “Link” with “Patient” in the Options, and then create any other fields you would like the system to track. If there’s any information that you want transferred automatically from the Patient doc, create identically named fields in the new Referral doctype.

Then, go the to Customize Form tool, select Patient for customization, and in the document link section add a link to your new referral doctype. That will add “Referral” to the patient header card, and you can simply click on the plus button to create a new Referral based on that patient.

There are definitely other ways to go about this if what I’ve described here doesn’t seem like the right flow, and you can add a lot more complexity using Client Scripts, etc., but this might be a good start. Let us know if it works!

peterg,

Thanks a million for your advice! :slight_smile: I think I follow the process you have outlined here. Just one question…am I correct in understanding that I need to link the new doctype (Referral) to my Patient doctype with a Link field to Patient and also in Patient with a Link field to Referral? So, in essence, they are both linked to each other in a one-to-many relationship…I think that’s the correct terminology. :thinking:

I will give it a try.

Cheers
Jason

P.S. Editing after having experimented a bit. Creating the new doctype works but more or less in the same way it did when I had Healthcare Practitioner linked in my Patient doctype. I guess I need to work on the next time…adding some detail to the referral so it has meaning…i.e. a date I guess.

peterg,

Thanks again. I’d like to pick your brain a bit more if I can as I feel like I’m almost there…but not quite.

My desired work flow is:

  1. Entity A creates new patients and some of those patients are referred to Healthcare Practitioners

  2. I want Healthcare Practitioners to be able to log in and see when and how many patients have been referred to them.

So I think I need to use the new Referral doctype I’ve made to accomplish this but can’t quite grasp how to do so. I guess the referral doctype needs to have the patient identifying information (in our case we are using an ID, not name) which can be written to Referral when the new patient is created…if I set it up correctly on the Patient doctype…correct?

Then, I need to make the Referral doctype visible to Healthcare Practitioners but only such that they can see the patients referred to them. Hmm…

I’ve been banging away at this for too long today…on a Sunday. Might be a good idea for me to take a break and revisit later. I feel like this should be possible by simply using the Healthcare Practitioner doctype but maybe it is lacking some necessary fields and as it is not customizable, this process, of creating a new doctype, is the work around…? I just have to get my head around how to get them all correctly connected.

I’m working toward an important demo on the 1st of September…after which we’ll be paying someone (ERPNext I guess…hopefully) for a year Enterprise account to get it all fine tuned. Just in a bit of a panic as I prepare for the demo.

Thanks again for your help and in advance for any additional advice you can provide.

Jason

It sounds like you have some work to do clarifying your data architecture. If I were in your shoes, I would make sure that was all rock solid before trying to implementation in ERPNext.

In simple language, every DocType should represent a thing in the real world, usually either an entity (a patient, a drug, a hospital, a provider, etc.) or an event (a hospital visit, a prescription, a referral, etc.)

I don’t know enough about your desired workflow to say for certain, but I would assume that the relationship between Patients and Referrals is indeed one-to-many: each Patient (an entity) can have many different Referrals (an event), but each Referral always belongs to exactly one Patient. Presumably, Providers can each have multiple Referrals, too. If Patients only ever have one Referral, you might want to set this up a bit differently.

So, to answer your questions:

Nope, not quite. As a general rule, you don’t want to create “circular references”, where document A has a link field pointing to document B and document B has a link field pointing to document A. Instead, in the database:

  • The Referrals should have a field pointing back to Patient (the many point to the one)
  • The Patient should not have a field pointing to the Referrals (the one does not point to the many)

To get Referral references for Patient documents, you can use the “Linked Documents” section of either the doctype definition or the Customize Form tool. Referrals gets a field, documents doesn’t.

I think so, though I’m a little confused about the sequencing you want. Under normal circumstances, you create Patients first and then generate referrals for them (with links to Practitioners, presumably). If that’s the case, you can pass along as much or as little information from the patient doctype as you’d like. If you pass data to the referral doctype, it will get “baked in” however it was when created, remaining the same even if the Patient doctype changes in the future. Alternately, you can give Providers access to your Patient doctype. Like I said, this all just comes down to how you want to organize your data.

There are a few ways to do this, but the easiest is probably with Permission Queries via Server Scripts:

https://erpnext-documentation.frappe.cloud/docs/v13/user/manual/en/customize-erpnext/server-script#24-permission-query

peterg,

Wow, thanks very much for your time. I sincerely appreciate it. I should have been less vague about the details of my desired usage scenario.

Let’s see, if I can have just a bit more of your time:

My goal is to have patients (newborns) entered into the system together with information about screening the children are subjected to. As such, each patient (child) will be entered with screening results. In the event of screening results that require follow up, they are referred to specific hospitals of which there are four. If they ‘pass’ the screening, the patient record is still recorded in the system but it basically will not be used aside for the purpose of calculating screening percentages per births and generating invoices (see below).

For those who do not ‘pass’ the screen and require a referral and followup visit, I would like to have the referred hospital tagged to their record. Later, when they go in for follow up the hospital will subsequently add to their record with a clinical procedure record addition. Additionally, the referred hospitals can check the system at any time to see how many children have been referred to them.

The reason for wanting to be able to generate the patient record together with the first screening results and referral is to make data entry as absolutely simple as possible for the various birthing centers. As such, I am envisioning it as a part of their basic ‘patient record’.

A few other details to fill out the picture:

The screenings are reimbursed at a particular rate, depending on which procedure is used. I have entered the screening procedures as services with fees. Each birthing center (hospital, clinic, midwife) needs to generate an invoice once a month for each locality that they serve. That is, the localities where the children born at their facility are from. Most clinics have patients from multiple localities so they need to be able to generate an invoice for locality A that is based on the number of screening procedures they conducted for a month as well as for locality B etc.

Regarding the referral relationship, you are correct. It should be one referral per patient so it’s not a one to many in either direction. I guess it could be one to many (one patient / multiple referrals) but that is not the goal in this particular scenario.

I’m definitely going to need to have help with this and have obtained generous funding to get it all done but I have to give one final presentation prior to moving forward with using the funds so I’m trying to get it as polished, as it possibly by me alone, prior to that. For what I’m unable to do I will use mock ups that display the planned end result. :slight_smile:

Thanks again and will continue to be most appreciative of any advice you are able to provide.

Sincerely
Jason

A good data engineer will be critical here to help you think through all the moving parts. It’s very important to get good advice, because a poorly structured architecture can be very expensive to fix down the road.

If patients, screenings, and referrals truly are fix one-to-one, how to combine or separate them will largely come down to organizational dynamics: chiefly, that means understanding who should have access to what information, and who generates what data when. The idea behind any ERP system is that it should be the single source of truth for an organization, which means that it’s less about what people do and more about how they need to communicate.

Once you have a clear picture of those flows, I’m sure you’ll find people here happy to answer specific questions about implementation.

peterg,

Thanks for your time and comments. It is very helpful to exchange ideas and get advice from an external entity. Your advice and suggestions are valuable.

We are definitely planning to get professional advice and help. I’m thinking we will sign up for an Enterprise account with ERPNext and actually have a follow up e-mail out to them now.

Like you said, designing the structure and clearly identifying the data flow is crucial. I have a fairly detailed schematic of it all and have received approval for the idea and design. Now we just have to get it implemented. I’m feeling more and more like ERPNext is the way to go. Initially, I think the package is way more than what we need but I like the idea of being able to grow into the system rather than forcing a limited system to grow with us.

Thanks again for your advice and time. :slight_smile:
Jason

1 Like