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

PXRMGECW.m

Go to the documentation of this file.
PXRMGECW ;SLC/JVS -Extract data for GEC Reports Cont'd ;5/23/03  12:49
 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
 Q
 ;
 ;Arrays
 ;^TMP("PXRMGEC",$J,    = Root Reference
 ;"REF",DATE,DFN)       = Number of HF in Referral
 ;"REFDFN",DFN)         = Number of Referrals per Patient
 ;"HS"                  = Heath Summary Array
 Q
 ;
PATIENT ;Patient,Count
 K ^TMP("PXRMGEC",$J,"REFDFNN")
 K ^TMP("PXRMGEC",$J,"REFDFN")
 N DATE,DFN,SSN
 S DATE="" F  S DATE=$O(^TMP("PXRMGEC",$J,"REF",DATE)) Q:DATE=""  D
 .S DFN="" F  S DFN=$O(^TMP("PXRMGEC",$J,"REF",DATE,DFN)) Q:DFN=""  D
 ..S DFNXX=$P($G(^DPT(DFN,0)),"^",1)
 ..S SSN=$P($G(^DPT(DFN,0)),"^",9)
 ..I $D(^TMP("PXRMGEC",$J,"REFDFN",DFN)) S ^TMP("PXRMGEC",$J,"REFDFN",DFN)=$G(^TMP("PXRMGEC",$J,"REFDFN",DFN))+1
 ..E  S ^TMP("PXRMGEC",$J,"REFDFN",DFN)=1
 ..I $D(^TMP("PXRMGEC",$J,"REFDFNN",DFNXX)) S ^TMP("PXRMGEC",$J,"REFDFNN",DFNXX)=$G(^TMP("PXRMGEC",$J,"REFDFNN",DFNXX))+1
 ..E  S ^TMP("PXRMGEC",$J,"REFDFNN",DFNXX)=1
 ..I $D(^TMP("PXRMGEC",$J,"REFDFNN",DFNXX,SSN)) S ^TMP("PXRMGEC",$J,"REFDFNN",DFNXX,SSN)=$G(^TMP("PXRMGEC",$J,"REFDFNN",DFNXX,SSN))+1
 ..E  S ^TMP("PXRMGEC",$J,"REFDFNN",DFNXX,SSN)=1
 ;
 Q
LOCCNT ;Count by date
 N LOC,DATE
 S LOC="" F  S LOC=$O(^TMP("PXRMGEC",$J,"REFLOC",LOC)) Q:LOC=""  D
 .S DATE=0 F  S DATE=$O(^TMP("PXRMGEC",$J,"REFLOC",LOC,DATE)) Q:DATE=""  D
 ..I $D(^TMP("PXRMGEC",$J,"REFLOCC",LOC)) S ^TMP("PXRMGEC",$J,"REFLOCC",LOC)=$G(^TMP("PXRMGEC",$J,"REFLOCC",LOC))+1
 ..E  S ^TMP("PXRMGEC",$J,"REFLOCC",LOC)=1
 Q
 ;
DOCCNT ;Count by date
 N DOC,DATE,DIEN
 S DOC="" F  S DOC=$O(^TMP("PXRMGEC",$J,"REFDOC",DOC)) Q:DOC=""  D
 .S DATE=0 F  S DATE=$O(^TMP("PXRMGEC",$J,"REFDOC",DOC,DATE)) Q:DATE=""  D
 ..S DIEN=0 F  S DIEN=$O(^TMP("PXRMGEC",$J,"REFDOC",DOC,DATE,DIEN)) Q:DIEN=""  D
 ...I $D(^TMP("PXRMGEC",$J,"REFDOCC",DOC,DIEN)) S ^TMP("PXRMGEC",$J,"REFDOCC",DOC,DIEN)=$G(^TMP("PXRMGEC",$J,"REFDOCC",DOC,DIEN))+1
 ...E  S ^TMP("PXRMGEC",$J,"REFDOCC",DOC,DIEN)=1
 Q
 ;
DATECNT ;Count by date
 N DATE,DFN
 S DATE=0 F  S DATE=$O(^TMP("PXRMGEC",$J,"REF",DATE)) Q:DATE=""  D
 .S DFN=0 F  S DFN=$O(^TMP("PXRMGEC",$J,"REF",DATE,DFN)) Q:DFN=""  D
 ..I $D(^TMP("PXRMGEC",$J,"REFDATE",$P(DATE,".",1))) S ^TMP("PXRMGEC",$J,"REFDATE",$P(DATE,".",1))=$G(^TMP("PXRMGEC",$J,"REFDATE",$P(DATE,".",1)))+1
 ..E  S ^TMP("PXRMGEC",$J,"REFDATE",$P(DATE,".",1))=1
 Q
 ;
INIT ;Initialize values in PCE DATA SOURCE FILE
 N GEX,FLAG,III
 S FLAG=0
 I '$D(^PX(839.7,"B","GEC1")) S GEX(1,839.7,"+1,",.01)="GEC1",FLAG=1
 I '$D(^PX(839.7,"B","GEC2")) S GEX(1,839.7,"+2,",.01)="GEC2",FLAG=1
 I '$D(^PX(839.7,"B","GEC3")) S GEX(1,839.7,"+3,",.01)="GEC3",FLAG=1
 I '$D(^PX(839.7,"B","GECF")) S GEX(1,839.7,"+4,",.01)="GECF",FLAG=1
 I FLAG D UPDATE^DIE("","GEX(1)")
 ;CLEAN OUT 801.5
 I $D(^PXRMD(801.5)) D
 .S DIK="^PXRMD(801.5,"
 .F III=1:1:1000 S DA=III D ^DIK
 .K ^PXRMD(801.5,"ACOPY")
 Q