- YTQRCDB5 ;BAL/KTL - MHA CLOUD DATABASE RPC CALLS; 1/25/2017
- ;;5.01;MENTAL HEALTH;**250**;Dec 30, 1994;Build 26
- ;
- ;
- ;Reference to PXRMINDX in ICR #4290
- ;
- Q
- GETPAT(ARGS,RESULTS) ; Get patient name list by id
- N YSPOI,POILST,I,POI,POINAM,CNT
- N HIT,STR
- K ^TMP("YTQ-JSON",$J) S (HIT,CNT)=0
- D SETRES("[")
- S YSPOI=$G(ARGS("poilist")) I YSPOI="" D SETERROR^YTQRUTL(404,"No POI list") QUIT
- F I=1:1:$L(YSPOI,",") D
- . S POI=$P(YSPOI,",",I) Q:+POI=0
- . Q:'$D(^DPT(POI))
- . S POINAM=$P(^DPT(POI,0),U)
- . S STR="{""id"":"""_POI_""", ""name"":"""_POINAM_""" },"
- . D SETRES(STR) S HIT=1
- I HIT S STR=^TMP("YTQ-JSON",$J,CNT,0),STR=$E(STR,1,$L(STR)-1),^TMP("YTQ-JSON",$J,CNT,0)=STR
- D SETRES("]")
- S RESULTS=$NA(^TMP("YTQ-JSON",$J))
- Q
- GETDOC(ARGS,RESULTS) ; Get clinician name list by id
- N YSDOC,DOCLST,I,DOC,DOCNAM,CNT
- N HIT,STR
- S CNT=0
- K ^TMP("YTQ-JSON",$J) S CNT=0
- D SETRES("[")
- S YSDOC=$G(ARGS("doclist")) I YSDOC="" D SETERROR^YTQRUTL(404,"No DOC list") QUIT
- F I=1:1:$L(YSDOC,",") D
- . S DOC=$P(YSDOC,",",I) Q:+DOC=0
- . Q:'$D(^VA(200,DOC))
- . S DOCNAM=$P(^VA(200,DOC,0),U)
- . S STR="{""id"":"""_DOC_""", ""name"":"""_DOCNAM_""" },"
- . D SETRES(STR) S HIT=1
- I HIT S STR=^TMP("YTQ-JSON",$J,CNT,0),STR=$E(STR,1,$L(STR)-1),^TMP("YTQ-JSON",$J,CNT,0)=STR
- D SETRES("]")
- S RESULTS=$NA(^TMP("YTQ-JSON",$J))
- Q
- SETRES(STR) ;
- S CNT=CNT+1,^TMP("YTQ-JSON",$J,CNT,0)=STR
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTQRCDB5 1415 printed Mar 13, 2025@21:23:37 Page 2
- YTQRCDB5 ;BAL/KTL - MHA CLOUD DATABASE RPC CALLS; 1/25/2017
- +1 ;;5.01;MENTAL HEALTH;**250**;Dec 30, 1994;Build 26
- +2 ;
- +3 ;
- +4 ;Reference to PXRMINDX in ICR #4290
- +5 ;
- +6 QUIT
- GETPAT(ARGS,RESULTS) ; Get patient name list by id
- +1 NEW YSPOI,POILST,I,POI,POINAM,CNT
- +2 NEW HIT,STR
- +3 KILL ^TMP("YTQ-JSON",$JOB)
- SET (HIT,CNT)=0
- +4 DO SETRES("[")
- +5 SET YSPOI=$GET(ARGS("poilist"))
- IF YSPOI=""
- DO SETERROR^YTQRUTL(404,"No POI list")
- QUIT
- +6 FOR I=1:1:$LENGTH(YSPOI,",")
- Begin DoDot:1
- +7 SET POI=$PIECE(YSPOI,",",I)
- if +POI=0
- QUIT
- +8 if '$DATA(^DPT(POI))
- QUIT
- +9 SET POINAM=$PIECE(^DPT(POI,0),U)
- +10 SET STR="{""id"":"""_POI_""", ""name"":"""_POINAM_""" },"
- +11 DO SETRES(STR)
- SET HIT=1
- End DoDot:1
- +12 IF HIT
- SET STR=^TMP("YTQ-JSON",$JOB,CNT,0)
- SET STR=$EXTRACT(STR,1,$LENGTH(STR)-1)
- SET ^TMP("YTQ-JSON",$JOB,CNT,0)=STR
- +13 DO SETRES("]")
- +14 SET RESULTS=$NAME(^TMP("YTQ-JSON",$JOB))
- +15 QUIT
- GETDOC(ARGS,RESULTS) ; Get clinician name list by id
- +1 NEW YSDOC,DOCLST,I,DOC,DOCNAM,CNT
- +2 NEW HIT,STR
- +3 SET CNT=0
- +4 KILL ^TMP("YTQ-JSON",$JOB)
- SET CNT=0
- +5 DO SETRES("[")
- +6 SET YSDOC=$GET(ARGS("doclist"))
- IF YSDOC=""
- DO SETERROR^YTQRUTL(404,"No DOC list")
- QUIT
- +7 FOR I=1:1:$LENGTH(YSDOC,",")
- Begin DoDot:1
- +8 SET DOC=$PIECE(YSDOC,",",I)
- if +DOC=0
- QUIT
- +9 if '$DATA(^VA(200,DOC))
- QUIT
- +10 SET DOCNAM=$PIECE(^VA(200,DOC,0),U)
- +11 SET STR="{""id"":"""_DOC_""", ""name"":"""_DOCNAM_""" },"
- +12 DO SETRES(STR)
- SET HIT=1
- End DoDot:1
- +13 IF HIT
- SET STR=^TMP("YTQ-JSON",$JOB,CNT,0)
- SET STR=$EXTRACT(STR,1,$LENGTH(STR)-1)
- SET ^TMP("YTQ-JSON",$JOB,CNT,0)=STR
- +14 DO SETRES("]")
- +15 SET RESULTS=$NAME(^TMP("YTQ-JSON",$JOB))
- +16 QUIT
- SETRES(STR) ;
- +1 SET CNT=CNT+1
- SET ^TMP("YTQ-JSON",$JOB,CNT,0)=STR
- +2 QUIT