GE has provided a Database Stored Procedure that can be called to send a flag to a user in CPS or CEMR. Here is some sample code on how to use it.
try {
var sysDate = qie.formatDate('yyyy-MM-dd HH:mm:ss');
if (isOracle) {
qie.doQuery( channelCache.getValue('dbName'),
"CALL EXT_SEND_FLAG(" +
priority + ", '" +
qie.escapeSql(message) + "', " +
pvidList[i] + ", " +
"-2, " +
pid + ", " +
"to_date('" + qie.formatDate('yyyy-MM-dd') + "', 'yyyy-mm-dd'), '" +
subject + "')");
} else {
qie.doQuery( channelCache.getValue('dbName'),
"EXEC EXT_SEND_FLAG\n" +
" @p_level = " + priority + ",\n" +
" @p_msg = '" + qie.escapeSql(message) + "',\n" +
" @p_usernum = " + pvidList[i] + ",\n" +
" @p_fromuser = -2,\n" +
" @p_patientid = " + pid + ",\n" +
" @p_ddue = '" + qie.formatDate('yyyy-MM-dd') + "',\n" +
" @p_subject = '" + subject + "'");
}
} catch (err) {
qie.error("Error inserting flag to DB: " + err);
}