Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: YTQRCDB5

YTQRCDB5.m

Go to the documentation of this file.
  1. YTQRCDB5 ;BAL/KTL - MHA CLOUD DATABASE RPC CALLS; 1/25/2017
  1. ;;5.01;MENTAL HEALTH;**250**;Dec 30, 1994;Build 26
  1. ;
  1. ;
  1. ;Reference to PXRMINDX in ICR #4290
  1. ;
  1. Q
  1. GETPAT(ARGS,RESULTS) ; Get patient name list by id
  1. N YSPOI,POILST,I,POI,POINAM,CNT
  1. N HIT,STR
  1. K ^TMP("YTQ-JSON",$J) S (HIT,CNT)=0
  1. D SETRES("[")
  1. S YSPOI=$G(ARGS("poilist")) I YSPOI="" D SETERROR^YTQRUTL(404,"No POI list") QUIT
  1. F I=1:1:$L(YSPOI,",") D
  1. . S POI=$P(YSPOI,",",I) Q:+POI=0
  1. . Q:'$D(^DPT(POI))
  1. . S POINAM=$P(^DPT(POI,0),U)
  1. . S STR="{""id"":"""_POI_""", ""name"":"""_POINAM_""" },"
  1. . D SETRES(STR) S HIT=1
  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
  1. D SETRES("]")
  1. S RESULTS=$NA(^TMP("YTQ-JSON",$J))
  1. Q
  1. GETDOC(ARGS,RESULTS) ; Get clinician name list by id
  1. N YSDOC,DOCLST,I,DOC,DOCNAM,CNT
  1. N HIT,STR
  1. S CNT=0
  1. K ^TMP("YTQ-JSON",$J) S CNT=0
  1. D SETRES("[")
  1. S YSDOC=$G(ARGS("doclist")) I YSDOC="" D SETERROR^YTQRUTL(404,"No DOC list") QUIT
  1. F I=1:1:$L(YSDOC,",") D
  1. . S DOC=$P(YSDOC,",",I) Q:+DOC=0
  1. . Q:'$D(^VA(200,DOC))
  1. . S DOCNAM=$P(^VA(200,DOC,0),U)
  1. . S STR="{""id"":"""_DOC_""", ""name"":"""_DOCNAM_""" },"
  1. . D SETRES(STR) S HIT=1
  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
  1. D SETRES("]")
  1. S RESULTS=$NA(^TMP("YTQ-JSON",$J))
  1. Q
  1. SETRES(STR) ;
  1. S CNT=CNT+1,^TMP("YTQ-JSON",$J,CNT,0)=STR
  1. Q