Skip to content

Set treatment order date to tomorrow at 8AM #1372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: release24.11-SNAPSHOT
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/model/sources/Surgery.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ EHR.model.DataModelManager.registerMetadata('onprc_Surgery', {
shownInGrid: true,
defaultValue: 'Surgical',
allowBlank: false
},
date: {
inheritDefaultDateFromParent: false,
getInitialValue: function(v, rec){
if (v)
return v;

var ret = Ext4.Date.clearTime(new Date());
ret = Ext4.Date.add(ret, Ext4.Date.DAY, 1);
ret.setHours(8);
return ret;
}
}

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public EncounterChildFormSection(String schemaName, String queryName, String lab
// Modified: 2-13-2025 R. Blasa
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/AddProcedureDefaultsWindow.js"));

addConfigSource("Encounter");
addConfigSource("EncounterChild");

setTemplateMode(TEMPLATE_MODE.ENCOUNTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,8 @@ public SingleSurgeryFormType(DataEntryFormContext ctx, Module owner)

for (FormSection s : this.getFormSections())
{
s.addConfigSource("Encounter");

// Modified: 4-20-2021 R. Blasa
s.addConfigSource("onprc_Surgery");

//Added: 9-6-2017 R.Blasa
s.addConfigSource("Surgery_Blood");

//Added: 10-13-2017 R.Blasa
s.addConfigSource("Biopsy_Staff");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ private void customizeTreatmentFrequency(AbstractTableInfo ti)
ColumnInfo existing = ti.getColumn(name);
if (null == existing && null != ti.getColumn("meaning"))
{
SQLFragment sql = new SQLFragment("(SELECT " + ti.getSqlDialect().getGroupConcat(new SQLFragment("REPLICATE('0', 4 - LEN(t.hourofday)) + cast(t.hourofday as varchar(4))"), true, true, "','").getSqlCharSequence() +
SQLFragment sql = new SQLFragment("(SELECT " + ti.getSqlDialect().getGroupConcat(new SQLFragment("REPLICATE('0', 4 - LEN(t.hourofday)) + cast(t.hourofday as varchar(4))"), true, true, ",").getSqlCharSequence() +
"FROM ehr_lookups.treatment_frequency_times t " +
" WHERE t.frequency = " + ExprColumn.STR_TABLE_ALIAS + ".meaning " +
" GROUP BY t.frequency " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -1550,6 +1551,8 @@ public void testPathology()
@Test
public void testSurgeryForm()
{
LocalDateTime tomorrow = LocalDateTime.now().plusDays(1);

_helper.goToTaskForm("Surgeries");

Ext4GridRef proceduresGrid = _helper.getExt4GridForFormSection("Procedures");
Expand Down Expand Up @@ -1689,6 +1692,17 @@ public void testSurgeryForm()
waitForElementToDisappear(caseWindow);
waitForElement(Ext4Helper.Locators.window("Success").append(Locator.tagWithText("div", "Surgical cases opened")));
waitAndClick(Ext4Helper.Locators.window("Success").append(Ext4Helper.Locators.ext4ButtonEnabled("OK")));

_ext4Helper.clickExt4Tab("Medication/Treatment Orders");
treatmentGrid = _helper.getExt4GridForFormSection("Medication/Treatment Orders");
treatmentGrid.clickTbarButton("Add Record");
treatmentGrid.completeEdit();

Assert.assertEquals(tomorrow.withHour(8).withMinute(0).withSecond(0).withNano(0),
treatmentGrid.getDateFieldValue(3, "date").toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime());

_helper.discardForm();
}

Expand Down