Medical Records - changing the order of the visits
Hello All...
I have completed all that I need (for the time being) to get OpenVPMS to be workable software solution in Canada. :) However, the feedback that I am getting is somewhat loud and clear. :( My understanding from the Canadian contingent is that the order of the visits within medical records in the more commonly used clinic management software there is the opposite of what is perhaps the norm here in Australia. The request I have before me is to make sure that the visits as displayed within the medical records go from oldest at the top, to newest at the bottom. Unfortunately, while I can change the order of items found within a visit, the help screen states that "... the visits themselves are always shown in descending order."
So my question is:
1) could the option to specify sorting order of the visits be offered in a subsequent version, even if this were to be priced out as a separate project, (high priority it seems for these folks), or
2) as the descending order is hard-coded, is there a simple change to a java class that I could specify and after a re-compile, get it to default to an ascending order for visits?
Thanks,
Sam Longiaru
Re: Medical Records - changing the order of the visits
1). Sure. It would probably involve adding other sort options to the party.organisationPractice medicalRecordsSortOrder node.
2). Try changing PatientHistoryQuery so that declares:
private static final SortConstraint[] DEFAULT_SORT = { new NodeSortConstraint("startTime", true), new NodeSortConstraint("id") };
And then invokes the following in the constructor:
setDefaultSortConstraint(DEFAULT_SORT);
This overrides the default sort constraint set by the ActQuery superclass.
Re: Medical Records - changing the order of the visits
Hi Tim... Thanks for getting back.
If you wouldn't mind at some point pricing out 1), then I will present that to them as I believe that is something they would be willing to consider funding. Going that way is more of a general contribution to the project anyway, as opposed to 2).
Personally, however, I would like to explore 2) as well, although with only a quick look, I've not been able to find the PatientHistoryQuery that you mention. I probably haven't downloaded everything I need yet as I admit to having some difficulty getting Eclipse set up correctly. Are the instructions and links here still applicable?
In any event, I won't be able to really address 2) until early July as I am leaving Australia in a couple of days and won't be back in Canada with access to my computer until then. I'll get the Eclipse thing sorted out then. But in the meantime, at least I can tell them that a solution is on the way... one way or another. Crisis averted.
Thanks,
Sam
Re: Medical Records - changing the order of the visits
Niether tim nor I use eclipse at this point, I found the setup clunky
I use netbeans and works very well to build. Tim uses
ItelliJ Idea. I havent tried it yet.
I have added changes to the nbactions.xml files for netbeans builds that makes the builds work well...
-Skiptests=true to all the builds is a good idea.
The svn addresses are all still valid
I have forked onto GIT here. https://github.com/CharltonIT
Its not ideal I have to maintain 7 projects because GITSVN cant take more than 1 svn server into a git repo safely.
I would prefer to build it as 1 GIT repo, but thats for another day.
You can take see the build history quite nicely on GITHUB
https://github.com/CharltonIT/openvpms-web/blob/master/openvpms-web-work...
That gives you the path. Just add the first code block TimA mentioned (the sort constraint to the class as a variable. )
then add
setDefaultSortConstraint(DEFAULT_SORT);
to the constructor code.
ie
public PatientHistoryQuery(Party patient) { super(patient, "patient", PatientArchetypes.PATIENT_PARTICIPATION, SHORT_NAMES, Act.class); String[] actItemShortNames = RelationshipHelper.getTargetShortNames(PatientArchetypes.CLINICAL_EVENT_ITEM); shortNames = (String[]) ArrayUtils.addAll(actItemShortNames, DOC_VERSION_SHORT_NAMES); selectedShortNames = (String[]) ArrayUtils.add(shortNames, CustomerAccountArchetypes.INVOICE_ITEM); model = new ShortNameListModel(actItemShortNames, true, false); shortNameSelector = SelectFieldFactory.create(model); includeCharges = CheckBoxFactory.create("patient.record.query.includeCharges", true); ActionListener listener = new ActionListener() { public void onAction(ActionEvent event) { updateSelectedShortNames(); onQuery(); } }; setDefaultSortConstraint(DEFAULT_SORT); shortNameSelector.addActionListener(listener); shortNameSelector.setCellRenderer(new ShortNameListCellRenderer()); includeCharges.addActionListener(listener); setAuto(true); }
Re: Medical Records - changing the order of the visits
You would probably want to change the boolean value for
/** * Determines if the visit items are being sorted ascending or descending. */ private boolean sortAscending = true;
which you can do either via by changing the initial assignment or
during construction by adding
setSortAscending(false);
Re: Medical Records - changing the order of the visits
I've created a new project here: http://www.openvpms.org/project/visit-order
It needs some comment before it can be costed.
Re: Medical Records - changing the order of the visits
Thanks Ben, Tim...
I'm not locked into Eclipse as I have only used it for a few small projects and so will use NetBeans if that is easier to use with OpenVPMS. I'll also look into the JetBrains offering. I'm curious as I hadn't heard of that before now.
Also, thanks very much for the code and the links. I had a look and it seems pretty straightforward to do after my build environment is set up. The instructions are very clear.
I'll forward the new project link and discuss it with these folks again before I post any comments. For one thing, I don't see that our sample dataset has any patients with problems and so I'll generate a good set of those first and see what that looks like.
Thanks again... I'll get working on this.
Sam
Re: Medical Records - changing the order of the visits
Greetings...
I've reopened this thread as I am finally addressing this issue as outlined above. I have the maven build sequence working well now and have implemented the changes suggested by Tim and Ben. Unfortunately I am getting a 'cannot find symbol' compiling error while running
~/openvpms-web $ mvn -Dmaven.test.skip install
at:
private static final SortConstraint[] DEFAULT_SORT = { new NodeSortConstraint("startTime", true), new NodeSortConstraint("id") };
which is located in the variable declarations.
[INFO] Compiling 1 source file to /home/ian/openvpms-web/openvpms-web-workspaces/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/ian/openvpms-web/openvpms-web-workspaces/src/main/java/org/openvpms/web/workspace/patient/history/PatientHistoryQuery.java:[104,22] error: cannot find symbol
[ERROR] class PatientHistoryQuery
/home/ian/openvpms-web/openvpms-web-workspaces/src/main/java/org/openvpms/web/workspace/patient/history/PatientHistoryQuery.java:[105,16] error: cannot find symbol
[ERROR] class PatientHistoryQuery
/home/ian/openvpms-web/openvpms-web-workspaces/src/main/java/org/openvpms/web/workspace/patient/history/PatientHistoryQuery.java:[106,16] error: cannot find symbol
[INFO] 3 errors
[INFO] -------------------------------------------------------------
Unfortunately, not working within a more sophisticated environment, I'm not getting a lot of information back such as where the other items are declared. Any thoughts as to where the problem may be hiding?
Thanks,
Sam
Re: Medical Records - changing the order of the visits
I think I found the fix although I'm not sure why it is required. Adding:
import org.openvpms.component.system.common.query.SortConstraint;
import org.openvpms.component.system.common.query.NodeSortConstraint;
allows PatientHistoryQuery.java to compile and execute. I would have thought that as the imports are listed in the superclass ActQuery that they would not need to be listed explicitly here, but I am right at the limit of my Java understanding.
Sam
Re: Medical Records - changing the order of the visits
You need to use imports if the class isn't in the current package, or isn't in the java.lang package.
Its much easier to develop in an IDE - they will provide syntax and error hightlighting and suggest imports as you type. My preference is IntelliJ Idea - http://www.jetbrains.com/idea/download/ which has a capable free edititon.