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

AZPPTCP.m

Go to the documentation of this file.
AZPPTCP ;PAO/FCJ;COPY PATIENTS HRN TO NEW FACILITY [ 04/11/96  3:35 PM ]
 ;1/4/94
 S U="^",(DFN,CT,TST)=0
FAC S DIC(0)="AMZQE",DIC("A")="Create Patient globals for which Facility: "
 S DIC="^AUTTLOC(" D ^DIC G:Y<0 EXT 
 S FAC=$P(Y,U),FACNM=Y(0)
 W !!
FAC2 S DIC(0)="AMZQE",DIC("A")="Copy Health Record Numbers from which Facility: "
 S DIC="^AUTTLOC(" D ^DIC G:Y<0 EXT 
 S AZPFAC=$P(Y,U),AZPNM=Y(0) D CHK
 I TST=0 W !,"ERROR: THIS FACILITY DOES NOT EXIST IN THE AUPNPAT GLOBAL" G FAC
 F  S DFN=$O(^AUPNPAT(DFN)) Q:'DFN  I $D(^AUPNPAT(DFN,41,AZPFAC,0)) D  
 .S DATA=$G(^AUPNPAT(DFN,41,AZPFAC,0))
 .;I DATA="" K ^DPT(DFN),^AUPNPAT(DFN) Q
 .S CT=CT+1
 .S HRN=$P(^AUPNPAT(DFN,41,AZPFAC,0),U,2)
 .S:HRN'="" ^AUPNPAT("D",HRN,DFN,FAC)=""
 .S ^AUPNPAT(DFN,41,FAC,0)=^AUPNPAT(DFN,41,AZPFAC,0)
 .S $P(^AUPNPAT(DFN,41,FAC,0),U)=FAC
 .S $P(^AUPNPAT(DFN,41,0),U,4)=$P(^AUPNPAT(DFN,41,0),U,4)+1
 .S:FAC>AZPFAC $P(^AUPNPAT(DFN,41,0),U,3)=FAC
 G EXT1
CHK ;TEST FOR FACILITY IN WITHIN DATA
 F  S DFN=$O(^AUPNPAT(DFN)) Q:DFN'?1N.N  D  Q:TST=1
 .S DATA=$G(^AUPNPAT(DFN,41,AZPFAC,0)) I DATA'="" S TST=1
 S DFN=0 Q
EXT1 W !,"There are ",CT," patients registered for the ",$P(^DIC(4,FAC,0),U)," Facility"
EXT K DIC,X,X1,Y,AZPFAC,TST,DFN,HRN,FACNM,FAC,CT Q