HMPCPRS ;SLC/AGP,ASMR/RRB - CPRS RPC for;9/21/12 5:57pm
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Sep 01, 2011;Build 63
;Per VA Directive 6402, this routine should not be modified.
;
Q
;
RPC(HMPOUT,PARAMS) ; Process request via RPC instead of CSP
N X,REQ,HMPCNT,HMPSITE,HMPUSER,HMPDBUG,HMPSTA
S HMPCNT=0
S HMPUSER=DUZ,HMPSITE=DUZ(2),HMPSTA=$$STA^XUAF4(DUZ(2))
S X="" F S X=$O(PARAMS(X)) Q:X="" S REQ(X,1)=PARAMS(X)
;
COMMON ; Come here for both CSP and RPC Mode
;
N CMD
S CMD=$G(REQ("command",1))
;
; returns an order structure for change orders
; or places an order if auto-accept QO
I CMD="alerts" D G OUT
. D ALERTS(.HMPOUT)
;
I CMD="reminders" D G OUT
.D EVALLIST^HMPPXRM(.HMPOUT,$$VAL("patientId"),$$VAL("userId"),$$VAL("location"))
;
OUT ;
END ;
;
BLDINFO(INFO) ;
N X
S X="" F S X=$O(REQ(X)) Q:X="" D
.S INFO(X)=REQ(X,1)
Q
;
VAL(X) ; return value from request
Q $G(REQ(X,1))
;
ALERTS(HMPOUT) ;
N ALERT,CNT,ERROR,NODE,NUM,RESULT,HMPORY
K ^TMP("HMPALERTS",$J),^TMP("HMPOUT",$J)
;S HMPOUT=$NA(^TMP("HMPOUT",$J))
D FASTUSER^ORWORB(.HMPORY)
;ZW HMPORY
S CNT=0,NUM=1 F S CNT=$O(@HMPORY@(CNT)) Q:CNT'>0 D
.S NODE=$G(@HMPORY@(CNT))
.K ALERT
.I $P(NODE,U)="I" S ALERT("infoOnly")="I"
.S ALERT("patient")=$P(NODE,U,2),ALERT("urgency")=$P(NODE,U,4),ALERT("dateTime")=$P(NODE,U,5)
.I $P(NODE,U,3)'="" S ALERT("location")=$P(NODE,U,3)
.S ALERT("message")=$P(NODE,U,6)
.I $P(NODE,U,8)'="" S ALERT("action")=$P(NODE,U,8)
.S ALERT("mustBeProcess")=$S($P(NODE,U,9)="yes":"false",1:"true")
.I $P(NODE,U,10)'="" S ALERT("forwardBy")="true"
.M ^TMP("HMPALERTS",$J,"data","alerts",NUM,"alert")=ALERT S NUM=NUM+1
D ENCODE^HMPJSON($NA(^TMP("HMPALERTS",$J)),"HMPOUT","ERROR")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPCPRS 1781 printed Dec 13, 2024@01:53:04 Page 2
HMPCPRS ;SLC/AGP,ASMR/RRB - CPRS RPC for;9/21/12 5:57pm
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Sep 01, 2011;Build 63
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
RPC(HMPOUT,PARAMS) ; Process request via RPC instead of CSP
+1 NEW X,REQ,HMPCNT,HMPSITE,HMPUSER,HMPDBUG,HMPSTA
+2 SET HMPCNT=0
+3 SET HMPUSER=DUZ
SET HMPSITE=DUZ(2)
SET HMPSTA=$$STA^XUAF4(DUZ(2))
+4 SET X=""
FOR
SET X=$ORDER(PARAMS(X))
if X=""
QUIT
SET REQ(X,1)=PARAMS(X)
+5 ;
COMMON ; Come here for both CSP and RPC Mode
+1 ;
+2 NEW CMD
+3 SET CMD=$GET(REQ("command",1))
+4 ;
+5 ; returns an order structure for change orders
+6 ; or places an order if auto-accept QO
+7 IF CMD="alerts"
Begin DoDot:1
+8 DO ALERTS(.HMPOUT)
End DoDot:1
GOTO OUT
+9 ;
+10 IF CMD="reminders"
Begin DoDot:1
+11 DO EVALLIST^HMPPXRM(.HMPOUT,$$VAL("patientId"),$$VAL("userId"),$$VAL("location"))
End DoDot:1
GOTO OUT
+12 ;
OUT ;
END ;
+1 ;
BLDINFO(INFO) ;
+1 NEW X
+2 SET X=""
FOR
SET X=$ORDER(REQ(X))
if X=""
QUIT
Begin DoDot:1
+3 SET INFO(X)=REQ(X,1)
End DoDot:1
+4 QUIT
+5 ;
VAL(X) ; return value from request
+1 QUIT $GET(REQ(X,1))
+2 ;
ALERTS(HMPOUT) ;
+1 NEW ALERT,CNT,ERROR,NODE,NUM,RESULT,HMPORY
+2 KILL ^TMP("HMPALERTS",$JOB),^TMP("HMPOUT",$JOB)
+3 ;S HMPOUT=$NA(^TMP("HMPOUT",$J))
+4 DO FASTUSER^ORWORB(.HMPORY)
+5 ;ZW HMPORY
+6 SET CNT=0
SET NUM=1
FOR
SET CNT=$ORDER(@HMPORY@(CNT))
if CNT'>0
QUIT
Begin DoDot:1
+7 SET NODE=$GET(@HMPORY@(CNT))
+8 KILL ALERT
+9 IF $PIECE(NODE,U)="I"
SET ALERT("infoOnly")="I"
+10 SET ALERT("patient")=$PIECE(NODE,U,2)
SET ALERT("urgency")=$PIECE(NODE,U,4)
SET ALERT("dateTime")=$PIECE(NODE,U,5)
+11 IF $PIECE(NODE,U,3)'=""
SET ALERT("location")=$PIECE(NODE,U,3)
+12 SET ALERT("message")=$PIECE(NODE,U,6)
+13 IF $PIECE(NODE,U,8)'=""
SET ALERT("action")=$PIECE(NODE,U,8)
+14 SET ALERT("mustBeProcess")=$SELECT($PIECE(NODE,U,9)="yes":"false",1:"true")
+15 IF $PIECE(NODE,U,10)'=""
SET ALERT("forwardBy")="true"
+16 MERGE ^TMP("HMPALERTS",$JOB,"data","alerts",NUM,"alert")=ALERT
SET NUM=NUM+1
End DoDot:1
+17 DO ENCODE^HMPJSON($NAME(^TMP("HMPALERTS",$JOB)),"HMPOUT","ERROR")
+18 QUIT
+19 ;