Saving Patient State

I’m trying to save the a the state of my patient. However, I can’t find the service that saves the patient’s state. There is no method in the ProgramWorkflowService class that saves the patient state.

Does anybody know where it can be found, or does it not work that way?

Thank you!

PatientStates don’t exist on their own, they belong to PatientPrograms, you need to set the states on a PatientProgram and then save the PatientProgram

1 Like

Thank you @wyclif!

However when I try adding a new state for the same program, I encounter this error:

“A patient can’t be in multiple patient states for the same program work flow”

Do I have to create a new patient program to save my new patient state?

You should actually be calling PatientProgram.transitionToState(ProgramWorkflowState), the API will create and set the PatientState for you the proper way.

Thank you very much!