YTQRRPC ;SLC/KCM - Other RPC Calls for MHA ; 1/25/2017
;;5.01;MENTAL HEALTH;**130,141**;Dec 30, 1994;Build 85
;
; External Reference ICR#
; ------------------ -----
; HOSPLOC^ORWU 1816
; NEWPERS^ORWU 1836
;
SELECT(YTQRRSP,REQ) ; Controller for patient select screen
N I,CMD,PARAMS
S CMD=$G(REQ(1))
S I=1 F S I=$O(REQ(I)) Q:'I S PARAMS($P(REQ(I),"="))=$P(REQ(I),"=",2,99)
;
; switch on CMD
; ---------------------------------
; getCurrentUser ==> duz^username
I CMD="getCurrentUser" D G OUT
. D USERINFO^YTQRIS(.YTQRRSP)
; ---------------------------------
; getPatientInfo ==> lastname,firstname^PID
I CMD="getPatientInfo" D G OUT
. D PTINFO^YTQRIS(.YTQRRSP,$$VAL("patientId"))
; ---------------------------------
; subsetOfPersons ==> [ien^name^- organization]
I CMD="subsetOfPersons" D G OUT
. D NEWPERS^ORWU(.YTQRRSP,$$VAL("startFrom"),$$VAL("direction"))
; ---------------------------------
; subsetOfLocations ==> [ien^locationName]
I CMD="subsetOfLocations" D G OUT
. D HOSPLOC^ORWU(.YTQRRSP,$$VAL("startFrom"),$$VAL("direction"))
; ---------------------------------
; deleteAssignment(itemType,identifier) ==> ok or errorMsg
I CMD="deleteAssignment" D G OUT
. D DELASMT^YTQRIS(.YTQRRSP,$$VAL("itemType"),$$VAL("identifier"))
; ---------------------------------
; listAssignments(patientId,userId) ==> [displayText^pin^test|adminId^...]
I CMD="listActiveAssignments" D G OUT
. D ACTIVE^YTQRIS(.YTQRRSP,$$VAL("patientId"),$$VAL("userId"))
; ---------------------------------
; listActiveForTest(patientId,userId,testName) ==> [testName^pin^adminId^...]
I CMD="listActiveForTest" D G OUT
. D ACTIVE1^YTQRIS(.YTQRRSP,$$VAL("patientId"),$$VAL("userId"),$$VAL("testName"))
; ---------------------------------
; deleteAssignment2(pin,admins) ==> ok or errorMsg
I CMD="deleteAssignment2" D G OUT
. D DELASMT2^YTQRIS(.YTQRRSP,$$VAL("pin"),$$VAL("admins"))
; ---------------------------------
; describeAssignment(pin,admins) ==> [text]
I CMD="describeAssignment" D G OUT
. D DESCRIBE^YTQRIS(.YTQRRSP,$$VAL("pin"),$$VAL("admins"))
; ---------------------------------
; validateInstruments(mode,orderedBy,tests) ==> ok or errorMsg
I CMD="validateInstruments" D G OUT
. D VALTSTS^YTQRIS(.YTQRRSP,$$VAL("mode"),$$VAL("orderedBy"),$$VAL("tests"))
; ---------------------------------
; listCategories ==> [categoryName]
I CMD="listCategories" D G OUT
. D ACTCAT^YTQRIS(.YTQRRSP)
; ---------------------------------
; listByCategory(category) ==> root=TEST1^TEST2^...
I CMD="listByCategory" D G OUT
. D INBYCAT^YTQRIS(.YTQRRSP,$$VAL("category"))
; ---------------------------------
; buildProgressNote(admin) ==> [text]
I CMD="buildProgressNote" D G OUT
. N YTQRERRS
. D BLDRPT^YTQRRPT(.YTQRRSP,$$VAL("adminId"),79)
. I $G(YTQRRSP(1))=" " K YTQRRSP(1) ; drop empty first line
; ---------------------------------
; buildResultReport(admin) ==> [text]
I CMD="buildResultReport" D G OUT
. N YTQRERRS
. D BLDRPT^YTQRRPT(.YTQRRSP,$$VAL("adminId"),512)
. I $G(YTQRRSP(1))=" " K YTQRRSP(1) ; drop empty first line
. ; N I S I=0 F S I=$O(YTQRRSP(I)) Q:'I S YTQRRSP(I)=" "_YTQRRSP(I)
. I $G(YTQRERRS) K YTQRRSP S YTQRRSP="ERROR"
; else
S YTQRRSP(1)="Error: command not found"
;
OUT ; end of switch statement
Q
;
VAL(X) ; return value from request
; expects PARAMS
Q $G(PARAMS(X))
;
TEST ;
N REQ,RSP
S REQ(1)="buildProgressNote"
S REQ(2)="adminId=100943"
D SELECT(.RSP,.REQ)
;W ! ZW RSP
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTQRRPC 3598 printed Oct 16, 2024@18:19:43 Page 2
YTQRRPC ;SLC/KCM - Other RPC Calls for MHA ; 1/25/2017
+1 ;;5.01;MENTAL HEALTH;**130,141**;Dec 30, 1994;Build 85
+2 ;
+3 ; External Reference ICR#
+4 ; ------------------ -----
+5 ; HOSPLOC^ORWU 1816
+6 ; NEWPERS^ORWU 1836
+7 ;
SELECT(YTQRRSP,REQ) ; Controller for patient select screen
+1 NEW I,CMD,PARAMS
+2 SET CMD=$GET(REQ(1))
+3 SET I=1
FOR
SET I=$ORDER(REQ(I))
if 'I
QUIT
SET PARAMS($PIECE(REQ(I),"="))=$PIECE(REQ(I),"=",2,99)
+4 ;
+5 ; switch on CMD
+6 ; ---------------------------------
+7 ; getCurrentUser ==> duz^username
+8 IF CMD="getCurrentUser"
Begin DoDot:1
+9 DO USERINFO^YTQRIS(.YTQRRSP)
End DoDot:1
GOTO OUT
+10 ; ---------------------------------
+11 ; getPatientInfo ==> lastname,firstname^PID
+12 IF CMD="getPatientInfo"
Begin DoDot:1
+13 DO PTINFO^YTQRIS(.YTQRRSP,$$VAL("patientId"))
End DoDot:1
GOTO OUT
+14 ; ---------------------------------
+15 ; subsetOfPersons ==> [ien^name^- organization]
+16 IF CMD="subsetOfPersons"
Begin DoDot:1
+17 DO NEWPERS^ORWU(.YTQRRSP,$$VAL("startFrom"),$$VAL("direction"))
End DoDot:1
GOTO OUT
+18 ; ---------------------------------
+19 ; subsetOfLocations ==> [ien^locationName]
+20 IF CMD="subsetOfLocations"
Begin DoDot:1
+21 DO HOSPLOC^ORWU(.YTQRRSP,$$VAL("startFrom"),$$VAL("direction"))
End DoDot:1
GOTO OUT
+22 ; ---------------------------------
+23 ; deleteAssignment(itemType,identifier) ==> ok or errorMsg
+24 IF CMD="deleteAssignment"
Begin DoDot:1
+25 DO DELASMT^YTQRIS(.YTQRRSP,$$VAL("itemType"),$$VAL("identifier"))
End DoDot:1
GOTO OUT
+26 ; ---------------------------------
+27 ; listAssignments(patientId,userId) ==> [displayText^pin^test|adminId^...]
+28 IF CMD="listActiveAssignments"
Begin DoDot:1
+29 DO ACTIVE^YTQRIS(.YTQRRSP,$$VAL("patientId"),$$VAL("userId"))
End DoDot:1
GOTO OUT
+30 ; ---------------------------------
+31 ; listActiveForTest(patientId,userId,testName) ==> [testName^pin^adminId^...]
+32 IF CMD="listActiveForTest"
Begin DoDot:1
+33 DO ACTIVE1^YTQRIS(.YTQRRSP,$$VAL("patientId"),$$VAL("userId"),$$VAL("testName"))
End DoDot:1
GOTO OUT
+34 ; ---------------------------------
+35 ; deleteAssignment2(pin,admins) ==> ok or errorMsg
+36 IF CMD="deleteAssignment2"
Begin DoDot:1
+37 DO DELASMT2^YTQRIS(.YTQRRSP,$$VAL("pin"),$$VAL("admins"))
End DoDot:1
GOTO OUT
+38 ; ---------------------------------
+39 ; describeAssignment(pin,admins) ==> [text]
+40 IF CMD="describeAssignment"
Begin DoDot:1
+41 DO DESCRIBE^YTQRIS(.YTQRRSP,$$VAL("pin"),$$VAL("admins"))
End DoDot:1
GOTO OUT
+42 ; ---------------------------------
+43 ; validateInstruments(mode,orderedBy,tests) ==> ok or errorMsg
+44 IF CMD="validateInstruments"
Begin DoDot:1
+45 DO VALTSTS^YTQRIS(.YTQRRSP,$$VAL("mode"),$$VAL("orderedBy"),$$VAL("tests"))
End DoDot:1
GOTO OUT
+46 ; ---------------------------------
+47 ; listCategories ==> [categoryName]
+48 IF CMD="listCategories"
Begin DoDot:1
+49 DO ACTCAT^YTQRIS(.YTQRRSP)
End DoDot:1
GOTO OUT
+50 ; ---------------------------------
+51 ; listByCategory(category) ==> root=TEST1^TEST2^...
+52 IF CMD="listByCategory"
Begin DoDot:1
+53 DO INBYCAT^YTQRIS(.YTQRRSP,$$VAL("category"))
End DoDot:1
GOTO OUT
+54 ; ---------------------------------
+55 ; buildProgressNote(admin) ==> [text]
+56 IF CMD="buildProgressNote"
Begin DoDot:1
+57 NEW YTQRERRS
+58 DO BLDRPT^YTQRRPT(.YTQRRSP,$$VAL("adminId"),79)
+59 ; drop empty first line
IF $GET(YTQRRSP(1))=" "
KILL YTQRRSP(1)
End DoDot:1
GOTO OUT
+60 ; ---------------------------------
+61 ; buildResultReport(admin) ==> [text]
+62 IF CMD="buildResultReport"
Begin DoDot:1
+63 NEW YTQRERRS
+64 DO BLDRPT^YTQRRPT(.YTQRRSP,$$VAL("adminId"),512)
+65 ; drop empty first line
IF $GET(YTQRRSP(1))=" "
KILL YTQRRSP(1)
+66 ; N I S I=0 F S I=$O(YTQRRSP(I)) Q:'I S YTQRRSP(I)=" "_YTQRRSP(I)
+67 IF $GET(YTQRERRS)
KILL YTQRRSP
SET YTQRRSP="ERROR"
End DoDot:1
GOTO OUT
+68 ; else
+69 SET YTQRRSP(1)="Error: command not found"
+70 ;
OUT ; end of switch statement
+1 QUIT
+2 ;
VAL(X) ; return value from request
+1 ; expects PARAMS
+2 QUIT $GET(PARAMS(X))
+3 ;
TEST ;
+1 NEW REQ,RSP
+2 SET REQ(1)="buildProgressNote"
+3 SET REQ(2)="adminId=100943"
+4 DO SELECT(.RSP,.REQ)
+5 ;W ! ZW RSP
+6 QUIT