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

DGRP11B.m

Go to the documentation of this file.
DGRP11B ;ALB/JAM,ARF - REGISTRATION SCREEN 11.5.1/VERIFICATION INFORMATION ;Mar 09, 2020@12:34
 ;;5.3;Registration;**997,1014**;AUG 13, 1993;Build 42
 ;IA's:
 ; GETDFN^MPIF001 - Supported #2701 ;retrieves DFN from ICN via MPI
 ;
EN(DFN) ;Main entry point to invoke the DGEN CGP DETAIL list
 ; Input  -- DFN      Patient IEN
 ;
 D WAIT^DICD
 D EN^VALM("DGEN CGP DETAIL")
 Q
 ;
HDR ;Header code
 N X
 D LISTHDR^DGRPU(1) ;DG*5.3*1014 - ARF - sets patient data in the 1st and 2nd entries in VALMHDR array 
 ;D PID^VADPT                                             ;DG*5.3*1014 begin - comment previous code 
 ;S VALMHDR(1)=$E("Patient: "_$P($G(^DPT(DFN,0)),U),1,30)
 ;S VALMHDR(1)=VALMHDR(1)_" ("_VA("BID")_")"
 ;S X="PATIENT TYPE UNKNOWN"
 ;I $D(^DPT(DFN,"TYPE")),$D(^DG(391,+^("TYPE"),0)) S X=$P(^(0),U,1)
 ;S VALMHDR(1)=$$SETSTR^VALM1(X,VALMHDR(1),60,80)     ;DG*5.3*1014 end - comment previous code
 Q
 ;
INIT ;Build patient Caregiver screen
 D CLEAN^VALM10
 D CLEAR^VALM1
 D GETCGP
 Q
 ;
GETCGP ;Load Caregiver data from MPI array into TMP(VALMAR global for display
 N DGCGRET,DGCGTCNT,DGCG,DGCGG1,DGCGICN,DGSSN,DGCGRELTYP,DGCGSUBTYP,DGCGSTATUS,DGX,DGY,DGCGSTATDT,DGCGCNT,DGCGDISPDT
 N LINEVAR,DGDFN,DGFNAME,DGLNAME,DGNAME
 ; Call MPI interface to get patient relationship array
 D GET^VAFCREL(.DGCGRET,DFN)
 ; Get array of Cargivers (DGCG) from the MPI Relationship array
 D MPIGETCG^DGRP11A(.DGCGRET,.DGCG,.DGCGTCNT)
 S VALMCNT=0,DGCGCNT=0
 ; Format of DGCG array:
 ;  ICN^RELTYP^RELTYPDISP^RCODE^RSTATUS^RSTATUSDISP^RSTATDATE^CGSPONSNAM"
 ;  eg: DGCG(1)="1002345678V123456^CGP^CAREGIVER: PRIMARY^QUAL^ACTIVE^APPROVED^20200220^Jones, William M"
 S LINEVAR="CAREGIVER"
 F  S DGCGCNT=$O(DGCG(DGCGCNT)) Q:DGCGCNT=""  D
 . S DGCGG1=DGCG(DGCGCNT)
 . S VALMCNT=VALMCNT+1
 . S LINEVAR=$$SETFLD^VALM1("<"_VALMCNT_">",LINEVAR,"NO")
 . S DGNAME=$P(DGCGG1,U,8)
 . S DGNAME=$$UPPER^DGUTL(DGNAME)
 . ;Remove extra space between Last and First names 
 . S DGLNAME=$P(DGNAME,","),DGFNAME=$P(DGNAME,",",2),DGFNAME=$S($E(DGFNAME)=" ":$E(DGFNAME,2,99),1:DGFNAME)
 . S LINEVAR=$$SETFLD^VALM1(" "_$E(DGLNAME_","_DGFNAME,1,30),LINEVAR,"NAME")
 . ;ICN-->DFN-->SSN
 . S DGCGICN=$P(DGCGG1,U,1)
 . S DGDFN=$$GETDFN^MPIF001(DGCGICN)
 . S DGX=$S($D(^DPT(+DGDFN,0)):^(0),1:"")
 . S DGSSN=$P(DGX,"^",9)
 . ; Grab chars 6-10 of SSN in case of Pseudo SSN
 . S LINEVAR=$$SETFLD^VALM1($E(DGSSN,6,10),LINEVAR,"L4SSN")
 . S DGCGRELTYP=$P(DGCGG1,U,2)
 . S DGCGRELTYP=$$UPPER^DGUTL(DGCGRELTYP)
 . S DGCGSUBTYP=$S(DGCGRELTYP="CGP":"PRIMARY",DGCGRELTYP="CGS":"SECONDARY",DGCGRELTYP="CGG":"GENERAL",1:"??")
 . S LINEVAR=$$SETFLD^VALM1(DGCGSUBTYP,LINEVAR,"SUBTYPE")
 . S DGCGSTATUS=$P(DGCGG1,U,5)
 . S DGCGSTATUS=$$UPPER^DGUTL(DGCGSTATUS)
 . ; Pending-> In Process, Decline -> Denied, Inactive->Revoked, Active->Approved, Terminated->Benefit End
 . S DGCGSTATUS=$S(DGCGSTATUS="PENDING":"IN PROCESS",DGCGSTATUS="DECLINE":"DENIED",DGCGSTATUS="INACTIVE":"REVOKED",DGCGSTATUS="ACTIVE":"APPROVED",DGCGSTATUS="TERMINATED":"BENEFIT END",1:DGCGSTATUS)
 . S LINEVAR=$$SETFLD^VALM1($E(DGCGSTATUS,1,13),LINEVAR,"STATUS")
 . S DGX=$P(DGCGG1,U,7),DGY=$E(DGX,5,6)_"/"_$E(DGX,7,8)_"/"_$E(DGX,1,4) D DT^DILF("E",DGY,.DGCGSTATDT)
 . ; strip the space between the day and year
 . S DGCGDISPDT=$P(DGCGSTATDT(0)," ",1,2)_$P(DGCGSTATDT(0)," ",3)
 . S LINEVAR=$$SETFLD^VALM1(DGCGDISPDT,LINEVAR,"DATE")
 . D SET^VALM10(VALMCNT,LINEVAR,VALMCNT)
 Q
 ;
HELP ;Help code
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ;Exit code
 D CLEAN^VALM10
 D CLEAR^VALM1
 Q