HMPCRPC ;SLC/AGP,ASMR/RRB - Generic RPC controller for HMP;11/7/12 5:42pm
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**2**;Sep 01, 2011;Build 28
;Per VA Directive 6402, this routine should not be modified.
;
Q
;
CHAINRPC(HMPRES,PARAMS) ; Chain multiple rpcs into one call
N CITER,RSP,PID
S CITER="" F S CITER=$O(PARAMS("commandList",CITER)) Q:CITER="" D
. N SUBCMD,SUBRSP,X
. S X=""
. F S X=$O(PARAMS("commandList",CITER,X)) Q:X="" M SUBCMD(X)=PARAMS("commandList",CITER,X)
. D CHAINCMD(.SUBCMD,.SUBRSP)
. I $D(SUBRSP) D DECODE^HMPJSON("SUBRSP","RSP(SUBCMD(""command""))","^JMCERR") I 1
. I '$TEST S RSP(SUBCMD("command"))=""
D ENCODE^HMPJSON("RSP","HMPRES","^JMCERR")
Q
RPC(HMPRES,PARAMS) ; Process request via RPC instead of CSP
N X,REQ,HMPVAL,HMPCNT,HMPSITE,HMPUSER,HMPDBUG,HMPSTA
;S HMPXML=$NA(^TMP($J,"HMP RESULTS")) K @HMPXML
S HMPCNT=0
;S HMPUSER=DUZ,HMPSITE=DUZ(2),HMPSTA=$$STA^XUAF4(DUZ(2))
S X="" F S X=$O(PARAMS(X)) Q:X="" I X'="value" S REQ(X,1)=PARAMS(X)
I $D(PARAMS("value")) M HMPVAL=PARAMS("value")
;
COMMON ; Come here for both CSP and RPC Mode
;
N CMD
S CMD=$G(REQ("command",1))
;
I CMD="saveParam" D G OUT
. D PUTPARAM^HMPPARAM(.HMPRES,.HMPVAL,"")
;
I CMD="saveParamByUid" D G OUT
. D PUTBYUID^HMPPARAM(.HMPRES,$$VAL("uid"),.HMPVAL)
;
I CMD="getParam" D G OUT
. D GETBYUID^HMPPARAM(.HMPRES,$$VAL("uid"))
;
I CMD="clearParam" D G OUT
. D DELPARAM^HMPPARAM(.HMPRES,$$VAL("uid"))
;
I CMD="getAllParam" D G OUT
.D GETALPAR^HMPPARAM(.HMPRES,$$VAL("entity"),$$VAL("entityId"),$$VAL("getValues"))
;
I CMD="getUserInfo" D G OUT
.D GETUSERI^HMPCRPC1(.HMPRES,$$VAL("userId"))
;
I CMD="getPatientInfo" D G OUT
.D GETPATI^HMPCRPC1(.HMPRES,$$VAL("patientId"))
;
I CMD="getPatientChecks" D G OUT
.D CHKS^HMPFPTC(.HMPRES,$$VAL("patientId"))
;
I CMD="logPatientAccess" D G OUT
.D LOG^HMPFPTC(.HMPRES,$$VAL("patientId"))
;
I CMD="addTask" D G OUT
.D PUT^HMPDJ1(.HMPRES,$$VAL("patientId"),$$VAL("type"),.HMPVAL)
;
I CMD="getReminderList" D G OUT
.D REMLIST^HMPPXRM(.HMPRES,$$VAL("user"),$$VAL("location"))
;
I CMD="evaluateReminder" D G OUT
.D EVALREM^HMPPXRM(.HMPRES,$$VAL("patientId"),$$VAL("uid"))
;
I CMD="getDefaultPatientList" D G OUT
.D GETDLIST^HMPROS8(.HMPRES,$$VAL("server"))
;
I CMD="getWardList" D G OUT
.D GETWLIST^HMPROS8(.HMPRES,$$VAL("server"),$$VAL("id"))
;
I CMD="getClinicList" D G OUT
.D GETCLIST^HMPROS8(.HMPRES,$$VAL("server"),$$VAL("id"),$$VAL("start"),$$VAL("end"))
;
OUT ; output the XML
;S HMPRES=$G(RESULT)
I '$D(HMPRES) S HMPRES="{}"
END Q
;
VAL(X) ; return value from request
Q $G(REQ(X,1))
;
CHAINCMD(HMPCMD,HMPRSP) ; Do one command in chain
;
N CMD
S CMD=$G(HMPCMD("command"))
I CMD="getParam" D GETBYUID^HMPPARAM(.HMPRSP,$G(HMPCMD("uid")))
I CMD="getPatientInfo" D GETPATI^HMPCRPC1(.HMPRSP,$G(HMPCMD("patientId")))
I CMD="getPatientChecks" D CHKS^HMPFPTC(.HMPRSP,$G(HMPCMD("patientId")))
I CMD="saveParam" D PUTPARAM^HMPPARAM(.HMPRSP,$G(HMPCMD("value")),"")
I CMD="saveParamByUid" D PUTBYUID^HMPPARAM(.HMPRSP,$G(HMPCMD("uid")),$G(HMPCMD("value")))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPCRPC 3185 printed Sep 15, 2024@21:17:10 Page 2
HMPCRPC ;SLC/AGP,ASMR/RRB - Generic RPC controller for HMP;11/7/12 5:42pm
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**2**;Sep 01, 2011;Build 28
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
CHAINRPC(HMPRES,PARAMS) ; Chain multiple rpcs into one call
+1 NEW CITER,RSP,PID
+2 SET CITER=""
FOR
SET CITER=$ORDER(PARAMS("commandList",CITER))
if CITER=""
QUIT
Begin DoDot:1
+3 NEW SUBCMD,SUBRSP,X
+4 SET X=""
+5 FOR
SET X=$ORDER(PARAMS("commandList",CITER,X))
if X=""
QUIT
MERGE SUBCMD(X)=PARAMS("commandList",CITER,X)
+6 DO CHAINCMD(.SUBCMD,.SUBRSP)
+7 IF $DATA(SUBRSP)
DO DECODE^HMPJSON("SUBRSP","RSP(SUBCMD(""command""))","^JMCERR")
IF 1
+8 IF '$TEST
SET RSP(SUBCMD("command"))=""
End DoDot:1
+9 DO ENCODE^HMPJSON("RSP","HMPRES","^JMCERR")
+10 QUIT
RPC(HMPRES,PARAMS) ; Process request via RPC instead of CSP
+1 NEW X,REQ,HMPVAL,HMPCNT,HMPSITE,HMPUSER,HMPDBUG,HMPSTA
+2 ;S HMPXML=$NA(^TMP($J,"HMP RESULTS")) K @HMPXML
+3 SET HMPCNT=0
+4 ;S HMPUSER=DUZ,HMPSITE=DUZ(2),HMPSTA=$$STA^XUAF4(DUZ(2))
+5 SET X=""
FOR
SET X=$ORDER(PARAMS(X))
if X=""
QUIT
IF X'="value"
SET REQ(X,1)=PARAMS(X)
+6 IF $DATA(PARAMS("value"))
MERGE HMPVAL=PARAMS("value")
+7 ;
COMMON ; Come here for both CSP and RPC Mode
+1 ;
+2 NEW CMD
+3 SET CMD=$GET(REQ("command",1))
+4 ;
+5 IF CMD="saveParam"
Begin DoDot:1
+6 DO PUTPARAM^HMPPARAM(.HMPRES,.HMPVAL,"")
End DoDot:1
GOTO OUT
+7 ;
+8 IF CMD="saveParamByUid"
Begin DoDot:1
+9 DO PUTBYUID^HMPPARAM(.HMPRES,$$VAL("uid"),.HMPVAL)
End DoDot:1
GOTO OUT
+10 ;
+11 IF CMD="getParam"
Begin DoDot:1
+12 DO GETBYUID^HMPPARAM(.HMPRES,$$VAL("uid"))
End DoDot:1
GOTO OUT
+13 ;
+14 IF CMD="clearParam"
Begin DoDot:1
+15 DO DELPARAM^HMPPARAM(.HMPRES,$$VAL("uid"))
End DoDot:1
GOTO OUT
+16 ;
+17 IF CMD="getAllParam"
Begin DoDot:1
+18 DO GETALPAR^HMPPARAM(.HMPRES,$$VAL("entity"),$$VAL("entityId"),$$VAL("getValues"))
End DoDot:1
GOTO OUT
+19 ;
+20 IF CMD="getUserInfo"
Begin DoDot:1
+21 DO GETUSERI^HMPCRPC1(.HMPRES,$$VAL("userId"))
End DoDot:1
GOTO OUT
+22 ;
+23 IF CMD="getPatientInfo"
Begin DoDot:1
+24 DO GETPATI^HMPCRPC1(.HMPRES,$$VAL("patientId"))
End DoDot:1
GOTO OUT
+25 ;
+26 IF CMD="getPatientChecks"
Begin DoDot:1
+27 DO CHKS^HMPFPTC(.HMPRES,$$VAL("patientId"))
End DoDot:1
GOTO OUT
+28 ;
+29 IF CMD="logPatientAccess"
Begin DoDot:1
+30 DO LOG^HMPFPTC(.HMPRES,$$VAL("patientId"))
End DoDot:1
GOTO OUT
+31 ;
+32 IF CMD="addTask"
Begin DoDot:1
+33 DO PUT^HMPDJ1(.HMPRES,$$VAL("patientId"),$$VAL("type"),.HMPVAL)
End DoDot:1
GOTO OUT
+34 ;
+35 IF CMD="getReminderList"
Begin DoDot:1
+36 DO REMLIST^HMPPXRM(.HMPRES,$$VAL("user"),$$VAL("location"))
End DoDot:1
GOTO OUT
+37 ;
+38 IF CMD="evaluateReminder"
Begin DoDot:1
+39 DO EVALREM^HMPPXRM(.HMPRES,$$VAL("patientId"),$$VAL("uid"))
End DoDot:1
GOTO OUT
+40 ;
+41 IF CMD="getDefaultPatientList"
Begin DoDot:1
+42 DO GETDLIST^HMPROS8(.HMPRES,$$VAL("server"))
End DoDot:1
GOTO OUT
+43 ;
+44 IF CMD="getWardList"
Begin DoDot:1
+45 DO GETWLIST^HMPROS8(.HMPRES,$$VAL("server"),$$VAL("id"))
End DoDot:1
GOTO OUT
+46 ;
+47 IF CMD="getClinicList"
Begin DoDot:1
+48 DO GETCLIST^HMPROS8(.HMPRES,$$VAL("server"),$$VAL("id"),$$VAL("start"),$$VAL("end"))
End DoDot:1
GOTO OUT
+49 ;
OUT ; output the XML
+1 ;S HMPRES=$G(RESULT)
+2 IF '$DATA(HMPRES)
SET HMPRES="{}"
END QUIT
+1 ;
VAL(X) ; return value from request
+1 QUIT $GET(REQ(X,1))
+2 ;
CHAINCMD(HMPCMD,HMPRSP) ; Do one command in chain
+1 ;
+2 NEW CMD
+3 SET CMD=$GET(HMPCMD("command"))
+4 IF CMD="getParam"
DO GETBYUID^HMPPARAM(.HMPRSP,$GET(HMPCMD("uid")))
+5 IF CMD="getPatientInfo"
DO GETPATI^HMPCRPC1(.HMPRSP,$GET(HMPCMD("patientId")))
+6 IF CMD="getPatientChecks"
DO CHKS^HMPFPTC(.HMPRSP,$GET(HMPCMD("patientId")))
+7 IF CMD="saveParam"
DO PUTPARAM^HMPPARAM(.HMPRSP,$GET(HMPCMD("value")),"")
+8 IF CMD="saveParamByUid"
DO PUTBYUID^HMPPARAM(.HMPRSP,$GET(HMPCMD("uid")),$GET(HMPCMD("value")))
+9 QUIT