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

VAFCPDT2.m

Go to the documentation of this file.
VAFCPDT2 ;BIR/CML/ALS-DISPLAY MPI/PD INFORMATION FOR SELECTED PATIENT ;14 Nov 2018  4:20 PM
 ;;5.3;Registration;**414,505,627,697,797,876,937,944,974**;Aug 13, 1993;Build 2
 ;Reference to ^MPIF(984.9,"C" supported by IA #3298
 ;
CMORHIS ;Find CMOR History
 I '$O(^DPT(DFN,"MPICMOR",0)) G CMORCHG
 I $Y+4>IOSL&($E(IOST,1,2)="C-") D  Q:QFLG
 .S LNQ=22 D SS^VAFCPDAT Q:QFLG
 .W @IOF,!,"MPI/PD data for: ",NAME,"  (DFN #",DFN,")",!,LN2
 D CHISHDR
 S HIS=0 F  S HIS=$O(^DPT(DFN,"MPICMOR",HIS)) Q:'HIS  D  Q:QFLG
 .S DIC=2,DR="993",DR(2.0993)=".01;3",DA=DFN,DA(2.0993)=HIS
 .S DIQ(0)="E",DIQ="CMORNODE"
 .D EN^DIQ1 K DIC,DR,DA,DIQ
 .S HISCMOR=$G(CMORNODE(2.0993,HIS,.01,"E"))
 .I +HISCMOR S HISCMOR=$$GET1^DIQ(4,HISCMOR,.01)
 .S CHGDT=$G(CMORNODE(2.0993,HIS,3,"E"))
 .I $Y+3>IOSL&($E(IOST,1,2)="C-") D  Q:QFLG
 ..S LNQ=22 D SS^VAFCPDAT Q:QFLG
 ..W @IOF,!,"MPI/PD data for: ",NAME,"  (DFN #",DFN,")",!,LN2 D CHISHDR
 .W !,$P(CHGDT,"@"),?12," - CMOR changed from ",HISCMOR
 ;
CMORCHG ;Find CMOR change request
 I '$O(^MPIF(984.9,"C",DFN,0)) G EXT
 I $Y+4>IOSL&($E(IOST,1,2)="C-") D  Q:QFLG
 .S LNQ=22 D SS^VAFCPDAT Q:QFLG
 .W @IOF,!,"MPI/PD data for: ",NAME,"  (DFN #",DFN,")",!,LN2
 D CCHGHDR
 S CHG=0 F  S CHG=$O(^MPIF(984.9,"C",DFN,CHG)) Q:'CHG  D  Q:QFLG
 .S DIC=984.9,DA=CHG,DR=".01;.03;.06;.07;.08;1.03",DIQ="CHGNODE"
 .S DIQ(0)="EI" D EN^DIQ1 K DIC,DA,DR,DIQ
 .S CHGNUM=$G(CHGNODE(984.9,CHG,.01,"E"))
 .S CHGDT=$G(CHGNODE(984.9,CHG,.03,"E"))
 .S TMSG=$G(CHGNODE(984.9,CHG,.08,"E"))
 .S TREQ=$G(CHGNODE(984.9,CHG,1.03,"E"))
 .S SITE=$G(CHGNODE(984.9,CHG,.07,"E"))
 .S STATUS=$G(CHGNODE(984.9,CHG,.06,"E"))
 .I $Y+4>IOSL&($E(IOST,1,2)="C-") D  Q:QFLG
 ..S LNQ=22 D SS^VAFCPDAT Q:QFLG
 ..W @IOF,!,"MPI/PD data for: ",NAME,"  (DFN #",DFN,")",!,LN2 D CCHGHDR
 .W !,"REQUEST #",CHGNUM," - ",TMSG," ",CHGDT
 .W !?4,"Type of Request: ",TREQ," ",SITE
 .W !?4,"Status : ",STATUS,!
 ;
EXT ;Extended patient demographic data
 I $E(IOST,1,2)="C-" D  Q:QFLG
 .S LNQ=22 D SS^VAFCPDAT Q:QFLG
 .W @IOF
 I QFLG=1 G QUIT^VAFCPDAT
 W !!,"Additional DPT Data for: ",NAME,"  (DFN #",DFN,")",!,LN2
 S DA=DFN,DIC=2,DIQ="XDATA",DIQ(0)="EI"
 ;Story 513046 (elz) place of birth prov and country
 S DR=".05;.08;.092;.093;.219;.2401;.2402;.2403;.211;.302;.323;.341;.331;.361;1901;.325;.328;.326;.327;.097;.525;391;.0931;.0932"  ;**876 - MVI_3432 (cml)
 N COB,SOB,FNM,MNM,MMNM,NOK,NOKN,DESIG,EMER,ELIG,VET,SRVBR,SRVNUM,SRVEDT,SRVSDT,SRVCPCT,POSRVC,FILEDT,MARS,RELP,POW,NODE,MSD,PATTYPE,POBP,POBC  ;**876 - MVI_3432 (cml)
 D EN^DIQ1 K DIC,DA,DR,DIQ
 S COB=$G(XDATA(2,DFN,.092,"E")),SOB=$G(XDATA(2,DFN,.093,"E"))
 S FILEDT=$G(XDATA(2,DFN,.097,"E")),FNM=$G(XDATA(2,DFN,.2401,"E"))
 S MNM=$G(XDATA(2,DFN,.2402,"E")),MMNM=$G(XDATA(2,DFN,.2403,"E"))
 S NOK=$G(XDATA(2,DFN,.211,"E")),DESIG=$G(XDATA(2,DFN,.341,"E"))
 S EMER=$G(XDATA(2,DFN,.331,"E"))
 S ELIG=$G(XDATA(2,DFN,.361,"E")),VET=$G(XDATA(2,DFN,1901,"E"))
 S SRVBR=$G(XDATA(2,DFN,.325,"E")),SRVNUM=$G(XDATA(2,DFN,.328,"E"))
 S SRVEDT=$G(XDATA(2,DFN,.326,"E")),SRVSDT=$G(XDATA(2,DFN,.327,"E"))
 S MARS=$G(XDATA(2,DFN,.05,"E")),RELP=$G(XDATA(2,DFN,.08,"E"))
 S POSRVC=$G(XDATA(2,DFN,.323,"E")),SRVCPCT=$G(XDATA(2,DFN,.302,"E"))
 S NOKN=$G(XDATA(2,DFN,.219,"E")),POW=$G(XDATA(2,DFN,.525,"E"))
 S PATTYPE=$G(XDATA(2,DFN,391,"E"))  ;**876 - MVI_3432 (cml)
 S POBC=$G(XDATA(2,DFN,.0931,"I")) ;Story 513046 (elz)
 S POBP=$G(XDATA(2,DFN,.0932,"E")) ;Story 513046 (elz)
 ;
 W !,"PLACE OF BIRTH [CITY]",?31,": ",COB
 W:'$L(POBP) !,"PLACE OF BIRTH [STATE]",?31,": ",SOB
 W:$L(POBP) !,"PLACE OF BIRTH PROVINCE",?31,": ",POBP ;Story 513046 (elz)
 W !,"PLACE OF BIRTH COUNTRY",?31,": ",$S(POBC:$$GET1^DIQ(779.004,POBC_",",2),1:"") ; Story 513046 (elz)
 W !,"FATHER'S NAME",?31,": ",FNM
 W !,"MOTHER'S NAME",?31,": ",MNM
 W !,"MOTHER'S MAIDEN NAME",?31,": ",MMNM
 W !,"NAME OF PRIMARY NEXT OF KIN",?31,": ",NOK
 W !,"NEXT OF KIN PHONE NUMBER",?31,": ",NOKN
 W !,"NAME OF DESIGNEE",?31,": ",DESIG
 W !,"EMERGENCY NAME",?31,": ",EMER
 W !,"MARITAL STATUS",?31,": ",MARS
 W !,"RELIGIOUS PREFERENCE",?31,": ",RELP
 ;
 D DEM^VADPT
 ;ETHNICITY info
 I $G(VADM(11,1)) W !,"ETHNICITY INFORMATION",?31,": ",$P(VADM(11,1),"^",2)
 ;
 ;RACE multiple
 I $O(VADM(12,0)) D
 .W !,"RACE INFORMATION (multiple):"
 .S RACEMUL=0 F  S RACEMUL=$O(VADM(12,RACEMUL)) Q:'RACEMUL  W !?3,$P(VADM(12,RACEMUL),"^",2)
 ;
 W !,"PRIMARY ELIGIBILITY CODE",?31,": ",ELIG
 W !,"PATIENT TYPE",?31,": ",PATTYPE  ;**876 - MVI_3432 (cml)
 W !,"VETERAN (Y/N)?",?31,": ",VET
 W !,"SERVICE CONNECTED PERCENT",?31,": ",SRVCPCT
 W !,"PERIOD OF SERVICE",?31,": ",POSRVC
 W !,"POW STATUS INDICATED?",?31,": ",POW
 ;
 ;Military Service Data multiple
 I $O(^DPT(DFN,.3216,0)) D
 .W !,"MILITARY SERVICE (multiple):"
 .W !,"Service Branch   Service #   Entry DT       Separation DT"
 .W !,"---------------------------------------------------------"
 .K MSDARR
 .S MSD=0 F  S MSD=$O(^DPT(DFN,.3216,MSD)) Q:'MSD  D
 ..S NODE=^DPT(DFN,.3216,MSD,0)
 ..S SRVEDT=$P(NODE,"^"),SRVSDT=$P(NODE,"^",2),SRVNUM=$P(NODE,"^",5),SRVBR=$$GET1^DIQ(23,$P(NODE,"^",3),.01)
 ..S MSDARR(-SRVEDT)=SRVSDT_"^"_SRVNUM_"^"_SRVBR
 .S SRVEDT="" F  S SRVEDT=$O(MSDARR(SRVEDT)) Q:'SRVEDT  D
 ..W !?0,$P(MSDARR(SRVEDT),"^",3),?17,$P(MSDARR(SRVEDT),"^",2),?29,$$FMTE^XLFDT($P(SRVEDT,"-",2)),?44,$$FMTE^XLFDT(+MSDARR(SRVEDT))
 ;
 ;**974,Story 841921 (mko): Name Components
 N NCIEN
 S NCIEN=+$P($G(^DPT(DFN,"NAME")),"^")
 I NCIEN W !,"PATIENT NAME COMPONENTS:" D NC(NCIEN,3,22)
 ;
 ;ALIAS multiple
 I $O(^DPT(DFN,.01,0)) D
 .W !,"ALIAS (multiple):"
 .S ALIAS=0 F  S ALIAS=$O(^DPT(DFN,.01,ALIAS)) Q:'ALIAS  D
 ..;**974,Story 841921 (mko): Show the entire Alias Name rather than truncating to 30
 ..W !?3,$P(^DPT(DFN,.01,ALIAS,0),"^"),?40,"SSN: "_$P($G(^DPT(DFN,.01,ALIAS,0)),"^",2)
 ..;**974,Story 841921 (mko): Alias Name Components
 ..D NC(+$P($G(^DPT(DFN,.01,ALIAS,0)),"^",3),6,25)
 ;
 ; Preferred Name
 I $G(DNODE(2,DFN,.2405,"E"))]"" W !,"PREFERRED NAME",?31,": ",DNODE(2,DFN,.2405,"E")
 ;
 W !,"DATE ENTERED IN PATIENT FILE",?31,": ",FILEDT
 ;
 K ALIAS,XDATA,CHG,CHGNUM,CHGDT,TMSG,TREQ,SITE,STATUS,HIS,HISCMOR,CMORNODE,CHGNODE,RACEMUL,VADM,MSDARR
 Q
 ;
