169 lines
6.8 KiB
Plaintext
169 lines
6.8 KiB
Plaintext
maintenance:
|
|
|
|
title: MEDREC_FILLTEMPLATE;;
|
|
mlmname: FORM_MEDREC_FILLTEMPLATE;;
|
|
arden: version 2;;
|
|
version: 4.50;;
|
|
institution: SCH;;
|
|
author: Robert Spence Ext 7461;;
|
|
specialist: ;;
|
|
date: 2010-04-30;;
|
|
validation: testing;;
|
|
library:
|
|
purpose: This MLM sets the fields in the order form to the correct data per Med Rec hence correcting child form issue.
|
|
|
|
;;
|
|
explanation: Blah blah blah
|
|
;;
|
|
keywords: Called MLMs, Form fields, MED REC,OMP
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
// This MLM is passed three arguments, of types
|
|
// communication_type, form_type and client info object respectively.
|
|
|
|
(this_communication, // Communication object
|
|
this_form, // Form object
|
|
client_info_obj //Arden ClientInfo object
|
|
) := argument;
|
|
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
|
|
// marker
|
|
// using "MoreThanOneMedRec";
|
|
// using namespace "MoreThanOneMedRec";
|
|
// test:= new net_object {{{SINGLE-QUOTE}}}MoreThanOne{{{SINGLE-QUOTE}}};
|
|
// end of marker
|
|
|
|
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
|
|
|
/* Set to true if a decision.log is needed.*/
|
|
log_execution_info := FALSE;
|
|
|
|
|
|
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Where am I"
|
|
// ,"Tester","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"STOP" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button2" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
|
|
// Note: Dialog result proves that the objects + call will hold up the MLM, exactly what we wanted.
|
|
|
|
// Assigns fields passed in the Form object to the Field object
|
|
field_list:= this_form.fields;
|
|
prim_obj := this_communication.PrimaryObj;
|
|
|
|
frm_modify := prim_obj.Modifier;
|
|
itemguid := this_communication.ItemID;
|
|
|
|
if (frm_modify matches pattern "%Med Reconciliation Order%" and prim_obj.IsForDischarge = false)
|
|
then
|
|
|
|
itemguid := this_communication.ItemID;
|
|
|
|
orderguid:= prim_obj.GUID;
|
|
ClientGuid:=this_communication.ClientGUID;
|
|
|
|
// tryme := CALL test.retrievedata with itemguid as string,clientguid as string;
|
|
/* sqlstatement := " select ao.guid,isnull(orox.toorderguid,0),ao.frequencycode from CV3AlternateOrder as ao with (nolock) "
|
|
|| " left join cv3orderreconcileorderxref as orox with (nolock) "
|
|
|| " on orox.fromorderguid = ao.guid "
|
|
|| " where ao.ordercatalogmasteritemguid = " || itemguid
|
|
|| " and ao.clientguid = " || ClientGuid
|
|
|| " and ao.repflags = 0 "
|
|
|| " and orox.toorderguid is null ";
|
|
tryme := CALL test.retrievedata with itemguid as string,clientguid as string, sqlstatement as string;
|
|
*/
|
|
fromguid,toguid,freqcode := read last {" select ao.guid,isnull(orox.toorderguid,0),ao.frequencycode from CV3AlternateOrder as ao with (nolock) "
|
|
|| " left join cv3orderreconcileorderxref as orox with (nolock) "
|
|
|| " on orox.fromorderguid = ao.guid "
|
|
|| " where ao.ordercatalogmasteritemguid = " || sql(itemguid)
|
|
|| " and ao.clientguid = " || sql(ClientGuid)
|
|
|| " and ao.repflags = 0 "
|
|
|| " and orox.toorderguid is null "
|
|
};
|
|
|
|
|
|
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Discharge Order? " || prim_obj.IsForDischarge
|
|
// ,"Tester","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"STOP" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button2" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
|
|
if fromguid is not null
|
|
then
|
|
dosesql, uomsql,routesql := read last{ " select me.dosagelow,me.uom,me.orderroutecode "
|
|
|| " from cv3medicationextension as me with (nolock) "
|
|
|| " where me.guid = " ||sql(fromguid)
|
|
};
|
|
|
|
rxinstructsupper,rxinstructs := read last {" select upper(value),value from CV3OrderUserData with (nolock)"
|
|
|| " WHERE ClientGUID = " || sql(ClientGUID)
|
|
|| " and OrderGUID = " || sql(fromguid)
|
|
|| " and userdatacode = {{{SINGLE-QUOTE}}}RX Instructions{{{SINGLE-QUOTE}}} "
|
|
};
|
|
|
|
if (rxinstructs is not null) and (rxinstructs <> "") then
|
|
if (rxinstructsupper matches pattern "%PRN%") or
|
|
(rxinstructsupper matches pattern "%AS NEEDED%") or
|
|
// (rxinstructsupper matches pattern "%LAST DOSE TAKEN%") or
|
|
// (rxinstructsupper matches pattern "%DOSE UNKNOWN%") or
|
|
(rxinstructsupper matches pattern "%FOR AGITATION%") or
|
|
(rxinstructsupper matches pattern "%FOR ANXIETY%") or
|
|
(rxinstructsupper matches pattern "%FOR CHEST PAIN%") or
|
|
(rxinstructsupper matches pattern "%FOR CONSTIPATION%") or
|
|
(rxinstructsupper matches pattern "%FOR DIARRHEA%") or
|
|
(rxinstructsupper matches pattern "%FOR DIFFICULTY BREATHING%") or
|
|
(rxinstructsupper matches pattern "%FOR FEVER%") or
|
|
(rxinstructsupper matches pattern "%FOR HEADACHE%") or
|
|
(rxinstructsupper matches pattern "%FOR ITCHING%") or
|
|
(rxinstructsupper matches pattern "%FOR NAUSEA%") or
|
|
(rxinstructsupper matches pattern "%FOR PAIN%") or
|
|
(rxinstructsupper matches pattern "%FOR RESTLESSNESS%") or
|
|
(rxinstructsupper matches pattern "%FOR SLEEP%") or
|
|
(rxinstructsupper matches pattern "%FOR SPASMS%") or
|
|
(rxinstructsupper matches pattern "%FOR WHEEZING%")
|
|
then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "This order with Rx Instructions: \n\n" || rxinstructs
|
|
|| "\n\nHas been identified as a possible PRN order\n\n"
|
|
|| "Would you like to mark this order as PRN?"
|
|
,"PRN ALERT","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"STOP" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button1" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
|
|
|
|
resulttext := dialogResult as string;
|
|
|
|
if resulttext = "Yes"
|
|
then
|
|
IsPRN := first of (field_list where field_list.DataItemName = "IsPRN");
|
|
IsPRN.Value := true;
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
// do test on fields, see if we can hardcode them. remove this logic at stage 2
|
|
dose := first of (field_list where field_list.DataItemName = "DosageLow");
|
|
regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
|
|
regular_freq_value := regular_freq.value;
|
|
dose_route := first of (field_list where field_list.DataItemName = "OrderRouteCode");
|
|
|
|
dose.value := dosesql as number;
|
|
regular_freq_value.FrequencySummary := freqcode;
|
|
dose_route := routesql;
|
|
endif;
|
|
endif;
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
evoke: // No evoke statement
|
|
;;
|
|
logic:
|
|
//oeUnsigned:=CALL test.ShowDialog;
|
|
conclude true;
|
|
;;
|
|
action:
|
|
// This MLM returns two parameters, of types communication_type and form_type respectively.
|
|
return this_communication, this_form;
|
|
;;
|
|
end:
|