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

DGPTAPA1.m

Go to the documentation of this file.
  1. DGPTAPA1 ;ALB/MTC - PTF A/P ARCHIVE UTILITY ; 10-19-92
  1. ;;5.3;Registration;;Aug 13, 1993
  1. ;
  1. ARINT ;
  1. D ARMAIN,AR401^DGPTAPA2,AR601^DGPTAPA2,AR501^DGPTAPA3,AR535^DGPTAPA3
  1. Q
  1. ;
  1. ARMAIN ;-- This function will load the array containing the
  1. ; PTF detailed information.
  1. ; INPUT : DGPTF - Valid PTF entry
  1. ; DGTMP - IEN of the template used
  1. ;
  1. N I,X,Y,DG70,NUMREC,SEQ,OSEQ,REF
  1. ;--
  1. S OSEQ=$G(^DGP(45.62,DGTMP,100,0)) Q:OSEQ']""
  1. S SEQ=$P(OSEQ,U,3),REF="^DGP(45.62,"_DGTMP_",100)"
  1. S DG70=$G(^DGPT(DGPTF,70))
  1. ;
  1. ;--patient name (2)
  1. S Y=DGPTF_U_$P(^DPT(+^DGPT(DGPTF,0),0),U)
  1. ;--admission date (3)
  1. S Y=Y_U_$P(^DGPT(DGPTF,0),U,2)
  1. ;--discharge date (4)
  1. S Y=Y_U_$S(+DG70:+DG70,1:"")
  1. ;--discharge specilaty (5)
  1. S Y=Y_U_$S($P(DG70,U,2):$P(^DIC(42.4,$P(DG70,U,2),0),U),1:""),X=$P(DG70,U,3)
  1. ;--type of disposition (6)
  1. S Y=Y_U_$S(X:$P($P($P(^DD(45,72,0),U,3),";",X),":",2),1:"")
  1. S X=$P(DG70,U,14)
  1. ;--discharge status (7)
  1. S Y=Y_U_$S(X:$P($P($P(^DD(45,72.1,0),U,3),";",X),":",2),1:"")
  1. S X=$P(DG70,U,4)
  1. ;--outpatient treatment (8)
  1. S Y=Y_U_$S(X=1:"YES",1:"NO")
  1. ;-- ASIH days (9)
  1. S Y=Y_U_$S($P(DG70,U,8)]"":$P(DG70,U,8),1:"")
  1. S X=$P(DG70,U,9)
  1. ;-- C&P Status (10)
  1. S Y=Y_U_$S(X:$P($P($P(^DD(45,78,0),U,3),";",X),":",2),1:"")
  1. ;-- VA Auspices (11)
  1. S Y=Y_U_$S($P(DG70,U,5)=1:"YES",1:"NO")
  1. ;-- income (12)
  1. S DGINC=$P($G(^DGPT(DGPTF,101)),U,7)
  1. S Y=Y_U_$S(DGINC]"":DGINC,1:"")
  1. ;
  1. ;-- check for ICD codes (13-22)
  1. F I=10,15:1:24 D
  1. . S Y=Y_U_$S($P(DG70,U,I):$P(^ICD9($P(DG70,U,I),0),U),1:"")
  1. ;
  1. ;-- check for 300 node information (23-28)
  1. S X=$G(^DGPT(DGPTF,300))
  1. S Y=Y_U_$$AR300(X),SEQ=SEQ+1,@REF@(SEQ,0)=Y
  1. ;
  1. ;-- update
  1. S $P(^DGP(45.62,DGTMP,100,0),U,3,4)=SEQ_U_SEQ
  1. ;
  1. Q
  1. ;
  1. AR300(N300) ;-- load 300 node information
  1. ; INPUT N300 - Contains 300 node
  1. ; OUTPUT - Load display array
  1. ;
  1. N Y,X
  1. ;-- suicide indicator
  1. S Y=$S($P(N300,U,2)=1:"Attempted",$P(N300,U,2)=2:"Accomplished",1:"")_U
  1. ;-- legionnaire's
  1. S Y=Y_$S($P(N300,U,3)=1:"YES",1:"NO")_U
  1. ;-- abused substance
  1. S Y=Y_$S($P(N300,U,4):$P($G(^DIC(45.61,$P(N300,U,4),0)),U),1:"")_U
  1. ;-- psych class severity
  1. I $P(N300,U,5)]"" D
  1. . S X=$P(N300,U,5)
  1. . S Y=Y_$S(X]"":$P($P($P(^DD(45.02,300.05,0),U,3),";",X),":",2),1:"")_U
  1. I $P(N300,U,5)="" S Y=Y_U
  1. ;-- current func assessment
  1. S Y=Y_$S($P(N300,U,6):$P(N300,U,6),1:"")_U
  1. ;-- high level psych class
  1. S Y=Y_$S($P(N300,U,7):$P(N300,U,7),1:"")_U
  1. Q Y
  1. ;