NC(NCIEN,TAB1,TAB2) ;**974,Story 841921 (mko): Get and write Name Components
 Q:'$G(NCIEN)
 S TAB1="?"_+$G(TAB1),TAB2="?"_+$G(TAB2)
 N DIERR,DIHELP,DIMSG,NC,NCIENS,TARG,MSG
 S NCIENS=NCIEN_","
 D GETS^DIQ(20,NCIENS,"1;2;3;5","I","TARG","MSG") Q:$D(DIERR)
 S NC=$G(TARG(20,NCIENS,1,"I")) W:NC]"" !,@TAB1,"Family (Last) Name",@TAB2,": "_NC
 S NC=$G(TARG(20,NCIENS,2,"I")) W:NC]"" !,@TAB1,"Given (First) Name",@TAB2,": "_NC
 S NC=$G(TARG(20,NCIENS,3,"I")) W:NC]"" !,@TAB1,"Middle Name",@TAB2,": "_NC
 S NC=$G(TARG(20,NCIENS,5,"I")) W:NC]"" !,@TAB1,"Suffix",@TAB2,": "_NC
 Q
 ;
CHISHDR W !!,"CMOR History:",!,"--------------"
 Q
CCHGHDR W !!,"CMOR Change Request History:",!,"----------------------------"
 Q