Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (15 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

Location:
WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM
Files:
86 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DG10.m

    r613 r623  
    1 DG10    ;ALB/MRL,DAK,AEG,PHH-LOAD/EDIT PATIENT DATA ; 1/5/2006  21:46
    2         ;;5.3;Registration;**32,109,139,149,182,326,513,425,574,642,658,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19 START   ;
    20         D LO^DGUTL
    21         I $G(DGPRFLG)=1,$G(DGPLOC)=1 D  G Q:$G(DGRPOUT),A1
    22         .; D EN^DGRPD,REG^IVMCQ($G(DFN))
    23         . D EN^DGRPD
    24         . Q:$G(DGRPOUT)
    25         . ;
    26         . ; ** start of VOE change 1 of 3: DAOU/WCJ,VA/CJS,WV/TOAD 1/5/2006 **
    27         . ;
    28         . ; HEC query call only wanted/needed for VA agency code
    29         . ;
    30         . I $G(DUZ("AG"))="V" D REG^IVMCQ($G(DFN))
    31         . ;
    32         . ; ** end of VOE change 1 **
    33         . ;
    34         . D HINQ
    35         ;
    36 A       W !! K VET,DIE,DIC,CARD S DIC=2,DLAYGO=2,DIC(0)="ALEQM" K DIC("S") D ^DIC G Q:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) K DLAYGO
    37         N Y D PAUSE I DGNEW D NEW^DGRP S DA=DFN,VET=$S($D(^DPT(DFN,"VET")):^("VET")'="Y",1:0)
    38         ;
    39         ;MPI QUERY
    40         ;check to see if CIRN PD/MPI is installed
    41         N X S X="MPIFAPI" X ^%ZOSF("TEST") G:'$T SKIP
    42         K MPIFRTN
    43         ;
    44         ; ** start of VOE change 2 of 3: DAOU/WCJ,VA/CJS,WV/TOAD 1/5/2006 **
    45         ;
    46         ; MPI query call only wanted/needed for VA agency code
    47         ;
    48         I $G(DUZ("AG"))="V"!$$GET^XPAR("SYS","DG MPI") D MPIQ^MPIFAPI(DFN)
    49         ;
    50         ; ** end of VOE change 2 **
    51         ;
    52         K MPIFRTN
    53         ;
    54         I +$G(DGNEW) D
    55         . ; query CMOR for Patient Record Flag Assignments if NEW patient and
    56         . ; display results
    57         . I $$PRFQRY^DGPFAPI(DFN) D DISPPRF^DGPFAPI(DFN)
    58         ;
    59 SKIP    ;
    60         S DGELVER=0 D EN^DGRPD I $D(DGRPOUT) K DGRPOUT G A
    61         ;
    62         ; ** start of VOE change 3 of 3: DAOU/WCJ,VA/CJS,WV/TOAD 1/5/2006 **
    63         ;
    64         ; these query calls only wanted/needed for VA agency code
    65         ;
    66         I $G(DUZ("AG"))="V" D HINQ,REG^IVMCQ($G(DFN))
    67         G A1
    68         ;
    69         ; ** end of VOE change 3 **
    70         ;
    71         ;
    72 HINQ    ;
    73         S Y=$S($D(^DG(43,1,0)):^(0),1:0) I $P(Y,U,27) S X="DVBHQZ4" X ^%ZOSF("TEST") I $T D
    74         .N DGROUT
    75         .S DGROUT=X
    76         .I $G(DFN) D
    77         ..N X,Y,DGRP
    78         ..F X=.3,.32 S DGRP(X)=$G(^DPT(DFN,X))
    79         ..W !,"     Money Verified: " S Y=$P(DGRP(.3),"^",6) X:Y]"" ^DD("DD") W $S(Y]"":Y,1:"NOT VERIFIED")
    80         ..W ?40,"   Service Verified: " S Y=$P(DGRP(.32),"^",2) X:Y]"" ^DD("DD") W $S(Y]"":Y,1:"NOT VERIFIED")
    81         .D @("EN^"_DGROUT) K Y Q  ;from dgdem0
    82         Q
    83         ;
    84         ;   SDIEMM is used as a flag by AMBCARE Incomplete Encounter Management
    85         ;   to bypass the embossing routines when calling load/edit from IEMM
    86         ;
    87 A1      D  G H:'%,CK:%'=1 S DGRPV=0 D EN1^DGRP,MT(DFN),CP G Q:$G(DGPRFLG)=1 G Q:$G(SDIEMM) G Q:'$D(DA),EMBOS
    88         .W !,"Do you want to ",$S(DGNEW:"enter",1:"edit")," Patient Data"
    89         .S %=1 D YN^DICN
    90         .I +$G(DGNEW) Q
    91         .I $$ADD^DGADDUTL($G(DFN)) ;
    92         ;
    93 H       W !?5,"Enter 'YES' to enter/edit registration data or 'NO' to continue without",!?5,"editing."
    94         G A1
    95         ;
    96 CK      S DGEDCN=1 D ^DGRPC,MT(DFN),CP
    97         G Q:$G(DGPRFLG)=1 G Q:$G(SDIEMM)
    98         I $G(DGER)[55 K DIR S DIR(0)="Y",DIR("A")="Do you wish to return to Screen #9 to enter missing Income Data? " D ^DIR K DIR
    99         ;G:Y ^DGRP9
    100         ;
    101 EMBOS   ;W ! D EMBOS^DGQEMA G A
    102         G A
    103         ;
    104         ;
    105 Q       K X,Y,Z,DIC,DGELVER,DGNEW,DGRPV,VET Q
    106         ;
    107 MT(DFN) ; Check if user requires a means test.  Ask user if they want to proceedif
    108         ; one is required
    109         I '$D(SDIEMM) DO
    110         .N DGREQF,DIV
    111         .D EN^DGMTR
    112         .I DGREQF D EDT^DGMTU(DFN,DT):$P($$MTS^DGMTU(DFN),U,2)="R"
    113         .Q
    114         I $D(SDIEMM) DO
    115         .N DGMTI
    116         .S DGMTI=$$LST^DGMTU(DFN,SCINF("ENCOUNTER"),1)
    117         .I $P(DGMTI,U,4)="R" D  I 1
    118         ..S DGMT0=$G(^DGMT(408.31,+DGMTI,0)),DGMTDT=$P(DGMT0,"^")
    119         ..I '$$OKTOCONT(DGMTDT) Q
    120         ..S DGMTI=+DGMTI,DGMTYPT=1,DGMTACT="COM",DGMTROU="COM^DGMTEO" D EN^DGMTSC
    121         .E  D WARNING
    122         .Q
    123         Q
    124         ;
    125 WARNING ;
    126         ;prints a warning to the screen about means test
    127         ;
    128         W !!,"A means test for this encounter date was not found and may be required!"
    129         W !,"Further investigation will be needed."
    130         W !
    131         D PAUSE
    132         Q
    133         ;
    134 PAUSE   ;
    135         N DIR
    136         S DIR(0)="FAO",DIR("A")="Press ENTER to continue " D ^DIR
    137         Q
    138         ;
    139 OKTOCONT(Y)     ;
    140         ;
    141         N DIR
    142         W !!,"Patient Requires a means Test"
    143         X ^DD("DD")
    144         W !,"Primary Means Test Required from '",Y,"'",!
    145         ;
    146         I $D(SDIEMM),'$D(^XUSEC("SCENI MEANS TEST EDIT",DUZ)) DO  G OKQ
    147         .W !,$C(7),"You do not have the appropriate IEMM Security Key.  Contact your supervisor.",!
    148         .D PAUSE
    149         .S Y=0
    150         ;
    151         S DIR("A")="Do you wish to proceed with the means test at this time"
    152         S DIR("B")="YES"
    153         S DIR(0)="Y"
    154         D ^DIR
    155 OKQ     Q $S(Y=1:1,1:0)
    156         ;
    157 CP      ;If not (autoexempt or MTested) & no CP test this year then
    158         ;prompt for add/edit cp test
    159         N DIV,DGIB,DGIBDT,DGX,X,DIRUT,DTOUT
    160         G:'$P($G(^DG(43,1,0)),U,41) QTCP ;USE CP FLAG
    161         S DGIBDT=$S($D(DFN1):9999999-DFN1,1:DT)
    162         D EN^DGMTCOR
    163         I +$G(DGNOCOPF) S DGMTCOR=0
    164         I DGMTCOR D THRESH^DGMTCOU1(DGIBDT) D EDT^DGMTCOU(DFN,DT)
    165         K DGNOCOPF
    166 QTCP    Q
     1DG10 ;ALB/MRL,DAK,AEG,PHH-LOAD/EDIT PATIENT DATA ; 1/5/2006  21:46
     2 ;;5.3;Registration;**32,109,139,149,182,326,513,425,574,642,658,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19START ;
     20 D LO^DGUTL
     21 I $G(DGPRFLG)=1,$G(DGPLOC)=1 D  G Q:$G(DGRPOUT),A1
     22 .; D EN^DGRPD,REG^IVMCQ($G(DFN))
     23 . D EN^DGRPD
     24 . Q:$G(DGRPOUT)
     25 . ;
     26 . ; ** start of VOE change 1 of 3: DAOU/WCJ,VA/CJS,WV/TOAD 1/5/2006 **
     27 . ;
     28 . ; HEC query call only wanted/needed for VA agency code
     29 . ;
     30 . I $G(DUZ("AG"))="V" D REG^IVMCQ($G(DFN))
     31 . ;
     32 . ; ** end of VOE change 1 **
     33 . ;
     34 . D HINQ
     35 ;
     36A W !! K VET,DIE,DIC,CARD S DIC=2,DLAYGO=2,DIC(0)="ALEQM" K DIC("S") D ^DIC G Q:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) K DLAYGO
     37 N Y D PAUSE I DGNEW D NEW^DGRP S DA=DFN,VET=$S($D(^DPT(DFN,"VET")):^("VET")'="Y",1:0)
     38 ;
     39 ;MPI QUERY
     40 ;check to see if CIRN PD/MPI is installed
     41 N X S X="MPIFAPI" X ^%ZOSF("TEST") G:'$T SKIP
     42 K MPIFRTN
     43 ;
     44 ; ** start of VOE change 2 of 3: DAOU/WCJ,VA/CJS,WV/TOAD 1/5/2006 **
     45 ;
     46 ; MPI query call only wanted/needed for VA agency code
     47 ;
     48 I $G(DUZ("AG"))="V"!$$GET^XPAR("SYS","DG MPI") D MPIQ^MPIFAPI(DFN)
     49 ;
     50 ; ** end of VOE change 2 **
     51 ;
     52 K MPIFRTN
     53 ;
     54 I +$G(DGNEW) D
     55 . ; query CMOR for Patient Record Flag Assignments if NEW patient and
     56 . ; display results
     57 . I $$PRFQRY^DGPFAPI(DFN) D DISPPRF^DGPFAPI(DFN)
     58 ;
     59SKIP ;
     60 S DGELVER=0 D EN^DGRPD I $D(DGRPOUT) K DGRPOUT G A
     61 ;
     62 ; ** start of VOE change 3 of 3: DAOU/WCJ,VA/CJS,WV/TOAD 1/5/2006 **
     63 ;
     64 ; these query calls only wanted/needed for VA agency code
     65 ;
     66 I $G(DUZ("AG"))="V" D HINQ,REG^IVMCQ($G(DFN))
     67 G A1
     68 ;
     69 ; ** end of VOE change 3 **
     70 ;
     71 ;
     72HINQ ;
     73 S Y=$S($D(^DG(43,1,0)):^(0),1:0) I $P(Y,U,27) S X="DVBHQZ4" X ^%ZOSF("TEST") I $T D
     74 .N DGROUT
     75 .S DGROUT=X
     76 .I $G(DFN) D
     77 ..N X,Y,DGRP
     78 ..F X=.3,.32 S DGRP(X)=$G(^DPT(DFN,X))
     79 ..W !,"     Money Verified: " S Y=$P(DGRP(.3),"^",6) X:Y]"" ^DD("DD") W $S(Y]"":Y,1:"NOT VERIFIED")
     80 ..W ?40,"   Service Verified: " S Y=$P(DGRP(.32),"^",2) X:Y]"" ^DD("DD") W $S(Y]"":Y,1:"NOT VERIFIED")
     81 .D @("EN^"_DGROUT) K Y Q  ;from dgdem0
     82 Q
     83 ;
     84 ;   SDIEMM is used as a flag by AMBCARE Incomplete Encounter Management
     85 ;   to bypass the embossing routines when calling load/edit from IEMM
     86 ;
     87A1 D  G H:'%,CK:%'=1 S DGRPV=0 D EN1^DGRP,MT(DFN),CP G Q:$G(DGPRFLG)=1 G Q:$G(SDIEMM) G Q:'$D(DA),EMBOS
     88 .W !,"Do you want to ",$S(DGNEW:"enter",1:"edit")," Patient Data"
     89 .S %=1 D YN^DICN
     90 .I +$G(DGNEW) Q
     91 .I $$ADD^DGADDUTL($G(DFN)) ;
     92 ;
     93H W !?5,"Enter 'YES' to enter/edit registration data or 'NO' to continue without",!?5,"editing."
     94 G A1
     95 ;
     96CK S DGEDCN=1 D ^DGRPC,MT(DFN),CP
     97 G Q:$G(DGPRFLG)=1 G Q:$G(SDIEMM)
     98 I $G(DGER)[55 K DIR S DIR(0)="Y",DIR("A")="Do you wish to return to Screen #9 to enter missing Income Data? " D ^DIR K DIR
     99 ;G:Y ^DGRP9
     100 ;
     101EMBOS ;W ! D EMBOS^DGQEMA G A
     102 G A
     103 ;
     104 ;
     105Q K X,Y,Z,DIC,DGELVER,DGNEW,DGRPV,VET Q
     106 ;
     107MT(DFN) ; Check if user requires a means test.  Ask user if they want to proceedif
     108 ; one is required
     109 I '$D(SDIEMM) DO
     110 .N DGREQF,DIV
     111 .D EN^DGMTR
     112 .I DGREQF D EDT^DGMTU(DFN,DT):$P($$MTS^DGMTU(DFN),U,2)="R"
     113 .Q
     114 I $D(SDIEMM) DO
     115 .N DGMTI
     116 .S DGMTI=$$LST^DGMTU(DFN,SCINF("ENCOUNTER"),1)
     117 .I $P(DGMTI,U,4)="R" D  I 1
     118 ..S DGMT0=$G(^DGMT(408.31,+DGMTI,0)),DGMTDT=$P(DGMT0,"^")
     119 ..I '$$OKTOCONT(DGMTDT) Q
     120 ..S DGMTI=+DGMTI,DGMTYPT=1,DGMTACT="COM",DGMTROU="COM^DGMTEO" D EN^DGMTSC
     121 .E  D WARNING
     122 .Q
     123 Q
     124 ;
     125WARNING ;
     126 ;prints a warning to the screen about means test
     127 ;
     128 W !!,"A means test for this encounter date was not found and may be required!"
     129 W !,"Further investigation will be needed."
     130 W !
     131 D PAUSE
     132 Q
     133 ;
     134PAUSE ;
     135 N DIR
     136 S DIR(0)="FAO",DIR("A")="Press ENTER to continue " D ^DIR
     137 Q
     138 ;
     139OKTOCONT(Y) ;
     140 ;
     141 N DIR
     142 W !!,"Patient Requires a means Test"
     143 X ^DD("DD")
     144 W !,"Primary Means Test Required from '",Y,"'",!
     145 ;
     146 I $D(SDIEMM),'$D(^XUSEC("SCENI MEANS TEST EDIT",DUZ)) DO  G OKQ
     147 .W !,$C(7),"You do not have the appropriate IEMM Security Key.  Contact your supervisor.",!
     148 .D PAUSE
     149 .S Y=0
     150 ;
     151 S DIR("A")="Do you wish to proceed with the means test at this time"
     152 S DIR("B")="YES"
     153 S DIR(0)="Y"
     154 D ^DIR
     155OKQ Q $S(Y=1:1,1:0)
     156 ;
     157CP ;If not (autoexempt or MTested) & no CP test this year then
     158 ;prompt for add/edit cp test
     159 N DIV,DGIB,DGIBDT,DGX,X,DIRUT,DTOUT
     160 G:'$P($G(^DG(43,1,0)),U,41) QTCP ;USE CP FLAG
     161 S DGIBDT=$S($D(DFN1):9999999-DFN1,1:DT)
     162 D EN^DGMTCOR
     163 I +$G(DGNOCOPF) S DGMTCOR=0
     164 I DGMTCOR D THRESH^DGMTCOU1(DGIBDT) D EDT^DGMTCOU(DFN,DT)
     165 K DGNOCOPF
     166QTCP Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGCV.m

    r613 r623  
    1 DGCV    ;ALB/DW,ERC,BRM,TMK - COMBAT VET ELIGIBILTY; 10/15/05 ; 3/24/08 7:28am
    2         ;;5.3;Registration;**528,576,564,673,778**; Aug 13, 1993;Build 9
    3         ;
    4 CVELIG(DFN)     ;
    5         ;API will determine whether or not this veteran needs to have CV End
    6         ;Date set.  If this determination cannot be done due to imprecise
    7         ;or missing dates, it returns which dates need editing.
    8         ;Input:
    9         ;  DFN - Patient file IEN
    10         ;Output
    11         ;  RESULT
    12         ;    0 - CV End Date should not be set
    13         ;    1 - CV End Date should be set
    14         ;  If critical dates are imprecise return the following
    15         ;    A - CV End Date should not be set, imprecise Service Sep date
    16         ;    B - CV End Date should not be set, imprecise Combat To date
    17         ;    C - CV End Date should not be set, imprecise Yugoslavia To date
    18         ;    D - CV End Date should not be set, imprecise Somalia To date
    19         ;    E - CV End Date should not be set, imprecise Pers Gulf To date
    20         ;  If the Service Sep Date is missing, and there are no OEF/OIF/UNKNOWN
    21         ;    OEF/OIF records on file, return the following so that it  will
    22         ;    appear on the Imprecise/Missing Date Report
    23         ;    F - missing Service Sep Date & no OEF OIF or OEF/OIF Unknown dates
    24         ;  If critical dates are missing but the corresponding indicator fields
    25         ;    are set to 'YES' return the following
    26         ;    G - missing Combat To Date, but Combat Indicated? = 'Yes'
    27         ;    H - missing PG To Date, but PG Indicated? = 'Yes'
    28         ;    I - missing Somalia To Date, but Somalia Indicator = 'Yes'
    29         ;    J - missing Yugoslavia To Date, but Yugoslavia Indicator = 'Yes'
    30         ;
    31         N DG1,DG2,I,RESULT
    32         N DGCOM,DGCVDT,DGCVFLG,DGGULF,DGSOM,DGSRV,DGYUG,DGOEIF
    33         S (DG1,DG2,RESULT)=0
    34         I $G(DFN)']"" Q RESULT
    35         I '$D(^DPT(DFN)) Q RESULT
    36         ;
    37         ;get combat related data from top-level VistA fields
    38         N DGARR,DGERR
    39         D GETS^DIQ(2,DFN_",",".327;.322012;.322018;.322021;.5294;.5295","I","DGARR","DGERR")
    40         D PARSE
    41         ;
    42         S DG1=$$CHKSSD(DFN) ;check SSD for imprecise or missing
    43         S DGDATE=$G(DGCOM)_"^"_$G(DGYUG)_"^"_$G(DGSOM)_"^"_$G(DGGULF)_"^"_$G(DGOEIF)
    44         ;
    45         I $S(DG1="F":1,1:$P(DGDATE,U,5)>$G(DGSRV)) D
    46         . ; Use OIF/OEF/UNKNOWN OEF/OIF to dt only when SSD missing or SSD less
    47         . ; than OIF/OEF/UNKNOWN OEF/OIF to dt
    48         . N DGSRV,Z
    49         . S DGSRV=$P(DGDATE,U,5),Z=$$CHKSSD(DFN)
    50         . I Z=1 S DG1=Z
    51         ;
    52         S DG2=$$CHKREST(DGDATE,$G(DGSRV)) ;check other "TO" dates for imprecise, missing or invalid
    53         S RESULT=$$RES(DG1,$G(DG2))
    54         Q RESULT
    55         ;
    56 RES(DG1,DG2)    ;determine the final RESULT code from DG1 & DG2
    57         ;if SSD evaluates to earlier than 11/11/98, can't set CV End Date
    58         I DG1=0!($G(DG2)=0) Q 0
    59         ;if SSD is 1
    60         I DG1=1,($G(DG2)=1!($G(DG2)']"")) Q 1
    61         I DG1=1,($G(DG2)=0) Q 0
    62         I DG1=1 Q DG2
    63         ;if SSD is imprecise or missing
    64         I DG1'=1,($G(DG2)=1) S DG2=""
    65         Q DG1_DG2
    66         ;
    67 CHKDATE(DGDATE,I,SSD)   ;check to see if date is imprecise or missing
    68         ;if imprecise check to see if the imprecision prevents CV evaluation
    69         ;if not imprecise check to see if after 11/11/98
    70         ; Note that SSD doesn't appear to ever be used here (TMK)
    71         N RES
    72         S RES=0
    73         I $G(DGDATE)']"",I'=5 D  Q RES
    74         . S RES=$S(I=0:"F",I=1:"G",I=2:"H",I=3:"I",I=4:"J",1:"")
    75         I $E(DGDATE,6,7)="00" D
    76         . I I=0 I DGDATE>2981111 S RES="A" Q
    77         . I DGDATE=2980000!(DGDATE=2981100) D  Q
    78         .. ; Note OIF/OEF/UNKNOWN OEF/OIF will not get here as these dates by
    79         .. ; definition are after 11/11/98
    80         . . S RES=$S(I=0:"A",I=1:"B",I=2:"C",I=3:"D",I=4:"E",1:"")
    81         Q:RES="A" RES
    82         I DGDATE>2981111 S RES=1
    83         Q RES
    84         ;
    85 SETCV(DFN,DGSRV)        ;calculate CV end date
    86         ;    DGSRV is the most recent of the Service Separation Date
    87         ;    or the OEF/OIF To Date, called from file #2 new style
    88         ;    cross reference "ACVCOM"
    89         N DGCVEDT,DGFDA,DGNDAA,DGPLUS3,DGTMPDT,DGYRS
    90         S DGNDAA=3080128
    91         I $G(DFN)']""!($G(DGSRV)']"") Q
    92         I '$D(^DPT(DFN)) Q
    93         I $$GET1^DIQ(2,DFN_",",.5295,"I") Q
    94         D CVRULES(DFN,DGSRV,.DGYRS)
    95         Q:$G(DGYRS)'=3&($G(DGYRS)'=5)
    96         ;NDAA legislation, enacted 1/28/08, gives vets discharged
    97         ;on or after 1/28/03 (2 years previously) CV Eligibility
    98         ;for 5 years.  Vets discharged before 1/28/03 get eligibility
    99         ;for 3 years after enactment (or until 1/27/2011) DG*5.3*778
    100         S DGTMPDT=$S(DGYRS=3:DGNDAA,1:DGSRV)
    101         S DGCVEDT=($E(DGTMPDT,1,3)+DGYRS)_$E(DGTMPDT,4,7)
    102         S DGCVEDT=$$FMADD^XLFDT(DGCVEDT,-1)
    103         S DGFDA(2,DFN_",",.5295)=DGCVEDT
    104         D FILE^DIE(,"DGFDA")
    105         Q
    106         ;
    107 CVRULES(DFN,DGSRV,DGYRS)        ;apply rules for the CV End Date
    108         ;extension project - DG*5.3*778
    109         ;DGSRV - most recent of Service Sep Date or OEIUUF to date
    110         ;   DGYRS = 3 years from NDAA or 1/27/2011
    111         ;         = 5 years from SSD or Enrollment App Date
    112         ;determine how many years extra CV eligibility to give
    113         N DGCIEN,DGCUTOFF,DGENRDT,DGPIEN,DGPRI,DGQT,DGSTAT
    114         ;determine if veteran has an enrollment record prior
    115         ;to 1/28/2008 (the NDAA date) and no CV End Date for
    116         ;this enrollment
    117         S DGYRS=5
    118         S (DGPRI,DGQT)=0
    119         S DGCUTOFF=3030128
    120         S DGCIEN=$$FINDCUR^DGENA(DFN)
    121         I $G(DGCIEN),($D(^DGEN(27.11,DGCIEN,0)))]"" D
    122         . S DGENRDT=$$GET1^DIQ(27.11,DGCIEN_",",75.01,"I") Q:$G(DGENRDT)']""
    123         . I $P(DGENRDT,".",1)<DGNDAA S DGPRI=1 Q
    124         . I DGENRDT'<DGNDAA D
    125         . . S DGPIEN=DGCIEN
    126         . . F  S DGPIEN=$$FINDPRI^DGENA(DGPIEN) Q:'DGPIEN  D  Q:DGQT
    127         . . . S DGENRDT=$$GET1^DIQ(27.11,DGPIEN_",",75.01,"I")
    128         . . . Q:$G(DGENRDT)']""
    129         . . . I $P(DGENRDT,".",1)<DGNDAA S (DGPRI,DGQT)=1
    130         ;if DGPRI=1, then there is an enrollment prior to 1/28/08
    131         I DGPRI=1 D  Q
    132         . I $G(DGCIEN)]"" S DGSTAT=$$GET1^DIQ(27.11,DGCIEN_",",.04,"E")
    133         . I $G(DGSTAT)["INITIAL APPLICATION BY VAMC"!($G(DGSTAT)["BELOW ENROLLMENT GROUP THRESHOLD") D
    134         . . I DGSRV<DGCUTOFF S DGYRS=3
    135         ;
    136         ;if no enrollment prior to 1/28/08 (DGPRI=0) check service date
    137         ;against cutoff date - 1/28/03
    138         I DGSRV<DGCUTOFF S DGYRS=3
    139         Q
    140         ;
    141 CVEDT(DFN,DGDT) ;Provide Combat Vet Eligibility End Date, if eligible
    142         ;Supported DBIA #4156
    143         ;Input:  DFN - Patient file IEN
    144         ;        DGDT - Treatment date (optional),
    145         ;               DT is default
    146         ;Output :RESULT=(1,0,-1)^End Date (if populated, otherwise null)^CV
    147         ;               Eligible on DGDT(1,0)^is patient eligible on input date?
    148         ;      (piece 1)  1 - qualifies as a CV
    149         ;                 0 - does not qualify as a CV
    150         ;                -1 - bad DFN or date
    151         ;      (piece 3)  1 - vet was eligible on date specified (or DT)     
    152         ;                 0 - vet was not eligible on date specified (or DT)
    153         ;
    154         N RESULT
    155         S RESULT=""
    156         I $G(DFN)="" Q -1
    157         I '$D(^DPT(DFN)) Q -1
    158         ;if time sent in, drop time
    159         I $G(DGDT)']"" S DGDT=DT
    160         I DGDT?7N1"."1.6N S DGDT=$E(DGDT,1,7)
    161         I DGDT'?7N Q -1
    162         S RESULT=$$GET1^DIQ(2,DFN_",",.5295,"I")
    163         I $G(RESULT)']"" Q 0
    164         S RESULT=$S(DGDT'>RESULT:RESULT_"^1",1:RESULT_"^0") ; if treatment date is earlier or equal to end date, veteran is eligible
    165         S RESULT=$S($G(RESULT):1_"^"_RESULT,1:0)
    166         Q RESULT
    167         ;
    168 PARSE   ;GETS^DIQ called in CVELIG - in this subroutine stuff results into array
    169         S DGSRV=$G(DGARR(2,DFN_",",.327,"I"))
    170         S DGCOM=$G(DGARR(2,DFN_",",.5294,"I")) ;Combat To Date
    171         S DGGULF=$G(DGARR(2,DFN_",",.322012,"I")) ;Persian Gulf To Date
    172         S DGSOM=$G(DGARR(2,DFN_",",.322018,"I")) ;Somalia To Date
    173         S DGYUG=$G(DGARR(2,DFN_",",.322021,"I")) ;Yugoslavia To Date
    174         S DGCVDT=$G(DGARR(2,DFN_",",.5295,"I")) ;CV End Date
    175         ; get last OIF/OEF/UNKNOWN OEF/OIF episode from multiple
    176         S DGOEIF=$P($$LAST^DGENOEIF(DFN),U)
    177         Q
    178         ;
    179 CHKSSD(DFN)     ;check the Serv Sep Date [Last]
    180         ; DGSRV=last SSD
    181         ;  Output - RESULT
    182         ;    1 - Date is present and after 11/11/1998
    183         ;    0 - Date is present but before 11/11/1998
    184         ;    A - Date is imprecise & either is or potentially is after 11/11/98
    185         ;    F - Date is missing
    186         N DG1
    187         I $G(DGSRV)']"" Q "F"
    188         S DG1=$$CHKDATE(DGSRV,0)
    189         I $G(DG1)']"" S DG1=0
    190         Q DG1
    191         ;
    192 CHKREST(DGDATE,SSD)     ;
    193         ; SSD = optional, = to the last serv sep date
    194         N DG3,DG4,DGDT,DGFLG,DGLEN,DGQ,DGR,DGRES,DGX
    195         S (DG3,DG4,DGR,DGRES)=""
    196         S DGQ=0 ;loop terminator
    197         S DGFLG=0 ;flag to indicate that one of the dates is missing (no
    198         ;          need to check this for OIF/OEF/UNKNOWN OEF/OIF since
    199         ;          by definition, these must always be post 11/11/98)
    200         F DGX=1:1:5 D
    201         . S DGDT=$P(DGDATE,U,DGX) D
    202         . . I DGX'=5,$G(DGDT)']"" S DGFLG=1
    203         . . S DG4=$$CHKDATE(DGDT,DGX,$G(SSD))
    204         . . I $G(DG4)'=0 S DG3=$G(DG3)_$G(DG4)
    205         S DGLEN=$L(DG3)
    206         S DGQ=0
    207         F DGX=1:1:DGLEN S DGCHAR=$E(DG3,DGX) D  Q:DGQ=1
    208         . I DGCHAR=1 S DG3=DGCHAR,DGQ=1 Q
    209         . I "BCDE"[DGCHAR S DGR=DGR_DGCHAR,DGQ=2
    210         I DGQ=1 Q 1
    211         I DGQ=2 Q $E(DGR)
    212         I DGFLG=1 S DGRES=$$MISS(DFN,DGLEN,DG3)
    213         Q DGRES
    214         ;
    215 MISS(DFN,DGLEN,DGRES)   ;there is at least one missing date, and in order to
    216         ;return a RESULT of a missing date, need to check to see if the
    217         ;corresponding indicator field is set to 'YES'
    218         N DGARR,DGCHAR,DGERR,DGQ,DGR,DGX
    219         N DGCIND,DGPGIND,DGSIND,DGYIND
    220         S (DGCHAR,DGQ,DGR)=0
    221         D GETS^DIQ(2,DFN_",",".32201;.322019;.322016;.5291","I","DGARR","DGERR")
    222         S DGCIND=$G(DGARR(2,DFN_",",.5291,"I")) ;Combat Service Indicated
    223         S DGYIND=$G(DGARR(2,DFN_",",.322019,"I")) ;Yugo service indicated
    224         S DGSIND=$G(DGARR(2,DFN_",",.322016,"I")) ;Somalia service indicated
    225         S DGPGIND=$G(DGARR(2,DFN_",",.32201,"I")) ;Pers Gulf service indicated
    226         F DGX=1:1:DGLEN S DGCHAR=$E(DGRES,DGX) D  Q:DGQ=1
    227         . I DGCHAR="G",($G(DGCIND)="Y") S DGR="G",DGQ=1 Q
    228         . I DGCHAR="H",($G(DGYIND)="Y") S DGR="H",DGQ=1 Q
    229         . I DGCHAR="I",($G(DGSIND)="Y") S DGR="I",DGQ=1 Q
    230         . I DGCHAR="J",($G(DGPGIND)="Y") S DGR="J"
    231         Q DGR
    232 DELCV(DFN)      ;called by the Kill logic of the ACVCOM cross reference
    233         ;if $$CVELIG^DGCV returns a 0 the CV End Date should be deleted
    234         ;because this would indicate that fields have been changed and
    235         ;CV eligibility is no longer appropriate
    236         ;
    237         N DGCV,DGFDA
    238         K DGCVFLG
    239         S DGCVFLG=0
    240         I $G(DFN)']"" Q
    241         I '$D(^DPT(DFN)) Q
    242         S DGCV=$$GET1^DIQ(2,DFN_",",.5295,"I")
    243         I $G(DGCV)']"" Q
    244         S DGCVFLG=1
    245         S DGFDA(2,DFN_",",.5295)="@"
    246         D FILE^DIE(,"DGFDA")
    247         Q
     1DGCV ;ALB/DW,ERC,BRM,TMK - COMBAT VET ELIGIBILTY; 10/15/05
     2 ;;5.3;Registration;**528,576,564,673**; Aug 13, 1993
     3 ;
     4CVELIG(DFN) ;
     5 ;API will determine whether or not this vetearn needs to have CV End
     6 ;Date set.  If this determination cannot be done due to imprecise
     7 ;or missing dates, it returns which dates need editing.
     8 ;Input:
     9 ;  DFN - Patient file IEN
     10 ;Output
     11 ;  RESULT
     12 ;    0 - CV End Date should not be updated
     13 ;    1 - CV End Date should be updated
     14 ;  If critical dates are imprecise return the following
     15 ;    A - CV End Date should not be updated, imprecise Service Sep date
     16 ;    B - CV End Date should not be updated, imprecise Combat To date
     17 ;    C - CV End Date should not be updated, imprecise Yugoslavia To date
     18 ;    D - CV End Date should not be updated, imprecise Somalia To date
     19 ;    E - CV End Date should not be updated, imprecise Pers Gulf To date
     20 ;  If the Service Sep Date is missing, and there are no OEF/OIF/UNKNOWN
     21 ;    OEF/OIF records on file, return the following so that it  will
     22 ;    appear on the Imprecise/Missing Date Report
     23 ;    F - missing Service Sep Date & no OEF OIF or OEF/OIF Unknown dates
     24 ;  If critical dates are missing but the corresponding indicator fields
     25 ;    are set to 'YES' return the following
     26 ;    G - missing Combat To Date, but Combat Indicated? = 'Yes'
     27 ;    H - missing PG To Date, but PG Indicated? = 'Yes'
     28 ;    I - missing Somalia To Date, but Somalia Indicator = 'Yes'
     29 ;    J - missing Yugoslavia To Date, but Yugoslavia Indicator = 'Yes'
     30 ;
     31 N DG1,DG2,I,RESULT
     32 N DGCOM,DGCVDT,DGCVFLG,DGGULF,DGSOM,DGSRV,DGYUG,DGOEIF
     33 S (DG1,DG2,RESULT)=0
     34 I $G(DFN)']"" Q RESULT
     35 I '$D(^DPT(DFN)) Q RESULT
     36 ;
     37 ;get combat related data from top-level VistA fields
     38 N DGARR,DGERR
     39 D GETS^DIQ(2,DFN_",",".327;.322012;.322018;.322021;.5294;.5295","I","DGARR","DGERR")
     40 D PARSE
     41 ;
     42 S DG1=$$CHKSSD(DFN) ;check SSD for imprecise or missing
     43 S DGDATE=$G(DGCOM)_"^"_$G(DGYUG)_"^"_$G(DGSOM)_"^"_$G(DGGULF)_"^"_$G(DGOEIF)
     44 ;
     45 I $S(DG1="F":1,1:$P(DGDATE,U,5)>$G(DGSRV)) D
     46 . ; Use OIF/OEF/UNKNOWN OEF/OIF to dt only when SSD missing or SSD less
     47 . ; than OIF/OEF/UNKNOWN OEF/OIF to dt
     48 . N DGSRV,Z
     49 . S DGSRV=$P(DGDATE,U,5),Z=$$CHKSSD(DFN)
     50 . I Z=1 S DG1=Z
     51 ;
     52 S DG2=$$CHKREST(DGDATE,$G(DGSRV)) ;check other "TO" dates for imprecise, missing or invalid
     53 S RESULT=$$RES(DG1,$G(DG2))
     54 Q RESULT
     55 ;
     56RES(DG1,DG2) ;determine the final RESULT code from DG1 & DG2
     57 ;if SSD evaluates to earlier than 11/11/98, can't set CV End Date
     58 I DG1=0!($G(DG2)=0) Q 0
     59 ;if SSD is 1
     60 I DG1=1,($G(DG2)=1!($G(DG2)']"")) Q 1
     61 I DG1=1,($G(DG2)=0) Q 0
     62 I DG1=1 Q DG2
     63 ;if SSD is imprecise or missing
     64 I DG1'=1,($G(DG2)=1) S DG2=""
     65 Q DG1_DG2
     66 ;
     67CHKDATE(DGDATE,I,SSD) ;check to see if date is imprecise or missing
     68 ;if imprecise check to see if the imprecision prevents CV evaluation
     69 ;if not imprecise check to see if after 11/11/98
     70 ; Note that SSD doesn't appear to ever be used here (TMK)
     71 N RES
     72 S RES=0
     73 I $G(DGDATE)']"",I'=5 D  Q RES
     74 . S RES=$S(I=0:"F",I=1:"G",I=2:"H",I=3:"I",I=4:"J",1:"")
     75 I $E(DGDATE,6,7)="00" D
     76 . I I=0 I DGDATE>2981111 S RES="A" Q
     77 . I DGDATE=2980000!(DGDATE=2981100) D  Q
     78 .. ; Note OIF/OEF/UNKNOWN OEF/OIF will not get here as these dates by
     79 .. ; definition are after 11/11/98
     80 . . S RES=$S(I=0:"A",I=1:"B",I=2:"C",I=3:"D",I=4:"E",1:"")
     81 Q:RES="A" RES
     82 I DGDATE>2981111 S RES=1
     83 Q RES
     84 ;
     85SETCV(DFN,DGSRV) ;calculate CV end date
     86 K DGCVEDT
     87 N DGFDA
     88 I $G(DFN)']""!($G(DGSRV)']"") Q
     89 I '$D(^DPT(DFN)) Q
     90 S DGCVEDT=$P($$SCH^XLFDT("24M",DGSRV),".")
     91 I DGCVEDT=$G(DGCVDT) Q
     92 I $$GET1^DIQ(2,DFN_",",.5295,"I") Q
     93 S DGFDA(2,DFN_",",.5295)=DGCVEDT
     94 D FILE^DIE(,"DGFDA")
     95 Q
     96 ;
     97CVEDT(DFN,DGDT) ;Provide Combat Vet Eligibility End Date, if eligible
     98 ;Supported DBIA #4156
     99 ;Input:  DFN - Patient file IEN
     100 ;        DGDT - Treatment date (optional),
     101 ;               DT is default
     102 ;Output :RESULT=(1,0,-1)^End Date (if populated, otherwise null)^CV
     103 ;               Eligible on DGDT(1,0)^is patient eligible on input date?
     104 ;      (piece 1)  1 - qualifies as a CV
     105 ;                 0 - does not qualify as a CV
     106 ;                -1 - bad DFN or date
     107 ;      (piece 3)  1 - vet was eligible on date specified (or DT)     
     108 ;                 0 - vet was not eligible on date specified (or DT)
     109 ;
     110 N RESULT
     111 S RESULT=""
     112 I $G(DFN)="" Q -1
     113 I '$D(^DPT(DFN)) Q -1
     114 ;if time sent in, drop time
     115 I $G(DGDT)']"" S DGDT=DT
     116 I DGDT?7N1"."1.6N S DGDT=$E(DGDT,1,7)
     117 I DGDT'?7N Q -1
     118 S RESULT=$$GET1^DIQ(2,DFN_",",.5295,"I")
     119 I $G(RESULT)']"" Q 0
     120 S RESULT=$S(DGDT'>RESULT:RESULT_"^1",1:RESULT_"^0") ; if treatment date is earlier or equal to end date, veteran is eligible
     121 S RESULT=$S($G(RESULT):1_"^"_RESULT,1:0)
     122 Q RESULT
     123 ;
     124PARSE ;GETS^DIQ called in CVELIG - in this subroutine stuff results into array
     125 S DGSRV=$G(DGARR(2,DFN_",",.327,"I"))
     126 S DGCOM=$G(DGARR(2,DFN_",",.5294,"I")) ;Combat To Date
     127 S DGGULF=$G(DGARR(2,DFN_",",.322012,"I")) ;Persian Gulf To Date
     128 S DGSOM=$G(DGARR(2,DFN_",",.322018,"I")) ;Somalia To Date
     129 S DGYUG=$G(DGARR(2,DFN_",",.322021,"I")) ;Yugoslavia To Date
     130 S DGCVDT=$G(DGARR(2,DFN_",",.5295,"I")) ;CV End Date
     131 ; get last OIF/OEF/UNKNOWN OEF/OIF episode from multiple
     132 S DGOEIF=$P($$LAST^DGENOEIF(DFN),U)
     133 Q
     134 ;
     135CHKSSD(DFN) ;check the Serv Sep Date [Last]
     136 ; DGSRV=last SSD
     137 ;  Output - RESULT
     138 ;    1 - Date is present and after 11/11/1998
     139 ;    0 - Date is present but before 11/11/1998
     140 ;    A - Date is imprecise & either is or potentially is after 11/11/98
     141 ;    F - Date is missing
     142 N DG1
     143 I $G(DGSRV)']"" Q "F"
     144 S DG1=$$CHKDATE(DGSRV,0)
     145 I $G(DG1)']"" S DG1=0
     146 Q DG1
     147 ;
     148CHKREST(DGDATE,SSD) ;
     149 ; SSD = optional, = to the last serv sep date
     150 N DG3,DG4,DGDT,DGFLG,DGLEN,DGQ,DGR,DGRES,DGX
     151 S (DG3,DG4,DGR,DGRES)=""
     152 S DGQ=0 ;loop terminator
     153 S DGFLG=0 ;flag to indicate that one of the dates is missing (no
     154 ;          need to check this for OIF/OEF/UNKNOWN OEF/OIF since
     155 ;          by definition, these must always be post 11/11/98)
     156 F DGX=1:1:5 D
     157 . S DGDT=$P(DGDATE,U,DGX) D
     158 . . I DGX'=5,$G(DGDT)']"" S DGFLG=1
     159 . . S DG4=$$CHKDATE(DGDT,DGX,$G(SSD))
     160 . . I $G(DG4)'=0 S DG3=$G(DG3)_$G(DG4)
     161 S DGLEN=$L(DG3)
     162 S DGQ=0
     163 F DGX=1:1:DGLEN S DGCHAR=$E(DG3,DGX) D  Q:DGQ=1
     164 . I DGCHAR=1 S DG3=DGCHAR,DGQ=1 Q
     165 . I "BCDE"[DGCHAR S DGR=DGR_DGCHAR,DGQ=2
     166 I DGQ=1 Q 1
     167 I DGQ=2 Q $E(DGR)
     168 I DGFLG=1 S DGRES=$$MISS(DFN,DGLEN,DG3)
     169 Q DGRES
     170 ;
     171MISS(DFN,DGLEN,DGRES) ;there is at least one missing date, and in order to
     172 ;return a RESULT of a missing date, need to check to see if the
     173 ;corresponding indicator field is set to 'YES'
     174 N DGARR,DGCHAR,DGERR,DGQ,DGR,DGX
     175 N DGCIND,DGPGIND,DGSIND,DGYIND
     176 S (DGCHAR,DGQ,DGR)=0
     177 D GETS^DIQ(2,DFN_",",".32201;.322019;.322016;.5291","I","DGARR","DGERR")
     178 S DGCIND=$G(DGARR(2,DFN_",",.5291,"I")) ;Combat Service Indicated
     179 S DGYIND=$G(DGARR(2,DFN_",",.322019,"I")) ;Yugo service indicated
     180 S DGSIND=$G(DGARR(2,DFN_",",.322016,"I")) ;Somalia service indicated
     181 S DGPGIND=$G(DGARR(2,DFN_",",.32201,"I")) ;Pers Gulf service indicated
     182 F DGX=1:1:DGLEN S DGCHAR=$E(DGRES,DGX) D  Q:DGQ=1
     183 . I DGCHAR="G",($G(DGCIND)="Y") S DGR="G",DGQ=1 Q
     184 . I DGCHAR="H",($G(DGYIND)="Y") S DGR="H",DGQ=1 Q
     185 . I DGCHAR="I",($G(DGSIND)="Y") S DGR="I",DGQ=1 Q
     186 . I DGCHAR="J",($G(DGPGIND)="Y") S DGR="J"
     187 Q DGR
     188DELCV(DFN) ;called by the Kill logic of the ACVCOM cross reference
     189 ;if $$CVELIG^DGCV returns a 0 the CV End Date should be deleted
     190 ;because this would indicate that fields have been changed and
     191 ;CV eligibility is no longer appropriate
     192 ;
     193 N DGCV,DGFDA
     194 K DGCVFLG
     195 S DGCVFLG=0
     196 I $G(DFN)']"" Q
     197 I '$D(^DPT(DFN)) Q
     198 S DGCV=$$GET1^DIQ(2,DFN_",",.5295,"I")
     199 I $G(DGCV)']"" Q
     200 S DGCVFLG=1
     201 S DGFDA(2,DFN_",",.5295)="@"
     202 D FILE^DIE(,"DGFDA")
     203 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGDEATH.m

    r613 r623  
    1 DGDEATH ;ALB/MRL/PJR-PROCESS DECEASED PATIENTS ; 10/27/04 9:45pm
    2         ;;5.3;Registration;**45,84,101,149,392,545,595,568,563,725,772**;Aug 13, 1993;Build 4
    3         ;
    4 GET     N DGMTI,DATA
    5         S DGDTHEN="" W !! S DIC="^DPT(",DIC(0)="AEQMZ" D ^DIC G Q:Y'>0 S (DA,DFN)=+Y
    6         S DGDOLD=$G(^DPT(DFN,.35))
    7         I $D(^DPT(DFN,.1)) W !?3,"Patient is currently in-house.  Discharge him with a discharge type of DEATH." G GET
    8         I $S($D(^DPT(DFN,.35)):^(.35),1:"") F DGY=0:0 S DGY=$O(^DGPM("ATID1",DFN,DGY)) Q:'DGY  S DGDA=$O(^(DGY,0)) I $D(^DGPM(+DGDA,0)),$P(^(0),"^",17)]"" S DGXX=$P(^(0),"^",17),DGXX=^DGPM(DGXX,0) I "^12^38^"[("^"_$P(DGXX,"^",18)_"^") G DIS
    9         D NOW^%DTC S DGNOW=%
    10         S ^TMP("DEATH",$J)=1
    11         K A W ! S DIE=DIC,DR=".351" D ^DIE
    12         I '$D(^DPT(DFN,.35)) K ^TMP("DEATH",$J) G GET
    13         S DGDNEW=^DPT(DFN,.35)
    14         I $P(DGDNEW,"^",1)="",$P(DGDNEW,"^",2)'="" S DR=".352////@" D ^DIE
    15         I $P(DGDNEW,"^",1)="" K ^TMP("DEATH",$J) G GET
    16 SN      I $P(DGDNEW,"^",1)'="" S DR=".353" D ^DIE I $P($G(^DPT(DFN,.35)),"^",3)']"" D SNDISP G SN
    17         I DGDOLD'=DGDNEW D DISCHRGE
    18         I $P(DGDOLD,"^",1)'=$P(DGDNEW,"^",1) D XFR
    19         K ^TMP("DEATH",$J) G GET
    20         ;
    21 DIS     W !,"Patient has a discharge type of Death",!,"Edit the discharge",!
    22 Q       K A,DA,DFN,DGDA,DIC,DIE,DR,DGXX,DGY,DGDTHEN,DGDOLD,DGDNEW,DGDONOT Q
    23 XFR     ; called from set x-ref of field .351 of file 2
    24         N DGPCMM,DGFAPT,DGFAPTI,DGFAPT1
    25         Q:'$D(DFN)
    26         K DGTEXT D ^DGPATV S DGDEATH=$$GET1^DIQ(2,DFN,.351,"I"),XMSUB="PATIENT HAS EXPIRED",DGCT=0
    27         D DEMOG
    28         S DGT=X-.0001,(Y,DGDDT)=X,DG1="" D:DGT]"" ^DGPMSTAT
    29         S Y=$$FMTE^XLFDT(Y),Y=$S(Y]"":Y,1:"UNKNOWN")
    30         S DGDONOT=0 D APTT3
    31         D LINE("")
    32         D LINE("      Date/Time of Death: "_DEATHVAL_$S(DGDONOT:"",'DG1:"",$D(DGDTHEN):"",1:"  (While an inpatient)"))
    33         D LINE("")
    34         I '$D(ADM),DG1,$D(^DGPM(+DGA1,0)) S ADM=+^DGPM($P(^(0),"^",14),0)
    35         S Y=$$FMTE^XLFDT($S($D(ADM):ADM,1:""))
    36         D LINE($S($D(DGDTHEN):"",DG1:"     Admission Date/Time: "_Y_$S((DGDDT-ADM)<1:"  (Within 24 hours of hospitalization)",1:""),1:""))
    37         D LINE("")
    38         S DGX=$P($G(^DGPM(+$G(DGA1),0)),"^",6),DGX=$P($G(^DIC(42,+DGX,0)),U,1)
    39         D LINE($S($D(DGDTHEN):"",('DG1):"",$D(DGA1):"             Admitted To: "_$S(DGX]"":DGX,1:"UNKNOWN"),1:"")) K DGX
    40         D LINE("")
    41         I DG1&'$D(DGDTHEN) D
    42         . D LINE($S($D(DGXFR0):"           Last Transfer: "_$S($D(^DIC(42,+$P(DGXFR0,"^",6),0)):$P(^(0),"^"),1:"UNKNOWN"),1:""))
    43         . D LINE("")
    44 F       N DGARRAY,SDCNT S DGFAPT=DGDEATH,DGFAPTI=""
    45         S DGARRAY("FLDS")=3,DGARRAY(4)=DFN,DGARRAY("SORT")="P",DGARRAY(1)=DT,DGARRAY(3)="I;R"
    46         S SDCNT=$$SDAPI^SDAMA301(.DGARRAY)
    47         ;
    48         I SDCNT>0 F  S DGFAPT=$O(^TMP($J,"SDAMA301",DFN,DGFAPT)) Q:'DGFAPT  S DGFAPT1=$G(^TMP($J,"SDAMA301",DFN,DGFAPT)) Q:DGFAPT1']""  D  Q:DGFAPTI
    49         .I $P($P(DGFAPT1,U,3),";")'["C" D LINE("NOTE: Patient has future appointments scheduled!!") S DGFAPTI=1
    50         S DGSCHAD=0 D SA I DGSCHAD D LINE("NOTE: Patient had scheduled admissions which have been cancelled!!")
    51         I 'DGVETS D LINE("Patient is a NON-VETERAN."_$S($D(^DIC(21,+$P($G(^DPT(DFN,.32)),"^",3),0)):"  ["_$P(^(0),"^",1)_"]",1:""))
    52         S DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0) ;creates xmy array
    53         S DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
    54 Q1      S DGB=1 D ^DGBUL S X=DGDEATH
    55         K DGDEATH,DGSCHAD,DGI,Y,DGDDT,^TMP($J,"SDAMA301") D KILL^DGPATV K ADM,DG1,DGA1,DGCT,DGT,DGXX,DGY,Z Q
    56 SA      F DGI=0:0 S DGI=$O(^DGS(41.1,"B",DFN,DGI)) Q:'DGI  I $D(^DGS(41.1,DGI,0)),($P(^(0),"^",13)']""),($P(^(0),"^",17)']"") S $P(^(0),"^",13)=DGDEATH,$P(^(0),"^",14)=+DUZ,$P(^(0),"^",15)=1,$P(^(0),"^",16)=2,DGSCHAD=1
    57         Q
    58         ;
    59 DEL     ; delete death bulletin
    60         N DGPCMM,DELBY,DELTM,DTHINFO
    61         S DFN=+$G(DA) I '$D(^DPT(DFN,0)) Q  ; no patient node
    62         I +$G(^DPT(DFN,.35)) Q  ; not deletion
    63         S DGDEATH=X,XMSUB="Patient Death has been Deleted",DGCT=0
    64         D ^DGPATV
    65         D LINE("The date of death for the following patient has been deleted.")
    66         D LINE("")
    67         D DEMOG
    68         D LINE("")
    69         S DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0) ;creates xmy array
    70         S DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
    71         S DGB=1 D ^DGBUL S X=DGDEATH
    72         K DGCT,DGDEATH D KILL^DGPATV
    73         Q
    74         ;
    75 DEMOG   ; list main demographics
    76         D LINE("                    NAME: "_DGNAME)
    77         D LINE("                     SSN: "_$P(SSN,"^",2))
    78         D LINE("                     DOB: "_$P(DOB,"^",2))
    79         I DGVETS D
    80         . N DGX
    81         . S DGX=$G(^DPT(DFN,.31))
    82         . S DGLOCATN=$$FIND1^DIC(4,"","MX","`"_+$P(DGX,U,4)),DGLOCATN=$S(+DGLOCATN>0:$P($$NS^XUAF4(DGLOCATN),U),1:"NOT LISTED")
    83         . D LINE("   CLAIM FOLDER LOCATION: "_$S($D(DGLOCATN):DGLOCATN,1:"NOT LISTED"))
    84         . D LINE("            CLAIM NUMBER: "_$S($P(DGX,"^",3)]"":$P(DGX,"^",3),1:"NOT LISTED"))
    85         D LINE("   COORDINATING MASTER OF RECORD: "_DGCMOR)
    86         D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","DTHINFO")
    87         S DEATHVAL=$G(DTHINFO(2,DFN_",",.351,"E"))
    88         S DEATHVAL=$$FMTE^XLFDT(DEATHVAL),DEATHVAL=$S(DEATHVAL]"":DEATHVAL,1:"UNKNOWN")
    89         S SOURCE=$G(DTHINFO(2,DFN_",",.353,"E"))
    90         S DELTM=$G(DTHINFO(2,DFN_",",.354,"E"))
    91         S DELBY=$G(DTHINFO(2,DFN_",",.355,"E"))
    92         D LINE("")
    93         D LINE("             LAST EDITED BY: "_DELBY)
    94         D LINE("    DATE/TIME LAST MODIFIED: "_DELTM)
    95         D LINE("     SOURCE OF NOTIFICATION: "_$S(SOURCE="":"UNDEFINED",1:SOURCE))
    96         ;K DEATHVAL,SOURCE,DELTM,DELBY
    97         Q
    98         ;
    99 LINE(X) ; add line contained in X to array
    100         S DGCT=DGCT+1
    101         S DGTEXT(DGCT,0)=X
    102         Q
    103 DSBULL  ;
    104         ;
    105         I $G(IVMDODUP)=1 Q
    106         S DFN=DA
    107         I $D(DGPMDA) D  Q
    108         .S DISTYPE=$P($G(^DGPM(DGPMDA,0)),"^",18)
    109         .I $G(^DG(405.2,DISTYPE,0))["DEATH" D
    110         ..S FDA(2,DFN_",",.353)=1 D FILE^DIE(,"FDA","BWFERR")
    111         ..D DISCHRGE,XFR
    112         I $D(^TMP("DEATH",$J)) Q
    113         D DISCHRGE,XFR
    114         Q
    115 DKBULL  ;
    116         S DFN=DA
    117         S FDA(2,DFN_",",.353)="@"
    118         I $D(^TMP("DEATH",$J)) S FDA(2,DFN_",",.355)=DUZ
    119         D FILE^DIE(,"FDA",)
    120         D DEL
    121         Q
    122 DISCHRGE        ;
    123         ; If the patient is being discharged, determine values needed for
    124         ; Source of Notification and Date/Time last entered.
    125         ;
    126         I '$D(DGNOW) S DGNOW=$$HTFM^XLFDT($H)
    127         I $G(DGDAUTO)'=1 S FDA(2,DFN_",",.354)=DGNOW
    128         S FDA(2,DFN_",",.355)=DUZ
    129         D FILE^DIE(,"FDA",)
    130         Q
    131 APTT3   ;Check to exclude "While an Inpatient" from DOD Bulletin
    132         ; Input:  DFN  Output: DGDONOT
    133         N DATE,XIEN,TYPE,XDOD,YES
    134         S DGDONOT=0
    135         S XDOD=$P($G(^DPT(DFN,.35)),"^",1) I 'XDOD Q
    136         S XDOD=$P(XDOD,".",1),YES=0,TYPE=""
    137         I '$D(^DGPM("APTT3",DFN)) Q
    138         S DATE=$O(^DGPM("APTT3",DFN,XDOD)) I 'DATE Q
    139         I $P(DATE,".",1)=XDOD S YES=1
    140         I ($P(DATE,".",1)-1)=XDOD S YES=1
    141         S XIEN=$O(^DGPM("APTT3",DFN,DATE,"")) I 'XIEN Q
    142         S TYPE=$P($G(^DGPM(XIEN,0)),"^",4)
    143         I YES,'((TYPE=27)!(TYPE=32)) S DGDONOT=1
    144         Q
    145 SNDISP  ; Source of Notification display choices
    146         N DIR,DTOUT,DUOUT,DIRUT,DIROUT,DGLIST,DGLNAME,I,X,Y
    147         S DGLIST=$P($G(^DD(2,.353,0)),"^",3)
    148         S Y=6
    149         S DIR("?",1)=" "
    150         S DIR("?",2)=" This is a required response. Please select from the following:"
    151         S DIR("?",3)=" Entering '^' will take you back to the Source of Notification prompt"
    152         S DIR("?",4)=" "
    153         S DIR("?",5)=" "
    154         F X=1:1 S DGLNAME=$P(DGLIST,";",X) Q:DGLNAME']""  S DIR("?",Y)="      "_$P(DGLNAME,":",1)_"      "_$P(DGLNAME,":",2) S Y=Y+1
    155         S DIR("?",Y)=" "
    156         F I=1:1 Q:'$D(DIR("?",I))  W !,DIR("?",I)
    157         Q
     1DGDEATH ;ALB/MRL/PJR-PROCESS DECEASED PATIENTS ; 10/27/04 9:45pm
     2 ;;5.3;Registration;**45,84,101,149,392,545,595,568,563,725**;Aug 13, 1993;Build 12
     3 ;
     4GET N DGMTI,DATA
     5 S DGDTHEN="" W !! S DIC="^DPT(",DIC(0)="AEQMZ" D ^DIC G Q:Y'>0 S (DA,DFN)=+Y
     6 S DGDOLD=$G(^DPT(DFN,.35))
     7 I $D(^DPT(DFN,.1)) W !?3,"Patient is currently in-house.  Discharge him with a discharge type of DEATH." G GET
     8 I $S($D(^DPT(DFN,.35)):^(.35),1:"") F DGY=0:0 S DGY=$O(^DGPM("ATID1",DFN,DGY)) Q:'DGY  S DGDA=$O(^(DGY,0)) I $D(^DGPM(+DGDA,0)),$P(^(0),"^",17)]"" S DGXX=$P(^(0),"^",17),DGXX=^DGPM(DGXX,0) I "^12^38^"[("^"_$P(DGXX,"^",18)_"^") G DIS
     9 D NOW^%DTC S DGNOW=%
     10 S ^TMP("DEATH",$J)=1
     11 K A W ! S DIE=DIC,DR=".351" D ^DIE
     12 I '$D(^DPT(DFN,.35)) K ^TMP("DEATH",$J) G GET
     13 S DGDNEW=^DPT(DFN,.35)
     14 I $P(DGDNEW,"^",1)="",$P(DGDNEW,"^",2)'="" S DR=".352////@" D ^DIE
     15 I $P(DGDNEW,"^",1)="" K ^TMP("DEATH",$J) G GET
     16 I $P(DGDNEW,"^",1)'="" S DR=".353" D ^DIE
     17 I DGDOLD'=DGDNEW D DISCHRGE
     18 I $P(DGDOLD,"^",1)'=$P(DGDNEW,"^",1) D XFR
     19 K ^TMP("DEATH",$J) G GET
     20 ;
     21DIS W !,"Patient has a discharge type of Death",!,"Edit the discharge",!
     22Q K A,DA,DFN,DGDA,DIC,DIE,DR,DGXX,DGY,DGDTHEN,DGDOLD,DGDNEW,DGDONOT Q
     23XFR ; called from set x-ref of field .351 of file 2
     24 N DGPCMM,DGFAPT,DGFAPTI,DGFAPT1
     25 Q:'$D(DFN)
     26 K DGTEXT D ^DGPATV S DGDEATH=$$GET1^DIQ(2,DFN,.351,"I"),XMSUB="PATIENT HAS EXPIRED",DGCT=0
     27 D DEMOG
     28 S DGT=X-.0001,(Y,DGDDT)=X,DG1="" D:DGT]"" ^DGPMSTAT
     29 S Y=$$FMTE^XLFDT(Y),Y=$S(Y]"":Y,1:"UNKNOWN")
     30 S DGDONOT=0 D APTT3
     31 D LINE("")
     32 D LINE("      Date/Time of Death: "_DEATHVAL_$S(DGDONOT:"",'DG1:"",$D(DGDTHEN):"",1:"  (While an inpatient)"))
     33 D LINE("")
     34 I '$D(ADM),DG1,$D(^DGPM(+DGA1,0)) S ADM=+^DGPM($P(^(0),"^",14),0)
     35 S Y=$$FMTE^XLFDT($S($D(ADM):ADM,1:""))
     36 D LINE($S($D(DGDTHEN):"",DG1:"     Admission Date/Time: "_Y_$S((DGDDT-ADM)<1:"  (Within 24 hours of hospitalization)",1:""),1:""))
     37 D LINE("")
     38 S DGX=$P($G(^DGPM(+$G(DGA1),0)),"^",6),DGX=$P($G(^DIC(42,+DGX,0)),U,1)
     39 D LINE($S($D(DGDTHEN):"",('DG1):"",$D(DGA1):"             Admitted To: "_$S(DGX]"":DGX,1:"UNKNOWN"),1:"")) K DGX
     40 D LINE("")
     41 I DG1&'$D(DGDTHEN) D
     42 . D LINE($S($D(DGXFR0):"           Last Transfer: "_$S($D(^DIC(42,+$P(DGXFR0,"^",6),0)):$P(^(0),"^"),1:"UNKNOWN"),1:""))
     43 . D LINE("")
     44F N DGARRAY,SDCNT S DGFAPT=DGDEATH,DGFAPTI=""
     45 S DGARRAY("FLDS")=3,DGARRAY(4)=DFN,DGARRAY("SORT")="P",DGARRAY(1)=DT,DGARRAY(3)="I;R"
     46 S SDCNT=$$SDAPI^SDAMA301(.DGARRAY)
     47 ;
     48 I SDCNT>0 F  S DGFAPT=$O(^TMP($J,"SDAMA301",DFN,DGFAPT)) Q:'DGFAPT  S DGFAPT1=$G(^TMP($J,"SDAMA301",DFN,DGFAPT)) Q:DGFAPT1']""  D  Q:DGFAPTI
     49 .I $P($P(DGFAPT1,U,3),";")'["C" D LINE("NOTE: Patient has future appointments scheduled!!") S DGFAPTI=1
     50 S DGSCHAD=0 D SA I DGSCHAD D LINE("NOTE: Patient had scheduled admissions which have been cancelled!!")
     51 I 'DGVETS D LINE("Patient is a NON-VETERAN."_$S($D(^DIC(21,+$P($G(^DPT(DFN,.32)),"^",3),0)):"  ["_$P(^(0),"^",1)_"]",1:""))
     52 S DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0) ;creates xmy array
     53 S DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
     54Q1 S DGB=1 D ^DGBUL S X=DGDEATH
     55 K DGDEATH,DGSCHAD,DGI,Y,DGDDT,^TMP($J,"SDAMA301") D KILL^DGPATV K ADM,DG1,DGA1,DGCT,DGT,DGXX,DGY,Z Q
     56SA F DGI=0:0 S DGI=$O(^DGS(41.1,"B",DFN,DGI)) Q:'DGI  I $D(^DGS(41.1,DGI,0)),($P(^(0),"^",13)']""),($P(^(0),"^",17)']"") S $P(^(0),"^",13)=DGDEATH,$P(^(0),"^",14)=+DUZ,$P(^(0),"^",15)=1,$P(^(0),"^",16)=2,DGSCHAD=1
     57 Q
     58 ;
     59DEL ; delete death bulletin
     60 N DGPCMM,DELBY,DELTM,DTHINFO
     61 S DFN=+$G(DA) I '$D(^DPT(DFN,0)) Q  ; no patient node
     62 I +$G(^DPT(DFN,.35)) Q  ; not deletion
     63 S DGDEATH=X,XMSUB="Patient Death has been Deleted",DGCT=0
     64 D ^DGPATV
     65 D LINE("The date of death for the following patient has been deleted.")
     66 D LINE("")
     67 D DEMOG
     68 D LINE("")
     69 S DGPCMM=$$PCMMXMY^SCAPMC25(1,DFN,,,0) ;creates xmy array
     70 S DGCT=$$PCMAIL^SCMCMM(DFN,"DGTEXT",DT)
     71 S DGB=1 D ^DGBUL S X=DGDEATH
     72 K DGCT,DGDEATH D KILL^DGPATV
     73 Q
     74 ;
     75DEMOG ; list main demographics
     76 D LINE("                    NAME: "_DGNAME)
     77 D LINE("                     SSN: "_$P(SSN,"^",2))
     78 D LINE("                     DOB: "_$P(DOB,"^",2))
     79 I DGVETS D
     80 . N DGX
     81 . S DGX=$G(^DPT(DFN,.31))
     82 . S DGLOCATN=$$FIND1^DIC(4,"","MX","`"_+$P(DGX,U,4)),DGLOCATN=$S(+DGLOCATN>0:$P($$NS^XUAF4(DGLOCATN),U),1:"NOT LISTED")
     83 . D LINE("   CLAIM FOLDER LOCATION: "_$S($D(DGLOCATN):DGLOCATN,1:"NOT LISTED"))
     84 . D LINE("            CLAIM NUMBER: "_$S($P(DGX,"^",3)]"":$P(DGX,"^",3),1:"NOT LISTED"))
     85 D LINE("   COORDINATING MASTER OF RECORD: "_DGCMOR)
     86 D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","DTHINFO")
     87 S DEATHVAL=$G(DTHINFO(2,DFN_",",.351,"E"))
     88 S DEATHVAL=$$FMTE^XLFDT(DEATHVAL),DEATHVAL=$S(DEATHVAL]"":DEATHVAL,1:"UNKNOWN")
     89 S SOURCE=$G(DTHINFO(2,DFN_",",.353,"E"))
     90 S DELTM=$G(DTHINFO(2,DFN_",",.354,"E"))
     91 S DELBY=$G(DTHINFO(2,DFN_",",.355,"E"))
     92 D LINE("")
     93 D LINE("             LAST EDITED BY: "_DELBY)
     94 D LINE("    DATE/TIME LAST MODIFIED: "_DELTM)
     95 D LINE("     SOURCE OF NOTIFICATION: "_$S(SOURCE="":"UNDEFINED",1:SOURCE))
     96 ;K DEATHVAL,SOURCE,DELTM,DELBY
     97 Q
     98 ;
     99LINE(X) ; add line contained in X to array
     100 S DGCT=DGCT+1
     101 S DGTEXT(DGCT,0)=X
     102 Q
     103DSBULL ;
     104 ;
     105 I $G(IVMDODUP)=1 Q
     106 S DFN=DA
     107 I $D(DGPMDA) D  Q
     108 .S DISTYPE=$P($G(^DGPM(DGPMDA,0)),"^",18)
     109 .I $G(^DG(405.2,DISTYPE,0))["DEATH" D
     110 ..S FDA(2,DFN_",",.353)=1 D FILE^DIE(,"FDA","BWFERR")
     111 ..D DISCHRGE,XFR
     112 I $D(^TMP("DEATH",$J)) Q
     113 D DISCHRGE,XFR
     114 Q
     115DKBULL ;
     116 S DFN=DA
     117 S FDA(2,DFN_",",.353)="@"
     118 I $D(^TMP("DEATH",$J)) S FDA(2,DFN_",",.355)=DUZ
     119 D FILE^DIE(,"FDA",)
     120 D DEL
     121 Q
     122DISCHRGE ;
     123 ; If the patient is being discharged, determine values needed for
     124 ; Source of Notification and Date/Time last entered.
     125 ;
     126 I '$D(DGNOW) S DGNOW=$$HTFM^XLFDT($H)
     127 I $G(DGDAUTO)'=1 S FDA(2,DFN_",",.354)=DGNOW
     128 S FDA(2,DFN_",",.355)=DUZ
     129 D FILE^DIE(,"FDA",)
     130 Q
     131APTT3 ;Check to exclude "While an Inpatient" from DOD Bulletin
     132 ; Input:  DFN  Output: DGDONOT
     133 N DATE,XIEN,TYPE,XDOD,YES
     134 S DGDONOT=0
     135 S XDOD=$P($G(^DPT(DFN,.35)),"^",1) I 'XDOD Q
     136 S XDOD=$P(XDOD,".",1),YES=0,TYPE=""
     137 I '$D(^DGPM("APTT3",DFN)) Q
     138 S DATE=$O(^DGPM("APTT3",DFN,XDOD)) I 'DATE Q
     139 I $P(DATE,".",1)=XDOD S YES=1
     140 I ($P(DATE,".",1)-1)=XDOD S YES=1
     141 S XIEN=$O(^DGPM("APTT3",DFN,DATE,"")) I 'XIEN Q
     142 S TYPE=$P($G(^DGPM(XIEN,0)),"^",4)
     143 I YES,'((TYPE=27)!(TYPE=32)) S DGDONOT=1
     144 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGENA2.m

    r613 r623  
    1 DGENA2  ;ALB/CJM,RTK,TDM - Enrollment API - Automatic Update; 9/19/2002 ; 1/31/03 11:54am
    2         ;;5.3;Registration;**121,122,147,232,327,469,491,779**;Aug 13,1993;Build 11
    3         ;
    4 AUTOUPD(DFN,EVENT)      ;
    5         ;Description: If the patient meets the criteria for transmission to HEC,
    6         ;   he is entered to the IVM PATIENT file for future transmission.
    7         ;   This procedure checks for changes in enrollment priority,
    8         ;   status and fields in the eligibility sub-record. If any changes are
    9         ;   found, the current enrollment record is automatically updated.
    10         ;Input:
    11         ;  DFN - Patient IEN
    12         ;  EVENT - Event Type (optional)
    13         ;          EVENT 1 : Date of Death Deleted
    14         ;          EVENT 2 : Ineligible Date Deleted
    15         ;Output: None
    16         ;
    17         ;if the eligibility/enrollment upload is in progess, do not do anything
    18         Q:($G(DGENUPLD)="ENROLLMENT/ELIGIBILITY UPLOAD IN PROGRESS")
    19         ;
    20         ; If the INCOME TEST DATA (Z10) upload is in progess, do not do anything
    21         Q:($G(IVMZ10)="UPLOAD IN PROGRESS")
    22         ;
    23         N DGENRIEN,DGENR1,DGENR2,STATUS,EFFDATE,OK,DEATH
    24         ;
    25         ;try to prevent problems rsulting from calling FM within FM
    26         N DS,D0,DO,D1,DA,DD,DS,DG,DIC,DICR,DIE,DIG,DIH,DIV,DIW,DIX,DQ,DR
    27         ;
    28         S EVENT=+$G(EVENT)
    29         ;
    30         D EVENT^IVMPLOG(DFN)
    31         ;
    32         D:$$LOCK^DGENA1($G(DFN))  ;may drop out of block
    33         .S DGENRIEN=$$FINDCUR^DGENA(DFN)
    34         .Q:'DGENRIEN
    35         .Q:'$$GET^DGENA(DGENRIEN,.DGENR1)
    36         .S STATUS=$$EXT^DGENU("STATUS",DGENR1("STATUS"))
    37         .S (DEATH,EFFDATE)=$$DEATH^DGENPTA(DFN)
    38         .I STATUS'="VERIFIED",STATUS'="UNVERIFIED",STATUS'="DECEASED",STATUS'["NOT ELIGIBLE",STATUS'["PENDING",STATUS'["REJECTED" Q
    39         .I STATUS="DECEASED",((EVENT'=1)!(DEATH)) Q
    40         .I STATUS["NOT ELIGIBLE",((EVENT'=2)!('$$VET^DGENPTA(DFN))) Q
    41         .S:'EFFDATE EFFDATE=DT
    42         .Q:'$$CREATE^DGENA6(DFN,DGENR1("APP"),EFFDATE,DGENR1("REASON"),DGENR1("REMARKS"),.DGENR2,DGENR1("DATE"),DGENR1("END"))
    43         .S OK=1
    44         .S:(DGENR1("PRIORITY")'=DGENR2("PRIORITY"))!(DGENR2("STATUS")'=DGENR1("STATUS")) OK=0
    45         .I OK D
    46         ..N SUB
    47         ..S SUB=""
    48         ..F  S SUB=$O(DGENR2("ELIG",SUB)) Q:SUB=""  S:(DGENR1("ELIG",SUB)'=DGENR2("ELIG",SUB)) OK=0
    49         .I 'OK D
    50         ..I (DGENR1("EFFDATE")=DGENR2("EFFDATE")),(DGENR1("SOURCE")=DGENR2("SOURCE")),(DGENR1("USER")=DGENR2("USER")),(DGENR1("DATETIME")\1)=(DGENR2("DATETIME")\1) D
    51         ...;in this case it's an overlay
    52         ...S DGENR2("PRIORREC")=DGENR1("PRIORREC")
    53         ...I $$EDITCUR^DGENA1(.DGENR2)
    54         ..E  D
    55         ...;in this case create a new record, to preserve the audit trail
    56         ...I $$STORECUR^DGENA1(.DGENR2)
    57         D UNLOCK^DGENA1($G(DFN))
    58         Q
    59 MTUPD   ;
    60         ;Description - entry point for Means Test Event Driver for Enrollment
    61         ;
    62         D AUTOUPD($G(DFN))
    63         Q
    64         ;
    65 SDDIS   ;Entry point for the DGEN SD DISPLAY CURRENT ENROLLMENT protocol,
    66         ;which hangs of the Scheduling Event Driver
    67         ;
    68         N DFN S DFN=$P($G(SDATA),"^",2)
    69         ;
    70         ;don't display if running in the background
    71         Q:$D(ZTQUEUED)
    72         ;
    73         ;don't want to display enrollment for non-vets with no enrollment status
    74         Q:('$$VET^DGENPTA(DFN))&('$$STATUS^DGENA(DFN))
    75         ;
    76         ;if making an appt., & in interactive mode, display enrollment status
    77         I ($G(SDAMEVT)=1),$G(SDMODE)=0 D
    78         .D DISPLAY^DGENU($P($G(SDATA),"^",2))
    79         .D PAUSE^VALM1
    80         ;
    81         ;want to do the same thing for check-in, unless appt just made
    82         I ($G(SDAMEVT)=4),$G(SDMODE)=0 D
    83         .;want to try avoiding giving display if it was done already
    84         .;so, if it is an unscheduled appt made today, skip
    85         .N PTNODE,SCNODE
    86         .S SCNODE=$G(^TMP("SDAMEVT",$J,"AFTER","SC"))
    87         .S PTNODE=$G(^TMP("SDAMEVT",$J,"AFTER","DPT"))
    88         .I +$P(SCNODE,"^",7)=$G(DT),$P(PTNODE,"^",7)=4 Q  ;unscheduled appt made today
    89         .D DISPLAY^DGENU($P($G(SDATA),"^",2))
    90         .D PAUSE^VALM1
    91         Q
    92         ;
    93 ENROLL  ;Entry point for the DGEN SD ENROLL PATIENT protocol, which hangs of
    94         ;the Scheduling Event Driver. This event enrolls patients upon check-out
    95         ;if there is no prior enrollment record.
    96         ;
    97         ; Input  -- SDATA & SDAMEVT defined by the scheduling event driver
    98         ; Output -- none
    99         ;
    100         N DGENR,DFN
    101         ;
    102         ;NOTE - it appears from testing that means test status REQUIRED is set
    103         ;within scheduling, obviating the need to do it here.  This is why
    104         ;several lines are commented out.
    105         ;
    106         ;N DGENR,DGOKF,DGREQF,DFN,DGMSGF,DG,DGMT,DGMTCOR,DGMTE,DGRGAUTO,DGWRT,XMZ,DIG,DIH
    107         ;
    108         ;appointment made, check if enrollment appointment request needs reset.
    109         I $G(SDAMEVT)=1 D REQUST(SDAMEVT,SDATA)
    110         ;check-out?
    111         Q:($G(SDAMEVT)'=5)
    112         ;
    113         S DFN=$P($G(SDATA),"^",2)
    114         ;
    115         ;don't enroll if the patient has an enrollment record
    116         I $$FINDCUR^DGENA(DFN) D REQUST(SDAMEVT,SDATA) Q
    117         ;
    118         ;non-vet?
    119         Q:'$$VET^DGENPTA(DFN)
    120         ;
    121         ;dead?
    122         Q:$$DEATH^DGENPTA(DFN)
    123         ;
    124         ;Does patient require a Means Test?
    125         ;S DGMSGF=1
    126         ;D EN^DGMTR
    127         ;
    128         ;Create local enrollment array
    129         I $$CREATE^DGENA6(DFN,DT,,,,.DGENR) D
    130         . ;
    131         . ;Store local enrollment as current
    132         . I $$STORECUR^DGENA1(.DGENR) D
    133         . . D REQUST(SDAMEVT,SDATA)
    134         . . ;
    135         . . ;If patient's means test status is required, send bulletin
    136         . . ;I $$MTREQ^DGEN(DFN) D MTBULL^DGEN(DFN,.DGENR)
    137         Q
    138         ;
    139 REQUST(SDAMEVT,SDATA)   ;
    140         ;Automatic collection of Appointment Request Date and Appointment
    141         ;Request Response
    142         ;- Set when Enrollment Application Date >= 8/1/2005 AND
    143         ;-     Appointment Request Date is null.
    144         ;
    145         ; Input  -- SDATA and SDAMEVT defined by scheduling event driver
    146         ; Output -- none
    147         ;
    148         N DGENRIEN,DGENR,DPTERR,DGCOM
    149         ;apointment made or checked out?
    150         Q:(($G(SDAMEVT)'=1)&($G(SDAMEVT)'=5))
    151         ;
    152         S DFN=$P($G(SDATA),"^",2)
    153         ;get enrollment ien
    154         S DGENRIEN=$$FINDCUR^DGENA(DFN)
    155         I DGENRIEN,$$GET^DGENA(DGENRIEN,.DGENR) ;set-up enrollment array
    156         I $G(DGENR("APP"))>3050731 D
    157         . ;and, no appointment request date. Set request="yes", request date
    158         . I '$$GET1^DIQ(2,DFN,1010.1511,"I") D
    159         . . ;set fields
    160         . . N FDATA
    161         . . S FDATA(2,DFN_",",1010.159)=1
    162         . . S FDATA(2,DFN_",",1010.1511)=DT
    163         . . D FILE^DIE("","FDATA","DPTERR")
    164         . ;if appointment made (or checkout), appt. request="yes", request status'="filled"
    165         . ;- set request status='filled' w comment
    166         . I ($$GET1^DIQ(2,DFN,1010.159,"I")),($$GET1^DIQ(2,DFN,1010.161,"I")'="F") D
    167         . . ;set fields
    168         . . N FDATA
    169         . . S FDATA(2,DFN_",",1010.161)="F"
    170         . . S DGCOM=$$GET1^DIQ(2,DFN,1010.163)
    171         . . S DGCOM=DGCOM_$S(DGCOM'="":"<>",1:"")_"AutoComm:"_$S($$GET1^DIQ(2,DFN,1010.161,"I")="":"null",1:$S($$GET1^DIQ(2,DFN,1010.161,"I")="I":"IN PROGRESS",1:$$GET1^DIQ(2,DFN,1010.161)))_"|FILLED by Scheduling"
    172         . . S FDATA(2,DFN_",",1010.163)=DGCOM
    173         . . D FILE^DIE("","FDATA","DPTERR")
    174         Q
     1DGENA2 ;ALB/CJM,RTK,TDM - Enrollment API - Automatic Update; 9/19/2002 ; 1/31/03 11:54am
     2 ;;5.3;Registration;**121,122,147,232,327,469,491**;Aug 13,1993
     3 ;
     4AUTOUPD(DFN,EVENT) ;
     5 ;Description: If the patient meets the criteria for transmission to HEC,
     6 ;   he is entered to the IVM PATIENT file for future transmission.
     7 ;   This procedure checks for changes in enrollment priority,
     8 ;   status and fields in the eligibility sub-record. If any changes are
     9 ;   found, the current enrollment record is automatically updated.
     10 ;Input:
     11 ;  DFN - Patient IEN
     12 ;  EVENT - Event Type (optional)
     13 ;          EVENT 1 : Date of Death Deleted
     14 ;          EVENT 2 : Ineligible Date Deleted
     15 ;Output: None
     16 ;
     17 ;if the eligibility/enrollment upload is in progess, do not do anything
     18 Q:($G(DGENUPLD)="ENROLLMENT/ELIGIBILITY UPLOAD IN PROGRESS")
     19 ;
     20 ; If the INCOME TEST DATA (Z10) upload is in progess, do not do anything
     21 Q:($G(IVMZ10)="UPLOAD IN PROGRESS")
     22 ;
     23 N DGENRIEN,DGENR1,DGENR2,STATUS,EFFDATE,OK,DEATH
     24 ;
     25 ;try to prevent problems rsulting from calling FM within FM
     26 N DS,D0,DO,D1,DA,DD,DS,DG,DIC,DICR,DIE,DIG,DIH,DIV,DIW,DIX,DQ,DR
     27 ;
     28 S EVENT=+$G(EVENT)
     29 ;
     30 D EVENT^IVMPLOG(DFN)
     31 ;
     32 D:$$LOCK^DGENA1($G(DFN))  ;may drop out of block
     33 .S DGENRIEN=$$FINDCUR^DGENA(DFN)
     34 .Q:'DGENRIEN
     35 .Q:'$$GET^DGENA(DGENRIEN,.DGENR1)
     36 .S STATUS=$$EXT^DGENU("STATUS",DGENR1("STATUS"))
     37 .S (DEATH,EFFDATE)=$$DEATH^DGENPTA(DFN)
     38 .I STATUS'="VERIFIED",STATUS'="UNVERIFIED",STATUS'="DECEASED",STATUS'["NOT ELIGIBLE",STATUS'["PENDING",STATUS'["REJECTED" Q
     39 .I STATUS="DECEASED",((EVENT'=1)!(DEATH)) Q
     40 .I STATUS["NOT ELIGIBLE",((EVENT'=2)!('$$VET^DGENPTA(DFN))) Q
     41 .S:'EFFDATE EFFDATE=DT
     42 .Q:'$$CREATE^DGENA6(DFN,DGENR1("APP"),EFFDATE,DGENR1("REASON"),DGENR1("REMARKS"),.DGENR2,DGENR1("DATE"),DGENR1("END"))
     43 .S OK=1
     44 .S:(DGENR1("PRIORITY")'=DGENR2("PRIORITY"))!(DGENR2("STATUS")'=DGENR1("STATUS")) OK=0
     45 .I OK D
     46 ..N SUB
     47 ..S SUB=""
     48 ..F  S SUB=$O(DGENR2("ELIG",SUB)) Q:SUB=""  S:(DGENR1("ELIG",SUB)'=DGENR2("ELIG",SUB)) OK=0
     49 .I 'OK D
     50 ..I (DGENR1("EFFDATE")=DGENR2("EFFDATE")),(DGENR1("SOURCE")=DGENR2("SOURCE")),(DGENR1("USER")=DGENR2("USER")),(DGENR1("DATETIME")\1)=(DGENR2("DATETIME")\1) D
     51 ...;in this case it's an overlay
     52 ...S DGENR2("PRIORREC")=DGENR1("PRIORREC")
     53 ...I $$EDITCUR^DGENA1(.DGENR2)
     54 ..E  D
     55 ...;in this case create a new record, to preserve the audit trail
     56 ...I $$STORECUR^DGENA1(.DGENR2)
     57 D UNLOCK^DGENA1($G(DFN))
     58 Q
     59MTUPD ;
     60 ;Description - entry point for Means Test Event Driver for Enrollment
     61 ;
     62 D AUTOUPD($G(DFN))
     63 Q
     64 ;
     65SDDIS ;Entry point for the DGEN SD DISPLAY CURRENT ENROLLMENT protocol,
     66 ;which hangs of the Scheduling Event Driver
     67 ;
     68 N DFN S DFN=$P($G(SDATA),"^",2)
     69 ;
     70 ;don't display if running in the background
     71 Q:$D(ZTQUEUED)
     72 ;
     73 ;don't want to display enrollment for non-vets with no enrollment status
     74 Q:('$$VET^DGENPTA(DFN))&('$$STATUS^DGENA(DFN))
     75 ;
     76 ;if making an appt., & in interactive mode, display enrollment status
     77 I ($G(SDAMEVT)=1),$G(SDMODE)=0 D
     78 .D DISPLAY^DGENU($P($G(SDATA),"^",2))
     79 .D PAUSE^VALM1
     80 ;
     81 ;want to do the same thing for check-in, unless appt just made
     82 I ($G(SDAMEVT)=4),$G(SDMODE)=0 D
     83 .;want to try avoiding giving display if it was done already
     84 .;so, if it is an unscheduled appt made today, skip
     85 .N PTNODE,SCNODE
     86 .S SCNODE=$G(^TMP("SDAMEVT",$J,"AFTER","SC"))
     87 .S PTNODE=$G(^TMP("SDAMEVT",$J,"AFTER","DPT"))
     88 .I +$P(SCNODE,"^",7)=$G(DT),$P(PTNODE,"^",7)=4 Q  ;unscheduled appt made today
     89 .D DISPLAY^DGENU($P($G(SDATA),"^",2))
     90 .D PAUSE^VALM1
     91 Q
     92 ;
     93ENROLL ;Entry point for the DGEN SD ENROLL PATIENT protocol, which hangs of
     94 ;the Scheduling Event Driver. This event enrolls patients upon check-out
     95 ;if there is no prior enrollment record.
     96 ;
     97 ; Input  -- SDATA & SDAMEVT defined by the scheduling event driver
     98 ; Output -- none
     99 ;
     100 N DGENR,DFN
     101 ;
     102 ;NOTE - it appears from testing that means test status REQUIRED is set
     103 ;within scheduling, obviating the need to do it here.  This is why
     104 ;several lines are commented out.
     105 ;
     106 ;N DGENR,DGOKF,DGREQF,DFN,DGMSGF,DG,DGMT,DGMTCOR,DGMTE,DGRGAUTO,DGWRT,XMZ,DIG,DIH
     107 ;
     108 ;check-out?
     109 Q:($G(SDAMEVT)'=5)
     110 ;
     111 S DFN=$P($G(SDATA),"^",2)
     112 ;
     113 ;don't enroll if the patient has an enrollment record
     114 Q:$$FINDCUR^DGENA(DFN)
     115 ;
     116 ;non-vet?
     117 Q:'$$VET^DGENPTA(DFN)
     118 ;
     119 ;dead?
     120 Q:$$DEATH^DGENPTA(DFN)
     121 ;
     122 ;Does patient require a Means Test?
     123 ;S DGMSGF=1
     124 ;D EN^DGMTR
     125 ;
     126 ;Create local enrollment array
     127 I $$CREATE^DGENA6(DFN,DT,,,,.DGENR) D
     128 . ;
     129 . ;Store local enrollment as current
     130 . I $$STORECUR^DGENA1(.DGENR) D
     131 . . ;
     132 . . ;If patient's means test status is required, send bulletin
     133 . . ;I $$MTREQ^DGEN(DFN) D MTBULL^DGEN(DFN,.DGENR)
     134 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGENUPLB.m

    r613 r623  
    1 DGENUPLB        ;ALB/TDM - PROCESS INCOMING (Z11 EVENT TYPE) HL7 MESSAGES ; 11/14/07 3:02pm
    2         ;;5.3;REGISTRATION;**625,763**;Aug 13,1993;Build 9
    3         ;
    4 EP      N MSGARY
    5         D CHECK
    6         Q
    7         ;
    8 CHECK   ;Check for Rated Disability Changes
    9         Q:'$D(DGELG)
    10         N RDOCC,TMPARY,RD,RDOCC1,RDOCC2,RDFLG,RDNOD
    11         ;
    12         ;Change in Rated Disabilities
    13         I $D(OLDELG("RATEDIS")) D
    14         .S RDOCC=0 F  S RDOCC=$O(OLDELG("RATEDIS",RDOCC)) Q:RDOCC=""  D
    15         ..S RD=$P(OLDELG("RATEDIS",RDOCC,"RD"),"^") Q:RD=""
    16         ..S TMPARY(RD)=RDOCC
    17         ;
    18         I $D(DGELG("RATEDIS")) D
    19         .S RDOCC=0 F  S RDOCC=$O(DGELG("RATEDIS",RDOCC)) Q:RDOCC=""  D
    20         ..S RD=$P(DGELG("RATEDIS",RDOCC,"RD"),"^") Q:RD=""
    21         ..S $P(TMPARY(RD),"^",2)=RDOCC
    22         ;
    23         I $D(TMPARY) D
    24         .S RD=""
    25         .F  S RD=$O(TMPARY(RD)) Q:RD=""  D
    26         ..S RDOCC2=+$P(TMPARY(RD),"^",2) Q:'RDOCC2
    27         ..S RDOCC1=+$P(TMPARY(RD),"^")
    28         ..I 'RDOCC1 D STOR390 Q
    29         ..S RDFLG=0
    30         ..F RDNOD="RD","PER","RDSC","RDEXT","RDORIG","RDCURR" D  Q:RDFLG
    31         ...I $G(OLDELG("RATEDIS",RDOCC1,RDNOD))'=$G(DGELG("RATEDIS",RDOCC2,RDNOD)) D STOR390
    32         Q
    33         ;
    34 STOR390 ;Store Data in file# 390
    35         S RDFLG=1
    36         N DATA,DA
    37         S DATA(.01)=$$NOW^XLFDT
    38         S DATA(2)=DFN
    39         S DATA(3)=DGELG("RATEDIS",RDOCC2,"RD")
    40         S DATA(4)=DGELG("RATEDIS",RDOCC2,"PER")
    41         S DATA(5)=DGELG("RATEDIS",RDOCC2,"RDEXT")
    42         S DATA(6)=DGELG("RATEDIS",RDOCC2,"RDORIG")
    43         S DATA(7)=DGELG("RATEDIS",RDOCC2,"RDCURR")
    44         I '$$ADD^DGENDBS(390,,.DATA) S ERROR="FILEMAN FAILED TO ADD RATED DISABILITY UPLOAD AUDIT"
    45         Q
     1DGENUPLB ;TDM - PROCESS INCOMING (Z11 EVENT TYPE) HL7 MESSAGES ; 10/26/04 2:01pm
     2 ;;5.3;REGISTRATION;**625**;Aug 13,1993
     3 ;
     4EP N MSGARY
     5 D CHECK,SNDMSG
     6 Q
     7 ;
     8CHECK ;Perform C&P and SC status checks and generate mailman messages
     9 ;for MCCR eligibility & billing staff.
     10 Q:'$D(OLDELG)
     11 N RDOCC,TMPARY,RD,RDOCC1,RDOCC2,RDFLG
     12 ;
     13 ;Change in SC Indicator
     14 I OLDELG("SC")'=DGELG("SC") D
     15 .Q:(OLDELG("SC")="")&(DGELG("SC")="N")
     16 .Q:(OLDELG("SC")="N")&(DGELG("SC")="")
     17 .D ADDMSG^DGENUPL3(.MSGARY,"VETERAN SC INDICATOR CHANGED",1)
     18 ;
     19 ;SC% change to 50% or greater
     20 I (OLDELG("SCPER")<50),(DGELG("SCPER")>49) D ADDMSG^DGENUPL3(.MSGARY,"VETERAN SC% CHANGED TO 50% OR GREATER",1)
     21 ;
     22 ;Change in VA Pension
     23 I OLDELG("VAPEN")'=DGELG("VAPEN") D
     24 .Q:(OLDELG("VAPEN")="")&(DGELG("VAPEN")="N")
     25 .Q:(OLDELG("VAPEN")="N")&(DGELG("VAPEN")="")
     26 .D ADDMSG^DGENUPL3(.MSGARY,"VETERAN VA PENSION CHANGED",1)
     27 ;
     28 ;Change in Rated Disabilities
     29 I $D(OLDELG("RATEDIS")) D
     30 .S RDOCC=0 F  S RDOCC=$O(OLDELG("RATEDIS",RDOCC)) Q:RDOCC=""  D
     31 ..S RD=$P(OLDELG("RATEDIS",RDOCC,"RD"),"^") Q:RD=""
     32 ..S TMPARY(RD)=RDOCC
     33 ;
     34 I $D(DGELG("RATEDIS")) D
     35 .S RDOCC=0 F  S RDOCC=$O(DGELG("RATEDIS",RDOCC)) Q:RDOCC=""  D
     36 ..S RD=$P(DGELG("RATEDIS",RDOCC,"RD"),"^") Q:RD=""
     37 ..S $P(TMPARY(RD),"^",2)=RDOCC
     38 ;
     39 I $D(TMPARY) D
     40 .S RD="",RDFLG=0
     41 .F  S RD=$O(TMPARY(RD)) Q:RD=""  D
     42 ..S RDOCC1=+$P(TMPARY(RD),"^"),RDOCC2=+$P(TMPARY(RD),"^",2)
     43 ..I $G(OLDELG("RATEDIS",RDOCC1,"RD"))'=$G(DGELG("RATEDIS",RDOCC2,"RD")) S RDFLG=1
     44 .I RDFLG D ADDMSG^DGENUPL3(.MSGARY,"VETERAN RATED DISABILITIES CHANGED",1)
     45 Q
     46 ;
     47SNDMSG ;Description: Send messages generated above to the G.IB MEANS TEST
     48 ;mail group.
     49 ;
     50 N TEXT,XMDUZ,XMTEXT,XMSUB,XMSTRIP,XMROU,XMY,XMZ,XMDF,COUNT
     51 N HEADER,NSC,POW,TMPSTR,XMGROUP,ELIG,CD
     52 ;
     53 ;if there are no alerts, then quit
     54 Q:'$D(MSGARY)
     55 S HEADER="C&P Alert: ",XMDF="",(XMDUN,XMDUZ)="Registration Enrollment Module"
     56 ;DGPAT("SSN") is built by the parser. DGPAT("NAME"),DGPAT("SEX"),DGPAT("DOB")(are merged into DGPAT from OLDPAT.
     57 ;The checks below are to setup the DGPAT elements from OLDPAT if NOTIFY is called before the merge.
     58 I '$D(DGPAT("NAME")) S DGPAT("NAME")=$G(OLDPAT("NAME"))
     59 I '$D(DGPAT("SEX")) S DGPAT("SEX")=$G(OLDPAT("SEX"))
     60 I '$D(DGPAT("DOB")) S DGPAT("DOB")=$G(OLDPAT("DOB"))
     61 S TMPSTR=" ("_$E(DGPAT("NAME"),1,1)
     62 S TMPSTR=TMPSTR_$E(DGPAT("SSN"),$L(DGPAT("SSN"))-3,1000)_")"
     63 S XMSUB=HEADER_$E(DGPAT("NAME"),1,25)_TMPSTR
     64 ;
     65 ; send msg to mail group in IB SITE PARAMETERS (#350.9) file
     66 S XMY("G.IB MEANS TEST")=""    ; Means Test billing Group
     67 ;
     68 S XMTEXT="TEXT("
     69 S TEXT(1)="The enrollment/eligibility upload produced the following alerts:"
     70 S TEXT(2)="  "
     71 S TEXT(3)="Patient Name   :     "_DGPAT("NAME")
     72 S TEXT(4)="SSN            :     "_DGPAT("SSN")
     73 S TEXT(5)="DOB            :     "_$$EXTERNAL^DILFD(2,$$FIELD^DGENPTA1("DOB"),"F",DGPAT("DOB"))
     74 S TEXT(6)="SEX            :     "_$$EXTERNAL^DILFD(2,$$FIELD^DGENPTA1("SEX"),"F",DGPAT("SEX"))
     75 S TEXT(7)=" "
     76 ;
     77 S TEXT(8)=" ** Alerts **"
     78 S TEXT(9)=" "
     79 S COUNT=0 F  S COUNT=$O(MSGARY(COUNT)) Q:'COUNT  S TEXT(10+COUNT)=COUNT_") "_MSGARY(COUNT)
     80 ;
     81 D ^XMD
     82 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGLBPID.m

    r613 r623  
    1 DGLBPID ;DJW,TOAD; Health Record Number Identifier ;5/1/07  20:26
    2         ;;5.3;Registration;**634**;Aug 13, 1993;Build 30
    3         ; Copyright (C) 2007 WorldVistA
    4         ;
    5         ; This program is free software; you can redistribute it and/or modify
    6         ; it under the terms of the GNU General Public License as published by
    7         ; the Free Software Foundation; either version 2 of the License, or
    8         ; (at your option) any later version.
    9         ;
    10         ; This program is distributed in the hope that it will be useful,
    11         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    12         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13         ; GNU General Public License for more details.
    14         ;
    15         ; You should have received a copy of the GNU General Public License
    16         ; along with this program; if not, write to the Free Software
    17         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    18         ;'Modified' MAS Patient Look-up Check Cross-References June 1987
    19         Q
    20         ;
    21         ;
    22 ID(DFN) ;GFT/VW  IA 10035
    23         N ID S ID=$P($G(^DPT(DFN,.36)),U,3) ;PRIMARY LONG ID
    24         I ID="" S ID=$$HRN(DFN)
    25         I ID="" S ID=$P($G(^DPT(DFN,0)),U,9) I ID]"" S ID=$E(ID,1,3)_"-"_$E(ID,4,5)_"-"_$E(ID,6,99)
    26         I ID="" D
    27         .N I F I=0:0 S I=$O(^AUPNPAT(DFN,41,I)) Q:'I  I $P($G(^(I,0)),U,5)="" S ID=$P($G(^(0)),U,2) I ID]"" S ID=ID_" ("_$P($G(^DIC(4,I,0)),U,5)_")" Q
    28         I ID="" S ID="`"_DFN
    29         Q ID
    30         ;
    31         ;
    32         ;
    33         ;
    34 HRN(DFN)        ;LOOKUP HEALTH RECORD NUMBER
    35         I '$G(DUZ(2)) Q ""
    36         Q $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2)
    37         ;
    38         ;
    39 GOTIDQ(DFN)     ;Do we have the needed number for this guy?
    40         N T S T=$$REQID(DFN)
    41         I T="SSN" Q $P(^DPT(DFN,0),U,9)]""
    42         I T="HRN" Q:'$G(DUZ(2)) 0 Q $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2)]""
    43         Q 1
    44         ;
    45         ;
    46 REQID(DFN)      ;WHICH IDENTIFICATION FORMAT IS REQUIRED?
    47         N TYPE S TYPE=""
    48         D:$G(DFN)
    49         .S TYPE=+$G(^DPT(DFN,.361)) I TYPE S TYPE=$P($G(^DIC(8,TYPE,0)),U,9) ;try PRIMARY ELIGIBILITY CODE
    50         .I TYPE="" S TYPE=+$G(^DPT(DFN,"TYPE")) I TYPE S TYPE=+$G(^DG(391,TYPE,8.2)) ;try patient TYPE
    51         I 'TYPE S TYPE=$G(DUZ("AG")),TYPE=$S(TYPE="V":1,1:2) ;or just assume it's HRN if not VA
    52         Q $P("SSN^HRN",U,TYPE)
    53         ;
    54         ;
    55 IDCAP() ;Returns 3 characters: " ID" or "SSN"
    56         I $G(DUZ("AG"))="E" Q " ID"
    57         Q "SSN"
    58         ;
    59         ;
    60         ;
    61         ;
    62         ;
    63         ;
    64 LONGID  ;Called by ^DIC(8.2,2,"LONG") (assumes DA(1) is DFN!)
    65         N INSTITU,DFN,DFNID,SSNID,IHSID D GETALL
    66         S X=$S($G(IHSID("L"))'?."-":IHSID("L"),$G(SSNID("L"))'?."-":SSNID("L"),$G(DFNID("L"))'?."-":DFNID("L"),1:"")
    67         ;I X="" W 1/0  ;some LONGID must exist for a patient, else ERROR!
    68         Q
    69         ;
    70         ;
    71 SHORTID ;Called by ^DIC(8.2,2,"SHORT") (assumes DA(1) is DFN!)
    72         N INSTITU,DFN,DFNID,SSNID,IHSID D GETALL
    73         S X=$S($G(IHSID("S"))'?."-":IHSID("S"),$G(SSNID("S"))'?."-":SSNID("S"),$G(DFNID("S"))'?."-":DFNID("S"),1:"")
    74         ;I X="" W 1/0  ;some SHORTID must exist for a patient, else ERROR!
    75         Q
    76         ;
    77         ;
    78 IHSID   ;
    79         ;given INSTITU (current institution #)
    80         ;get HEALTH RECORD NUMBER (Multiple 4101, 9000001.41) associated
    81         ;with the institution
    82         S IHSID=$P($G(^AUPNPAT(DFN,41,+INSTITU,0)),"^",2)
    83         I IHSID'="" D
    84         . S IHSID("L")=IHSID ; $J(IHSID,12) ; if we want to zero pad then $TR($J(IHSID("L"),12)," ",0)
    85         . S IHSID("S")=$TR(IHSID("L"),$TR(IHSID("L"),9876543210))
    86         . S IHSID("S")=$TR($J(IHSID("S"),4)," ",0)
    87         . S IHSID("S")=$E(IHSID("S"),$L(IHSID("S"))-3,$L(IHSID("S")))
    88         ;now return Health Record Number
    89         Q
    90 DFNID   S DFN=DA(1) ; IEN in patient file, with default institution from
    91         ;kernel system parameters file as prefix.
    92         ;8989.3,217    DEFAULT INSTITUTION of #8989.3 -- KERNEL SYSTEM PARAMETERS FILE
    93         S INSTITU=$P($G(^XTV(8989.3,1,"XUS")),U,17)
    94         ;150.9  VISIT TRACKING PARAMETERS :: DEFAULT INSTITUTION:
    95         I INSTITU="",$P($G(^DIC(150.9,1,0)),U,4)'="" S INSTITU=$P(^(0),U,4)
    96         ; if we have a medical record number in IHS PATIENT, for this
    97         I INSTITU'="",$P($G(^DIC(4,+INSTITU,99)),U)'="" S INSTITU("STA#")=$P(^(99),U)
    98         ; now put INSTITUtion STATION NUMBER as prefix to DFN as "DFNID"
    99         S DFNID("S")="`"_DFN,DFNID("L")=999_"-`"_DFN S:$D(INSTITU("STA#"))#2 DFNID("L")=INSTITU("STA#")_"-`"_DFN
    100         Q
    101 SSNID   ;
    102         ;code scarfed from ^DIC(8.2,1,"LONG") - retrieving the SSN
    103         N X
    104         S SSNID("L")="" I $D(DFN),$D(^DPT(DFN,0)) S X=$P(^(0),U,9),SSNID("L")=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10)
    105         S SSNID("S")=$P(SSNID("L"),"-",3)
    106         Q
    107 GETALL  ;
    108         ;Utility Subroutine to Getall the variables
    109         D DFNID,IHSID,SSNID
    110         ;K DFNID,SSNID ; kill because HRN is "required"
    111         Q
    112         ;
    113 ENALL   ;RE-INDEX PHONE NUMBER (KIDS POST-INSTALL DG*5.3*634)
    114         K ^DPT("AZVWVOE")
    115         N DIK S DIK="^DPT(",DIK(1)=".131^251000" D ENALL^DIK
    116         Q
     1DGLBPID ;DJW,TOAD; Health Record Number Identifier ;5/1/07  20:26
     2 ;;5.3;Registration;**634**;Aug 13, 1993;Build 28
     3 ; Copyright (C) 2007 WorldVistA
     4 ;
     5 ; This program is free software; you can redistribute it and/or modify
     6 ; it under the terms of the GNU General Public License as published by
     7 ; the Free Software Foundation; either version 2 of the License, or
     8 ; (at your option) any later version.
     9 ;
     10 ; This program is distributed in the hope that it will be useful,
     11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 ; GNU General Public License for more details.
     14 ;
     15 ; You should have received a copy of the GNU General Public License
     16 ; along with this program; if not, write to the Free Software
     17 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     18 ;'Modified' MAS Patient Look-up Check Cross-References June 1987
     19 Q
     20 ;
     21 ;
     22ID(DFN) ;GFT/VW  IA 10035
     23 N ID S ID=$P($G(^DPT(DFN,.36)),U,3) ;PRIMARY LONG ID
     24 I ID="" S ID=$$HRN(DFN)
     25 I ID="" S ID=$P($G(^DPT(DFN,0)),U,9) I ID]"" S ID=$E(ID,1,3)_"-"_$E(ID,4,5)_"-"_$E(ID,6,99)
     26 I ID="" D
     27 .N I F I=0:0 S I=$O(^AUPNPAT(DFN,41,I)) Q:'I  I $P($G(^(I,0)),U,5)="" S ID=$P($G(^(0)),U,2) I ID]"" S ID=ID_" ("_$P($G(^DIC(4,I,0)),U,5)_")" Q
     28 I ID="" S ID="`"_DFN
     29 Q ID
     30 ;
     31 ;
     32 ;
     33 ;
     34HRN(DFN) ;LOOKUP HEALTH RECORD NUMBER
     35 I '$G(DUZ(2)) Q ""
     36 Q $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2)
     37 ;
     38 ;
     39GOTIDQ(DFN) ;Do we have the needed number for this guy?
     40 N T S T=$$REQID(DFN)
     41 I T="SSN" Q $P(^DPT(DFN,0),U,9)]""
     42 I T="HRN" Q:'$G(DUZ(2)) 0 Q $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2)]""
     43 Q 1
     44 ;
     45 ;
     46REQID(DFN) ;WHICH IDENTIFICATION FORMAT IS REQUIRED?
     47 N TYPE S TYPE=""
     48 D:$G(DFN)
     49 .S TYPE=+$G(^DPT(DFN,.361)) I TYPE S TYPE=$P($G(^DIC(8,TYPE,0)),U,9) ;try PRIMARY ELIGIBILITY CODE
     50 .I TYPE="" S TYPE=+$G(^DPT(DFN,"TYPE")) I TYPE S TYPE=+$G(^DG(391,TYPE,8.2)) ;try patient TYPE
     51 I 'TYPE S TYPE=$G(DUZ("AG")),TYPE=$S(TYPE="V":1,1:2) ;or just assume it's HRN if not VA
     52 Q $P("SSN^HRN",U,TYPE)
     53 ;
     54 ;
     55IDCAP() ;Returns 3 characters: " ID" or "SSN"
     56 I $G(DUZ("AG"))="E" Q " ID"
     57 Q "SSN"
     58 ;
     59 ;
     60 ;
     61 ;
     62 ;
     63 ;
     64LONGID ;Called by ^DIC(8.2,2,"LONG") (assumes DA(1) is DFN!)
     65 N INSTITU,DFN,DFNID,SSNID,IHSID D GETALL
     66 S X=$S($G(IHSID("L"))'?."-":IHSID("L"),$G(SSNID("L"))'?."-":SSNID("L"),$G(DFNID("L"))'?."-":DFNID("L"),1:"")
     67 ;I X="" W 1/0  ;some LONGID must exist for a patient, else ERROR!
     68 Q
     69 ;
     70 ;
     71SHORTID ;Called by ^DIC(8.2,2,"SHORT") (assumes DA(1) is DFN!)
     72 N INSTITU,DFN,DFNID,SSNID,IHSID D GETALL
     73 S X=$S($G(IHSID("S"))'?."-":IHSID("S"),$G(SSNID("S"))'?."-":SSNID("S"),$G(DFNID("S"))'?."-":DFNID("S"),1:"")
     74 ;I X="" W 1/0  ;some SHORTID must exist for a patient, else ERROR!
     75 Q
     76 ;
     77 ;
     78IHSID ;
     79 ;given INSTITU (current institution #)
     80 ;get HEALTH RECORD NUMBER (Multiple 4101, 9000001.41) associated
     81 ;with the institution
     82 S IHSID=$P($G(^AUPNPAT(DFN,41,+INSTITU,0)),"^",2)
     83 I IHSID'="" D
     84 . S IHSID("L")=IHSID ; $J(IHSID,12) ; if we want to zero pad then $TR($J(IHSID("L"),12)," ",0)
     85 . S IHSID("S")=$TR(IHSID("L"),$TR(IHSID("L"),9876543210))
     86 . S IHSID("S")=$TR($J(IHSID("S"),4)," ",0)
     87 . S IHSID("S")=$E(IHSID("S"),$L(IHSID("S"))-3,$L(IHSID("S")))
     88 ;now return Health Record Number
     89 Q
     90DFNID S DFN=DA(1) ; IEN in patient file, with default institution from
     91 ;kernel system parameters file as prefix.
     92 ;8989.3,217    DEFAULT INSTITUTION of #8989.3 -- KERNEL SYSTEM PARAMETERS FILE
     93 S INSTITU=$P($G(^XTV(8989.3,1,"XUS")),U,17)
     94 ;150.9  VISIT TRACKING PARAMETERS :: DEFAULT INSTITUTION:
     95 I INSTITU="",$P($G(^DIC(150.9,1,0)),U,4)'="" S INSTITU=$P(^(0),U,4)
     96 ; if we have a medical record number in IHS PATIENT, for this
     97 I INSTITU'="",$P($G(^DIC(4,+INSTITU,99)),U)'="" S INSTITU("STA#")=$P(^(99),U)
     98 ; now put INSTITUtion STATION NUMBER as prefix to DFN as "DFNID"
     99 S DFNID("S")="`"_DFN,DFNID("L")=999_"-`"_DFN S:$D(INSTITU("STA#"))#2 DFNID("L")=INSTITU("STA#")_"-`"_DFN
     100 Q
     101SSNID ;
     102 ;code scarfed from ^DIC(8.2,1,"LONG") - retrieving the SSN
     103 N X
     104 S SSNID("L")="" I $D(DFN),$D(^DPT(DFN,0)) S X=$P(^(0),U,9),SSNID("L")=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10)
     105 S SSNID("S")=$P(SSNID("L"),"-",3)
     106 Q
     107GETALL ;
     108 ;Utility Subroutine to Getall the variables
     109 D DFNID,IHSID,SSNID
     110 ;K DFNID,SSNID ; kill because HRN is "required"
     111 Q
     112 ;
     113ENALL ;RE-INDEX PHONE NUMBER (KIDS POST-INSTALL DG*5.3*634)
     114 K ^DPT("AZVWVOE")
     115 N DIK S DIK="^DPT(",DIK(1)=".131^251000" D ENALL^DIK
     116 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGMSTAPI.m

    r613 r623  
    1 DGMSTAPI        ;ALB/SCK - API's for Military Sexual Trauma ;7:34 PM  30 Jan 2008
    2         ;;5.3;Registration;**195,243,308,353,379,443,700,VWEHR1**;WorldVistA 30-Jan-08;Build 4
    3         ;
    4         ;Modified from FOIA VISTA,
    5         ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
    6         ;General Public License See attached copy of the License.
    7         ;
    8         ;This program is free software; you can redistribute it and/or modify
    9         ;it under the terms of the GNU General Public License as published by
    10         ;the Free Software Foundation; either version 2 of the License, or
    11         ;(at your option) any later version.
    12         ;
    13         ;This program is distributed in the hope that it will be useful,
    14         ;but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16         ;GNU General Public License for more details.
    17         ;
    18         ;You should have received a copy of the GNU General Public License along
    19         ;with this program; if not, write to the Free Software Foundation, Inc.,
    20         ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    21         ;
    22         Q
    23         ;
    24 GETSTAT(DFN,DGDATE)     ;  Retrieves the current MST status for a patient
    25         ;
    26         ;  Input
    27         ;    DFN  - IEN of patient in the PATIENT File (#2)
    28         ;    DGDATE - Date for status lookup [OPTIONAL]
    29         ;
    30         ;  Output
    31         ;    DGMST - Format will depend on result of lookup
    32         ;
    33         ;    If an entry is found then:
    34         ;       DGMST returns a 7 piece data string, caret(^)-delimited:
    35         ;        $P(1) = IEN of entry in MST HISTORY File (#29.11)
    36         ;        $P(2) = Internal value of MST Status ("Y,N,D,U")
    37         ;        $P(3) = Date of status change
    38         ;        $P(4) = IEN of provider making determination, file (#200)
    39         ;        $P(5) = IEN of user who entered status, file (#200)
    40         ;        $P(6) = External format of MST Status
    41         ;        $P(7) = IEN pointer of the INSTITUTION file (#4)
    42         ;
    43         ;    If no MST History is found, then:
    44         ;       DGMST = 0^U
    45         ;                "U" = (Unknown)
    46         ;    If an error occured in the GETS^DIQ lookup, then:
    47         ;       DGMST = -1^^Error Code IEN
    48         ;                   (returned by GETS^DIQ call)
    49         ;
    50         ; Get most recent MST status entry for the patient from file using
    51         ;  reverse $Order on the "APDT" x-ref.
    52         ;
    53         N DGMST,DGIEN,DGFDA,DGMSG
    54         S DFN=$G(DFN)
    55         I '+DFN!('$D(^DPT(DFN,0))) D  G STATQ
    56         . S DGMST="-1"
    57         I '$D(^DGMS(29.11,"APDT",DFN))  D  G STATQ
    58         .S DGMST="0^U"
    59         S DGDATE=$S(+$G(DGDATE)>0:DGDATE,1:$$NOW^XLFDT)
    60         I '$D(^DGMS(29.11,"APDT",DFN,DGDATE)) S DGDATE=$$DATE(DFN,DGDATE)
    61         I '+DGDATE D  G STATQ
    62         . S DGMST="0^U"
    63         S DGIEN=""
    64         ;
    65         ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
    66         ;
    67         ;S DGIEN=+$P($Q(^DGMS(29.11,"APDT",DFN,DGDATE,DGIEN),-1),",",5)
    68         S DGIEN=+$P($$Q^VWUTIL($NA(^DGMS(29.11,"APDT",DFN,DGDATE,DGIEN)),-1),",",5)
    69         ;
    70         ;END CHANGE
    71         ;
    72         ; Check for valid ien, if entry missing, return Unknown
    73         I +DGIEN'>0 D  G STATQ
    74         . S DGMST="0^U"
    75         ;
    76         ; Retrieve data
    77         D GETS^DIQ(29.11,+DGIEN_",","*","IE","DGFDA","DGMSG")
    78         ; check for errors
    79         I $D(DGMSG) D  G STATQ
    80         .S DGMST="-1^^"_$G(DGMSG("DIERR",1))
    81         ;
    82         S DGMST=DGIEN_U_$G(DGFDA(29.11,+DGIEN_",",3,"I"))_U_$G(DGFDA(29.11,+DGIEN_",",.01,"I"))_U_$G(DGFDA(29.11,+DGIEN_",",4,"I"))_U_$G(DGFDA(29.11,+DGIEN_",",5,"I"))
    83         S DGMST=DGMST_U_$G(DGFDA(29.11,+DGIEN_",",3,"E"))
    84         S DGMST=DGMST_U_$S($G(DGFDA(29.11,+DGIEN_",",6,"I"))]"":$G(DGFDA(29.11,+DGIEN_",",6,"I")),1:$$SITE)
    85         ;
    86 STATQ   Q $G(DGMST)
    87         ;
    88 NEWSTAT(DFN,DGSTAT,DGDATE,DGPROV,DGSITE,DGXMIT) ; MST HISTORY (#29.11) filer
    89         ; Callpoint to create a new MST HISTORY FILE (#29.11) entry.
    90         ; Will also queue HL7 message for HEC database updates.
    91         ;
    92         ;  Input
    93         ;    DFN    - Patients DFN
    94         ;    DGSTAT - MST Status code, "Y,N,D,U"
    95         ;    DGDATE - Date of MST status change  [default=NOW]
    96         ;    DGPROV - IEN of Provider making determination, file (#200)
    97         ;    DGSITE - IEN pointer of the INSTITUTION file (#4)
    98         ;    DGXMIT - HL7 transmit flag [OPTIONAL]
    99         ;              0=don't queue a message
    100         ;              1=queue a message [default])
    101         ;
    102         ;  Output
    103         ;    DGRSLT - Returns IEN of file (#29.11) entry if successful
    104         ;
    105         ;    If no patient was defined, then:
    106         ;       DGRSLT = -1^No patient defined
    107         ;
    108         ;    If an error occured in the GETS^DIQ lookup, then:
    109         ;       DGMST = -1^^Error Code IEN
    110         ;                   (returned by GETS^DIQ call)
    111         ;
    112         N DGFDA,DGMSG,DGERR,DGRSLT,MSTIEN
    113         S DFN=$G(DFN)
    114         I DFN']""!('$D(^DPT(DFN,0))) D  G NEWQ
    115         . S DGRSLT="-1^No patient defined"
    116         ;
    117         S DGSTAT=$S($G(DGSTAT)]"":DGSTAT,1:"U")
    118         S DGDATE=$G(DGDATE)
    119         S DGPROV=$G(DGPROV)
    120         S DGSITE=$G(DGSITE)
    121         S DGXMIT=$S($G(DGXMIT)=0:DGXMIT,1:1)
    122         S DGDATE=$S(+DGDATE>0:DGDATE,1:$$NOW^XLFDT)
    123         S DGSITE=$S(+DGSITE>0:DGSITE,1:$$SITE)
    124         ;
    125         I '$$CHANGE(DFN,DGSTAT,DGDATE) D  G NEWQ
    126         . S DGRSLT="0"
    127         ;
    128         I '$$VALID(DFN,DGSTAT,DGDATE,DGPROV,DGSITE,.DGERR) D  G NEWQ
    129         . S DGRSLT="-1^"_DGERR
    130         ;
    131         S DGFDA(1,29.11,"+1,",.01)=DGDATE
    132         S DGFDA(1,29.11,"+1,",2)=DFN
    133         S DGFDA(1,29.11,"+1,",3)=DGSTAT
    134         S DGFDA(1,29.11,"+1,",4)=DGPROV
    135         S DGFDA(1,29.11,"+1,",5)=DUZ
    136         S DGFDA(1,29.11,"+1,",6)=DGSITE
    137         ;
    138         D UPDATE^DIE("","DGFDA(1)","MSTIEN","DGERR")
    139         I $D(DGERR) D  G NEWQ
    140         . S DGRSLT="-1^"_$G(DGERR("DIERR",1))
    141         ;
    142         S DGRSLT=+MSTIEN(1)
    143         ;
    144         ; Callpoint to queue an entry that will trigger a HEC
    145         ;  Enrollment Full Data Transmission (ORF/ORU~ZO7) HL7 message.
    146         ; The HL7 message will contain the following three MST data elments
    147         ;  as part of the VA-Specific Eligibility ZEL segment:
    148         ;   (23) - MST STATUS
    149         ;   (24) - DATE MST STATUS CHANGED
    150         ;   (25) - SITE DETERMINING MST STATUS
    151         ;
    152         I DGXMIT D
    153         . D SEND^DGMSTL1(DFN,"Z07")
    154         ;
    155 NEWQ    Q $G(DGRSLT)
    156         ;
    157 DELMST(MSTIEN)  ; Deletes the MST HISTORY File (#29.11) entry passed in.
    158         ; This call is not to be used except from inside the DG MST List
    159         ; Manager interface.
    160         ;
    161         ; Input
    162         ;    MSTIEN   - IEN of the entry in the MST HISTORY File (#29.11)
    163         ;
    164         ; Output
    165         ;    If no IEN passed in, return -1
    166         ;    otherwise return 1
    167         ;
    168         Q:'$G(MSTIEN) "-1^No entry to delete"
    169         ;
    170         N DA,XD
    171         S DA=+$G(MSTIEN)
    172         S DIK="^DGMS(29.11,"
    173         D ^DIK K DIK
    174         Q 1
    175         ;
    176 NAME(DA)        ; Returns name from the VA NEW PERSON File using DIQ call
    177         ;
    178         N DGNAME,DGPROV,DIQ,DR,DIC
    179         I $G(DA)="" G NAMEQ
    180         S DIC=200,DR=".01",DIQ="DGPROV"
    181         D EN^DIQ1
    182         S DGNAME=$G(DGPROV(200,DA,.01))
    183 NAMEQ   Q $G(DGNAME)
    184         ;
    185 CHANGE(DFN,DGSTAT,DGDATE)       ;Did the Status OR Date change?
    186         ;  Input
    187         ;      DFN    - Patients DFN
    188         ;      DGSTAT - MST Status code, "Y,N,D,U"
    189         ;      DGDATE - Date of MST Status Change (FM format)
    190         ;
    191         ;  Output
    192         ;      Returns 0 if no status change
    193         ;              1 if status changed
    194         ;
    195         N DGCHG,DGMST
    196         S DGCHG=0
    197         I +$G(DFN)'>0!('$D(^DPT(DFN,0))) G CHNGQ
    198         S DGSTAT=$G(DGSTAT)
    199         I DGSTAT'?1A!("YNDU"'[DGSTAT) G CHNGQ
    200         S DGDATE=$G(DGDATE)
    201         I DGDATE="" G CHNGQ
    202         S DGMST=$$GETSTAT(DFN),DGMST=$G(DGMST)
    203         I +DGMST<1!($P(DGMST,U,2)'=$G(DGSTAT))!($P(DGMST,U,3)'=$G(DGDATE)) S DGCHG=1
    204 CHNGQ   Q DGCHG
    205         ;
    206 SITE(DGSITE)    ;Convert a station number into a pointer to the
    207         ; INSTITUTION file (#4).  If called with a null parameter then
    208         ; the pointer to the INSTITUTION file (#4) of the primary site
    209         ; will be returned.
    210         ;
    211         ;  Input
    212         ;    DGSITE - Station number (optional)
    213         ;
    214         ;  Output
    215         ;    Return Site IEN to INSTITUTION file (#4)
    216         ;
    217         S DGSITE=$G(DGSITE)
    218         I DGSITE]"",$D(^DIC(4,"D",DGSITE)) D
    219         . S DGSITE=$O(^DIC(4,"D",DGSITE,0))
    220         E  D
    221         . S DGSITE=$P($$SITE^VASITE,U)
    222         I +DGSITE'>0 S DGSITE=""
    223         Q DGSITE
    224         ;
    225 DATE(DFN,DGDT)  ;Determine 'current' MST date
    226         ;
    227         ;  Input
    228         ;    DFN  - Patient's DFN
    229         ;    DGDT - FileMan format date
    230         ;
    231         ;  Output
    232         ;    Return MST effective date
    233         ;
    234         N DGMSTDT
    235         S DFN=$G(DFN)
    236         I '+DFN D  G DATEQ
    237         . S DGMSTDT=""
    238         S DGDT=$S(+$G(DGDT)>0:DGDT,1:$$NOW^XLFDT)
    239         I $P(DGDT,".",2)="" S DGDT=DGDT_".999999"
    240         S DGMSTDT=$O(^DGMS(29.11,"APDT",DFN,DGDT),-1)
    241 DATEQ   Q DGMSTDT
    242         ;
    243 VALID(DFN,DGSTAT,DGDATE,DGPROV,DGSITE,DGERR)    ;Validate fields before filing
    244         ; Input:
    245         ;      DFN - [REQUIRED] - ien of Patient
    246         ;   DGSTAT - [REQUIRED] - MST Status code, "Y,N,D,U"
    247         ;   DGDATE - [REQUIRED] - Date of MST status change[FileMan Internal]
    248         ;   DGPROV - [optional] - IEN of Provider making determination
    249         ;   DGSITE - [optional] - IEN pointer of the INSTITUTION file
    250         ;    DGERR - [optional] - error parameter passed by reference
    251         ; Output:
    252         ;   Function Value - Returns 1 - if validation checks passed
    253         ;                            0 - if validation checks failed
    254         ;            DGERR - an error message if validation checks fail
    255         ; init variables
    256         N I,DGFILE,DGFLD,DGMSG,DGSTR,DGVAL,DGVAR,DGX,VALID
    257         S DGFILE=29.11,VALID=1,DGMSG=" IS REQUIRED"
    258         ; Quit DO block if invalid condition found
    259         ; Check for [REQUIRED] fields
    260         D
    261         . I DFN="" D MSG(DGFILE,2,DGMSG,.DGERR) Q        ;pat ien
    262         . I DGSTAT="" D MSG(DGFILE,3,DGMSG,.DGERR) Q     ;mst status code
    263         . I DGDATE="" D MSG(DGFILE,.01,DGMSG,.DGERR) Q   ;dt chg status
    264         .;
    265         .; Check for valid FIELD values
    266         . S DGMSG=" IS NOT VALID"
    267         .; need to strip off the 'seconds' to pass the CHK^DIE() call...
    268         . I DGDATE["." N DGSECS S DGSECS=$E($P(DGDATE,".",2),5,6) I DGSECS'="" I DGSECS<0!(DGSECS>60) D MSG(DGFILE,.01,DGMSG,.DGERR) Q
    269         . N DGDATEX S DGDATEX=DGDATE
    270         . I DGDATEX["." S DGDATEX=$P(DGDATEX,".")_"."_$E($P(DGDATEX,".",2),1,4)
    271         . I $E($P(DGDATEX,".",2),1,4)="0000" S DGDATEX=$P(DGDATEX,".")_".1"
    272         . S DGSTR=".01;DGDATEX^2;DFN^3;DGSTAT^4;DGPROV^5;DUZ^6;DGSITE"
    273         .;
    274         . F I=1:1:$L(DGSTR,U) S DGX=$P(DGSTR,U,I) Q:DGX=""  D  Q:'VALID
    275         .. S DGFLD=$P(DGX,";"),DGVAR=$P(DGX,";",2),DGVAL=@DGVAR
    276         .. Q:DGVAL=""
    277         .. S VALID=$$TESTVAL(DGFILE,DGFLD,DGVAL)
    278         .. D:'VALID MSG(DGFILE,DGFLD,DGMSG,.DGERR)
    279         Q VALID
    280         ;
    281 MSG(DGFIL,DGFLD,DGMSG,DGERR)    ; error message setup
    282         ; Input:
    283         ;   DGFIL - file number
    284         ;   DGFLD - field number of file
    285         ;   DGMSG - message type verbiage - " IS REQUIRED" or " IS NOT VALID"
    286         ;   DGERR - error parameter passed by reference
    287         ; Output:
    288         ;   DGERR - error message
    289         S DGERR=$$GET1^DID(DGFIL,DGFLD,,"LABEL")_DGMSG
    290         Q
    291         ;
    292 TESTVAL(DGFIL,DGFLD,DGVAL)      ; Determine if a field value is valid.
    293         ; Input:
    294         ;   DGFIL - file number
    295         ;   DGFLD - field number of file
    296         ;   DGVAL - field value to be validated
    297         ; Output:
    298         ;   Function value: Returns 1 if field is valid
    299         ;                           0 if validation fails
    300         N DGVALEX,DGRSLT,VALID
    301         S VALID=1
    302         I DGVAL'="" D
    303         . S DGVALEX=$$EXTERNAL^DILFD(DGFIL,DGFLD,"F",DGVAL)
    304         . I DGVALEX="" S VALID=0 Q   ; no external value, not valid
    305         . I $$GET1^DID(DGFIL,DGFLD,"","TYPE")'="POINTER" D
    306         .. D CHK^DIE(DGFIL,DGFLD,,DGVALEX,.DGRSLT) I DGRSLT="^" S VALID=0
    307         Q VALID
     1DGMSTAPI ;ALB/SCK - API's for Military Sexual Trauma ;7:34 PM  30 Jan 2008
     2 ;;5.3;Registration;**195,243,308,353,379,443,700,VWEHR1**;WorldVistA 30-Jan-08
     3 ;
     4 ;Modified from FOIA VISTA,
     5 ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
     6 ;General Public License See attached copy of the License.
     7 ;
     8 ;This program is free software; you can redistribute it and/or modify
     9 ;it under the terms of the GNU General Public License as published by
     10 ;the Free Software Foundation; either version 2 of the License, or
     11 ;(at your option) any later version.
     12 ;
     13 ;This program is distributed in the hope that it will be useful,
     14 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 ;GNU General Public License for more details.
     17 ;
     18 ;You should have received a copy of the GNU General Public License along
     19 ;with this program; if not, write to the Free Software Foundation, Inc.,
     20 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     21 ;
     22 Q
     23 ;
     24GETSTAT(DFN,DGDATE) ;  Retrieves the current MST status for a patient
     25 ;
     26 ;  Input
     27 ;    DFN  - IEN of patient in the PATIENT File (#2)
     28 ;    DGDATE - Date for status lookup [OPTIONAL]
     29 ;
     30 ;  Output
     31 ;    DGMST - Format will depend on result of lookup
     32 ;
     33 ;    If an entry is found then:
     34 ;       DGMST returns a 7 piece data string, caret(^)-delimited:
     35 ;        $P(1) = IEN of entry in MST HISTORY File (#29.11)
     36 ;        $P(2) = Internal value of MST Status ("Y,N,D,U")
     37 ;        $P(3) = Date of status change
     38 ;        $P(4) = IEN of provider making determination, file (#200)
     39 ;        $P(5) = IEN of user who entered status, file (#200)
     40 ;        $P(6) = External format of MST Status
     41 ;        $P(7) = IEN pointer of the INSTITUTION file (#4)
     42 ;
     43 ;    If no MST History is found, then:
     44 ;       DGMST = 0^U
     45 ;                "U" = (Unknown)
     46 ;    If an error occured in the GETS^DIQ lookup, then:
     47 ;       DGMST = -1^^Error Code IEN
     48 ;                   (returned by GETS^DIQ call)
     49 ;
     50 ; Get most recent MST status entry for the patient from file using
     51 ;  reverse $Order on the "APDT" x-ref.
     52 ;
     53 N DGMST,DGIEN,DGFDA,DGMSG
     54 S DFN=$G(DFN)
     55 I '+DFN!('$D(^DPT(DFN,0))) D  G STATQ
     56 . S DGMST="-1"
     57 I '$D(^DGMS(29.11,"APDT",DFN))  D  G STATQ
     58 .S DGMST="0^U"
     59 S DGDATE=$S(+$G(DGDATE)>0:DGDATE,1:$$NOW^XLFDT)
     60 I '$D(^DGMS(29.11,"APDT",DFN,DGDATE)) S DGDATE=$$DATE(DFN,DGDATE)
     61 I '+DGDATE D  G STATQ
     62 . S DGMST="0^U"
     63 S DGIEN=""
     64 ;
     65 ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
     66 ;
     67 ;S DGIEN=+$P($Q(^DGMS(29.11,"APDT",DFN,DGDATE,DGIEN),-1),",",5)
     68 S DGIEN=+$P($$Q^VWUTIL($NA(^DGMS(29.11,"APDT",DFN,DGDATE,DGIEN)),-1),",",5)
     69 ;
     70 ;END CHANGE
     71 ;
     72 ; Check for valid ien, if entry missing, return Unknown
     73 I +DGIEN'>0 D  G STATQ
     74 . S DGMST="0^U"
     75 ;
     76 ; Retrieve data
     77 D GETS^DIQ(29.11,+DGIEN_",","*","IE","DGFDA","DGMSG")
     78 ; check for errors
     79 I $D(DGMSG) D  G STATQ
     80 .S DGMST="-1^^"_$G(DGMSG("DIERR",1))
     81 ;
     82 S DGMST=DGIEN_U_$G(DGFDA(29.11,+DGIEN_",",3,"I"))_U_$G(DGFDA(29.11,+DGIEN_",",.01,"I"))_U_$G(DGFDA(29.11,+DGIEN_",",4,"I"))_U_$G(DGFDA(29.11,+DGIEN_",",5,"I"))
     83 S DGMST=DGMST_U_$G(DGFDA(29.11,+DGIEN_",",3,"E"))
     84 S DGMST=DGMST_U_$S($G(DGFDA(29.11,+DGIEN_",",6,"I"))]"":$G(DGFDA(29.11,+DGIEN_",",6,"I")),1:$$SITE)
     85 ;
     86STATQ Q $G(DGMST)
     87 ;
     88NEWSTAT(DFN,DGSTAT,DGDATE,DGPROV,DGSITE,DGXMIT) ; MST HISTORY (#29.11) filer
     89 ; Callpoint to create a new MST HISTORY FILE (#29.11) entry.
     90 ; Will also queue HL7 message for HEC database updates.
     91 ;
     92 ;  Input
     93 ;    DFN    - Patients DFN
     94 ;    DGSTAT - MST Status code, "Y,N,D,U"
     95 ;    DGDATE - Date of MST status change  [default=NOW]
     96 ;    DGPROV - IEN of Provider making determination, file (#200)
     97 ;    DGSITE - IEN pointer of the INSTITUTION file (#4)
     98 ;    DGXMIT - HL7 transmit flag [OPTIONAL]
     99 ;              0=don't queue a message
     100 ;              1=queue a message [default])
     101 ;
     102 ;  Output
     103 ;    DGRSLT - Returns IEN of file (#29.11) entry if successful
     104 ;
     105 ;    If no patient was defined, then:
     106 ;       DGRSLT = -1^No patient defined
     107 ;
     108 ;    If an error occured in the GETS^DIQ lookup, then:
     109 ;       DGMST = -1^^Error Code IEN
     110 ;                   (returned by GETS^DIQ call)
     111 ;
     112 N DGFDA,DGMSG,DGERR,DGRSLT,MSTIEN
     113 S DFN=$G(DFN)
     114 I DFN']""!('$D(^DPT(DFN,0))) D  G NEWQ
     115 . S DGRSLT="-1^No patient defined"
     116 ;
     117 S DGSTAT=$S($G(DGSTAT)]"":DGSTAT,1:"U")
     118 S DGDATE=$G(DGDATE)
     119 S DGPROV=$G(DGPROV)
     120 S DGSITE=$G(DGSITE)
     121 S DGXMIT=$S($G(DGXMIT)=0:DGXMIT,1:1)
     122 S DGDATE=$S(+DGDATE>0:DGDATE,1:$$NOW^XLFDT)
     123 S DGSITE=$S(+DGSITE>0:DGSITE,1:$$SITE)
     124 ;
     125 I '$$CHANGE(DFN,DGSTAT,DGDATE) D  G NEWQ
     126 . S DGRSLT="0"
     127 ;
     128 I '$$VALID(DFN,DGSTAT,DGDATE,DGPROV,DGSITE,.DGERR) D  G NEWQ
     129 . S DGRSLT="-1^"_DGERR
     130 ;
     131 S DGFDA(1,29.11,"+1,",.01)=DGDATE
     132 S DGFDA(1,29.11,"+1,",2)=DFN
     133 S DGFDA(1,29.11,"+1,",3)=DGSTAT
     134 S DGFDA(1,29.11,"+1,",4)=DGPROV
     135 S DGFDA(1,29.11,"+1,",5)=DUZ
     136 S DGFDA(1,29.11,"+1,",6)=DGSITE
     137 ;
     138 D UPDATE^DIE("","DGFDA(1)","MSTIEN","DGERR")
     139 I $D(DGERR) D  G NEWQ
     140 . S DGRSLT="-1^"_$G(DGERR("DIERR",1))
     141 ;
     142 S DGRSLT=+MSTIEN(1)
     143 ;
     144 ; Callpoint to queue an entry that will trigger a HEC
     145 ;  Enrollment Full Data Transmission (ORF/ORU~ZO7) HL7 message.
     146 ; The HL7 message will contain the following three MST data elments
     147 ;  as part of the VA-Specific Eligibility ZEL segment:
     148 ;   (23) - MST STATUS
     149 ;   (24) - DATE MST STATUS CHANGED
     150 ;   (25) - SITE DETERMINING MST STATUS
     151 ;
     152 I DGXMIT D
     153 . D SEND^DGMSTL1(DFN,"Z07")
     154 ;
     155NEWQ Q $G(DGRSLT)
     156 ;
     157DELMST(MSTIEN) ; Deletes the MST HISTORY File (#29.11) entry passed in.
     158 ; This call is not to be used except from inside the DG MST List
     159 ; Manager interface.
     160 ;
     161 ; Input
     162 ;    MSTIEN   - IEN of the entry in the MST HISTORY File (#29.11)
     163 ;
     164 ; Output
     165 ;    If no IEN passed in, return -1
     166 ;    otherwise return 1
     167 ;
     168 Q:'$G(MSTIEN) "-1^No entry to delete"
     169 ;
     170 N DA,XD
     171 S DA=+$G(MSTIEN)
     172 S DIK="^DGMS(29.11,"
     173 D ^DIK K DIK
     174 Q 1
     175 ;
     176NAME(DA) ; Returns name from the VA NEW PERSON File using DIQ call
     177 ;
     178 N DGNAME,DGPROV,DIQ,DR,DIC
     179 I $G(DA)="" G NAMEQ
     180 S DIC=200,DR=".01",DIQ="DGPROV"
     181 D EN^DIQ1
     182 S DGNAME=$G(DGPROV(200,DA,.01))
     183NAMEQ Q $G(DGNAME)
     184 ;
     185CHANGE(DFN,DGSTAT,DGDATE) ;Did the Status OR Date change?
     186 ;  Input
     187 ;      DFN    - Patients DFN
     188 ;      DGSTAT - MST Status code, "Y,N,D,U"
     189 ;      DGDATE - Date of MST Status Change (FM format)
     190 ;
     191 ;  Output
     192 ;      Returns 0 if no status change
     193 ;              1 if status changed
     194 ;
     195 N DGCHG,DGMST
     196 S DGCHG=0
     197 I +$G(DFN)'>0!('$D(^DPT(DFN,0))) G CHNGQ
     198 S DGSTAT=$G(DGSTAT)
     199 I DGSTAT'?1A!("YNDU"'[DGSTAT) G CHNGQ
     200 S DGDATE=$G(DGDATE)
     201 I DGDATE="" G CHNGQ
     202 S DGMST=$$GETSTAT(DFN),DGMST=$G(DGMST)
     203 I +DGMST<1!($P(DGMST,U,2)'=$G(DGSTAT))!($P(DGMST,U,3)'=$G(DGDATE)) S DGCHG=1
     204CHNGQ Q DGCHG
     205 ;
     206SITE(DGSITE) ;Convert a station number into a pointer to the
     207 ; INSTITUTION file (#4).  If called with a null parameter then
     208 ; the pointer to the INSTITUTION file (#4) of the primary site
     209 ; will be returned.
     210 ;
     211 ;  Input
     212 ;    DGSITE - Station number (optional)
     213 ;
     214 ;  Output
     215 ;    Return Site IEN to INSTITUTION file (#4)
     216 ;
     217 S DGSITE=$G(DGSITE)
     218 I DGSITE]"",$D(^DIC(4,"D",DGSITE)) D
     219 . S DGSITE=$O(^DIC(4,"D",DGSITE,0))
     220 E  D
     221 . S DGSITE=$P($$SITE^VASITE,U)
     222 I +DGSITE'>0 S DGSITE=""
     223 Q DGSITE
     224 ;
     225DATE(DFN,DGDT) ;Determine 'current' MST date
     226 ;
     227 ;  Input
     228 ;    DFN  - Patient's DFN
     229 ;    DGDT - FileMan format date
     230 ;
     231 ;  Output
     232 ;    Return MST effective date
     233 ;
     234 N DGMSTDT
     235 S DFN=$G(DFN)
     236 I '+DFN D  G DATEQ
     237 . S DGMSTDT=""
     238 S DGDT=$S(+$G(DGDT)>0:DGDT,1:$$NOW^XLFDT)
     239 I $P(DGDT,".",2)="" S DGDT=DGDT_".999999"
     240 S DGMSTDT=$O(^DGMS(29.11,"APDT",DFN,DGDT),-1)
     241DATEQ Q DGMSTDT
     242 ;
     243VALID(DFN,DGSTAT,DGDATE,DGPROV,DGSITE,DGERR) ;Validate fields before filing
     244 ; Input:
     245 ;      DFN - [REQUIRED] - ien of Patient
     246 ;   DGSTAT - [REQUIRED] - MST Status code, "Y,N,D,U"
     247 ;   DGDATE - [REQUIRED] - Date of MST status change[FileMan Internal]
     248 ;   DGPROV - [optional] - IEN of Provider making determination
     249 ;   DGSITE - [optional] - IEN pointer of the INSTITUTION file
     250 ;    DGERR - [optional] - error parameter passed by reference
     251 ; Output:
     252 ;   Function Value - Returns 1 - if validation checks passed
     253 ;                            0 - if validation checks failed
     254 ;            DGERR - an error message if validation checks fail
     255 ; init variables
     256 N I,DGFILE,DGFLD,DGMSG,DGSTR,DGVAL,DGVAR,DGX,VALID
     257 S DGFILE=29.11,VALID=1,DGMSG=" IS REQUIRED"
     258 ; Quit DO block if invalid condition found
     259 ; Check for [REQUIRED] fields
     260 D
     261 . I DFN="" D MSG(DGFILE,2,DGMSG,.DGERR) Q        ;pat ien
     262 . I DGSTAT="" D MSG(DGFILE,3,DGMSG,.DGERR) Q     ;mst status code
     263 . I DGDATE="" D MSG(DGFILE,.01,DGMSG,.DGERR) Q   ;dt chg status
     264 .;
     265 .; Check for valid FIELD values
     266 . S DGMSG=" IS NOT VALID"
     267 .; need to strip off the 'seconds' to pass the CHK^DIE() call...
     268 . I DGDATE["." N DGSECS S DGSECS=$E($P(DGDATE,".",2),5,6) I DGSECS'="" I DGSECS<0!(DGSECS>60) D MSG(DGFILE,.01,DGMSG,.DGERR) Q
     269 . N DGDATEX S DGDATEX=DGDATE
     270 . I DGDATEX["." S DGDATEX=$P(DGDATEX,".")_"."_$E($P(DGDATEX,".",2),1,4)
     271 . I $E($P(DGDATEX,".",2),1,4)="0000" S DGDATEX=$P(DGDATEX,".")_".1"
     272 . S DGSTR=".01;DGDATEX^2;DFN^3;DGSTAT^4;DGPROV^5;DUZ^6;DGSITE"
     273 .;
     274 . F I=1:1:$L(DGSTR,U) S DGX=$P(DGSTR,U,I) Q:DGX=""  D  Q:'VALID
     275 .. S DGFLD=$P(DGX,";"),DGVAR=$P(DGX,";",2),DGVAL=@DGVAR
     276 .. Q:DGVAL=""
     277 .. S VALID=$$TESTVAL(DGFILE,DGFLD,DGVAL)
     278 .. D:'VALID MSG(DGFILE,DGFLD,DGMSG,.DGERR)
     279 Q VALID
     280 ;
     281MSG(DGFIL,DGFLD,DGMSG,DGERR) ; error message setup
     282 ; Input:
     283 ;   DGFIL - file number
     284 ;   DGFLD - field number of file
     285 ;   DGMSG - message type verbiage - " IS REQUIRED" or " IS NOT VALID"
     286 ;   DGERR - error parameter passed by reference
     287 ; Output:
     288 ;   DGERR - error message
     289 S DGERR=$$GET1^DID(DGFIL,DGFLD,,"LABEL")_DGMSG
     290 Q
     291 ;
     292TESTVAL(DGFIL,DGFLD,DGVAL) ; Determine if a field value is valid.
     293 ; Input:
     294 ;   DGFIL - file number
     295 ;   DGFLD - field number of file
     296 ;   DGVAL - field value to be validated
     297 ; Output:
     298 ;   Function value: Returns 1 if field is valid
     299 ;                           0 if validation fails
     300 N DGVALEX,DGRSLT,VALID
     301 S VALID=1
     302 I DGVAL'="" D
     303 . S DGVALEX=$$EXTERNAL^DILFD(DGFIL,DGFLD,"F",DGVAL)
     304 . I DGVALEX="" S VALID=0 Q   ; no external value, not valid
     305 . I $$GET1^DID(DGFIL,DGFLD,"","TYPE")'="POINTER" D
     306 .. D CHK^DIE(DGFIL,DGFLD,,DGVALEX,.DGRSLT) I DGRSLT="^" S VALID=0
     307 Q VALID
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGMTCOU1.m

    r613 r623  
    1 DGMTCOU1        ;ALB/REW,LD,JAN,AEG,LBD - COPAY UTILITIES ;11/5/06  20:29
    2         ;;5.3;Registration;**33,45,54,335,358,401,436,445,564,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19 AUTO(DFN,AUTOEX)        ;
    20         ; Returns 1 if Exempt from CP w/o needing MT/CP information
    21         ;  INPUT: DFN     [Required]
    22         ;         AUTOEX  [Optional]
    23         ;  RETURNS 1=Exempt 0=Not Exempt
    24         ;
    25         ; Hold the Auto exclusion information for later use
    26         S AUTOEX=$$AUTOINFO(DFN)
    27         ;
    28         Q AUTOEX["1"
    29 AUTOINFO(DFN)   ;
    30         ; This returns info needed to IB to see if MT information needs to be
    31         ; looked at to determine Copay Exemption Status
    32         ;
    33         ;  INPUT: DFN - IEN of Patient File (Required)
    34         ; OUTPUT: (SC>50%^REC.A&A^REC.HB^REC.PEN^DOM PT^NON.VET^INPT^POW^UNEMP)
    35         ;  Piece: (   1  ^   2   ^   3  ^   4   ^   5  ^   6   ^  7 ^ 8 ^  9  )
    36         ;  PIECES =1 IF TRUE
    37         ;
    38         N DGALLEL,DGDOM,DGEL,DGNODE,DGX,DGYR,VADMVT,DGI
    39         S DGX=""
    40         I $P($G(^DPT(DFN,"VET")),U,1)'="Y" S $P(DGX,U,6)=1 G QTAUTO ;NON-VET
    41         S DGEL=0,DGALLEL=U
    42         F  S DGEL=$O(^DPT("AEL",DFN,DGEL)) Q:'DGEL  S DGALLEL=DGALLEL_$P($G(^DIC(8,DGEL,0)),U,9)_U
    43         F DGI=.3,.362,.52 S DGNODE(DGI)=$G(^DPT(DFN,DGI))
    44         I (DGALLEL["^1^") S $P(DGX,U,1)=1 G QTAUTO ;SC>50
    45         I $P(DGNODE(.362),U,12)["Y"!(DGALLEL["^2^") S $P(DGX,U,2)=1 G QTAUTO ;A&A
    46         I $P(DGNODE(.362),U,13)["Y"!(DGALLEL["^15^") S $P(DGX,U,3)=1 G QTAUTO ;HB
    47         I $P(DGNODE(.362),U,14)["Y"!(DGALLEL["^4^") S $P(DGX,U,4)=1 G QTAUTO ;PENSION
    48         I $P(DGNODE(.52),U,5)["Y"!(DGALLEL["^18^") S $P(DGX,U,8)=1 G QTAUTO ;POW
    49         I $P(DGNODE(.3),U,5)["Y"&($P(DGNODE(.3),U,2)>0)&($P(DGNODE(.362),U,20)>0) S $P(DGX,U,9)=1 G QTAUTO ;UNEMPLOYABLE
    50         N DGDOM,DGDOM1,VAHOW,VAROOT,VAINDT,VAIP,VAERR
    51         D DOM^DGMTR I $G(DGDOM) S $P(DGX,U,5)=1 G QTAUTO ;DOM
    52         D IN5^VADPT I $G(VAIP(1))'="" S $P(DGX,U,7)=1 G QTAUTO ;INPAT
    53 QTAUTO  Q DGX
    54         ;
    55 LST(DFN,DGDT,DGMTYPT1)  ;Last Copay Exemption or Means Test for a patient
    56         ;   Input  -- DFN   Patient IEN
    57         ;             DGDT  Date/Time  (Optional- default today@2359)
    58         ;             DGMTYPT1 (Optional (1:MT, 2:CP, Null/Default or 3:Either)
    59         ;   Output -- MT IEN^Date of Test ^Status Name^Status Code^Type of Test
    60         ;      Piece:   1   ^     2              3         4            5
    61         ;
    62         N DGCPDT,DGIDT,DGIDT,DGMTDT,DGMTI,Y
    63         S DGIDT=$S($G(DGDT)>0:-DGDT,1:-DT) S:'$P(DGIDT,".",2) DGIDT=DGIDT_.2359
    64         I '$D(DGMTYPT1) S DGMTYPT1=3
    65         I DGMTYPT1=3 D  ;EITHER
    66         .S DGMTDT=+$O(^DGMT(408.31,"AID",1,DFN,DGIDT))
    67         .S DGCPDT=+$O(^DGMT(408.31,"AID",2,DFN,DGIDT))
    68         .S DGMTYPT1=$S(DGCPDT<DGMTDT:2,(DGCPDT>DGMTDT):1,$D(^DGMT(408.31,"AS",1,3,+DGMTDT,DFN)):2,1:1)
    69         S DGMTI=+$$LST^DGMTU(DFN,$P(DGIDT,"-",2),DGMTYPT1)
    70         I $D(^DGMT(408.31,DGMTI,0)) S Y=DGMTI_"^"_$P(^(0),"^")_"^"_$$MTS^DGMTU(DFN,+$P(^(0),"^",3))_"^"_DGMTYPT1
    71         Q $G(Y)
    72 THRESH(DGDT)    ;PRINTS THE YEAR'S COPAY THRESHOLDS
    73         ;UPDATE 11/15/00 TO REFLECT YEAR'S COPAY THRESHOLDS PER VHA DIRECTIVE
    74         ;99-064
    75         N DGCPLEV,DGDEP,DGNODE,DGTYPE,Y
    76         I '$D(DGDT) S DGDT=DT
    77         S DGDT=DGDT\1
    78         S Y=DGDT X ^DD("DD") W !,?2,"Net Annual Income Thresholds on ",Y,":"
    79         S DGTYPE=$S(DGDT<2961201:2,1:1)
    80         S DGCPLEV=$$THRES^IBARXEU1(DGDT,DGTYPE,0)
    81         I DGCPLEV']"" W !,"None for this date..." G THRESHQT
    82         W !,?5,"Num. Dependents: ",?25,"0 (Self)",?42,1,?52,2,?62,3,?72,4
    83         W !,?5,"Net Income:"
    84         F DGDEP=0:1:4 W ?(23+(DGDEP*10)),$J(+$$THRES^IBARXEU1(DGDT,DGTYPE,DGDEP),10)
    85 THRESHQT        Q
    86 DISPMAS(DFN)    ; Displays Co
    87         ;New EHR code    ;DAOU/JLG 2/4/05
    88         ;not relevant to Agency EHR
    89         Q:$G(DUZ("AG"))="E"
    90         ;End EHR modifications
    91         N DGCPS,DGEX,Y,AUTOEX
    92         S DGEX=$$AUTO(DFN,.AUTOEX)
    93         I $P($G(AUTOEX),U,5)!($P($G(AUTOEX),U,7)) Q
    94         I DGEX W !,"Patient is exempt from Copay."
    95         I 'DGEX D
    96         .S DGCPS=$$LST365(DFN,DT,2),Y=$P(DGCPS,U,2)
    97         .I DGCPS]"" D
    98         ..X ^DD("DD")
    99         ..W !,"Patient's Copay Status is ",$P(DGCPS,U,3)
    100         ..W ".  Last Test Date: ",Y,"."
    101         Q
    102 LST365(DFN,DGDT,DGMTYPT1)       ;RETURNS CURRENT MT/CP  (WITHIN 365 DAYS)
    103         ;  Input:   DGDT - IB DATE
    104         ;           DGMTYPT1 (Optional (1:MT, 2:CP, Null/Default or 3:Either)
    105         ;  Output -- MT IEN^Date of Test ^Status Name^Status Code^Type of Test
    106         ;     Piece:   1   ^     2              3         4            5
    107         N DGLST
    108         S DGDT=$G(DGDT)
    109         I '$D(DGMTYPT1) S DGMTYPT1=3
    110         S DGLST=$$LST(DFN,DGDT,DGMTYPT1)
    111         S:$P(DGLST,U,4)="N" DGLST=$$LST(DFN,DGDT,2)
    112         S:$$365($P(DGLST,U,2),DGDT) DGLST="" ;RETURN NULL IF LAST >365
    113         Q DGLST
    114 365(X1,DGDT)    ; RETURNS 1 IF X1 IS MORE THAN 1 YEAR BEFORE DGDT
    115         Q X1+10000'>DGDT
     1DGMTCOU1 ;ALB/REW,LD,JAN,AEG,LBD - COPAY UTILITIES ;11/5/06  20:29
     2 ;;5.3;Registration;**33,45,54,335,358,401,436,445,564,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19AUTO(DFN,AUTOEX) ;
     20 ; Returns 1 if Exempt from CP w/o needing MT/CP information
     21 ;  INPUT: DFN     [Required]
     22 ;         AUTOEX  [Optional]
     23 ;  RETURNS 1=Exempt 0=Not Exempt
     24 ;
     25 ; Hold the Auto exclusion information for later use
     26 S AUTOEX=$$AUTOINFO(DFN)
     27 ;
     28 Q AUTOEX["1"
     29AUTOINFO(DFN) ;
     30 ; This returns info needed to IB to see if MT information needs to be
     31 ; looked at to determine Copay Exemption Status
     32 ;
     33 ;  INPUT: DFN - IEN of Patient File (Required)
     34 ; OUTPUT: (SC>50%^REC.A&A^REC.HB^REC.PEN^DOM PT^NON.VET^INPT^POW^UNEMP)
     35 ;  Piece: (   1  ^   2   ^   3  ^   4   ^   5  ^   6   ^  7 ^ 8 ^  9  )
     36 ;  PIECES =1 IF TRUE
     37 ;
     38 N DGALLEL,DGDOM,DGEL,DGNODE,DGX,DGYR,VADMVT,DGI
     39 S DGX=""
     40 I $P($G(^DPT(DFN,"VET")),U,1)'="Y" S $P(DGX,U,6)=1 G QTAUTO ;NON-VET
     41 S DGEL=0,DGALLEL=U
     42 F  S DGEL=$O(^DPT("AEL",DFN,DGEL)) Q:'DGEL  S DGALLEL=DGALLEL_$P($G(^DIC(8,DGEL,0)),U,9)_U
     43 F DGI=.3,.362,.52 S DGNODE(DGI)=$G(^DPT(DFN,DGI))
     44 I (DGALLEL["^1^") S $P(DGX,U,1)=1 G QTAUTO ;SC>50
     45 I $P(DGNODE(.362),U,12)["Y"!(DGALLEL["^2^") S $P(DGX,U,2)=1 G QTAUTO ;A&A
     46 I $P(DGNODE(.362),U,13)["Y"!(DGALLEL["^15^") S $P(DGX,U,3)=1 G QTAUTO ;HB
     47 I $P(DGNODE(.362),U,14)["Y"!(DGALLEL["^4^") S $P(DGX,U,4)=1 G QTAUTO ;PENSION
     48 I $P(DGNODE(.52),U,5)["Y"!(DGALLEL["^18^") S $P(DGX,U,8)=1 G QTAUTO ;POW
     49 I $P(DGNODE(.3),U,5)["Y"&($P(DGNODE(.3),U,2)>0)&($P(DGNODE(.362),U,20)>0) S $P(DGX,U,9)=1 G QTAUTO ;UNEMPLOYABLE
     50 N DGDOM,DGDOM1,VAHOW,VAROOT,VAINDT,VAIP,VAERR
     51 D DOM^DGMTR I $G(DGDOM) S $P(DGX,U,5)=1 G QTAUTO ;DOM
     52 D IN5^VADPT I $G(VAIP(1))'="" S $P(DGX,U,7)=1 G QTAUTO ;INPAT
     53QTAUTO Q DGX
     54 ;
     55LST(DFN,DGDT,DGMTYPT1) ;Last Copay Exemption or Means Test for a patient
     56 ;   Input  -- DFN   Patient IEN
     57 ;             DGDT  Date/Time  (Optional- default today@2359)
     58 ;             DGMTYPT1 (Optional (1:MT, 2:CP, Null/Default or 3:Either)
     59 ;   Output -- MT IEN^Date of Test ^Status Name^Status Code^Type of Test
     60 ;      Piece:   1   ^     2              3         4            5
     61 ;
     62 N DGCPDT,DGIDT,DGIDT,DGMTDT,DGMTI,Y
     63 S DGIDT=$S($G(DGDT)>0:-DGDT,1:-DT) S:'$P(DGIDT,".",2) DGIDT=DGIDT_.2359
     64 I '$D(DGMTYPT1) S DGMTYPT1=3
     65 I DGMTYPT1=3 D  ;EITHER
     66 .S DGMTDT=+$O(^DGMT(408.31,"AID",1,DFN,DGIDT))
     67 .S DGCPDT=+$O(^DGMT(408.31,"AID",2,DFN,DGIDT))
     68 .S DGMTYPT1=$S(DGCPDT<DGMTDT:2,(DGCPDT>DGMTDT):1,$D(^DGMT(408.31,"AS",1,3,+DGMTDT,DFN)):2,1:1)
     69 S DGMTI=+$$LST^DGMTU(DFN,$P(DGIDT,"-",2),DGMTYPT1)
     70 I $D(^DGMT(408.31,DGMTI,0)) S Y=DGMTI_"^"_$P(^(0),"^")_"^"_$$MTS^DGMTU(DFN,+$P(^(0),"^",3))_"^"_DGMTYPT1
     71 Q $G(Y)
     72THRESH(DGDT) ;PRINTS THE YEAR'S COPAY THRESHOLDS
     73 ;UPDATE 11/15/00 TO REFLECT YEAR'S COPAY THRESHOLDS PER VHA DIRECTIVE
     74 ;99-064
     75 N DGCPLEV,DGDEP,DGNODE,DGTYPE,Y
     76 I '$D(DGDT) S DGDT=DT
     77 S DGDT=DGDT\1
     78 S Y=DGDT X ^DD("DD") W !,?2,"Net Annual Income Thresholds on ",Y,":"
     79 S DGTYPE=$S(DGDT<2961201:2,1:1)
     80 S DGCPLEV=$$THRES^IBARXEU1(DGDT,DGTYPE,0)
     81 I DGCPLEV']"" W !,"None for this date..." G THRESHQT
     82 W !,?5,"Num. Dependents: ",?25,"0 (Self)",?42,1,?52,2,?62,3,?72,4
     83 W !,?5,"Net Income:"
     84 F DGDEP=0:1:4 W ?(23+(DGDEP*10)),$J(+$$THRES^IBARXEU1(DGDT,DGTYPE,DGDEP),10)
     85THRESHQT Q
     86DISPMAS(DFN) ; Displays Co
     87 ;New EHR code    ;DAOU/JLG 2/4/05
     88 ;not relevant to Agency EHR
     89 Q:$G(DUZ("AG"))="E"
     90 ;End EHR modifications
     91 N DGCPS,DGEX,Y,AUTOEX
     92 S DGEX=$$AUTO(DFN,.AUTOEX)
     93 I $P($G(AUTOEX),U,5)!($P($G(AUTOEX),U,7)) Q
     94 I DGEX W !,"Patient is exempt from Copay."
     95 I 'DGEX D
     96 .S DGCPS=$$LST365(DFN,DT,2),Y=$P(DGCPS,U,2)
     97 .I DGCPS]"" D
     98 ..X ^DD("DD")
     99 ..W !,"Patient's Copay Status is ",$P(DGCPS,U,3)
     100 ..W ".  Last Test Date: ",Y,"."
     101 Q
     102LST365(DFN,DGDT,DGMTYPT1) ;RETURNS CURRENT MT/CP  (WITHIN 365 DAYS)
     103 ;  Input:   DGDT - IB DATE
     104 ;           DGMTYPT1 (Optional (1:MT, 2:CP, Null/Default or 3:Either)
     105 ;  Output -- MT IEN^Date of Test ^Status Name^Status Code^Type of Test
     106 ;     Piece:   1   ^     2              3         4            5
     107 N DGLST
     108 S DGDT=$G(DGDT)
     109 I '$D(DGMTYPT1) S DGMTYPT1=3
     110 S DGLST=$$LST(DFN,DGDT,DGMTYPT1)
     111 S:$P(DGLST,U,4)="N" DGLST=$$LST(DFN,DGDT,2)
     112 S:$$365($P(DGLST,U,2),DGDT) DGLST="" ;RETURN NULL IF LAST >365
     113 Q DGLST
     114365(X1,DGDT) ; RETURNS 1 IF X1 IS MORE THAN 1 YEAR BEFORE DGDT
     115 Q X1+10000'>DGDT
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGMTU.m

    r613 r623  
    1 DGMTU   ;ALB/RMO,LBD,BRM,EG - Means Test Utilities ; 02/08/2005 07:10 AM
    2         ;;5.3;Registration;**4,33,182,277,290,374,358,420,426,411,332,433,456,476,519,451,630,783**;Aug 13, 1993;Build 2
    3         ;MT=Means Test
    4 LST(DFN,DGDT,DGMTYPT)   ;Last MT for a patient
    5         ;         Input  -- DFN   Patient IEN
    6         ;                   DGDT  Date/Time  (Optional- default today@2359)
    7         ;                DGMTYPT  Type of Test (Optional - if not defined
    8         ;                                       Means Test will be assumed)
    9         ;         Output -- Annual Means Test IEN^Date of Test
    10         ;                   ^Status Name^Status Code^Source of Test
    11         N DGIDT,DGMTFL1,DGMTI,DGNOD,Y I '$D(DGMTYPT) S DGMTYPT=1
    12         S DGIDT=$S($G(DGDT)>0:-DGDT,1:-DT) S:'$P(DGIDT,".",2) DGIDT=DGIDT_.2359
    13         F  S DGIDT=+$O(^DGMT(408.31,"AID",DGMTYPT,DFN,DGIDT)) Q:'DGIDT!$G(DGMTFL1)  D
    14         .F DGMTI=0:0 S DGMTI=+$O(^DGMT(408.31,"AID",DGMTYPT,DFN,DGIDT,DGMTI)) Q:'DGMTI!$G(DGMTFL1)  D
    15         ..S DGNOD=$G(^DGMT(408.31,DGMTI,0)) I DGNOD,$G(^("PRIM"))!(DGMTYPT=4) S DGMTFL1=1,Y=DGMTI_"^"_$P(^(0),"^")_"^"_$$MTS(DFN,+$P(^(0),"^",3))_"^"_$P(DGNOD,"^",23) ; chk for primary MT
    16         Q $G(Y)
    17         ;
    18 LVMT(DFN,DGDT)  ;Last valid MT (status other than required)
    19         ;          Input  -- DFN    Patient IEN
    20         ;                    DGDT   Date (Optional - default today)
    21         ;          Output -- Annual Means Test IEN^Date of Test^Status Name
    22         ;                     ^Status Code
    23         N DGMT,DGMTL
    24         S:'$D(DGDT) DGDT=DT S DGMTL=$$LST^DGMTU(DFN,DGDT)
    25         I $P(DGMTL,"^",4)="R" F  S DGMT=$$LST^DGMTU(DFN,DGDT) Q:DGMT']""!($P(DGMT,U,4)'="R")  S DGDT=$P(DGMT,U,2)-1
    26         Q $S($G(DGMT)]"":DGMT,1:$G(DGMTL))
    27         ;
    28 NVMT(DFN,DGDT)  ;Next valid MT (status other than required)
    29         ;          Input  -- DFN    Patient IEN
    30         ;                    DGDT   Date (Required)
    31         ;          Output -- Annual Means Test IEN^Date of Test^Status Name
    32         ;                     ^Status Code
    33         N DGDTE,DGMT,DGMT0,DGMTI,DGMTPR,DGMTS
    34         S DGDTE=DGDT
    35         F  S DGDTE=$O(^DGMT(408.31,"AD",1,DFN,DGDTE)) Q:'DGDTE!$G(DGMT)  D
    36         .F DGMTI=0:0 S DGMTI=$O(^DGMT(408.31,"AD",1,DFN,DGDTE,DGMTI)) Q:'DGMTI  S DGMT0=$G(^DGMT(408.31,DGMTI,0)),DGMTS=+$P(DGMT0,"^",3),DGMTPR=$G(^("PRIM")) I +DGMT0,DGMTS'=1,DGMTPR S DGMT=DGMTI_"^"_+DGMT0_"^"_$$MTS^DGMTU(DFN,DGMTS) Q
    37         Q $G(DGMT)
    38         ;
    39 MTS(DFN,DGMTS)  ;MT status -- default current
    40         ;         Input  -- DFN    Patient IEN
    41         ;                   DGMTS  Means Test Status IEN  (Optional)
    42         ;         Output -- Status Name^Status Code
    43         N Y
    44         S DGMTS=$S($G(DGMTS)>0:DGMTS,1:$P($G(^DPT(DFN,0)),"^",14))
    45         I DGMTS S Y=$P($G(^DG(408.32,DGMTS,0)),"^",1,2)
    46         Q $G(Y)
    47         ;
    48 DIS(DFN)        ;Display patients current MT status,
    49         ;        eligibility for care, deductible information,
    50         ;        date of test and date of completion
    51         ;         Input  -- DFN    Patient IEN
    52         ;         Output -- None
    53         N DGCS,DGDED,DGMTI,DGMT0
    54         S DGCS=$P($G(^DPT(DFN,0)),"^",14) G DISQ:DGCS=""
    55         S DGMTI=+$$LST^DGMTU(DFN),DGMT0=$G(^DGMT(408.31,DGMTI,0))
    56         S MTSIG=$P(DGMT0,"^",29)
    57         W !,"Means Test Signed?: ",$S(MTSIG=1:"YES",MTSIG=0:"NO",MTSIG=9:"DELETED",1:"")
    58         I DGCS=1 W !!,"Patient Requires a Means Test"
    59         I DGCS=2 W !!,"Patient's Means Test is Pending Adjudication for "_$$PA^DGMTUTL(DGMTI)
    60         I DGCS=3 W !!,"Means Test Not Required"
    61         I ("^4^5^6^16^")[("^"_DGCS_"^") W !!,"Patient's status is ",$$GETNAME^DGMTH(DGCS)," based on primary means test"
    62         I $D(^DG(408.32,DGCS,"MSG")) W !,^("MSG")
    63         I DGCS=6 S DGDED=$P(DGMT0,"^",11) W ! W:DGDED]"" "Has",$S(DGDED:"",1:" not")," agreed to pay the deductible"
    64         S Y=$P(DGMT0,"^") X ^DD("DD") W !,"Primary Means Test ",$S(DGCS=1:"Required from",1:"Last Applied")," '",Y,"'"
    65         I ("^2^4^5^6^16^")[("^"_DGCS_"^") S Y=$P(DGMT0,"^",7) X ^DD("DD") W " (COMPLETED: ",Y,")"
    66         I DGCS=3 S Y=$P(DGMT0,"^",17) X ^DD("DD") W " (NO LONGER REQUIRED: ",Y,")"
    67 DISQ    Q
    68         ;
    69 EDT(DFN,DGDT)   ;Display patients current MT information and provide
    70         ;        the user with the option of proceeding with a required
    71         ;        MT or editing an existing means test
    72         ;         Input  -- DFN    Patient IEN
    73         ;                   DGDT   Date/Time
    74         ;         Output -- None
    75         ;
    76         ; obtain lock used to synchronize local MT/CT options with income test upload
    77         I $$LOCK^DGMTUTL(DFN)
    78         ;
    79         D DIS(DFN)
    80         S DGMTI=+$$LST(DFN,DGDT) G EDTQ:'DGMTI!(DGMTI'=+$$LST^DGMTU(DFN))
    81         S DGMT0=$G(^DGMT(408.31,DGMTI,0)),DGMTDT=+DGMT0,DGMTS=$P(DGMT0,"^",3)
    82         S DIR("A")="Do you wish to "_$S(DGMTS=1:"proceed with",1:"edit")_" the means test at this time"
    83         S DIR("B")=$S(DGMTS&($D(DGPRFLG)):"NO",DGMTS=1:"YES",1:"NO"),DIR(0)="Y"
    84         W ! D ^DIR G EDTQ:$D(DTOUT)!($D(DUOUT))
    85         I Y S DGMTYPT=1,DGMTACT="EDT",DGMTROU="EDTQ^DGMTU" G EN^DGMTSC
    86 EDTQ    K DGMT0,DGMTACT,DGMTDT,DGMTI,DGMTROU,DGMTS,DIR,DTOUT,DUOUT,Y
    87         ;
    88         ; release lock
    89         D UNLOCK^DGMTUTL(DFN)
    90         ;
    91         Q
    92         ;
    93 CMTS(DFN)       ;Get Current MT Status - query HEC if necessary
    94         ;
    95         ;        Input: DFN=patient ien
    96         ;       Output: MT IEN^Date of Test^Status Name
    97         ;                 ^Status Code^Source of Test
    98         ;
    99         N X,Y,DGMTDATA,DGQSENT,DGDOD,NODE0,DGRET,DGMFLG,DGTAG,DGMTYPT
    100         D CHKPT^DGMTU4(DFN)
    101         S DGMTYPT=1,DGMTDATA=$$LST(DFN,"",DGMTYPT)
    102         ;Next line checks to see if patient has expired, if so, Query not initiated
    103         S DGDOD=$P($G(^DPT(DFN,.35)),U)
    104         I +DGDOD Q DGMTDATA
    105         ;Next line checks to see if current test exists, if not, Query not initiated
    106         I '$G(DGMTDATA) Q DGMTDATA
    107         D:+$$QFLG(DGMTDATA)
    108         .I $G(IVMZ10)'="UPLOAD IN PROGRESS",'$$OPEN^IVMCQ2(DFN),'$$SENT^IVMCQ2(DFN),$G(DGMFLG)'=0 D
    109         ..I $$LOCK^DGMTUTL(DFN)
    110         ..D QRYQUE2^IVMCQ2(DFN,$G(DUZ),0,$G(XQY)) S DGQSENT=1
    111         ..I '$D(ZTQUEUED),'$G(DGMSGF),$G(DGQSENT) W !!,"Financial query queued to be sent to HEC...",! H .5
    112         ..D UNLOCK^DGMTUTL(DFN)
    113         .S DGMTDATA=$$LST(DFN,"",DGMTYPT)
    114         D:+$$MFLG(DGMTDATA)
    115         .S DGMFLG=$$MFLG(DGMTDATA)
    116         .S DGTAG=$S(DGMFLG=1:"MSG"_DGMFLG,DGMFLG=2:"MSG"_DGMFLG,1:0)
    117         .I DGTAG["MSG",'$G(DGMSGF) D @DGTAG
    118         Q DGMTDATA   ;return most current MT data
    119 MFLG(DGMTDATA)  ;Set up appropriate informational message flag for user's
    120         ;benefit.
    121         ;Input        -     DGMTDATA as defined by $$LST function.
    122         ;Output       -     DGRETV
    123         ;     1 = Current Test is REQUIRED
    124         ;     2 = Test is > 365 days old and is in a status of
    125         ;         other than REQUIRED or NO LONGER REQUIRED
    126         ;     2 = Pend Adj for GMT, test date is 10/6/99 or
    127         ;         greater and agreed to the deductible
    128         ;     0 = CAT C/Pend Adj for MT, test date is 10/6/99
    129         ;         or greater and agreed to the deductible.
    130         ; OR  0 = Cat C, declined income info and agreed
    131         ;         to pay deductible.
    132         ; OR  0 = Has a future dated Means Test
    133         N DGRETV,FTST,DGMT0
    134         S DGRETV=0 I '$G(DGMTDATA) Q DGRETV
    135         S DGMT0=$G(^DGMT(408.31,+DGMTDATA,0))
    136         I $P(DGMTDATA,U,4)="R" S DGRETV=1
    137         I $$OLD^DGMTU4($P(DGMTDATA,U,2)),($P(DGMTDATA,U,4)'="N")&($P(DGMTDATA,U,4)'="R") S DGRETV=2
    138         I ($P(DGMTDATA,U,4)="C")!($P(DGMTDATA,U,4)="P"&($P(DGMT0,U,12)'<$P(DGMT0,U,27))),$P(DGMTDATA,U,2)>2991005,$P(DGMT0,U,11)=1 S DGRETV=0
    139         I ($P(DGMTDATA,U,4)="C"),+$P(DGMT0,U,14),+$P(DGMT0,U,11) S DGRETV=0
    140         D DOM^DGMTR I $G(DGDOM) S DGRETV=0
    141         S FTST=$$FUT(DFN)
    142         I DGRETV,FTST,$P(^DGMT(408.31,+FTST,0),U,19)=1 S DGRETV=0
    143         Q DGRETV
    144 MSG1    ;Informational message 1
    145         N NODE0,Y
    146         S NODE0=$G(^DGMT(408.31,+DGMTDATA,0))
    147         W !!,$C(7),?15,"*** Patient Requires a Means Test ***",!
    148         S Y=$P(NODE0,U) X ^DD("DD") W !,?14,"Primary Means Test Required from "_Y,!
    149         I $G(IOST)["C-" R !!,"Enter <RETURN> to continue.",DGRET:DTIME
    150         Q
    151 MSG2    ;Informational message 2
    152         N NODE0,Y
    153         S NODE0=$G(^DGMT(408.31,+DGMTDATA,0))
    154         W !!,$C(7),?17,"*** Patient Requires a Means Test ***",!
    155         S Y=$P(NODE0,U) X ^DD("DD") W !,?10,"Patient's Test dated "_Y_" is "_$P(DGMTDATA,U,3)_"."_" The test"
    156         W !,?10,"date is greater than 365 days old.  Please update."
    157         I $G(IOST)["C-" R !!,"Enter <RETURN> to continue.",DGRET:DTIME
    158         Q
    159 QFLG(DGMTDATA)  ;
    160         ;INPUT - DGMTDATA
    161         ;OUTPUT- IVMQFLG 1 if query is necessary 0 if not
    162         N IVMQFLG,DGMT0
    163         S IVMQFLG=0 I '$G(DGMTDATA) Q IVMQFLG
    164         S DGMT0=$G(^DGMT(408.31,+DGMTDATA,0))
    165         ;Set flag to 1 if Means test is Required.
    166         I $P(DGMTDATA,U,4)="R" S IVMQFLG=1
    167         ;Set flag to 1 if Means test older than 365 days and status is not
    168         ;NO LONGER REQUIRED and not REQUIRED.
    169         I $$OLD^DGMTU4($P(DGMTDATA,U,2)),($P(DGMTDATA,U,4)'="N")&($P(DGMTDATA,U,4)'="R") S IVMQFLG=1
    170         ;If Cat C/Pend Adj for MT, older than 365 days, agreed to pay, test
    171         ;date > 10/5/99 reset flag to 0 - no query is necessary.
    172         I ($P(DGMTDATA,U,4)="C")!($P(DGMTDATA,U,4)="P"&($P(DGMT0,U,12)'<$P(DGMT0,U,27))),$P(DGMTDATA,U,2)>2991005,$P(DGMT0,U,11)=1 S IVMQFLG=0
    173         ;If patient is Cat C, declined to provide income but has agreed to
    174         ;pay deductible, no query necessary - reset flag to 0
    175         I ($P(DGMTDATA,U,4)="C"),+$P(DGMT0,U,14),+$P(DGMT0,U,11) S DGRETV=0
    176         ;If patient is on a DOM ward, don't initiate query
    177         D DOM^DGMTR I $G(DGDOM) S IVMQFLG=0
    178         Q IVMQFLG
    179         ;
    180 FUT(DFN,DGDT,DGMTYPT)   ; Future MT for a patient
    181         ;DFN      Patient IEN
    182         ;DGDT     Date (Optional- default to today)
    183         ;DGMTYPT  Type of Test (Optional - default to MT)
    184         ;Return
    185         ;If a DCD test was performed it will be returned, else the
    186         ;current future dated test for the Income Year.
    187         ;MT IEN^Date of Test^Status Name^Status Code^Source
    188         ;
    189         N DGIDT,Y,MTIEN,SRCE,DONE,MTNOD,ARR,LAST,TYPTST
    190         S:'$D(DGMTYPT) DGMTYPT=1
    191         ;no future LTC eg 02/15/2005
    192         I ($G(DGMTYPT)=4) Q ""
    193         S TYPTST=$S(DGMTYPT=2:"AF",1:"AE")
    194         S DGIDT=$S($G(DGDT)>0:DGDT,1:DT),DONE=0
    195         S (ARR,LAST,Y)=""
    196         S:$P(DGIDT,".",2) DGIDT=$P(DGIDT,".")
    197         F  S DGIDT=$O(^IVM(301.5,TYPTST,DFN,DGIDT)) Q:'DGIDT!(DONE)  D
    198         .S MTIEN=0
    199         .F  S MTIEN=$O(^IVM(301.5,TYPTST,DFN,DGIDT,MTIEN)) Q:'MTIEN!(DONE)  D
    200         ..Q:'$D(^DGMT(408.31,MTIEN,0))
    201         ..S MTNOD=^DGMT(408.31,MTIEN,0),SRCE=$P(MTNOD,U,23)
    202         ..I SRCE'=1 S DONE=1,Y=MTIEN_U_$P(MTNOD,U)_U_$$MTS^DGMTU(DFN,+$P(MTNOD,U,3))_U_$P(MTNOD,U,23) Q
    203         ..I 'DONE,'$D(ARR($P(MTNOD,U),MTIEN)) S ARR($P(MTNOD,U),MTIEN)=MTIEN_U_$P(MTNOD,U)_U_$$MTS^DGMTU(DFN,+$P(MTNOD,U,3))_U_$P(MTNOD,U,23)
    204         I 'DONE S LAST=$O(ARR(""),-1) I LAST S Y=ARR(LAST,$O(ARR(LAST,""),-1))
    205         Q $G(Y)
     1DGMTU ;ALB/RMO,LBD,BRM,EG - Means Test Utilities ; 02/08/2005 07:10 AM
     2 ;;5.3;Registration;**4,33,182,277,290,374,358,420,426,411,332,433,456,476,519,451,630**;Aug 13, 1993
     3 ;
     4LST(DFN,DGDT,DGMTYPT) ;Last means test for a patient
     5 ;         Input  -- DFN   Patient IEN
     6 ;                   DGDT  Date/Time  (Optional- default today@2359)
     7 ;                DGMTYPT  Type of Test (Optional - if not defined
     8 ;                                       Means Test will be assumed)
     9 ;         Output -- Annual Means Test IEN^Date of Test
     10 ;                   ^Status Name^Status Code^Source of Test
     11 N DGIDT,DGMTFL1,DGMTI,DGNOD,Y I '$D(DGMTYPT) S DGMTYPT=1
     12 S DGIDT=$S($G(DGDT)>0:-DGDT,1:-DT) S:'$P(DGIDT,".",2) DGIDT=DGIDT_.2359
     13 F  S DGIDT=+$O(^DGMT(408.31,"AID",DGMTYPT,DFN,DGIDT)) Q:'DGIDT!$G(DGMTFL1)  D
     14 .F DGMTI=0:0 S DGMTI=+$O(^DGMT(408.31,"AID",DGMTYPT,DFN,DGIDT,DGMTI)) Q:'DGMTI!$G(DGMTFL1)  D
     15 ..S DGNOD=$G(^DGMT(408.31,DGMTI,0)) I DGNOD,$G(^("PRIM"))!(DGMTYPT=4) S DGMTFL1=1,Y=DGMTI_"^"_$P(^(0),"^")_"^"_$$MTS(DFN,+$P(^(0),"^",3))_"^"_$P(DGNOD,"^",23) ; chk for primary MT
     16 Q $G(Y)
     17 ;
     18LVMT(DFN,DGDT) ;Last valid means test (status other than required)
     19 ;          Input  -- DFN    Patient IEN
     20 ;                    DGDT   Date (Optional - default today)
     21 ;          Output -- Annual Means Test IEN^Date of Test^Status Name
     22 ;                     ^Status Code
     23 N DGMT,DGMTL
     24 S:'$D(DGDT) DGDT=DT S DGMTL=$$LST^DGMTU(DFN,DGDT)
     25 I $P(DGMTL,"^",4)="R" F  S DGMT=$$LST^DGMTU(DFN,DGDT) Q:DGMT']""!($P(DGMT,U,4)'="R")  S DGDT=$P(DGMT,U,2)-1
     26 Q $S($G(DGMT)]"":DGMT,1:$G(DGMTL))
     27 ;
     28NVMT(DFN,DGDT) ;Next valid means test (status other than required)
     29 ;          Input  -- DFN    Patient IEN
     30 ;                    DGDT   Date (Required)
     31 ;          Output -- Annual Means Test IEN^Date of Test^Status Name
     32 ;                     ^Status Code
     33 N DGDTE,DGMT,DGMT0,DGMTI,DGMTPR,DGMTS
     34 S DGDTE=DGDT
     35 F  S DGDTE=$O(^DGMT(408.31,"AD",1,DFN,DGDTE)) Q:'DGDTE!$G(DGMT)  D
     36 .F DGMTI=0:0 S DGMTI=$O(^DGMT(408.31,"AD",1,DFN,DGDTE,DGMTI)) Q:'DGMTI  S DGMT0=$G(^DGMT(408.31,DGMTI,0)),DGMTS=+$P(DGMT0,"^",3),DGMTPR=$G(^("PRIM")) I +DGMT0,DGMTS'=1,DGMTPR S DGMT=DGMTI_"^"_+DGMT0_"^"_$$MTS^DGMTU(DFN,DGMTS) Q
     37 Q $G(DGMT)
     38 ;
     39MTS(DFN,DGMTS) ;Means test status -- default current
     40 ;         Input  -- DFN    Patient IEN
     41 ;                   DGMTS  Means Test Status IEN  (Optional)
     42 ;         Output -- Status Name^Status Code
     43 N Y
     44 S DGMTS=$S($G(DGMTS)>0:DGMTS,1:$P($G(^DPT(DFN,0)),"^",14))
     45 I DGMTS S Y=$P($G(^DG(408.32,DGMTS,0)),"^",1,2)
     46 Q $G(Y)
     47 ;
     48DIS(DFN) ;Display patients current means test status,
     49 ;        eligibility for care, deductible information,
     50 ;        date of test and date of completion
     51 ;         Input  -- DFN    Patient IEN
     52 ;         Output -- None
     53 N DGCS,DGDED,DGMTI,DGMT0
     54 S DGCS=$P($G(^DPT(DFN,0)),"^",14) G DISQ:DGCS=""
     55 S DGMTI=+$$LST^DGMTU(DFN),DGMT0=$G(^DGMT(408.31,DGMTI,0))
     56 S MTSIG=$P(DGMT0,"^",29)
     57 W !,"Means Test Signed?: ",$S(MTSIG=1:"YES",MTSIG=0:"NO",MTSIG=9:"DELETED",1:"")
     58 I DGCS=1 W !!,"Patient Requires a Means Test"
     59 I DGCS=2 W !!,"Patient's Means Test is Pending Adjudication for "_$$PA^DGMTUTL(DGMTI)
     60 I DGCS=3 W !!,"Means Test Not Required"
     61 I ("^4^5^6^16^")[("^"_DGCS_"^") W !!,"Patient's status is ",$$GETNAME^DGMTH(DGCS)," based on primary means test"
     62 I $D(^DG(408.32,DGCS,"MSG")) W !,^("MSG")
     63 I DGCS=6 S DGDED=$P(DGMT0,"^",11) W ! W:DGDED]"" "Has",$S(DGDED:"",1:" not")," agreed to pay the deductible"
     64 S Y=$P(DGMT0,"^") X ^DD("DD") W !,"Primary Means Test ",$S(DGCS=1:"Required from",1:"Last Applied")," '",Y,"'"
     65 I ("^2^4^5^6^16^")[("^"_DGCS_"^") S Y=$P(DGMT0,"^",7) X ^DD("DD") W " (COMPLETED: ",Y,")"
     66 I DGCS=3 S Y=$P(DGMT0,"^",17) X ^DD("DD") W " (NO LONGER REQUIRED: ",Y,")"
     67DISQ Q
     68 ;
     69EDT(DFN,DGDT) ;Display patients current means test information and provide
     70 ;        the user with the option of proceeding with a required
     71 ;        means test or editing an existing means test
     72 ;         Input  -- DFN    Patient IEN
     73 ;                   DGDT   Date/Time
     74 ;         Output -- None
     75 ;
     76 ; obtain lock used to synchronize local MT/CT options with income test upload
     77 I $$LOCK^DGMTUTL(DFN)
     78 ;
     79 D DIS(DFN)
     80 S DGMTI=+$$LST(DFN,DGDT) G EDTQ:'DGMTI!(DGMTI'=+$$LST^DGMTU(DFN))
     81 S DGMT0=$G(^DGMT(408.31,DGMTI,0)),DGMTDT=+DGMT0,DGMTS=$P(DGMT0,"^",3)
     82 S DIR("A")="Do you wish to "_$S(DGMTS=1:"proceed with",1:"edit")_" the means test at this time"
     83 S DIR("B")=$S(DGMTS=1:"YES",1:"NO"),DIR(0)="Y"
     84 W ! D ^DIR G EDTQ:$D(DTOUT)!($D(DUOUT))
     85 I Y S DGMTYPT=1,DGMTACT="EDT",DGMTROU="EDTQ^DGMTU" G EN^DGMTSC
     86EDTQ K DGMT0,DGMTACT,DGMTDT,DGMTI,DGMTROU,DGMTS,DIR,DTOUT,DUOUT,Y
     87 ;
     88 ; release lock
     89 D UNLOCK^DGMTUTL(DFN)
     90 ;
     91 Q
     92 ;
     93CMTS(DFN) ;Get Current Means Test Status - query HEC if necessary
     94 ;
     95 ;        Input: DFN=patient ien
     96 ;       Output: MT IEN^Date of Test^Status Name
     97 ;                 ^Status Code^Source of Test
     98 ;
     99 N X,Y,DGMTDATA,DGQSENT,DGDOD,NODE0,DGRET,DGMFLG,DGTAG,DGMTYPT
     100 D CHKPT^DGMTU4(DFN)
     101 S DGMTYPT=1,DGMTDATA=$$LST(DFN,"",DGMTYPT)
     102 ;Next line checks to see if patient has expired, if so, Query not initiated
     103 S DGDOD=$P($G(^DPT(DFN,.35)),U)
     104 I +DGDOD Q DGMTDATA
     105 ;Next line checks to see if current test exists, if not, Query not initiated
     106 I '$G(DGMTDATA) Q DGMTDATA
     107 D:+$$QFLG(DGMTDATA)
     108 .I $G(IVMZ10)'="UPLOAD IN PROGRESS",'$$OPEN^IVMCQ2(DFN),'$$SENT^IVMCQ2(DFN),$G(DGMFLG)'=0 D
     109 ..I $$LOCK^DGMTUTL(DFN)
     110 ..D QRYQUE2^IVMCQ2(DFN,$G(DUZ),0,$G(XQY)) S DGQSENT=1
     111 ..I '$D(ZTQUEUED),'$G(DGMSGF),$G(DGQSENT) W !!,"Financial query queued to be sent to HEC...",! H .5
     112 ..D UNLOCK^DGMTUTL(DFN)
     113 .S DGMTDATA=$$LST(DFN,"",DGMTYPT)
     114 D:+$$MFLG(DGMTDATA)
     115 .S DGMFLG=$$MFLG(DGMTDATA)
     116 .S DGTAG=$S(DGMFLG=1:"MSG"_DGMFLG,DGMFLG=2:"MSG"_DGMFLG,1:0)
     117 .I DGTAG["MSG",'$G(DGMSGF) D @DGTAG
     118 Q DGMTDATA   ;return most current MT data
     119MFLG(DGMTDATA) ;Set up appropriate informational message flag for user's
     120 ;benefit.
     121 ;Input        -     DGMTDATA as defined by $$LST function.
     122 ;Output       -     DGRETV
     123 ;     1 = Current Test is REQUIRED
     124 ;     2 = Test is > 365 days old and is in a status of
     125 ;         other than REQUIRED or NO LONGER REQUIRED
     126 ;     2 = Pend Adj for GMT, test date is 10/6/99 or
     127 ;         greater and agreed to the deductible
     128 ;     0 = CAT C/Pend Adj for MT, test date is 10/6/99
     129 ;         or greater and agreed to the deductible.
     130 ; OR  0 = Cat C, declined income info and agreed
     131 ;         to pay deductible.
     132 ; OR  0 = Has a future dated Means Test
     133 N DGRETV,FTST,DGMT0
     134 S DGRETV=0 I '$G(DGMTDATA) Q DGRETV
     135 S DGMT0=$G(^DGMT(408.31,+DGMTDATA,0))
     136 I $P(DGMTDATA,U,4)="R" S DGRETV=1
     137 I $$OLD^DGMTU4($P(DGMTDATA,U,2)),($P(DGMTDATA,U,4)'="N")&($P(DGMTDATA,U,4)'="R") S DGRETV=2
     138 I ($P(DGMTDATA,U,4)="C")!($P(DGMTDATA,U,4)="P"&($P(DGMT0,U,12)'<$P(DGMT0,U,27))),$P(DGMTDATA,U,2)>2991005,$P(DGMT0,U,11)=1 S DGRETV=0
     139 I ($P(DGMTDATA,U,4)="C"),+$P(DGMT0,U,14),+$P(DGMT0,U,11) S DGRETV=0
     140 D DOM^DGMTR I $G(DGDOM) S DGRETV=0
     141 S FTST=$$FUT(DFN)
     142 I DGRETV,FTST,$P(^DGMT(408.31,+FTST,0),U,19)=1 S DGRETV=0
     143 Q DGRETV
     144MSG1 ;Informational message 1
     145 N NODE0,Y
     146 S NODE0=$G(^DGMT(408.31,+DGMTDATA,0))
     147 W !!,$C(7),?15,"*** Patient Requires a Means Test ***",!
     148 S Y=$P(NODE0,U) X ^DD("DD") W !,?14,"Primary Means Test Required from "_Y,!
     149 I $G(IOST)["C-" R !!,"Enter <RETURN> to continue.",DGRET:DTIME
     150 Q
     151MSG2 ;Informational message 2
     152 N NODE0,Y
     153 S NODE0=$G(^DGMT(408.31,+DGMTDATA,0))
     154 W !!,$C(7),?17,"*** Patient Requires a Means Test ***",!
     155 S Y=$P(NODE0,U) X ^DD("DD") W !,?10,"Patient's Test dated "_Y_" is "_$P(DGMTDATA,U,3)_"."_" The test"
     156 W !,?10,"date is greater than 365 days old.  Please update."
     157 I $G(IOST)["C-" R !!,"Enter <RETURN> to continue.",DGRET:DTIME
     158 Q
     159QFLG(DGMTDATA) ;
     160 ;INPUT - DGMTDATA
     161 ;OUTPUT- IVMQFLG 1 if query is necessary 0 if not
     162 N IVMQFLG,DGMT0
     163 S IVMQFLG=0 I '$G(DGMTDATA) Q IVMQFLG
     164 S DGMT0=$G(^DGMT(408.31,+DGMTDATA,0))
     165 ;Set flag to 1 if Means test is Required.
     166 I $P(DGMTDATA,U,4)="R" S IVMQFLG=1
     167 ;Set flag to 1 if Means test older than 365 days and status is not
     168 ;NO LONGER REQUIRED and not REQUIRED.
     169 I $$OLD^DGMTU4($P(DGMTDATA,U,2)),($P(DGMTDATA,U,4)'="N")&($P(DGMTDATA,U,4)'="R") S IVMQFLG=1
     170 ;If Cat C/Pend Adj for MT, older than 365 days, agreed to pay, test
     171 ;date > 10/5/99 reset flag to 0 - no query is necessary.
     172 I ($P(DGMTDATA,U,4)="C")!($P(DGMTDATA,U,4)="P"&($P(DGMT0,U,12)'<$P(DGMT0,U,27))),$P(DGMTDATA,U,2)>2991005,$P(DGMT0,U,11)=1 S IVMQFLG=0
     173 ;If patient is Cat C, declined to provide income but has agreed to
     174 ;pay deductible, no query necessary - reset flag to 0
     175 I ($P(DGMTDATA,U,4)="C"),+$P(DGMT0,U,14),+$P(DGMT0,U,11) S DGRETV=0
     176 ;If patient is on a DOM ward, don't initiate query
     177 D DOM^DGMTR I $G(DGDOM) S IVMQFLG=0
     178 Q IVMQFLG
     179 ;
     180FUT(DFN,DGDT,DGMTYPT) ; Future Means Tests for a patient
     181 ;DFN      Patient IEN
     182 ;DGDT     Date (Optional- default to today)
     183 ;DGMTYPT  Type of Test (Optional - default to MT)
     184 ;Return
     185 ;If a DCD test was performed it will be returned, else the
     186 ;current future dated test for the Income Year.
     187 ;MT IEN^Date of Test^Status Name^Status Code^Source
     188 ;
     189 N DGIDT,Y,MTIEN,SRCE,DONE,MTNOD,ARR,LAST,TYPTST
     190 S:'$D(DGMTYPT) DGMTYPT=1
     191 ;no future LTC eg 02/15/2005
     192 I ($G(DGMTYPT)=4) Q ""
     193 S TYPTST=$S(DGMTYPT=2:"AF",1:"AE")
     194 S DGIDT=$S($G(DGDT)>0:DGDT,1:DT),DONE=0
     195 S (ARR,LAST,Y)=""
     196 S:$P(DGIDT,".",2) DGIDT=$P(DGIDT,".")
     197 F  S DGIDT=$O(^IVM(301.5,TYPTST,DFN,DGIDT)) Q:'DGIDT!(DONE)  D
     198 .S MTIEN=0
     199 .F  S MTIEN=$O(^IVM(301.5,TYPTST,DFN,DGIDT,MTIEN)) Q:'MTIEN!(DONE)  D
     200 ..Q:'$D(^DGMT(408.31,MTIEN,0))
     201 ..S MTNOD=^DGMT(408.31,MTIEN,0),SRCE=$P(MTNOD,U,23)
     202 ..I SRCE'=1 S DONE=1,Y=MTIEN_U_$P(MTNOD,U)_U_$$MTS^DGMTU(DFN,+$P(MTNOD,U,3))_U_$P(MTNOD,U,23) Q
     203 ..I 'DONE,'$D(ARR($P(MTNOD,U),MTIEN)) S ARR($P(MTNOD,U),MTIEN)=MTIEN_U_$P(MTNOD,U)_U_$$MTS^DGMTU(DFN,+$P(MTNOD,U,3))_U_$P(MTNOD,U,23)
     204 I 'DONE S LAST=$O(ARR(""),-1) I LAST S Y=ARR(LAST,$O(ARR(LAST,""),-1))
     205 Q $G(Y)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPFUT.m

    r613 r623  
    1 DGPFUT  ;ALB/RPM - PRF UTILITIES ;7:46 PM  30 Jan 2008
    2         ;;5.3;Registration;**425,554,650,VWEHR1**;WorldVistA 30-Jan-08;Build 4
    3         ;
    4         ;Modified from FOIA VISTA,
    5         ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
    6         ;General Public License See attached copy of the License.
    7         ;
    8         ;This program is free software; you can redistribute it and/or modify
    9         ;it under the terms of the GNU General Public License as published by
    10         ;the Free Software Foundation; either version 2 of the License, or
    11         ;(at your option) any later version.
    12         ;
    13         ;This program is distributed in the hope that it will be useful,
    14         ;but WITHOUT ANY WARRANTY; without even the implied warranty of
    15         ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16         ;GNU General Public License for more details.
    17         ;
    18         ;You should have received a copy of the GNU General Public License along
    19         ;with this program; if not, write to the Free Software Foundation, Inc.,
    20         ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    21         ;
    22         Q   ;no direct entry
    23         ;
    24 ANSWER(DGDIRA,DGDIRB,DGDIR0,DGDIRH,DGDIRS)      ;wrap FileMan Classic Reader call
    25         ;
    26         ;  Input
    27         ;    DGDIR0 - DIR(0) string
    28         ;    DGDIRA - DIR("A") string
    29         ;    DGDIRB - DIR("B") string
    30         ;    DGDIRH - DIR("?") string
    31         ;    DGDIRS - DIR("S") string
    32         ;
    33         ;  Output
    34         ;   Function Value - Internal value returned from ^DIR or -1 if user
    35         ;                    up-arrows, double up-arrows or the read times out.
    36         ;
    37         ;          DIR(0) type      Results
    38         ;          ------------     -------------------------------
    39         ;          DD               IEN of selected entry
    40         ;          Pointer          IEN of selected entry
    41         ;          Set of Codes     Internal value of code
    42         ;          Yes/No           0 for No, 1 for Yes
    43         ;
    44         N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y  ;^DIR variables
    45         ;
    46         S DIR(0)=DGDIR0
    47         S DIR("A")=$G(DGDIRA)
    48         I $G(DGDIRB)]"" S DIR("B")=DGDIRB
    49         I $D(DGDIRH) S DIR("?")=DGDIRH
    50         I $G(DGDIRS)]"" S DIR("S")=DGDIRS
    51         D ^DIR
    52         Q $S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,X="@":"@",1:$P(Y,U))
    53         ;
    54 CONTINUE()      ;pause display
    55         ;
    56         ;  Input:  none
    57         ;
    58         ;  Output:  1 - continue
    59         ;           0 - quit
    60         ;
    61         N DIR,Y
    62         S DIR(0)="E" D ^DIR
    63         Q $S(Y'=1:0,1:1)
    64         ;
    65 VALID(DGRTN,DGFILE,DGIP,DGERR)  ;validate input values before filing
    66         ;
    67         ;  Input:
    68         ;    DGRTN - (required) Routine name that contains $TEXT table
    69         ;   DGFILE - (required) File number for input values
    70         ;     DGIP - (required) Input value array
    71         ;    DGERR - (optional) Returns error message passed by reference
    72         ;
    73         ;  Output:
    74         ;   Function Value - Returns 1 on all values valid, 0 on failure
    75         ;
    76         I $G(DGRTN)=""!('$G(DGFILE)) Q 0
    77         N DGVLD   ;function return value
    78         N DGFXR   ;node name to field xref array
    79         N DGREQ   ;array of required fields
    80         N DGWP    ;word processing flag
    81         N DGN     ;array node name
    82         ;
    83         S DGVLD=1
    84         S DGN=""
    85         D BLDXR(DGRTN,.DGFXR)
    86         ;
    87         F  S DGN=$O(DGFXR(DGN)) Q:DGN=""  D  Q:'DGVLD
    88         . S DGREQ=$P(DGFXR(DGN),U,2)
    89         . S DGWP=$P(DGFXR(DGN),U,3)
    90         . I DGREQ D   ;required field check
    91         . . I DGWP,'$$CKWP("DGIP(DGN)") S DGVLD=0 Q
    92         . . I 'DGWP,$G(DGIP(DGN))']"" S DGVLD=0 Q
    93         . I 'DGVLD D  Q
    94         . . S DGERR=$$GET1^DID(DGFILE,+DGFXR(DGN),,"LABEL")_" REQUIRED"
    95         . Q:DGWP  ;don't check word processing fields for invalid values
    96         . ;check for invalid values
    97         . I '$$TESTVAL(DGFILE,+DGFXR(DGN),$P($G(DGIP(DGN)),U)) D  Q
    98         . . S DGVLD=0,DGERR=$$GET1^DID(DGFILE,+DGFXR(DGN),,"LABEL")_" NOT VALID"
    99         Q DGVLD
    100         ;
    101 BLDXR(DGRTN,DGFLDA)     ;build name/field xref array
    102         ;This procedure reads in the text from the XREF line tag of the DGRTN
    103         ;input parameter and loads name/field xref array with parsed line data.
    104         ;
    105         ;  Input:
    106         ;    DGRTN - (required) Routine name that contains the XREF line tag
    107         ;   DGFLDA - (required) Array name for name/field xref passed by
    108         ;            reference
    109         ;
    110         ;  Output:
    111         ;   Function Value - Returns 1 on success, 0 on failure
    112         ;           DGFLDA - Name/field xref array
    113         ;                  format: DGFLDA(subscript)=field#^required?^word proc?
    114         ;
    115         S DGRTN=$G(DGRTN)
    116         Q:DGRTN=""
    117         I $E(DGRTN,1)'="^" S DGRTN="^"_DGRTN
    118         Q:($T(@DGRTN)="")
    119         N DGTAG
    120         N DGOFF
    121         N DGLINE
    122         ;
    123         F DGOFF=1:1 S DGTAG="XREF+"_DGOFF_DGRTN,DGLINE=$T(@DGTAG) Q:DGLINE=""  D
    124         . S DGFLDA($P(DGLINE,";",3))=$P(DGLINE,";",4)_U_+$P(DGLINE,";",5)_U_+$P(DGLINE,";",6)
    125         Q
    126         ;
    127 CKWP(DGROOT)    ;ck word processing required fields
    128         ;This function verifies that at least one line in the word processing
    129         ;array contains text more than one space long.
    130         ;
    131         ;  Input:
    132         ;    DGROOT - (required) Word processing root
    133         ;
    134         ;  Output:
    135         ;   Function Value - Returns 1 on success, 0 on failure
    136         ;
    137         N DGLIN
    138         N DGRSLT
    139         S DGRSLT=0
    140         I $D(@DGROOT) D
    141         . S DGLIN=""
    142         . F  S DGLIN=$O(@DGROOT@(DGLIN)) Q:DGLIN=""  D  Q:DGRSLT
    143         . . I $G(@DGROOT@(DGLIN,0))]"",@DGROOT@(DGLIN,0)'=" " S DGRSLT=1
    144         Q DGRSLT
    145         ;
    146 TESTVAL(DGFIL,DGFLD,DGVAL)      ;validate individual value against field def
    147         ;
    148         ;  Input:
    149         ;    DGFIL - (required) File number
    150         ;    DGFLD - (required) Field number
    151         ;    DGVAL - (required) Field value to be validated
    152         ;
    153         ;  Output:
    154         ;   Function Value - Returns 1 if value is valid, 0 if value is invalid
    155         ;
    156         N DGVALEX  ;external value after conversion
    157         N DGTYP    ;field type
    158         N DGRSLT   ;results of CHK^DIE
    159         N VALID    ;function results
    160         ;
    161         S VALID=1
    162         I $G(DGFIL)>0,($G(DGFLD)>0),($G(DGVAL)'="") D
    163         . S DGVALEX=$$EXTERNAL^DILFD(DGFIL,DGFLD,"F",DGVAL)
    164         . I DGVALEX="" S VALID=0 Q
    165         . I $$GET1^DID(DGFIL,DGFLD,"","TYPE")'["POINTER" D
    166         . . D CHK^DIE(DGFIL,DGFLD,,DGVALEX,.DGRSLT) I DGRSLT="^" S VALID=0 Q
    167         Q VALID
    168         ;
    169 STATUS(DGACT)   ;calculate the assignment STATUS given an ACTION code
    170         ;
    171         ;  Input:
    172         ;    DGACT - (required) Action (.03) field value for PRF ASSIGNMENT
    173         ;            HISTORY (#26.14) file in internal or external format
    174         ;
    175         ;  Output:
    176         ;   Function Value - Status value on success, -1 on failure
    177         ;
    178         N DGERR   ;FM message root
    179         N DGRSLT  ;CHK^DIE result array
    180         N DGSTAT  ;calculated status value
    181         ;
    182         S DGSTAT=-1
    183         I $G(DGACT)]"" D
    184         . I DGACT?1.N S DGACT=$$EXTERNAL^DILFD(26.14,.03,"F",DGACT,"DGERR")
    185         . Q:$D(DGERR)
    186         . D CHK^DIE(26.14,.03,"E",DGACT,.DGRSLT,"DGERR")
    187         . Q:$D(DGERR)
    188         . I DGRSLT(0)="INACTIVATE"!(DGRSLT(0)="ENTERED IN ERROR") S DGSTAT=0
    189         . E  S DGSTAT=1
    190         Q DGSTAT
    191         ;
    192 MPIOK(DGDFN,DGICN)      ;return national ICN
    193         ;This function verifies that a given patient has a valid national
    194         ;Integration Control Number.
    195         ;
    196         ;  Supported DBIA #2701:  The supported DBIA is used to access MPI
    197         ;                         APIs to retrieve ICN and determine if ICN
    198         ;                         is local.
    199         ;
    200         ;  Input:
    201         ;    DGDFN - (required) IEN of patient in PATIENT (#2) file
    202         ;    DGICN - (optional) passed by reference to contain national ICN
    203         ;
    204         ;  Output:
    205         ;   Function Value - 1 on valid national ICN;
    206         ;                    0 on failure
    207         ;            DGICN - Patient's Integrated Control Number
    208         ;
    209         N DGRSLT
    210         S DGRSLT=0
    211         I $G(DGDFN)>0 D
    212         . S DGICN=$$GETICN^MPIF001(DGDFN)
    213         . ;
    214         . ;ICN must be valid
    215         . Q:(DGICN'>0)
    216         . ;
    217         . ;ICN must not be local
    218         . Q:$$IFLOCAL^MPIF001(DGDFN)
    219         . ;
    220         . S DGRSLT=1
    221         Q DGRSLT
    222         ;
    223 GETNXTF(DGDFN,DGLTF)    ;get previous treating facility
    224         ;This function will return the treating facility with a DATE LAST
    225         ;TREATED value immediately prior to the date for the treating facility
    226         ;passed as the second parameter.  The most recent treating facility
    227         ;will be returned when the second parameter is missing, null, or zero.
    228         ;
    229         ;  Input:
    230         ;    DGDFN - pointer to patient in PATIENT (#2) file
    231         ;    DGLTF - (optional) last treating facility [default=0]
    232         ;
    233         ;  Output:
    234         ;    Function value - previous facility as a pointer to INSTITUTION (#4)
    235         ;                     file on success; 0 on failure
    236         ;
    237         N DGARR   ;fully subscripted array node
    238         N DGDARR  ;date sorted treating facilities
    239         N DGINST  ;institution pointer
    240         N DGNAM   ;name of sorted treating facilities array
    241         N DGTFARR  ;array of non-local treating facilities
    242         ;
    243         ;
    244         I $G(DGDFN)>0,$$BLDTFL^DGPFUT2(DGDFN,.DGTFARR) D
    245         . ;
    246         . ;validate last treating facility input parameter
    247         . S DGLTF=+$G(DGLTF)
    248         . S DGLTF=$S(DGLTF&($D(DGTFARR(DGLTF))):DGLTF,1:0)
    249         . ;
    250         . ;build date sorted list
    251         . S DGINST=0
    252         . F  S DGINST=$O(DGTFARR(DGINST)) Q:'DGINST  D
    253         . . S DGDARR(DGTFARR(DGINST),DGINST)=""
    254         . ;
    255         . ;find entry for previous treating facility
    256         . S DGNAM="DGDARR"
    257         . ;
    258         . ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
    259         . ;
    260         . ;S DGARR=$QUERY(@DGNAM@(""),-1)
    261         . S DGARR=$$Q^VWUTIL($NA(@DGNAM@("")),-1)
    262         . ;
    263         . ;END CHANGE
    264         . ;
    265         . I DGLTF,DGARR]"" D
    266         . . I $QS(DGARR,2)'=DGLTF D
    267         . . . ;
    268         . . . ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
    269         . . . ;
    270         . . . ;F  S DGARR=$QUERY(@DGARR,-1) Q:+$QS(DGARR,2)=DGLTF
    271         . . . F  S DGARR=$$Q^VWUTIL($NA(@DGARR),-1) Q:+$QS(DGARR,2)=DGLTF
    272         . . . ;
    273         . . . ;END CHANGE
    274         . . . ;
    275         . . ;
    276         . . ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
    277         . . ;
    278         . . ;S DGARR=$QUERY(@DGARR,-1)
    279         . . S DGARR=$$Q^VWUTIL($NA(@DGARR),-1)
    280         . . ;
    281         . . ;END CHANGE
    282         . . ;
    283         ;
    284         Q $S($G(DGARR)]"":+$QS(DGARR,2),1:0)
    285         ;
    286 ISDIV(DGSITE)   ;is site local division
    287         ;
    288         ;  Input:
    289         ;    DGSITE - pointer to INSTITUTION (#4) file
    290         ;
    291         ;  Output:
    292         ;    Function value - 1 on success; 0 on failure
    293         ;
    294         S DGSITE=+$G(DGSITE)
    295         Q $S($D(^DG(40.8,"AD",DGSITE)):1,1:0)
     1DGPFUT ;ALB/RPM - PRF UTILITIES ;7:46 PM  30 Jan 2008
     2 ;;5.3;Registration;**425,554,650,VWEHR1**;WorldVistA 30-Jan-08
     3 ;
     4 ;Modified from FOIA VISTA,
     5 ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
     6 ;General Public License See attached copy of the License.
     7 ;
     8 ;This program is free software; you can redistribute it and/or modify
     9 ;it under the terms of the GNU General Public License as published by
     10 ;the Free Software Foundation; either version 2 of the License, or
     11 ;(at your option) any later version.
     12 ;
     13 ;This program is distributed in the hope that it will be useful,
     14 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 ;GNU General Public License for more details.
     17 ;
     18 ;You should have received a copy of the GNU General Public License along
     19 ;with this program; if not, write to the Free Software Foundation, Inc.,
     20 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     21 ;
     22 Q   ;no direct entry
     23 ;
     24ANSWER(DGDIRA,DGDIRB,DGDIR0,DGDIRH,DGDIRS) ;wrap FileMan Classic Reader call
     25 ;
     26 ;  Input
     27 ;    DGDIR0 - DIR(0) string
     28 ;    DGDIRA - DIR("A") string
     29 ;    DGDIRB - DIR("B") string
     30 ;    DGDIRH - DIR("?") string
     31 ;    DGDIRS - DIR("S") string
     32 ;
     33 ;  Output
     34 ;   Function Value - Internal value returned from ^DIR or -1 if user
     35 ;                    up-arrows, double up-arrows or the read times out.
     36 ;
     37 ;          DIR(0) type      Results
     38 ;          ------------     -------------------------------
     39 ;          DD               IEN of selected entry
     40 ;          Pointer          IEN of selected entry
     41 ;          Set of Codes     Internal value of code
     42 ;          Yes/No           0 for No, 1 for Yes
     43 ;
     44 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y  ;^DIR variables
     45 ;
     46 S DIR(0)=DGDIR0
     47 S DIR("A")=$G(DGDIRA)
     48 I $G(DGDIRB)]"" S DIR("B")=DGDIRB
     49 I $D(DGDIRH) S DIR("?")=DGDIRH
     50 I $G(DGDIRS)]"" S DIR("S")=DGDIRS
     51 D ^DIR
     52 Q $S($D(DUOUT):-1,$D(DTOUT):-1,$D(DIROUT):-1,X="@":"@",1:$P(Y,U))
     53 ;
     54CONTINUE() ;pause display
     55 ;
     56 ;  Input:  none
     57 ;
     58 ;  Output:  1 - continue
     59 ;           0 - quit
     60 ;
     61 N DIR,Y
     62 S DIR(0)="E" D ^DIR
     63 Q $S(Y'=1:0,1:1)
     64 ;
     65VALID(DGRTN,DGFILE,DGIP,DGERR) ;validate input values before filing
     66 ;
     67 ;  Input:
     68 ;    DGRTN - (required) Routine name that contains $TEXT table
     69 ;   DGFILE - (required) File number for input values
     70 ;     DGIP - (required) Input value array
     71 ;    DGERR - (optional) Returns error message passed by reference
     72 ;
     73 ;  Output:
     74 ;   Function Value - Returns 1 on all values valid, 0 on failure
     75 ;
     76 I $G(DGRTN)=""!('$G(DGFILE)) Q 0
     77 N DGVLD   ;function return value
     78 N DGFXR   ;node name to field xref array
     79 N DGREQ   ;array of required fields
     80 N DGWP    ;word processing flag
     81 N DGN     ;array node name
     82 ;
     83 S DGVLD=1
     84 S DGN=""
     85 D BLDXR(DGRTN,.DGFXR)
     86 ;
     87 F  S DGN=$O(DGFXR(DGN)) Q:DGN=""  D  Q:'DGVLD
     88 . S DGREQ=$P(DGFXR(DGN),U,2)
     89 . S DGWP=$P(DGFXR(DGN),U,3)
     90 . I DGREQ D   ;required field check
     91 . . I DGWP,'$$CKWP("DGIP(DGN)") S DGVLD=0 Q
     92 . . I 'DGWP,$G(DGIP(DGN))']"" S DGVLD=0 Q
     93 . I 'DGVLD D  Q
     94 . . S DGERR=$$GET1^DID(DGFILE,+DGFXR(DGN),,"LABEL")_" REQUIRED"
     95 . Q:DGWP  ;don't check word processing fields for invalid values
     96 . ;check for invalid values
     97 . I '$$TESTVAL(DGFILE,+DGFXR(DGN),$P($G(DGIP(DGN)),U)) D  Q
     98 . . S DGVLD=0,DGERR=$$GET1^DID(DGFILE,+DGFXR(DGN),,"LABEL")_" NOT VALID"
     99 Q DGVLD
     100 ;
     101BLDXR(DGRTN,DGFLDA) ;build name/field xref array
     102 ;This procedure reads in the text from the XREF line tag of the DGRTN
     103 ;input parameter and loads name/field xref array with parsed line data.
     104 ;
     105 ;  Input:
     106 ;    DGRTN - (required) Routine name that contains the XREF line tag
     107 ;   DGFLDA - (required) Array name for name/field xref passed by
     108 ;            reference
     109 ;
     110 ;  Output:
     111 ;   Function Value - Returns 1 on success, 0 on failure
     112 ;           DGFLDA - Name/field xref array
     113 ;                  format: DGFLDA(subscript)=field#^required?^word proc?
     114 ;
     115 S DGRTN=$G(DGRTN)
     116 Q:DGRTN=""
     117 I $E(DGRTN,1)'="^" S DGRTN="^"_DGRTN
     118 Q:($T(@DGRTN)="")
     119 N DGTAG
     120 N DGOFF
     121 N DGLINE
     122 ;
     123 F DGOFF=1:1 S DGTAG="XREF+"_DGOFF_DGRTN,DGLINE=$T(@DGTAG) Q:DGLINE=""  D
     124 . S DGFLDA($P(DGLINE,";",3))=$P(DGLINE,";",4)_U_+$P(DGLINE,";",5)_U_+$P(DGLINE,";",6)
     125 Q
     126 ;
     127CKWP(DGROOT) ;ck word processing required fields
     128 ;This function verifies that at least one line in the word processing
     129 ;array contains text more than one space long.
     130 ;
     131 ;  Input:
     132 ;    DGROOT - (required) Word processing root
     133 ;
     134 ;  Output:
     135 ;   Function Value - Returns 1 on success, 0 on failure
     136 ;
     137 N DGLIN
     138 N DGRSLT
     139 S DGRSLT=0
     140 I $D(@DGROOT) D
     141 . S DGLIN=""
     142 . F  S DGLIN=$O(@DGROOT@(DGLIN)) Q:DGLIN=""  D  Q:DGRSLT
     143 . . I $G(@DGROOT@(DGLIN,0))]"",@DGROOT@(DGLIN,0)'=" " S DGRSLT=1
     144 Q DGRSLT
     145 ;
     146TESTVAL(DGFIL,DGFLD,DGVAL) ;validate individual value against field def
     147 ;
     148 ;  Input:
     149 ;    DGFIL - (required) File number
     150 ;    DGFLD - (required) Field number
     151 ;    DGVAL - (required) Field value to be validated
     152 ;
     153 ;  Output:
     154 ;   Function Value - Returns 1 if value is valid, 0 if value is invalid
     155 ;
     156 N DGVALEX  ;external value after conversion
     157 N DGTYP    ;field type
     158 N DGRSLT   ;results of CHK^DIE
     159 N VALID    ;function results
     160 ;
     161 S VALID=1
     162 I $G(DGFIL)>0,($G(DGFLD)>0),($G(DGVAL)'="") D
     163 . S DGVALEX=$$EXTERNAL^DILFD(DGFIL,DGFLD,"F",DGVAL)
     164 . I DGVALEX="" S VALID=0 Q
     165 . I $$GET1^DID(DGFIL,DGFLD,"","TYPE")'["POINTER" D
     166 . . D CHK^DIE(DGFIL,DGFLD,,DGVALEX,.DGRSLT) I DGRSLT="^" S VALID=0 Q
     167 Q VALID
     168 ;
     169STATUS(DGACT) ;calculate the assignment STATUS given an ACTION code
     170 ;
     171 ;  Input:
     172 ;    DGACT - (required) Action (.03) field value for PRF ASSIGNMENT
     173 ;            HISTORY (#26.14) file in internal or external format
     174 ;
     175 ;  Output:
     176 ;   Function Value - Status value on success, -1 on failure
     177 ;
     178 N DGERR   ;FM message root
     179 N DGRSLT  ;CHK^DIE result array
     180 N DGSTAT  ;calculated status value
     181 ;
     182 S DGSTAT=-1
     183 I $G(DGACT)]"" D
     184 . I DGACT?1.N S DGACT=$$EXTERNAL^DILFD(26.14,.03,"F",DGACT,"DGERR")
     185 . Q:$D(DGERR)
     186 . D CHK^DIE(26.14,.03,"E",DGACT,.DGRSLT,"DGERR")
     187 . Q:$D(DGERR)
     188 . I DGRSLT(0)="INACTIVATE"!(DGRSLT(0)="ENTERED IN ERROR") S DGSTAT=0
     189 . E  S DGSTAT=1
     190 Q DGSTAT
     191 ;
     192MPIOK(DGDFN,DGICN) ;return national ICN
     193 ;This function verifies that a given patient has a valid national
     194 ;Integration Control Number.
     195 ;
     196 ;  Supported DBIA #2701:  The supported DBIA is used to access MPI
     197 ;                         APIs to retrieve ICN and determine if ICN
     198 ;                         is local.
     199 ;
     200 ;  Input:
     201 ;    DGDFN - (required) IEN of patient in PATIENT (#2) file
     202 ;    DGICN - (optional) passed by reference to contain national ICN
     203 ;
     204 ;  Output:
     205 ;   Function Value - 1 on valid national ICN;
     206 ;                    0 on failure
     207 ;            DGICN - Patient's Integrated Control Number
     208 ;
     209 N DGRSLT
     210 S DGRSLT=0
     211 I $G(DGDFN)>0 D
     212 . S DGICN=$$GETICN^MPIF001(DGDFN)
     213 . ;
     214 . ;ICN must be valid
     215 . Q:(DGICN'>0)
     216 . ;
     217 . ;ICN must not be local
     218 . Q:$$IFLOCAL^MPIF001(DGDFN)
     219 . ;
     220 . S DGRSLT=1
     221 Q DGRSLT
     222 ;
     223GETNXTF(DGDFN,DGLTF) ;get previous treating facility
     224 ;This function will return the treating facility with a DATE LAST
     225 ;TREATED value immediately prior to the date for the treating facility
     226 ;passed as the second parameter.  The most recent treating facility
     227 ;will be returned when the second parameter is missing, null, or zero.
     228 ;
     229 ;  Input:
     230 ;    DGDFN - pointer to patient in PATIENT (#2) file
     231 ;    DGLTF - (optional) last treating facility [default=0]
     232 ;
     233 ;  Output:
     234 ;    Function value - previous facility as a pointer to INSTITUTION (#4)
     235 ;                     file on success; 0 on failure
     236 ;
     237 N DGARR   ;fully subscripted array node
     238 N DGDARR  ;date sorted treating facilities
     239 N DGINST  ;institution pointer
     240 N DGNAM   ;name of sorted treating facilities array
     241 N DGTFARR  ;array of non-local treating facilities
     242 ;
     243 ;
     244 I $G(DGDFN)>0,$$BLDTFL^DGPFUT2(DGDFN,.DGTFARR) D
     245 . ;
     246 . ;validate last treating facility input parameter
     247 . S DGLTF=+$G(DGLTF)
     248 . S DGLTF=$S(DGLTF&($D(DGTFARR(DGLTF))):DGLTF,1:0)
     249 . ;
     250 . ;build date sorted list
     251 . S DGINST=0
     252 . F  S DGINST=$O(DGTFARR(DGINST)) Q:'DGINST  D
     253 . . S DGDARR(DGTFARR(DGINST),DGINST)=""
     254 . ;
     255 . ;find entry for previous treating facility
     256 . S DGNAM="DGDARR"
     257 . ;
     258 . ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
     259 . ;
     260 . ;S DGARR=$QUERY(@DGNAM@(""),-1)
     261 . S DGARR=$$Q^VWUTIL($NA(@DGNAM@("")),-1)
     262 . ;
     263 . ;END CHANGE
     264 . ;
     265 . I DGLTF,DGARR]"" D
     266 . . I $QS(DGARR,2)'=DGLTF D
     267 . . . ;
     268 . . . ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
     269 . . . ;
     270 . . . ;F  S DGARR=$QUERY(@DGARR,-1) Q:+$QS(DGARR,2)=DGLTF
     271 . . . F  S DGARR=$$Q^VWUTIL($NA(@DGARR),-1) Q:+$QS(DGARR,2)=DGLTF
     272 . . . ;
     273 . . . ;END CHANGE
     274 . . . ;
     275 . . ;
     276 . . ;WV/EHR REVERSE $Q REPLACEMENT; SO 01/12/08 ;VWEHR1
     277 . . ;
     278 . . ;S DGARR=$QUERY(@DGARR,-1)
     279 . . S DGARR=$$Q^VWUTIL($NA(@DGARR),-1)
     280 . . ;
     281 . . ;END CHANGE
     282 . . ;
     283 ;
     284 Q $S($G(DGARR)]"":+$QS(DGARR,2),1:0)
     285 ;
     286ISDIV(DGSITE) ;is site local division
     287 ;
     288 ;  Input:
     289 ;    DGSITE - pointer to INSTITUTION (#4) file
     290 ;
     291 ;  Output:
     292 ;    Function value - 1 on success; 0 on failure
     293 ;
     294 S DGSITE=+$G(DGSITE)
     295 Q $S($D(^DG(40.8,"AD",DGSITE)):1,1:0)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTF4.m

    r613 r623  
    1 DGPTF4  ;ALB/JDS - PTF ENTRY/EDIT-4 ; 2/19/04 9:33am
    2         ;;5.3;Registration;**114,115,397,510,517,478,683,775**;Aug 13, 1993;Build 3
    3         ;
    4 WR      ;
    5         W @IOF,HEAD,?72 S Z="<701>" D Z^DGPTFM K X S $P(X,"-",81)="" W !,X
    6         Q
    7 EN      S Y=+B(70) D D^DGPTUTL W ! S Z=5 D Z W $S($P(B(0),U,11)=1:"Date of Disch: ",1:"Census Date  : ") S Z=Y,Z1=20 D Z1 W "Disch Specialty: ",$S($D(^DIC(42.4,+$P(B(70),U,2),0)):$E($P(^(0),U,1),1,25),1:"")
    8         W !,"   Type of Disch: " S L=";"_$P(^DD(45,72,0),U,3),L1=";"_$P(B(70),U,3)_":" W $P($P(L,L1,2),";",1),?41 S L=";"_$P(^DD(45,72.1,0),U,3),L1=";"_$P(B(70),U,14)_":" W "Disch Status: ",$P($P(L,L1,2),";",1)
    9         W !,"   Place of Disp: ",$S($D(^DIC(45.6,+$P(B(70),U,6),0)):$E($P(^(0),U,1),1,21),1:"")
    10         W ?40 S Z=6 D Z W " Out Treat: ",$P("YES^^NO",U,+$P(B(70),U,4))
    11         W !?6,"Means Test: " S L=";"_$P(^DD(45,10,0),U,3),L1=";"_$P(B(0),U,10)_":" W $P($P(L,L1,2),";",1)
    12         W ?42,"VA Auspices: ",$S($P(B(70),U,5)=1:"YES",$P(B(70),U,5)=2:"NO",1:"")
    13         W ! S Z=7 D Z W " Receiv facil: " S Z=$P(B(70),U,12)_$P(B(70),U,13),Z1=18 D Z1 W ?38 S Z="Other Fields" D Z
    14         S DGINC=$P(B(101),U,7)
    15         I DGINC>1000 S DGINC=$E(DGINC,1,$L(DGINC)-3)_","_$E(DGINC,$L(DGINC)-2,$L(DGINC))
    16         W !,"      C&P Status: " S L=";"_$P(^DD(45,78,0),U,3),L1=";"_$P(B(70),U,9)_":" W $E($P($P(L,L1,2),";",1),1,24),?47,"Income: $",DGINC
    17         K DGINC
    18 AS      ;
    19         N DGRSC
    20         S DGRSC=$S($P(A(.3),U)="Y":$$RTEN^DGPTR4($P(A(.3),U,2)),1:"")
    21         W !,"       ASIH Days: ",$P(B(70),U,8)
    22         W ?40,"SC Percentage: ",$S($P(A(.3),U)="Y":$P(A(.3),U,2)_"%",1:"")
    23         I DGRSC]"",DGRSC'=$P(A(.3),U,2) W ?60,"Transmitted: ["_DGRSC_"%]"
    24         ;W !,?39,"Period Of Serv: ",$S($D(^DIC(21,$S('$D(^DGPM(+$O(^DGPM("APTF",PTF,0)),"ODS")):+$P(A(.32),U,3),+^("ODS"):+$O(^DIC(21,"D",6,0)),1:+$P(A(.32),U,3)),0)):$E($P(^(0),U),1,26),1:""),!
    25         W !,?39,"Period Of Serv: "
    26         W $S($D(^DIC(21,$S('$D(^DGPM(+$O(^DGPM("APTF",PTF,0)),"ODS")):+$$CKPOS^DGPTUTL($P(B(101),U,8),+$P(A(.32),U,3)),+^("ODS"):+$O(^DIC(21,"D",6,0)),1:$$CKPOS^DGPTUTL($P(B(101),U,8),+$P(A(.32),U,3))),0)):$E($P(^(0),U),1,26),1:""),!
    27         Q
    28         ;
    29 EN1     ;LOAD AND DISPLAY DIAGNOSES FOR PTF 701 SCREEN
    30         K DRG S B(70)=$S($D(^DGPT(PTF,70)):^(70),1:""),B(71)=$S($D(^DGPT(PTF,71)):^(71),1:"") D WR
    31         S DGPTDAT=$$GETDATE^ICDGTDRG(PTF) ;Get correct effective date
    32         S DGPTTMP=$$ICDDX^ICDCODE(+$P(B(70),U,10),DGPTDAT)
    33         W ! S Z=1 D Z W "  Principal Diagnosis: ",$S(DGPTTMP&$P(DGPTTMP,U,10):$P(DGPTTMP,U,4)_"("_$P(DGPTTMP,U,2)_")",1:"")
    34         S DGPTTMP=$$ICDDX^ICDCODE(+$P(B(70),U,11),DGPTDAT)
    35         W:$P(B(70),U,11)&('$P(B(70),U,10)) !,"  Principal Diag: ",$S(DGPTTMP&$P(DGPTTMP,U,10):$P(DGPTTMP,U,4)_" ("_$P(DGPTTMP,U,2)_")",1:"")
    36         S K=B(70) F I=16:1:24 D DSP
    37         S K=B(71) F I=1:1:4 D DSP
    38         S DGPTF=PTF D:'DGST CHK701^DGPTSCAN,UP701^DGPTSPQ
    39         ; display contents of 300th node
    40         S DG300=$S($D(^DGPT(PTF,300)):^(300),1:"") D:DG300]"" PRN2^DGPTFM8 K DG300
    41 EN2     K DRG
    42         I $D(^DGPT(PTF,0)),$P(^(0),U,11)=1 D
    43         .S DA=DFN
    44         .D EN1^DGPTFD
    45         .I $D(DRG),$D(^DGP(45.84,PTF,0)),$P(^(0),U,6)'=DRG D
    46         ..N DGFDA,DGMSG
    47         ..S DGFDA(45.84,PTF_",",6)=DRG
    48         ..D FILE^DIE("","DGFDA","DGMSG")
    49 JUMP    K AGE,B,CC,DA,DAM,DOB,DXLS,EXP,I,L1,L2,SEX,DRGCAL,S,DIC,DR,DIE
    50         Q:DGPR
    51         ;F I=$Y:1:18 W !
    52         K X S $P(X,"-",81)="" W X
    53         ;
    54         G O:DGST&(('$D(DRG))!('DGDD)!('$D(^DGP(45.84,PTF))))
    55 X       G ACT^DGPTF41
    56 CLS     G NOT:('$D(DRG))!('DGDD)!('DGFC)
    57         ;I DRG=470!(DRG=469) W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
    58         ;
    59         ;change made to allow release of 470, before grouper released to vamc's
    60         ;  patch 115
    61         ;DGDAT = effective date of DRG used in DGPTICD (468=CMS-DRG,998=MS-DRG)
    62         I DRG=469,(+$G(DGDAT)<3071001)  W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
    63         I DRG=998 W !!,*7,"Unable to release DRG ",DRG,".  Please verify data entered.",*7 D HANG^DGPTUTL G EN1
    64         I $D(DGCST),'DGCST D CEN G EN1:'DGCST
    65         I '$P(^DGPT(PTF,0),"^",4) W !,"Updating TRANSFER DRGs..." S DGADM=$P(^DGPT(PTF,0),U,2) D SUDO1^DGPTSUDO
    66         I DGDD>(DT+1) W !,"Cannot close with Discharge date in future." D HANG^DGPTUTL G EN1
    67         I $D(^DGM("PT",DFN)) F I=0:0 S I=$O(^DGM("PT",DFN,I)) Q:'I  I '$D(^DGM(I,0)) K ^DGM(I),^DGM("PT",DFN,I)
    68         I $D(^DGM("PT",DFN)) W !!,"Not all messages have been cleared up for this patient--cannot close.",*7,*7 S DGPTF=DFN,X="??" K DGALL D HELP^DGPTMSGD K DGPTF G EN1:'$D(DGALL) K DGALL
    69         G CLS^DGPTF2
    70         ;
    71 O       I '$D(^DGP(45.84,PTF,0)) S DR="6///0",DIE="^DGPT(",DA=PTF,(DGST,DGN)=0 D ^DIE W !,"  NOT CLOSED " D HANG^DGPTUTL G EN1
    72         S (DGST,DGN)=0
    73         S DGPTIFN=PTF,DGRTY=1 D OPEN^DGPTFDEL S DGST=0
    74         K DGPTIFN,DGRTY G EN1
    75         ;
    76 Q       G Q^DGPTF
    77         ;
    78 NOT     I 'DGFC S DR="3//^S X=$P($$SITE^VASITE,U,2);5",DIE="^DGPT(",DA=PTF D ^DIE S DGFC=$P(^DGPT(PTF,0),U,3) I DGFC G EN1
    79         W !!,"Unable to close without a ",$S('$D(DRG):"DRG being calculated.",'DGDD:" discharge date.",1:" facility specified"),!!,*7,*7 H 4 G EN1
    80         Q
    81         ;
    82 Z       D Z^DGPTF5 Q
    83 Z1      D Z1^DGPTF5 Q
    84 CEN     D CEN^DGPTF5 Q
    85 DSP     S J=$$ICDDX^ICDCODE(+$P(K,U,I),DGPTDAT) I J&$P(J,U,10) D
    86         .I I#2 W ?40,$P(J,U,4)_"("_$P(J,U,2)_")" Q
    87         .W !,$P(J,U,4)_"("_$P(J,U,2)_")"
    88         Q
     1DGPTF4 ;ALB/JDS - PTF ENTRY/EDIT-4 ; 2/19/04 9:33am
     2 ;;5.3;Registration;**114,115,397,510,517,478,683**;Aug 13, 1993
     3 ;
     4WR ;
     5 W @IOF,HEAD,?72 S Z="<701>" D Z^DGPTFM K X S $P(X,"-",81)="" W !,X
     6 Q
     7EN S Y=+B(70) D D^DGPTUTL W ! S Z=5 D Z W $S($P(B(0),U,11)=1:"Date of Disch: ",1:"Census Date  : ") S Z=Y,Z1=20 D Z1 W "Disch Specialty: ",$S($D(^DIC(42.4,+$P(B(70),U,2),0)):$E($P(^(0),U,1),1,25),1:"")
     8 W !,"   Type of Disch: " S L=";"_$P(^DD(45,72,0),U,3),L1=";"_$P(B(70),U,3)_":" W $P($P(L,L1,2),";",1),?41 S L=";"_$P(^DD(45,72.1,0),U,3),L1=";"_$P(B(70),U,14)_":" W "Disch Status: ",$P($P(L,L1,2),";",1)
     9 W !,"   Place of Disp: ",$S($D(^DIC(45.6,+$P(B(70),U,6),0)):$E($P(^(0),U,1),1,21),1:"")
     10 W ?40 S Z=6 D Z W " Out Treat: ",$P("YES^^NO",U,+$P(B(70),U,4))
     11 W !?6,"Means Test: " S L=";"_$P(^DD(45,10,0),U,3),L1=";"_$P(B(0),U,10)_":" W $P($P(L,L1,2),";",1)
     12 W ?42,"VA Auspices: ",$S($P(B(70),U,5)=1:"YES",$P(B(70),U,5)=2:"NO",1:"")
     13 W ! S Z=7 D Z W " Receiv facil: " S Z=$P(B(70),U,12)_$P(B(70),U,13),Z1=18 D Z1 W ?38 S Z="Other Fields" D Z
     14 S DGINC=$P(B(101),U,7)
     15 I DGINC>1000 S DGINC=$E(DGINC,1,$L(DGINC)-3)_","_$E(DGINC,$L(DGINC)-2,$L(DGINC))
     16 W !,"      C&P Status: " S L=";"_$P(^DD(45,78,0),U,3),L1=";"_$P(B(70),U,9)_":" W $E($P($P(L,L1,2),";",1),1,24),?47,"Income: $",DGINC
     17 K DGINC
     18AS ;
     19 N DGRSC
     20 S DGRSC=$S($P(A(.3),U)="Y":$$RTEN^DGPTR4($P(A(.3),U,2)),1:"")
     21 W !,"       ASIH Days: ",$P(B(70),U,8)
     22 W ?40,"SC Percentage: ",$S($P(A(.3),U)="Y":$P(A(.3),U,2)_"%",1:"")
     23 I DGRSC]"",DGRSC'=$P(A(.3),U,2) W ?60,"Transmitted: ["_DGRSC_"%]"
     24 ;W !,?39,"Period Of Serv: ",$S($D(^DIC(21,$S('$D(^DGPM(+$O(^DGPM("APTF",PTF,0)),"ODS")):+$P(A(.32),U,3),+^("ODS"):+$O(^DIC(21,"D",6,0)),1:+$P(A(.32),U,3)),0)):$E($P(^(0),U),1,26),1:""),!
     25 W !,?39,"Period Of Serv: "
     26 W $S($D(^DIC(21,$S('$D(^DGPM(+$O(^DGPM("APTF",PTF,0)),"ODS")):+$$CKPOS^DGPTUTL($P(B(101),U,8),+$P(A(.32),U,3)),+^("ODS"):+$O(^DIC(21,"D",6,0)),1:$$CKPOS^DGPTUTL($P(B(101),U,8),+$P(A(.32),U,3))),0)):$E($P(^(0),U),1,26),1:""),!
     27 Q
     28 ;
     29EN1 ;LOAD AND DISPLAY DIAGNOSES FOR PTF 701 SCREEN
     30 K DRG S B(70)=$S($D(^DGPT(PTF,70)):^(70),1:""),B(71)=$S($D(^DGPT(PTF,71)):^(71),1:"") D WR
     31 S DGPTDAT=$$GETDATE^ICDGTDRG(PTF) ;Get correct effective date
     32 S DGPTTMP=$$ICDDX^ICDCODE(+$P(B(70),U,10),DGPTDAT)
     33 W ! S Z=1 D Z W "  Principal Diagnosis: ",$S(DGPTTMP&$P(DGPTTMP,U,10):$P(DGPTTMP,U,4)_"("_$P(DGPTTMP,U,2)_")",1:"")
     34 S DGPTTMP=$$ICDDX^ICDCODE(+$P(B(70),U,11),DGPTDAT)
     35 W:$P(B(70),U,11)&('$P(B(70),U,10)) !,"  Principal Diag: ",$S(DGPTTMP&$P(DGPTTMP,U,10):$P(DGPTTMP,U,4)_" ("_$P(DGPTTMP,U,2)_")",1:"")
     36 S K=B(70) F I=16:1:24 D DSP
     37 S K=B(71) F I=1:1:4 D DSP
     38 S DGPTF=PTF D:'DGST CHK701^DGPTSCAN,UP701^DGPTSPQ
     39 ; display contents of 300th node
     40 S DG300=$S($D(^DGPT(PTF,300)):^(300),1:"") D:DG300]"" PRN2^DGPTFM8 K DG300
     41EN2 K DRG
     42 I $D(^DGPT(PTF,0)),$P(^(0),U,11)=1 D
     43 .S DA=DFN
     44 .D EN1^DGPTFD
     45 .I $D(DRG),$D(^DGP(45.84,PTF,0)),$P(^(0),U,6)'=DRG D
     46 ..N DGFDA,DGMSG
     47 ..S DGFDA(45.84,PTF_",",6)=DRG
     48 ..D FILE^DIE("","DGFDA","DGMSG")
     49JUMP K AGE,B,CC,DA,DAM,DOB,DXLS,EXP,I,L1,L2,SEX,DRGCAL,S,DIC,DR,DIE
     50 Q:DGPR
     51 ;F I=$Y:1:18 W !
     52 K X S $P(X,"-",81)="" W X
     53 ;
     54 G O:DGST&(('$D(DRG))!('DGDD)!('$D(^DGP(45.84,PTF))))
     55X G ACT^DGPTF41
     56CLS G NOT:('$D(DRG))!('DGDD)!('DGFC)
     57 ;I DRG=470!(DRG=469) W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
     58 ;
     59 ;change made to allow release of 470, before grouper released to vamc's
     60 ;  patch 115
     61 I DRG=469 W !!,*7,"Unable to release DRG ",DRG,". Please verify data entered.",*7 D HANG^DGPTUTL G EN1
     62 I $D(DGCST),'DGCST D CEN G EN1:'DGCST
     63 I '$P(^DGPT(PTF,0),"^",4) W !,"Updating TRANSFER DRGs..." S DGADM=$P(^DGPT(PTF,0),U,2) D SUDO1^DGPTSUDO
     64 I DGDD>(DT+1) W !,"Cannot close with Discharge date in future." D HANG^DGPTUTL G EN1
     65 I $D(^DGM("PT",DFN)) F I=0:0 S I=$O(^DGM("PT",DFN,I)) Q:'I  I '$D(^DGM(I,0)) K ^DGM(I),^DGM("PT",DFN,I)
     66 I $D(^DGM("PT",DFN)) W !!,"Not all messages have been cleared up for this patient--cannot close.",*7,*7 S DGPTF=DFN,X="??" K DGALL D HELP^DGPTMSGD K DGPTF G EN1:'$D(DGALL) K DGALL
     67 G CLS^DGPTF2
     68 ;
     69O I '$D(^DGP(45.84,PTF,0)) S DR="6///0",DIE="^DGPT(",DA=PTF,(DGST,DGN)=0 D ^DIE W !,"  NOT CLOSED " D HANG^DGPTUTL G EN1
     70 S (DGST,DGN)=0
     71 S DGPTIFN=PTF,DGRTY=1 D OPEN^DGPTFDEL S DGST=0
     72 K DGPTIFN,DGRTY G EN1
     73 ;
     74Q G Q^DGPTF
     75 ;
     76NOT I 'DGFC S DR="3//^S X=$P($$SITE^VASITE,U,2);5",DIE="^DGPT(",DA=PTF D ^DIE S DGFC=$P(^DGPT(PTF,0),U,3) I DGFC G EN1
     77 W !!,"Unable to close without a ",$S('$D(DRG):"DRG being calculated.",'DGDD:" discharge date.",1:" facility specified"),!!,*7,*7 H 4 G EN1
     78 Q
     79 ;
     80Z D Z^DGPTF5 Q
     81Z1 D Z1^DGPTF5 Q
     82CEN D CEN^DGPTF5 Q
     83DSP S J=$$ICDDX^ICDCODE(+$P(K,U,I),DGPTDAT) I J&$P(J,U,10) D
     84 .I I#2 W ?40,$P(J,U,4)_"("_$P(J,U,2)_")" Q
     85 .W !,$P(J,U,4)_"("_$P(J,U,2)_")"
     86 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTFDEL.m

    r613 r623  
    1 DGPTFDEL        ;ALB/JDS - PTF ENTRY DELETION ; 7/31/07 11:19am
    2         ;;5.3;Registration;**517,760**;Aug 13, 1993;Build 11
    3         ;
    4 A       D LO^DGUTL I $D(^DISV(DUZ,"^DPT(")),$D(^("^DGPT(")) S A=+^("^DGPT("),B=+^("^DPT(") I $D(^DGPT(A,0)),$D(^DPT(B,0)) S:(+^DGPT(A,0)'=B&$D(^DGPT("B",B))) ^DISV(DUZ,"^DGPT(")=""
    5         Q
    6         ;
    7 ASK     D A W !!
    8         S Y=1 D RTY^DGPTUTL
    9         S DIC("S")="I $P(^(0),U,11)=1,'$D(^DGP(45.84,+Y))",DIC="^DGPT(",DIC(0)="NEAQ",DIC("A")="Enter PTF record to delete: "
    10         D ^DIC G Q:Y'>0 S DA=+Y,DIC(0)="NE",X=DA D CEN G ASK:'$D(DA)
    11 A1      W !! D ^DIC S %=2 W !,"Ok to delete" D YN^DICN
    12         I %=1 S DGPTIFN=DA D KDGPT W !,"****** DELETED ******" D HANG^DGPTUTL G Q
    13 AD      I '% W !,"Anwer Yes or No",!,"On deletion pointers will be updated" G A1
    14         ;
    15         ;
    16 Q       K DA,DFN,A,B,L,I,ANS,DIE,DR,DIK,DIC,DGRTY,DGRTY0,DGPTIFN Q
    17         ;
    18 HEL     ;
    19         I '$D(DGRTY) S Y=1 D RTY^DGPTUTL
    20         D A W !!
    21         S DIC(0)="NEAQ",DIC="^DGP(45.84,",DIC("S")="I '$D(^DGP(45.83,""C"",+Y)),$D(^DGPT(+Y,0)),$P(^(0),U,11)="_DGRTY,DIC("A")="Enter "_$P(DGRTY0,U)_" record to re-open: "
    22         D ^DIC G Q:Y'>0 S (X,DGPTIFN)=+Y,%=2
    23 A2      I '% W !!,DGPTIFN,"  ",$P(^DPT(+^DGPT(DGPTIFN,0),0),U) S DGSENFLG="",X=DGPTIFN,DIC(0)="NE",DIC="^DGP(45.84," D ^DIC K DIC,DGSENFLG
    24         I DGRTY=2 D CHK G Q:'DGPTIFN
    25         S %=2 W !,"Ok to reactivate" D YN^DICN
    26         I '% W !,"Answer Yes or No" G A2
    27         G Q:%'=1
    28         D OPEN G Q
    29         ;
    30 OLD     I '$D(^DISV(DUZ,"PTFAD",DFN)) W "  ???",*7,*7 G AD
    31         S X=^(DFN)
    32         Q
    33 DREL    ; -- open released rec
    34         I '$D(DGRTY) S Y=1 D RTY^DGPTUTL
    35         W ! S DIC("A")="Enter Released "_$P(DGRTY0,U)_" Record to Re-open: ",DIC("S")="I $D(^DGP(45.83,""C"",+Y)),$D(^DGPT(+Y,0)),$D(^(70)),+^(70)>2901000,$P(^(0),U,11)="_DGRTY,DIC="^DGP(45.84,",DIC(0)="MEQA"
    36         D ^DIC K DIC G Q:+Y'>0 S DGPTIFN=+Y
    37         I DGRTY=2 D CHK G Q:'DGPTIFN
    38 OK      W !,"Ok to Re-open" S %=2 D YN^DICN
    39         I '% W !!?14,"Enter <RET> to exit routine",!?10,"Enter 'Y' for YES to RE-OPEN Record",! G OK
    40         G Q:%'=1
    41         S DA(1)=$O(^DGP(45.83,"C",DGPTIFN,0)) I DA(1) S DIK="^DGP(45.83,"_DA(1)_",""P"",",DA=DGPTIFN D ^DIK K DIK,DA
    42         D OPEN G Q
    43         ;
    44 OPEN    ;
    45         D KDGP,KDGPT:DGRTY=2
    46         W !,"****** RECORD RE-OPENED ******" D HANG^DGPTUTL
    47         Q
    48         ;
    49 KDGP    ; -- kill close-out rec ; input DGPTIFN := ifn
    50         S DA=DGPTIFN,DIK="^DGP(45.84," D ^DIK K DIK,DA
    51         Q
    52         ;
    53 KDGPT   ; -- kill DGPT rec ; input DGPTIFN := ifn
    54         S DA=DGPTIFN,DIK="^DGPT(",FLAG=1,I=0 F  S I=$O(^DGCPT(46,"C",DA,I)) Q:'I  I '$G(^DGCPT(46,I,9)) S FLAG=0 Q
    55         I 'FLAG W !,"CANNOT DELETE THE PTF RECORD WHEN THERE ARE ACTIVE ORDERS OR CPT RECORDS." H 2 K FLAG Q
    56         D ^DIK K DA,DIK,I,FLAG
    57         I DGRTY=1 S DA=+$O(^DGPM("APTF",DGPTIFN,0)) I $D(^DGPM(DA,0)),$P(^(0),U,16)=DGPTIFN S DR=".16///@",DIE="^DGPM(" D ^DIE K DR,DIE
    58         K DA Q
    59         ;
    60 CHK     ; -- check to see if PTF is open ; return DGPTIFN="" is not open
    61         I $D(^DGPT(+$P(^DGPT(DGPTIFN,0),U,12),0)),$P(^(0),U,6) W !!,*7,?5,"Associated PTF record #",+$P(^DGPT(DGPTIFN,0),U,12)," must be RE-OPENED",!?5,"in order to re-open Census record #",DGPTIFN,"." S DGPTIFN=""
    62         Q
    63         ;
    64 CEN     ; -- check if closed for census
    65         K DGI
    66         F DGI=0:0 S DGI=$O(^DGPT("ACENSUS",DA,DGI)) Q:'DGI  I $D(^DGPT(DGI,0)),$P(^(0),U,12)=DA,$D(^DG(45.86,+$P(^(0),U,13),0)) S Y=+^(0) X ^DD("DD") S DGI(DGI)=Y
    67         G CENQ:$D(DGI)<10
    68         W !!?2,*7,"This PTF record is associated with the following Census records:"
    69         F DGI=0:0 S DGI=$O(DGI(DGI)) Q:'DGI  W !?10,"Census Record #",DGI,?35,"==>",?40,"Census Date: ",DGI(DGI)
    70         W !!?2,"PTF record can not be deleted."
    71         K DA
    72 CENQ    K DGI Q
     1DGPTFDEL ;ALB/JDS - PTF ENTRY DELETION ; 1/15/04 8:23am
     2 ;;5.3;Registration;**517**;Aug 13, 1993
     3 ;
     4A D LO^DGUTL I $D(^DISV(DUZ,"^DPT(")),$D(^("^DGPT(")) S A=+^("^DGPT("),B=+^("^DPT(") I $D(^DGPT(A,0)),$D(^DPT(B,0)) S:(+^DGPT(A,0)'=B&$D(^DGPT("B",B))) ^DISV(DUZ,"^DGPT(")=""
     5 Q
     6 ;
     7ASK D A W !!
     8 S Y=1 D RTY^DGPTUTL
     9 S DIC("S")="I $P(^(0),U,11)=1,'$D(^DGP(45.84,+Y))",DIC="^DGPT(",DIC(0)="NEAQ",DIC("A")="Enter PTF record to delete: "
     10 D ^DIC G Q:Y'>0 S DA=+Y,DIC(0)="NE",X=DA D CEN G ASK:'$D(DA)
     11A1 W !! D ^DIC S %=2 W !,"Ok to delete" D YN^DICN
     12 I %=1 S DGPTIFN=DA D KDGPT W !,"****** DELETED ******" D HANG^DGPTUTL G Q
     13AD I '% W !,"Anwer Yes or No",!,"On deletion pointers will be updated" G A1
     14 ;
     15 ;
     16Q K DA,DFN,A,B,L,I,ANS,DIE,DR,DIK,DIC,DGRTY,DGRTY0,DGPTIFN Q
     17 ;
     18HEL ;
     19 I '$D(DGRTY) S Y=1 D RTY^DGPTUTL
     20 D A W !!
     21 S DIC(0)="NEAQ",DIC="^DGP(45.84,",DIC("S")="I '$D(^DGP(45.83,""C"",+Y)),$D(^DGPT(+Y,0)),$P(^(0),U,11)="_DGRTY,DIC("A")="Enter "_$P(DGRTY0,U)_" record to re-open: "
     22 D ^DIC G Q:Y'>0 S (X,DGPTIFN)=+Y,%=2
     23A2 I '% W !!,DGPTIFN,"  ",$P(^DPT(+^DGPT(DGPTIFN,0),0),U) S DGSENFLG="",X=DGPTIFN,DIC(0)="NE",DIC="^DGP(45.84," D ^DIC K DIC,DGSENFLG
     24 I DGRTY=2 D CHK G Q:'DGPTIFN
     25 S %=2 W !,"Ok to reactivate" D YN^DICN
     26 I '% W !,"Answer Yes or No" G A2
     27 G Q:%'=1
     28 D OPEN G Q
     29 ;
     30OLD I '$D(^DISV(DUZ,"PTFAD",DFN)) W "  ???",*7,*7 G AD
     31 S X=^(DFN)
     32 Q
     33DREL ; -- open released rec
     34 I '$D(DGRTY) S Y=1 D RTY^DGPTUTL
     35 W ! S DIC("A")="Enter Released "_$P(DGRTY0,U)_" Record to Re-open: ",DIC("S")="I $D(^DGP(45.83,""C"",+Y)),$D(^DGPT(+Y,0)),$D(^(70)),+^(70)>2901000,$P(^(0),U,11)="_DGRTY,DIC="^DGP(45.84,",DIC(0)="MEQA"
     36 D ^DIC K DIC G Q:+Y'>0 S DGPTIFN=+Y
     37 I DGRTY=2 D CHK G Q:'DGPTIFN
     38OK W !,"Ok to Re-open" S %=2 D YN^DICN
     39 I '% W !!?14,"Enter <RET> to exit routine",!?10,"Enter 'Y' for YES to RE-OPEN Record",! G OK
     40 G Q:%'=1
     41 S DA(1)=$O(^DGP(45.83,"C",DGPTIFN,0)) I DA(1) S DIK="^DGP(45.83,"_DA(1)_",""P"",",DA=DGPTIFN D ^DIK K DIK,DA
     42 D OPEN G Q
     43 ;
     44OPEN ;
     45 D KDGP,KDGPT:DGRTY=2
     46 W !,"****** RECORD RE-OPENED ******" D HANG^DGPTUTL
     47 Q
     48 ;
     49KDGP ; -- kill close-out rec ; input DGPTIFN := ifn
     50 S DA=DGPTIFN,DIK="^DGP(45.84," D ^DIK K DIK,DA
     51 Q
     52 ;
     53KDGPT ; -- kill DGPT rec ; input DGPTIFN := ifn
     54 S DA=DGPTIFN,DIK="^DGPT(",FLAG=1,I=0 F  S I=$O(^DGCPT(46,"C",DA,I)) Q:'I  I '$G(^DGCPT(I,9)) S FLAG=0 Q
     55 I FLAG S I=0 F  S I=$O(^DGICD9(46.1,"C",DA,I)) Q:'I  I '$G(^DGICD9(I,9)) S FLAG=0 Q
     56 I 'FLAG W !,"CANNOT DELETE THE PTF RECORD WHEN THERE ARE ACTIVE ORDERS OR CPT RECORDS." H 2 K FLAG Q
     57 D ^DIK K DA,DIK,I,FLAG
     58 I DGRTY=1 S DA=+$O(^DGPM("APTF",DGPTIFN,0)) I $D(^DGPM(DA,0)),$P(^(0),U,16)=DGPTIFN S DR=".16///@",DIE="^DGPM(" D ^DIE K DR,DIE
     59 K DA Q
     60 ;
     61CHK ; -- check to see if PTF is open ; return DGPTIFN="" is not open
     62 I $D(^DGPT(+$P(^DGPT(DGPTIFN,0),U,12),0)),$P(^(0),U,6) W !!,*7,?5,"Associated PTF record #",+$P(^DGPT(DGPTIFN,0),U,12)," must be RE-OPENED",!?5,"in order to re-open Census record #",DGPTIFN,"." S DGPTIFN=""
     63 Q
     64 ;
     65CEN ; -- check if closed for census
     66 K DGI
     67 F DGI=0:0 S DGI=$O(^DGPT("ACENSUS",DA,DGI)) Q:'DGI  I $D(^DGPT(DGI,0)),$P(^(0),U,12)=DA,$D(^DG(45.86,+$P(^(0),U,13),0)) S Y=+^(0) X ^DD("DD") S DGI(DGI)=Y
     68 G CENQ:$D(DGI)<10
     69 W !!?2,*7,"This PTF record is associated with the following Census records:"
     70 F DGI=0:0 S DGI=$O(DGI(DGI)) Q:'DGI  W !?10,"Census Record #",DGI,?35,"==>",?40,"Census Date: ",DGI(DGI)
     71 W !!?2,"PTF record can not be deleted."
     72 K DA
     73CENQ K DGI Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTFM4.m

    r613 r623  
    1 DGPTFM4 ;ALB/MTC/ADL - PTF ENTRY/EDIT-2 ; 12/18/07 11:37am
    2         ;;5.3;Registration;**114,195,397,510,565,775**;Aug 13, 1993;Build 3
    3         ;;ADL;Update for CSV Project;;Mar 26, 2003
    4         ;
    5         S DGZM0=DGZM0+1
    6 EN      N M3 D MOB:'$D(M) S M(DGZM0)=$S($D(M(DGZM0)):M(DGZM0),1:"") G NEXM:M(DGZM0)="" S (M3,M(DGZM0),M1)=$S($D(^DGPT(PTF,"M",+M(DGZM0),0)):^DGPT(PTF,"M",+M(DGZM0),0),1:"")
    7         I $D(^DGPT(PTF,"M",+M(DGZM0),"P")) S $P(M(DGZM0),U,20)=^("P"),$P(M1,U,20)=^("P")
    8 WR      S DG300=$S($D(^DGPT(PTF,"M",+M(DGZM0),300)):^(300),1:"")
    9         W @IOF,HEAD,?70 S Z="<501-"_DGZM0_">" D Z^DGPTFM I +M(DGZM0)=1 W !,?62,"Discharge Movement"
    10 M       S L=+$P(M1,U,10),Y=L D D^DGPTUTL W !! S Z=1 D Z W "Date of Move: " S Z=Y,Z1=20 D Z1 W "Losing Specialty: ",$E($S($D(^DIC(42.4,+$P(M1,U,2),0)):$P(^(0),U,1),1:""),1,25)
    11         W !,"     Leave days: ",$P(M1,U,3),?44,"Pass days: ",$P(M1,U,4)
    12         W !,"Treated for SC Condition: ",$S($P(M3,U,18)=1:"Yes",1:"No")
    13         N NL S NL=0
    14         I $P(M3,U,31)'="" W @($S(NL#2:"!",1:"?37")),"Potentially Related to Combat: ",$S($P(M3,U,31)="Y":"Yes",1:"No") S NL=NL+1
    15         I $P(M3,U,26)'="" W @($S(NL#2:"!",1:"?37")),"Treated for AO Condition: ",$S($P(M3,U,26)="Y":"Yes",1:"No") S NL=NL+1
    16         I $P(M3,U,27)'="" W @($S(NL#2:"!",1:"?37")),"Treated for IR Condition: ",$S($P(M3,U,27)="Y":"Yes",1:"No") S NL=NL+1
    17         I $P(M3,U,28)'="" W @($S(NL#2:"!",1:"?37")),"Treated for EC Condition: ",$S($P(M3,U,28)="Y":"Yes",1:"No") S NL=NL+1
    18         ; added 6/17/98 for MST enhancement
    19         I $P(M3,U,29)'="" W @($S(NL#2:"!",1:"?37")),"Treated for MST Condition: ",$S($P(M3,U,29)="Y":"Yes",1:"No") S NL=NL+1
    20         K DGNTARR
    21         S DGNTARR=$$GETCUR^DGNTAPI(DFN,"DGNTARR")
    22         I $P(M3,U,30)="",(",3,4,5,"[(","_$P($G(DGNTARR("STAT")),U)_",")) S $P(M3,U,30)="N"
    23         I $P(M3,U,30)'="" W @($S(NL#2:"!",1:"?37")),"Treated for HEAD/NECK CA Condition: ",$S($P(M3,U,30)="Y":"Yes",1:"No")
    24         K NL
    25         W !! S Z=2 D Z W "          DX: " F I=1:1:11 S L=$P(M1,U,I+4) I L'=""&(I'=6) S DGPTTMP=$$ICDDX^ICDCODE(+L,$$GETDATE^ICDGTDRG(PTF)) D
    26         . W $S(+DGPTTMP>0&($P(DGPTTMP,U,10)):$P(DGPTTMP,U,4)_" ("_$P(DGPTTMP,U,2)_")",1:"**********-"_L),!?17
    27         D PRN2^DGPTFM8:DG300]""
    28         I $P(M1,U,20) S DRG=$P(M1,U,20) W:DRG=998!(DRG=999)!((DRG=468!(DRG=469)!(DRG=470))&(+$P($G(M1),U,10)<3071001)) *7 W !!?14,"TRANSFER DRG: ",DRG D
    29         . N DXD,DGDX
    30         . S DXD=$$DRGD^ICDGTDRG(DRG,"DGDX",,$P(M1,U,10)),DGDS=0
    31         . F  S DGDS=$O(DGDX(DGDS)) Q:'+DGDS  Q:DGDX(DGDS)=" "  W !,DGDX(DGDS)
    32 JUMP    K DG300 F I=$Y:1:21 W !
    33 X       S DGNUM=$S($D(M(DGZM0+1)):501_"-"_(DGZM0+1),1:"MAS") G 501^DGPTFJC:DGST
    34         W "Enter <RET> to continue, 1-2 to edit,",!,"'M' ",$S(DGPTFE:" to add a patient movement",1:"to edit Treat. Specialty"),", '^N' for screen N, or '^' to abort:<",DGNUM,">// " R X:DTIME
    35         K DGNUM G Q:X="^",NEXM:X="",^DGPTFJ:X?1"^".E,M^DGPTFM1:X="M"!(X="m")
    36 X1      I X[1!(X[2) S DR="[DG501"_$E("F",DGPTFE) X:(+M(DGZM0)=1) "S J=^DGPT(PTF,""M"",1,0) F I=11:1:15 I $P(J,U,I) S DR=DR_1" S DR=DR_"]",DGJUMP=X,DIE="^DGPT(",(DA,DGPTF)=PTF,DGMOV=+M(DGZM0) D ^DIE K M,DR,DIE D CHK501^DGPTSCAN K DGPTF,DGMOV
    37         ; Determine if NTR HISTORY (#28.11) filer is called if question for
    38         ;  'Treated for Head/Neck CA Condition:' is answered YES.
    39         ; Only a NTR screening status of 3=PENDING DIAGNOSIS gets Filed.
    40         I $P($G(M3),U,30)="Y",$P($G(DGNTARR("STAT")),U)=3 D
    41         .S DGNTARR=$$FILEHNC^DGNTAPI1(DFN)
    42         K DGNTARR
    43         ;- update MT indicator after edit movement
    44         N DGPMCA,DGPMAN D PM^DGPTUTL
    45         I '$G(DGADM) S DGADM=+^DGPT(PTF,0)
    46         D MT^DGPTUTL
    47         G EN
    48 PR      W !,"Enter '^' to stop the display and edit of data",!,"'^N' to jump to screen #N (appears in upper right of screen '<N>'",!,"<RET> to continue on to the next screen or 1-2 to edit:"
    49         W !?10,"1-",$S(DGPTFE:"Date of movement, Losing Specialty, ",1:""),"Leave and Pass days",!?10,"2-ICD DIAGNOSIS CODES"
    50         W !,"You may also enter 1-2",!
    51         R !!,"Enter <RET>: ",X:DTIME G WR
    52         Q
    53 NEXM    S DGZM0=DGZM0+1 G ^DGPTFM:'$D(M(DGZM0)),EN
    54 ADD     S DGZM0=$S($D(DGZM0):DGZM0+1,1:0) S L=$S($D(^DGPT(PTF,"M",0)):^(0),1:"^45.02DA^^"),L1=$P(L,U,3) F I=1:1 Q:'$D(^DGPT(PTF,"M",L1+I))
    55         S DA(1)=PTF,DIC="^DGPT("_DA(1)_",""M"",",X=L1+I,DIC(0)="LMZQE" D ^DIC K DIC,DIE G ^DGPTFM:Y'>0
    56         S M(DGZM0)=L1+I S X="1-2" G X1
    57         Q
    58 MOB     S I=0 K M,M1,M2 S M2=0 F I1=1:1 S I=$O(^DGPT(PTF,"M",I)) Q:'I  S M(I1)=^(I,0)
    59         S PM=I1-1 D ORDER^DGPTF Q
    60 Q       G Q^DGPTF
    61 Z       I 'DGN S Z=$S(IOST="C-QUME"&($L(DGVI)'=2):Z,1:"["_Z_"]") W @DGVI,Z,@DGVO
    62         E  W "   "
    63         Q
    64 Z1      F I=1:1:(Z1-$L(Z)) S Z=Z_" "
    65         W Z
    66         Q
    67 R       ;DELETE PROCEDURE RECORD
    68         I '$D(^DGPT(PTF,"P")) G NOPROC
    69         I $O(^DGPT(PTF,"P",0))']"" G NOPROC
    70         S DGPNUM="" F DGPROC=0:0 S DGPROC=$O(P(DGPROC)) Q:'DGPROC  S:$D(P(DGPROC,1)) DGPNUM=DGPNUM_","_DGPROC
    71         S DGPNUM=DGPNUM_","
    72 ASKPRO  W !!,"Delete procedure record <",$P(DGPNUM,",",2,99),"> : " R DGPROC:DTIME I DGPROC[U!(DGPROC="") K DGPNUM,DGPROC G ^DGPTFM
    73         I DGPNUM'[(","_DGPROC_",") W !!,"Enter the record # to delete from the PTF file <",$P(DGPNUM,",",2,99),">",! G ASKPRO
    74         K DA N DGJ
    75         F DGJ=1:1 S DA=+$P(DGPROC,",",DGJ) Q:'DA  S DA=$S($D(P(DA,1)):+P(DA,1),1:0) I DA S DA(1)=PTF,DIK="^DGPT("_PTF_",""P""," D ^DIK K DA W "   ",$P(DGPROC,",",DGJ),"-DELETED***" H:'$P(DGPROC,",",DGJ+1) 2
    76         K DIK,DA,DGPROC,DGPNUM G ^DGPTFM
    77 NOPROC  W !!,*7,"No procedures to delete",! H 3 G ^DGPTFM
     1DGPTFM4 ;ALB/MTC/ADL - PTF ENTRY/EDIT-2 ; 11/19/03 11:37am
     2 ;;5.3;Registration;**114,195,397,510,565**;Aug 13, 1993
     3 ;;ADL;Update for CSV Project;;Mar 26, 2003
     4 ;
     5 S DGZM0=DGZM0+1
     6EN N M3 D MOB:'$D(M) S M(DGZM0)=$S($D(M(DGZM0)):M(DGZM0),1:"") G NEXM:M(DGZM0)="" S (M3,M(DGZM0),M1)=$S($D(^DGPT(PTF,"M",+M(DGZM0),0)):^DGPT(PTF,"M",+M(DGZM0),0),1:"")
     7 I $D(^DGPT(PTF,"M",+M(DGZM0),"P")) S $P(M(DGZM0),U,20)=^("P"),$P(M1,U,20)=^("P")
     8WR S DG300=$S($D(^DGPT(PTF,"M",+M(DGZM0),300)):^(300),1:"")
     9 W @IOF,HEAD,?70 S Z="<501-"_DGZM0_">" D Z^DGPTFM I +M(DGZM0)=1 W !,?62,"Discharge Movement"
     10M S L=+$P(M1,U,10),Y=L D D^DGPTUTL W !! S Z=1 D Z W "Date of Move: " S Z=Y,Z1=20 D Z1 W "Losing Specialty: ",$E($S($D(^DIC(42.4,+$P(M1,U,2),0)):$P(^(0),U,1),1:""),1,25)
     11 W !,"     Leave days: ",$P(M1,U,3),?44,"Pass days: ",$P(M1,U,4)
     12 W !,"Treated for SC Condition: ",$S($P(M3,U,18)=1:"Yes",1:"No")
     13 N NL S NL=0
     14 I $P(M3,U,31)'="" W @($S(NL#2:"!",1:"?37")),"Potentially Related to Combat: ",$S($P(M3,U,31)="Y":"Yes",1:"No") S NL=NL+1
     15 I $P(M3,U,26)'="" W @($S(NL#2:"!",1:"?37")),"Treated for AO Condition: ",$S($P(M3,U,26)="Y":"Yes",1:"No") S NL=NL+1
     16 I $P(M3,U,27)'="" W @($S(NL#2:"!",1:"?37")),"Treated for IR Condition: ",$S($P(M3,U,27)="Y":"Yes",1:"No") S NL=NL+1
     17 I $P(M3,U,28)'="" W @($S(NL#2:"!",1:"?37")),"Treated for EC Condition: ",$S($P(M3,U,28)="Y":"Yes",1:"No") S NL=NL+1
     18 ; added 6/17/98 for MST enhancement
     19 I $P(M3,U,29)'="" W @($S(NL#2:"!",1:"?37")),"Treated for MST Condition: ",$S($P(M3,U,29)="Y":"Yes",1:"No") S NL=NL+1
     20 K DGNTARR
     21 S DGNTARR=$$GETCUR^DGNTAPI(DFN,"DGNTARR")
     22 I $P(M3,U,30)="",(",3,4,5,"[(","_$P($G(DGNTARR("STAT")),U)_",")) S $P(M3,U,30)="N"
     23 I $P(M3,U,30)'="" W @($S(NL#2:"!",1:"?37")),"Treated for HEAD/NECK CA Condition: ",$S($P(M3,U,30)="Y":"Yes",1:"No")
     24 K NL
     25 W !! S Z=2 D Z W "          DX: " F I=1:1:11 S L=$P(M1,U,I+4) I L'=""&(I'=6) S DGPTTMP=$$ICDDX^ICDCODE(+L,$$GETDATE^ICDGTDRG(PTF)) D
     26 . W $S(+DGPTTMP>0&($P(DGPTTMP,U,10)):$P(DGPTTMP,U,4)_" ("_$P(DGPTTMP,U,2)_")",1:"**********-"_L),!?17
     27 D PRN2^DGPTFM8:DG300]""
     28 I $P(M1,U,20) S DRG=$P(M1,U,20) W:DRG=468!(DRG=469)!(DRG=470) *7 W !!?14,"TRANSFER DRG: ",DRG F DGDRGNM=0:0 S DGDRGNM=$O(^ICD(DRG,1,DGDRGNM)) Q:'DGDRGNM  W !,$P(^(DGDRGNM,0),U,1)
     29JUMP K DG300 F I=$Y:1:21 W !
     30X S DGNUM=$S($D(M(DGZM0+1)):501_"-"_(DGZM0+1),1:"MAS") G 501^DGPTFJC:DGST
     31 W "Enter <RET> to continue, 1-2 to edit,",!,"'M' ",$S(DGPTFE:" to add a patient movement",1:"to edit Treat. Specialty"),", '^N' for screen N, or '^' to abort:<",DGNUM,">// " R X:DTIME
     32 K DGNUM G Q:X="^",NEXM:X="",^DGPTFJ:X?1"^".E,M^DGPTFM1:X="M"!(X="m")
     33X1 I X[1!(X[2) S DR="[DG501"_$E("F",DGPTFE) X:(+M(DGZM0)=1) "S J=^DGPT(PTF,""M"",1,0) F I=11:1:15 I $P(J,U,I) S DR=DR_1" S DR=DR_"]",DGJUMP=X,DIE="^DGPT(",(DA,DGPTF)=PTF,DGMOV=+M(DGZM0) D ^DIE K M,DR,DIE D CHK501^DGPTSCAN K DGPTF,DGMOV
     34 ; Determine if NTR HISTORY (#28.11) filer is called if question for
     35 ;  'Treated for Head/Neck CA Condition:' is answered YES.
     36 ; Only a NTR screening status of 3=PENDING DIAGNOSIS gets Filed.
     37 I $P($G(M3),U,30)="Y",$P($G(DGNTARR("STAT")),U)=3 D
     38 .S DGNTARR=$$FILEHNC^DGNTAPI1(DFN)
     39 K DGNTARR
     40 ;- update MT indicator after edit movement
     41 N DGPMCA,DGPMAN D PM^DGPTUTL
     42 I '$G(DGADM) S DGADM=+^DGPT(PTF,0)
     43 D MT^DGPTUTL
     44 G EN
     45PR W !,"Enter '^' to stop the display and edit of data",!,"'^N' to jump to screen #N (appears in upper right of screen '<N>'",!,"<RET> to continue on to the next screen or 1-2 to edit:"
     46 W !?10,"1-",$S(DGPTFE:"Date of movement, Losing Specialty, ",1:""),"Leave and Pass days",!?10,"2-ICD DIAGNOSIS CODES"
     47 W !,"You may also enter 1-2",!
     48 R !!,"Enter <RET>: ",X:DTIME G WR
     49 Q
     50NEXM S DGZM0=DGZM0+1 G ^DGPTFM:'$D(M(DGZM0)),EN
     51ADD S DGZM0=$S($D(DGZM0):DGZM0+1,1:0) S L=$S($D(^DGPT(PTF,"M",0)):^(0),1:"^45.02DA^^"),L1=$P(L,U,3) F I=1:1 Q:'$D(^DGPT(PTF,"M",L1+I))
     52 S DA(1)=PTF,DIC="^DGPT("_DA(1)_",""M"",",X=L1+I,DIC(0)="LMZQE" D ^DIC K DIC,DIE G ^DGPTFM:Y'>0
     53 S M(DGZM0)=L1+I S X="1-2" G X1
     54 Q
     55MOB S I=0 K M,M1,M2 S M2=0 F I1=1:1 S I=$O(^DGPT(PTF,"M",I)) Q:'I  S M(I1)=^(I,0)
     56 S PM=I1-1 D ORDER^DGPTF Q
     57Q G Q^DGPTF
     58Z I 'DGN S Z=$S(IOST="C-QUME"&($L(DGVI)'=2):Z,1:"["_Z_"]") W @DGVI,Z,@DGVO
     59 E  W "   "
     60 Q
     61Z1 F I=1:1:(Z1-$L(Z)) S Z=Z_" "
     62 W Z
     63 Q
     64R ;DELETE PROCEDURE RECORD
     65 I '$D(^DGPT(PTF,"P")) G NOPROC
     66 I $O(^DGPT(PTF,"P",0))']"" G NOPROC
     67 S DGPNUM="" F DGPROC=0:0 S DGPROC=$O(P(DGPROC)) Q:'DGPROC  S:$D(P(DGPROC,1)) DGPNUM=DGPNUM_","_DGPROC
     68 S DGPNUM=DGPNUM_","
     69ASKPRO W !!,"Delete procedure record <",$P(DGPNUM,",",2,99),"> : " R DGPROC:DTIME I DGPROC[U!(DGPROC="") K DGPNUM,DGPROC G ^DGPTFM
     70 I DGPNUM'[(","_DGPROC_",") W !!,"Enter the record # to delete from the PTF file <",$P(DGPNUM,",",2,99),">",! G ASKPRO
     71 K DA N DGJ
     72 F DGJ=1:1 S DA=+$P(DGPROC,",",DGJ) Q:'DA  S DA=$S($D(P(DA,1)):+P(DA,1),1:0) I DA S DA(1)=PTF,DIK="^DGPT("_PTF_",""P""," D ^DIK K DA W "   ",$P(DGPROC,",",DGJ),"-DELETED***" H:'$P(DGPROC,",",DGJ+1) 2
     73 K DIK,DA,DGPROC,DGPNUM G ^DGPTFM
     74NOPROC W !!,*7,"No procedures to delete",! H 3 G ^DGPTFM
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTICD.m

    r613 r623  
    1 DGPTICD ;ALB/MTC - PTF DRG Grouper Utility ; 2/19/02 3:08pm
    2         ;;5.3;Registration;**375,441,510,559,599,606,775**;Aug 13, 1993;Build 3
    3         ;variables to pass in:
    4         ;  DGDX <- format: DX CODE1^DX CODE2^DX CODE3^...                      (REQUIRED)
    5         ;  DGSURG <- format: SURGERY CODE1^SURGERY CODE2^SURGERY CODE3^...       (OPTIONAL)
    6         ;  DGPROC <- format: PROCEDURE CODE1^PROCEDURE CODE2^PROCEDURE CODE3^... (OPTIONAL)
    7         ;  DGTRS  <- 1 if patient transferred to acute care facility             (REQUIRED)
    8         ;  DGEXP  <- 1 if patient died during this episode                       (REQUIRED)
    9         ;  DGDMS  <- 1 if patient was discharged with an Irregular discharge (discharged against medical advice) (REQUIRED)
    10         ;  AGE,SEX     (REQUIRED)
    11         ;values of variables listed above are left unchanged by this routine
    12         ;variable passed back: DRG(0) <- zero node of DRG in DRG file
    13         ;                    : DRG <- IFN of DRG in DRG file
    14         ;  DGDAT  <- Effective date to be used in calculating DRG
    15         ;
    16         ;-- check for required variables
    17         Q:'$D(DGDX)!'$D(DGTRS)!'$D(DGEXP)!'$D(DGDMS)
    18         N DGI
    19         ;-- build ICDDX array
    20         K ICDDX
    21         S DGI=0 F  S DGI=DGI+1 Q:$P(DGDX,U,DGI)=""  D
    22         . S DGPTTMP=$$ICDDX^ICDCODE(+$P(DGDX,U,DGI),+$G(DGDAT))
    23         . I +DGPTTMP>0,($P(DGPTTMP,U,10)) S ICDDX(DGI)=$P(DGDX,U,DGI)
    24         G Q:'$D(ICDDX)
    25         ;
    26         ;-- build ICDPRC array
    27         ;K ICDPRC
    28         ;I $D(DGPROC) S DGSURG=$S('$D(DGSURG):DGPROC,1:DGSURG_DGPROC)
    29         ;I $D(DGSURG) S DGI=0 F  S DGI=DGI+1 Q:$P(DGSURG,U,DGI)=""  D
    30         ;. I $D(^ICD0($P(DGSURG,U,DGI),0)) S ICDPRC(DGI)=$P(DGSURG,U,DGI)
    31         ;-- build ICDPRC array eliminating dupes as we go
    32         K ICDPRC
    33         N I,J,X,Y,FLG,SUB S SUB=0
    34         I $D(DGPROC) F I=2:1 S X=$P(DGPROC,U,I) Q:X=""  D
    35         . S DGPTTMP=$$ICDOP^ICDCODE(X,+$G(DGDAT))
    36         . I +DGPTTMP>0,($P(DGPTTMP,U,10)) S SUB=SUB+1,ICDPRC(SUB)=X
    37         I $D(DGSURG) F I=2:1 S X=$P(DGSURG,U,I) Q:X=""  D
    38         . S FLG=0,J=0 F  S J=$O(ICDPRC(J)) Q:'J  I X=$G(ICDPRC(J)) S FLG=1 Q
    39         . I FLG Q
    40         . S DGPTTMP=$$ICDOP^ICDCODE(X,+$G(DGDAT))
    41         . I +DGPTTMP>0,($P(DGPTTMP,U,10)) S SUB=SUB+1,ICDPRC(SUB)=X
    42         ;
    43         ;-- set other required variables
    44         S ICDTRS=DGTRS,ICDEXP=DGEXP,ICDDMS=DGDMS
    45         S ICDDATE=$S($D(DGDAT):DGDAT,1:DT),DGDAT=ICDDATE  ;Ensure that DGDAT is defined prior to executing PRT
    46         ;
    47         ;-- calculate DRG
    48         D ^ICDDRG S DRG=ICDDRG I '$D(DGDRGPRT) G Q
    49         ;
    50 PRT     ;print DRG and national HCFA values
    51         I (ICDDATE<3071001)&(DRG=468!(DRG=469)!(DRG=470)) W *7
    52         I DRG=998!(DRG=999) W *7
    53         S Y=ICDDATE D DD^%DT ; Y=external representation of effective date
    54         W !!?9,"Effective Date:","  ",Y
    55         S DRG(0)=$$DRG^ICDGTDRG(DRG,DGDAT) W !!,"Diagnosis Related Group: ",$J(DRG,6),?36,"Average Length of Stay(ALOS): ",$J($P(DRG(0),"^",8),6)
    56         W !?17,"Weight: ",$J($P(DRG(0),"^",2),6)  ;,?40,"Local Breakeven: ",$J($P(DRG(0),"^",12),6)
    57         W !?12," Low Day(s): ",$J($P(DRG(0),"^",3),6)  ;,?39,"Local Low Day(s): ",$J($P(DRG(0),"^",9),6)
    58         W !?13," High Days: ",$J($P(DRG(0),"^",4),6)  ;,?40,"Local High Days: ",$J($P(DRG(0),"^",10),6)
    59         N DXD,DGDX
    60         S DXD=$$DRGD^ICDGTDRG(DRG,"DGDX",,DGDAT),DGI=0
    61         W !!,"DRG: ",DRG,"-" F  S DGI=$O(DGDX(DGI)) Q:'+DGI  Q:DGDX(DGI)=" "  W ?10,DGDX(DGI),!
    62 Q       K ICDDMS,ICDDRG,ICDDX,ICDEXP,ICDMDC,ICDPRC,ICDRTC,ICDTRS,ICDDATE Q
     1DGPTICD ;ALB/MTC - PTF DRG Grouper Utility ; 2/19/02 3:08pm
     2 ;;5.3;Registration;**375,441,510,559,599,606**;Aug 13, 1993
     3 ;variables to pass in:
     4 ;  DGDX <- format: DX CODE1^DX CODE2^DX CODE3^...                      (REQUIRED)
     5 ;  DGSURG <- format: SURGERY CODE1^SURGERY CODE2^SURGERY CODE3^...       (OPTIONAL)
     6 ;  DGPROC <- format: PROCEDURE CODE1^PROCEDURE CODE2^PROCEDURE CODE3^... (OPTIONAL)
     7 ;  DGTRS  <- 1 if patient transferred to acute care facility             (REQUIRED)
     8 ;  DGEXP  <- 1 if patient died during this episode                       (REQUIRED)
     9 ;  DGDMS  <- 1 if patient was discharged with an Irregular discharge (discharged against medical advice) (REQUIRED)
     10 ;  AGE,SEX     (REQUIRED)
     11 ;values of variables listed above are left unchanged by this routine
     12 ;variable passed back: DRG(0) <- zero node of DRG in DRG file
     13 ;                    : DRG <- IFN of DRG in DRG file
     14 ;  DGDAT  <- Effective date to be used in calculating DRG
     15 ;
     16 ;-- check for required variables
     17 Q:'$D(DGDX)!'$D(DGTRS)!'$D(DGEXP)!'$D(DGDMS)
     18 N DGI
     19 ;-- build ICDDX array
     20 K ICDDX
     21 S DGI=0 F  S DGI=DGI+1 Q:$P(DGDX,U,DGI)=""  D
     22 . S DGPTTMP=$$ICDDX^ICDCODE(+$P(DGDX,U,DGI),+$G(DGDAT))
     23 . I +DGPTTMP>0,($P(DGPTTMP,U,10)) S ICDDX(DGI)=$P(DGDX,U,DGI)
     24 G Q:'$D(ICDDX)
     25 ;
     26 ;-- build ICDPRC array
     27 ;K ICDPRC
     28 ;I $D(DGPROC) S DGSURG=$S('$D(DGSURG):DGPROC,1:DGSURG_DGPROC)
     29 ;I $D(DGSURG) S DGI=0 F  S DGI=DGI+1 Q:$P(DGSURG,U,DGI)=""  D
     30 ;. I $D(^ICD0($P(DGSURG,U,DGI),0)) S ICDPRC(DGI)=$P(DGSURG,U,DGI)
     31 ;-- build ICDPRC array eliminating dupes as we go
     32 K ICDPRC
     33 N I,J,X,Y,FLG,SUB S SUB=0
     34 I $D(DGPROC) F I=2:1 S X=$P(DGPROC,U,I) Q:X=""  D
     35 . S DGPTTMP=$$ICDOP^ICDCODE(X,+$G(DGDAT))
     36 . I +DGPTTMP>0,($P(DGPTTMP,U,10)) S SUB=SUB+1,ICDPRC(SUB)=X
     37 I $D(DGSURG) F I=2:1 S X=$P(DGSURG,U,I) Q:X=""  D
     38 . S FLG=0,J=0 F  S J=$O(ICDPRC(J)) Q:'J  I X=$G(ICDPRC(J)) S FLG=1 Q
     39 . I FLG Q
     40 . S DGPTTMP=$$ICDOP^ICDCODE(X,+$G(DGDAT))
     41 . I +DGPTTMP>0,($P(DGPTTMP,U,10)) S SUB=SUB+1,ICDPRC(SUB)=X
     42 ;
     43 ;-- set other required variables
     44 S ICDTRS=DGTRS,ICDEXP=DGEXP,ICDDMS=DGDMS
     45 S ICDDATE=$S($D(DGDAT):DGDAT,1:DT),DGDAT=ICDDATE  ;Ensure that DGDAT is defined prior to executing PRT
     46 ;
     47 ;-- calculate DRG
     48 D ^ICDDRG S DRG=ICDDRG I '$D(DGDRGPRT) G Q
     49 ;
     50PRT ;print DRG and national HCFA values
     51 I DRG=468!(DRG=469)!(DRG=470) W *7
     52 S Y=ICDDATE D DD^%DT ; Y=external representation of effective date
     53 W !!?9,"Effective Date:","  ",Y
     54 S DRG(0)=$$DRG^ICDGTDRG(DRG,DGDAT) W !!,"Diagnosis Related Group: ",$J(DRG,6),?36,"Average Length of Stay(ALOS): ",$J($P(DRG(0),"^",8),6)
     55 W !?17,"Weight: ",$J($P(DRG(0),"^",2),6)  ;,?40,"Local Breakeven: ",$J($P(DRG(0),"^",12),6)
     56 W !?12," Low Day(s): ",$J($P(DRG(0),"^",3),6)  ;,?39,"Local Low Day(s): ",$J($P(DRG(0),"^",9),6)
     57 W !?13," High Days: ",$J($P(DRG(0),"^",4),6)  ;,?40,"Local High Days: ",$J($P(DRG(0),"^",10),6)
     58 N DXD,DGDX
     59 S DXD=$$DRGD^ICDGTDRG(DRG,"DGDX",,DGDAT),DGI=0
     60 W !!,"DRG: ",DRG,"-" F  S DGI=$O(DGDX(DGI)) Q:'+DGI  Q:DGDX(DGI)=" "  W ?10,DGDX(DGI),!
     61Q K ICDDMS,ICDDRG,ICDDX,ICDEXP,ICDMDC,ICDPRC,ICDRTC,ICDTRS,ICDDATE Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTR1.m

    r613 r623  
    1 DGPTR1  ;ALB/MTC - PTF VERIFICATION ; 12/14/06 10:31am
    2         ;;5.3;Registration;**58,247,338,342,423,415,565,678,696,729,781**;Aug 13, 1993;Build 1
    3 START   S T=$E(Y,2,3),T=$S(T=40&($E(Y,28)="P"):"P40",1:T),ERR=$P($T(@("T"_T)),";;",2,999),W=$P($T(@(T)),";;",2,999),F=31 D L
    4         I T=70 S ERR=$P($T(T701),";;",2,999),W=$P($T(701),";;",2,999),F=72 D L
    5         D @("D"_T) Q
    6         K DGFILL
    7         Q
    8         ;
    9 L       F H=1:1 S DGO=$P(W,U,H) Q:'DGO  F Z=1:1:$P(DGO,";",3) S DGL=$P(DGLOGIC,U,+DGO),X=$E(Y,F) D @("ERR:"_DGL) S F=F+1
    10         Q
    11         ;
    12 T10     ;;1:NAME^2:SOURCE OF ADM^3:TRANS FAC.^4:SOURCE OF PAY^5:POW^6:MARITAL ST^7:SEX^8:DOB^9:POS^10:VIETNAM^11:ION RADIATION^12:RESIDENCE^13:MEANS TEST^14:INCOME^15:MST^16:COMBAT VET^17:CV END DT^18:PROJ 112/SHAD^19:ERI
    13         ;
    14 T70     ;;1:DT OF DISP.^2:DISCH BD SEC^3:TYPE OF DIS^4:OUT TREAT^5:VA AUS^6:PL OF DIS^7:REC FAC^8:ASIH DAYS^9:NOT USED^10:C&P STAT^11:PDXLS^12:ONLY DX^13:PHY MPCR
    15         ;T701 is part 2 of T70
    16 T701    ;;1:PHY SPEC^2:%SC^3:LEGION^4:SUICIDE^5:DRUG^6:AXIS-IV^7:AXIS-V^8:SC^9:EXP^10:MST^11:HNC^12:ETHNICITY^13:RACE^14:COMBAT VET
    17         ;
    18 T50     ;;1:DT OF MVMT^2:LOSING BD SEC MPCR^3:LOSING BD SEC^4:LEAVE DAYS^5:PASS DAYS^6:SCI^7:DIAG^8:DOCTOR'S SSN^9:PHY MPCR^10:PHY SPEC^11:DISCHARGE STAT^^^^^16:LEGION^17:SUICIDE^18:DRUG^19:AXIS-IV^20:AXIS-V^21:SC^22:EXP^23:MST^24:HNC
    19         ;
    20 T53     ;;1:DATE OF PHYSICAL MOVEMENT^2:LOSING PHYSICAL MPCR^3:LOSING PHYSICAL SPECIALTY^4:TR SPECIALTY MPCR^5:TR SPECIALTY^6:LEAVE DAYS^7:PASS DAYS^8:DOCTOR'S SSN (NOT USED)
    21         ;
    22 T40     ;;1:DATE OF SURGERY^2:SURG SPEC.^3:CAT CHIEF SURGEON^4:CAT FIRST ASS^5:ANEST. TECH.^6:SOURCE OF PAY^7:OP CODE^8:DOCTOR'S SSN (NOT USED)^^^^^13:TRANSPLANT STATUS
    23         ;
    24 TP40    ;;1:OP CODE
    25         ;
    26 T60     ;;1:DATE OF PROCEDURE^2:LOSING BD SEC^3:DIALYSIS TYPE^4:NUMBER OF TREATMENTS^5:PROCEDURE CODE
    27         ;
    28 LOGIC   ;;X'?.N^X'?.A&(X'=" ")^X'=" "^X'?.N&(X'=" ")^X'?.A&(X'=" ")^0^X'?.N&(X'="X")^X'=" "&(X'="P")^X="E"^X="Y"^X=" "^X'="A"&(X'=" ")^(X'?.A)&(X'?.N)&(X'=" ")^(X'?.AN)&('$P(DG0,U,4))^((T1)&(X'=" "))!(('T1)&(X'?.AN)&('$P(DG0,U,4)))^(X'?.AN)
    29         ;
    30         ; ; edit check# ; edit field ; # x check preformed ; display error name #
    31 10      ;;6;;12;1^2;1;1;1^5;1;1;1^1;2;1;2^2;2;1;2^4;3;3;3^6;;3;3^4;4;1;4^6;5;1;5^2;6;1;6^2;7;1;7^1;8;8;8^6;;1;9^11;9;1;9^4;10;1;10^4;10;1;11^1;11;5;12^7;11;5;12^2;12;1;13^6;;1;13^1;;6;14^2;;1;15^1;;1;16^4;;6;17^3;;1;18^5;;1;19^3;;29
    32         ;
    33 70      ;;1;1;10;1^13;2;2;2^1;3;1;3^4;4;1;4^4;5;1;5^6;;1;6^4;7;3;7^6;;3;7^4;8;3;8^6;9;1;9^1;10;1;10^9;11;1;11^11;11;2;11^6;;3;11^10;11;1;11^6;;1;12^15;;6;13
    34         ;701 is part 2 of 70
    35 701     ;;15;;2;1^1;;3;2^4;;1;3^4;;1;4^12;;1;5^4;;3;5^4;;1;6^4;;4;7^4;;1;8^5;;3;9^5;;1;10^5;;1;11^13;12;2;12^13;13;12;13^5;;1;14^3;;17
    36         ;
    37 50      ;;1;1;10;1^1;;6;2^16;3;2;3^1;4;3;4^1;5;3;5^6;;1;6^11;7;3;7^6;;32;7^6;;9;8^14;;6;9^14;;2;10^6;;1;11^4;;1;16^4;;1;17^12;;1;18^4;;3;18^4;;1;19^4;;4;20^4;;1;21^5;;3;22^5;;1;23^5;;1;24
    38         ;
    39 53      ;;1;;10;1^1;;6;2^13;;2;3^1;;6;4^13;;2;5^1;;3;6^1;;3;7^3;;9;8^3;;54;
    40         ;
    41 40      ;;1;1;10;1^1;2;2;2^11;3;1;3^4;4;1;4^6;5;1;5^4;6;1;6^11;7;2;7^6;;3;7^3;7;2;7^6;;5;7^3;7;2;7^6;;5;7^3;7;2;7^6;;5;7^3;7;2;7^6;;5;7^3;7;2;7^3;;9;8^4;;1;13^3;;34;
    42         ;
    43 P40     ;;8;;1;^3;;11;^11;1;2;1^6;;3;1^3;1;2;1^6;;5;1^3;;2;1^6;;5;1^3;;2;1^6;;5;1^3;;2;1^6;;5;1^3;;2;1^3;;48
    44         ;
    45 60      ;;1;1;10;1^13;2;2;2^4;3;1;3^4;4;3;4^11;5;3;5^6;;32;5^3;;44
    46         ;
    47 ERR     S DGERR=1
    48         W !,T,$S(T["H":" ",1:$E(Y,4)),"  "
    49         W:"45"[$E(T,1) $E(Y,31,32),"-",$E(Y,33,34),"-",$E(Y,35,36),"@",$E(Y,37,40)
    50         W ?25,$P($P(ERR,U,$P(DGO,";",4)),":",2),?40,"COL.",F,"  VALUE: ",$S($E(Y,F)=" ":"BLANK",1:$E(Y,F))
    51         S I=$S('$D(I):1,I>0:I,1:1),^(I)=$S($D(^UTILITY("DG",$J,T_$S(T["H":"",1:$E(Y,4)),I)):^(I),1:U) I $P(DGO,";",2),^(I)'[(U_$P(DGO,";",2)_U) S ^(I)=^(I)_$P(DGO,";",2)_U
    52         Q
    53         ;
    54 D10     I $E(Y,66)="Z" S (F,H)=68,W="11;10;1;10" D L
    55         I $P(^DGPT(J,0),"^",4),$P(^(0),"^",10)="U",$D(^DGPT(J,70)),+^(70)>2890700 S F=79,DGO="2;12;1;12" D ERR
    56         Q
    57         ;
    58 D40     Q
    59 DP40    Q
    60 D70     I "467"'[$E(Y,43) S F=44,W="4;4;1;4^1;5;1;5^11;6;1;6" D L
    61         Q
    62 D50     I "A0"[$P(DG0,U,5)!("A4"[$P(DG0,U,5))!('$D(^DGPT(J,70))) S W="11;6;1;6",F=55 D L
    63         I $D(^DGPT(J,70)),$S(T1:1,1:+^(70)>2871000) S W="11;6;1;6",F=55 D L
    64         I $E(Y,4)=1 S W="9;7;1;7",F=56 D L
    65         I I=1,'T1 S W="1;11;1;11",F=108 D L
    66         Q
    67 D53     Q
    68 D60     I $E(Y,43) S F=44,W="1;4;3;4" D L
    69         Q
    70 HEAD    S ERR="1:SSN^2:ADMISSION DATE^3:FACILITY #",W="8;1;1;1^1;1;9;1^1;2;10;2^1;3;3;3^6;;3;3",F=5,DGLOGIC=$P($T(LOGIC),";;",2),T="HEADER"
    71         D L
    72         Q
    73 LOG     S DGLOGIC=$P($T(LOGIC),";;",2)
    74         Q
    75 CEN     S T=70,ERR=$P($T(T70),";;",2),W=$P($T(70),";;",2,999),W="13;9;1;9"_$P(W,"13;9;1;9",2,999),F=56 D L
    76         S ERR=$P($T(T701),";;",2),W=$P($T(701),";;",2,999),F=72 D L
    77         Q
     1DGPTR1 ;ALB/MTC - PTF VERIFICATION ; 12/14/06 10:31am
     2 ;;5.3;Registration;**58,247,338,342,423,415,565,678,696,729**;Aug 13, 1993;Build 59
     3START S T=$E(Y,2,3),T=$S(T=40&($E(Y,28)="P"):"P40",1:T),ERR=$P($T(@("T"_T)),";;",2,999),W=$P($T(@(T)),";;",2,999),F=31 D L
     4 I T=70 S ERR=$P($T(T701),";;",2,999),W=$P($T(701),";;",2,999),F=72 D L
     5 D @("D"_T) Q
     6 K DGFILL
     7 Q
     8 ;
     9L F H=1:1 S DGO=$P(W,U,H) Q:'DGO  F Z=1:1:$P(DGO,";",3) S DGL=$P(DGLOGIC,U,+DGO),X=$E(Y,F) D @("ERR:"_DGL) S F=F+1
     10 Q
     11 ;
     12T10 ;;1:NAME^2:SOURCE OF ADM^3:TRANS FAC.^4:SOURCE OF PAY^5:POW^6:MARITAL ST^7:SEX^8:DOB^9:POS^10:VIETNAM^11:ION RADIATION^12:RESIDENCE^13:MEANS TEST^14:INCOME^15:MST^16:COMBAT VET^17:CV END DT^18:PROJ 112/SHAD^19:ERI
     13 ;
     14T70 ;;1:DT OF DISP.^2:DISCH BD SEC^3:TYPE OF DIS^4:OUT TREAT^5:VA AUS^6:PL OF DIS^7:REC FAC^8:ASIH DAYS^9:NOT USED^10:C&P STAT^11:PDXLS^12:ONLY DX^13:PHY MPCR
     15 ;T701 is part 2 of T70
     16T701 ;;1:PHY SPEC^2:%SC^3:LEGION^4:SUICIDE^5:DRUG^6:AXIS-IV^7:AXIS-V^8:SC^9:EXP^10:MST^11:HNC^12:ETHNICITY^13:RACE^14:COMBAT VET
     17 ;
     18T50 ;;1:DT OF MVMT^2:LOSING BD SEC MPCR^3:LOSING BD SEC^4:LEAVE DAYS^5:PASS DAYS^6:SCI^7:DIAG^8:DOCTOR'S SSN^9:PHY MPCR^10:PHY SPEC^11:DISCHARGE STAT^^^^^16:LEGION^17:SUICIDE^18:DRUG^19:AXIS-IV^20:AXIS-V^21:SC^22:EXP^23:MST^24:HNC
     19 ;
     20T53 ;;1:DATE OF PHYSICAL MOVEMENT^2:LOSING PHYSICAL MPCR^3:LOSING PHYSICAL SPECIALTY^4:TR SPECIALTY MPCR^5:TR SPECIALTY^6:LEAVE DAYS^7:PASS DAYS^8:DOCTOR'S SSN (NOT USED)
     21 ;
     22T40 ;;1:DATE OF SURGERY^2:SURG SPEC.^3:CAT CHIEF SURGEON^4:CAT FIRST ASS^5:ANEST. TECH.^6:SOURCE OF PAY^7:OP CODE^8:DOCTOR'S SSN (NOT USED)^^^^^13:TRANSPLANT STATUS
     23 ;
     24TP40 ;;1:OP CODE
     25 ;
     26T60 ;;1:DATE OF PROCEDURE^2:LOSING BD SEC^3:DIALYSIS TYPE^4:NUMBER OF TREATMENTS^5:PROCEDURE CODE
     27 ;
     28LOGIC ;;X'?.N^X'?.A&(X'=" ")^X'=" "^X'?.N&(X'=" ")^X'?.A&(X'=" ")^0^X'?.N&(X'="X")^X'=" "&(X'="P")^X="E"^X="Y"^X=" "^X'="A"&(X'=" ")^(X'?.A)&(X'?.N)&(X'=" ")^(X'?.AN)&('$P(DG0,U,4))^((T1)&(X'=" "))!(('T1)&(X'?.AN)&('$P(DG0,U,4)))
     29 ;
     30 ; edit check# ; edit field ; # x check preformed ; display error name #
     3110 ;;6;;12;1^2;1;1;1^5;1;1;1^1;2;1;2^2;2;1;2^4;3;3;3^6;;3;3^4;4;1;4^6;5;1;5^2;6;1;6^2;7;1;7^1;8;8;8^6;;1;9^11;9;1;9^4;10;1;10^4;10;1;11^1;11;5;12^7;11;5;12^2;12;1;13^6;;1;13^1;;6;14^2;;1;15^1;;1;16^4;;6;17^3;;1;18^5;;1;19^3;;29
     32 ;
     3370 ;;1;1;10;1^13;2;2;2^1;3;1;3^4;4;1;4^4;5;1;5^6;;1;6^4;7;3;7^6;;3;7^4;8;3;8^6;9;1;9^1;10;1;10^9;11;1;11^11;11;2;11^6;;3;11^10;11;1;11^6;;1;12^15;;6;13
     34 ;701 is part 2 of 70
     35701 ;;15;;2;1^1;;3;2^4;;1;3^4;;1;4^12;;1;5^4;;3;5^4;;1;6^4;;4;7^4;;1;8^5;;3;9^5;;1;10^5;;1;11^13;12;2;12^13;13;12;13^5;;1;14^3;;17
     36 ;
     3750 ;;1;1;10;1^1;;6;2^13;3;2;3^1;4;3;4^1;5;3;5^6;;1;6^11;7;3;7^6;;32;7^6;;9;8^14;;6;9^14;;2;10^6;;1;11^4;;1;16^4;;1;17^12;;1;18^4;;3;18^4;;1;19^4;;4;20^4;;1;21^5;;3;22^5;;1;23^5;;1;24
     38 ;
     3953 ;;1;;10;1^1;;6;2^13;;2;3^1;;6;4^13;;2;5^1;;3;6^1;;3;7^3;;9;8^3;;54;
     40 ;
     4140 ;;1;1;10;1^1;2;2;2^11;3;1;3^4;4;1;4^6;5;1;5^4;6;1;6^11;7;2;7^6;;3;7^3;7;2;7^6;;5;7^3;7;2;7^6;;5;7^3;7;2;7^6;;5;7^3;7;2;7^6;;5;7^3;7;2;7^3;;9;8^4;;1;13^3;;34;
     42 ;
     43P40 ;;8;;1;^3;;11;^11;1;2;1^6;;3;1^3;1;2;1^6;;5;1^3;;2;1^6;;5;1^3;;2;1^6;;5;1^3;;2;1^6;;5;1^3;;2;1^3;;48
     44 ;
     4560 ;;1;1;10;1^13;2;2;2^4;3;1;3^4;4;3;4^11;5;3;5^6;;32;5^3;;44
     46 ;
     47ERR S DGERR=1
     48 W !,T,$S(T["H":" ",1:$E(Y,4)),"  "
     49 W:"45"[$E(T,1) $E(Y,31,32),"-",$E(Y,33,34),"-",$E(Y,35,36),"@",$E(Y,37,40)
     50 W ?25,$P($P(ERR,U,$P(DGO,";",4)),":",2),?40,"COL.",F,"  VALUE: ",$S($E(Y,F)=" ":"BLANK",1:$E(Y,F))
     51 S I=$S('$D(I):1,I>0:I,1:1),^(I)=$S($D(^UTILITY("DG",$J,T_$S(T["H":"",1:$E(Y,4)),I)):^(I),1:U) I $P(DGO,";",2),^(I)'[(U_$P(DGO,";",2)_U) S ^(I)=^(I)_$P(DGO,";",2)_U
     52 Q
     53 ;
     54D10 I $E(Y,66)="Z" S (F,H)=68,W="11;10;1;10" D L
     55 I $P(^DGPT(J,0),"^",4),$P(^(0),"^",10)="U",$D(^DGPT(J,70)),+^(70)>2890700 S F=79,DGO="2;12;1;12" D ERR
     56 Q
     57 ;
     58D40 Q
     59DP40 Q
     60D70 I "467"'[$E(Y,43) S F=44,W="4;4;1;4^1;5;1;5^11;6;1;6" D L
     61 Q
     62D50 I "A0"[$P(DG0,U,5)!("A4"[$P(DG0,U,5))!('$D(^DGPT(J,70))) S W="11;6;1;6",F=55 D L
     63 I $D(^DGPT(J,70)),$S(T1:1,1:+^(70)>2871000) S W="11;6;1;6",F=55 D L
     64 I $E(Y,4)=1 S W="9;7;1;7",F=56 D L
     65 I I=1,'T1 S W="1;11;1;11",F=108 D L
     66 Q
     67D53 Q
     68D60 I $E(Y,43) S F=44,W="1;4;3;4" D L
     69 Q
     70HEAD S ERR="1:SSN^2:ADMISSION DATE^3:FACILITY #",W="8;1;1;1^1;1;9;1^1;2;10;2^1;3;3;3^6;;3;3",F=5,DGLOGIC=$P($T(LOGIC),";;",2),T="HEADER"
     71 D L
     72 Q
     73LOG S DGLOGIC=$P($T(LOGIC),";;",2)
     74 Q
     75CEN S T=70,ERR=$P($T(T70),";;",2),W=$P($T(70),";;",2,999),W="13;9;1;9"_$P(W,"13;9;1;9",2,999),F=56 D L
     76 S ERR=$P($T(T701),";;",2),W=$P($T(701),";;",2,999),F=72 D L
     77 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGREG.m

    r613 r623  
    1 DGREG   ;ALB/JDS,MRL/PJR/PHH-REGISTER PATIENT ;1/27/07  13:08
    2         ;;5.3;Registration;**1,32,108,147,149,182,245,250,513,425,533,574,563,624,658,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11 START   ;
    12 EN      D LO^DGUTL S DGCLPR=""
    13         N DGDIV
    14         S DGDIV=$$PRIM^VASITE
    15         S:DGDIV %ZIS("B")=$P($G(^DG(40.8,+DGDIV,"DEV")),U,1)
    16         I $P(^DG(43,1,0),U,39) S %ZIS="NQ",%ZIS("A")="Select 1010 printer: " D ^%ZIS Q:POP  S (DGIO(10),DGIO("PRF"),DGIO("RT"),DGIO("HS"))=ION,DGASKDEV="" I $E(IOST,1,2)'["P-" W !,$C(7),"Not a printer" G DGREG
    17         K %ZIS("B")
    18         I '$D(DGIO),$P(^DG(43,1,0),U,30) S %ZIS="N",IOP="HOME" D ^%ZIS I $D(IOS),IOS,$D(^%ZIS(1,+IOS,99)),$D(^%ZIS(1,+^(99),0)) S Y=$P(^(0),U,1) W !,"Using closest printer ",Y,! F I=10,"PRF","RT","HS" S DGIO(I)=Y
    19 A       D ENDREG($G(DFN))
    20         ;
    21         ; ** VOE change 1 of 4: DAOU/WCJ 2/1/2005,VA/CJS,WV/TOAD 1/5/2006 **
    22         ;
    23         ; if not VA agency code, add DIC("DR") to default some identifiers and
    24         ; skip others also, improve readability
    25         ;
    26         ; before change:
    27         ; W !! S DIC=2,DIC(0)="ALEQM",DLAYGO=2 K DIC("S"),DIC("B") D ^DIC K DLAYGO G Q1:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) N Y D PAUSE^DG10 D BEGINREG(DFN) I DGNEW D NEW^DGRP
    28         ;
    29         ; after change:
    30         W !!
    31         N Y,DGREGY S DGREGY=1 D  I DGREGY<0 G Q1
    32         . N DIC S DIC=2 ; Patient file
    33         . S DIC(0)="ALEQM" ; ask, laygo, echo, question, and multi-index
    34         . N DLAYGO S DLAYGO=2 ; override file access by user: allow laygo
    35         . I $G(DUZ("AG"))'="V" D  ;adjust identifiers asked for VOE
    36         . . S DIC("DR")=".02;.03;994;.301///N;391///VISTA OFFICE EHR;1901///N;.09"
    37         . ;
    38         . D ^DIC ; Select Patient
    39         . ;
    40         . I Y<0 S DGREGY=-1 Q
    41         . K DIC("DR")
    42         . S (DFN,DA)=+Y
    43         . S DGNEW=$P(Y,"^",3) ; new patient?
    44         . N Y D PAUSE^DG10 ; prompt user before continuing
    45         . D BEGINREG(DFN) ; lock patient record
    46         ;
    47         ; ** end of VOE change 1 **
    48         ;
    49         ;; ask to continue if patient died - DG*5.3*563 - pjr 10/12/04
    50         S DOD="" I $G(DFN) S DOD=$P($G(^DPT(DFN,.35)),"^",1)
    51         I DOD S Y=DOD,DGPME=0 D DIED^DGPMV I DGPME K DFN,DGRPOUT G A
    52         ;
    53         D CIRN
    54         ;
    55         ; ** VOE change 2 of 4: DAOU/WCJ 2/1/2005,VA/CJS,WV/TOAD 1/5/2006 **
    56         ;
    57         I $G(DGNEW) D NEW^DGRP ; execute new patient DR string
    58         ;
    59         ; send CMOR query and display results only if VA agency code
    60         ;
    61         ; before change:
    62         ; I +$G(DGNEW) D
    63         ;
    64         ; after change:
    65         I $G(DGNEW),$G(DUZ("AG"))="V" D
    66         . ;
    67         . ; end of change
    68         . ;
    69         . ; query CMOR for Patient Record Flag Assignments if NEW patient and
    70         . ; display results.
    71         . I $$PRFQRY^DGPFAPI(DFN) D DISPPRF^DGPFAPI(DFN)
    72         ;
    73         ; before change:
    74         ; D ROMQRY
    75         ;
    76         ; after change:
    77         I $G(DUZ("AG"))="V" D ROMQRY
    78         ;
    79         ; ** end of VOE change 2 **
    80         ;
    81         S (DGFC,CURR)=0
    82         D:'$G(DGNEW) WARN S DA=DFN,DGFC="^1",VET=$S($D(^DPT(DFN,"VET")):^("VET")'="Y",1:0)
    83         S %ZIS="N",IOP="HOME" D ^%ZIS S DGELVER=0 D EN^DGRPD I $D(DGRPOUT) D ENDREG($G(DFN)) D HL7A08^VAFCDD01 K DFN,DGRPOUT G A
    84         D HINQ^DG10
    85         I $D(^DIC(195.4,1,"UP")) I ^("UP") D ADM^RTQ3
    86         ;
    87         ; ** VOE change 3 of 4: DAOU/WCJ 2/1/2005,VA/CJS,WV/TOAD 1/5/2006 **
    88         ;
    89         ; send financial query only for VA agency code
    90         ;
    91         ; before change:
    92         ; D REG^IVMCQ($G(DFN))  ; send financial query
    93         ;
    94         ; after change:
    95         I $G(DUZ("AG"))="V" D REG^IVMCQ($G(DFN)) ; send financial query
    96         ;
    97         ; ** end of VOE change 3 **
    98         ;
    99         G A1
    100         ;
    101 RT      I $D(^DIC(195.4,1,"UP")) I ^("UP") S $P(DGFC,U,1)=DIV D ADM^RTQ3
    102         Q
    103         ;
    104 A1      W !,"Do you want to ",$S(DGNEW:"enter",1:"edit")," Patient Data" S %=1 D YN^DICN D  G H:'%,CK:%'=1 S DGRPV=0 D EN1^DGRP G Q:'$D(DA)
    105         .I +$G(DGNEW) Q
    106         .I $$ADD^DGADDUTL($G(DFN)) ;
    107         G CH
    108 PR      W !!,"Is the patient currently being followed in a clinic for the same condition" S %=0 D YN^DICN G Q:%=-1
    109         I '% W !?4,$C(7),"Enter 'Y' if the patient is being followed in clinic for condition for which",!?6,"registered, 'N' if not." G PR
    110         S CURR=% G SEEN
    111         ;
    112 CK      S DGEDCN=1 D ^DGRPC
    113 CH      S X=$S('$D(^DPT(DFN,.36)):1,$P(^(.36),"^",1)']"":1,1:0),X1=$S('$D(^DPT(DFN,.32)):1,$P(^(.32),"^",3)']"":1,1:0) I 'X,'X1 G CH1
    114 CH1     S DA=DFN G PR:'$D(^DPT("ADA",1,DA)) W !!,"There is still an open disposition--register aborted.",$C(7),$C(7) G Q
    115 SEEN    W !!,"Is the patient to be examined in the medical center today" S %=1 D YN^DICN S SEEN=% G:%<0 Q I %'>0 W !!,"Enter 'Y' if the patient is to be examined today, 'N' if not.",$C(7) G SEEN
    116 ABIL    D ^DGREGG
    117 ENR     ; next line appears to be dead code.  left commented just to test.  mli 4/28/94
    118         ;S DE=0 F I=0:0 S I=$O(^DPT(DA,"DE",I)) Q:'I  I $P(^(I,0),"^",3)'?7N Q  D PR:'DE S L=+$P($S($D(^SC(L,0)):^(0),1:""),"^",1)
    119 REG     S (DIE,DIC)="^DPT("_DFN_",""DIS"",",%DT="PTEX",%DT("A")="Registration login date/time: NOW// "
    120         W !,%DT("A") R ANS:DTIME S:'$T ANS="^" S:ANS="" ANS="N" S X=ANS G Q:ANS="^" S DA(1)=DFN D CHK^DIE(2.101,.01,"E",X,.RESULT) G REG:RESULT="^"!('$D(RESULT)),PR3:'(RESULT#1) S Y=RESULT
    121         I (RESULT'="^") W "  ("_RESULT(0)_")"
    122         S DINUM=9999999-RESULT
    123         S (DFN1,Y1)=DINUM,APD=Y I $D(^DPT(DFN,"DIS",Y1)) W !!,"You must enter a date that does not exist.",$C(7),$C(7) G REG
    124         G:$D(^DPT("ADA",1,DA)) CH1 L @(DIE_DINUM_")"):2 G:'$T MSG S:'($D(^DPT(DA(1),"DIS",0))#2) ^(0)="^2.101D^^" S DIC(0)="L",X=+Y D ^DIC
    125         ;
    126         ;SAVE OFF DATE/TIME OF REGISTRATION FOR HL7 V2.3 MESSAGING, IN VAFCDDT
    127         S VAFCDDT=X
    128         ;
    129         S DA=DFN1,DIE("NO^")="",DA(1)=DFN,DP=2.101,DR="1///"_$S(SEEN=2:2,CURR=1:1,1:0)_";Q;2"_$S(CURR=1:"///3",1:"")_";2.1;3//"_$S($P(^DG(43,1,"GL"),"^",2):"",1:"/")_$S($D(^DG(40.8,+$P(^DG(43,1,"GL"),"^",3),0)):$P(^(0),"^",1),1:"")_";4////"_DUZ
    130         ;
    131         ; ** VOE change 4 of 4: DAOU/JLG 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
    132         ;
    133         ; for VOE or IHS agency codes, add the following:
    134         ; force TYPE OF CARE with ALL OTHER
    135         ;
    136         I $G(DUZ("AG"))="E"!($G(DUZ("AG"))="I") D
    137         . S DR="1///"_$S(SEEN=2:2,CURR=1:1,1:0)_";Q;2"_$S(CURR=1:"///3",1:"")_";2.1///5;3//"_$S($P(^DG(43,1,"GL"),"^",2):"",1:"/")_$S($D(^DG(40.8,+$P(^DG(43,1,"GL"),"^",3),0)):$P(^(0),"^",1),1:"")_";4////"_DUZ
    138         ;
    139         ; ** end of VOE change 4 **
    140         ;
    141         D EL K DIC("A") N DGNDLOCK S DGNDLOCK=DIE_DFN1_")" L +@DGNDLOCK:2 G:'$T MSG D ^DIE L -@DGNDLOCK
    142         I $D(DTOUT) D  G Q
    143         .K DTOUT
    144         .N DA,DIK
    145         .S DA(1)=DFN,DA=DFN1,DIK="^DPT("_DFN_",""DIS"","
    146         .D ^DIK
    147         .W !!?5,"User Time-out.  Required registration data could be missing."
    148         .W !,?5,"This registration has been deleted."
    149         ; check whether facility applying to (division) is inactive
    150         I '$$DIVCHK^DGREGFAC(DFN,DFN1) G CONT
    151 ASKDIV  W !!?5,"The facility chosen either has no pointer to an Institution"
    152         W !?5,"file record or the Institution file record is inactive."
    153         W !?5,"Please choose another division."
    154         S DA=DFN1,DIE("NO^")="",DA(1)=DFN,DP=2.101,DR="3" D ^DIE
    155         I $$DIVCHK^DGREGFAC(DFN,DFN1) G ASKDIV
    156 CONT    ; continue
    157         S DGXXXD=1 D EL^DGREGE I $P(^DPT(DFN,"DIS",DFN1,0),"^",3)=4 S DA=DFN,DIE="^DPT(",DR=".368;.369" D ^DIE S DIE="^DPT("_DFN_",""DIS"",",DA(1)=DFN,DA=DFN1
    158         S DA=DFN,DR="[DGREG]",DIE="^DPT(" D ^DIE K DIE("NO^")
    159         I $D(^DPT(DFN,"DIS",DFN1,2)),$P(^(2),"^",1)="Y" S DIE="^DPT(",DR="[DG EMPLOYER]",DA=DFN D ^DIE
    160         G ^DGREG0
    161 PR2     W !!,"You can only enter new registrations through this option.",$C(7),$C(7) G REG
    162 PR3     W !!,"Time is required to register the patient.",!!,$C(7),$C(7) G REG
    163 H       W !?5,"Enter 'YES' to enter/edit registration data or 'NO' to continue." G A1
    164 Q       K DG,DQ G Q1^DGREG0
    165 Q1      K DGIO,DGASKDEV,DGFC,DGCLRP,CURR,DGELVER,DGNEW Q
    166 EL      S DR=DR_";13//" I $D(^DPT(DFN,.36)),$D(^DIC(8,+^(.36),0)) S DR=DR_$P(^(0),"^",1) Q
    167         S DR=DR_"HUMANITARIAN EMERGENCY" Q
    168 FEE     S DGRPFEE=1 D DGREG K DGRPFEE G Q1
    169         ;
    170 WARN    I $S('$D(^DPT(DFN,.1)):0,$P(^(.1),"^",1)']"":0,1:1) W !,$C(7),"***PATIENT IS CURRENTLY AN INPATIENT***",! H 2
    171         I $S('$D(^DPT(DFN,.107)):0,$P(^(.107),"^",1)']"":0,1:1) W !,$C(7),"***PATIENT IS CURRENTLY A LODGER***",! H 2
    172         Q
    173 MSG     W !,"Another user is editing, try later ..." G Q
    174         ;
    175 BEGINREG(DFN)   ;
    176         ;Description: This is called at the beginning of the registration process.
    177         ;Concurrent processes can check the lock to determine if the patient is
    178         ;currently being registered.
    179         ;
    180         Q:'$G(DFN) 0
    181         I $$QRY^DGENQRY(DFN) W !!,"Enrollment/Eligibility Query sent ...",!!
    182         L +^TMP(DFN,"REGISTRATION IN PROGRESS"):1
    183         I $$LOCK^DGENPTA1(DFN) ;try to lock the patient record
    184         Q
    185         ;
    186 ENDREG(DFN)     ;
    187         ;Description: releases the lock obtained by calling BEGINREG.
    188         ;
    189         Q:'$G(DFN)
    190         L -^TMP(DFN,"REGISTRATION IN PROGRESS")
    191         D UNLOCK^DGENPTA1(DFN)
    192         Q
    193         ;
    194 IFREG(DFN)      ;
    195         ;Description: tests whether the lock set by BEGINREG is set
    196         ;
    197         ;Input:  DFN
    198         ;Output:
    199         ;      Function Value = 1 if lock is set, 0 otherwise
    200         ;
    201         N RETURN
    202         Q:'$G(DFN) 0
    203         L +^TMP(DFN,"REGISTRATION IN PROGRESS"):1
    204         S RETURN='$T
    205         L -^TMP(DFN,"REGISTRATION IN PROGRESS")
    206         Q RETURN
    207         Q
    208 CIRN    ;MPI QUERY
    209         ;check to see if CIRN PD/MPI is installed
    210         N X S X="MPIFAPI" X ^%ZOSF("TEST") Q:'$T
    211         K MPIFRTN
    212         D MPIQ^MPIFAPI(DFN)
    213         K MPIFRTN
    214         Q
    215 ROMQRY  ;
    216         I +$G(DGNEW) D
    217         . ; query LST for Patient Demographic Information if NEW patient and
    218         . ; file into patient's record.
    219         . N A
    220         . I $$ROMQRY^DGROAPI(DFN) D
    221         . . ;display busy message to interactive users
    222         . .S DGMSG(1)="Data retrieval from LST site has been completed successfully"
    223         . .S DGMSG(2)="Thank you for your patience."
    224         . .D EN^DDIOL(.DGMSG) R A:5
    225         . E  D
    226         . . ;display busy message to interactive users
    227         . .S DGMSG(1)="Data retrieval from LST site has not been successful."
    228         . .S DGMSG(2)="Please continue the Registration Process."
    229         . .D EN^DDIOL(.DGMSG) R A:5
    230         . ;
    231         Q
     1DGREG ;ALB/JDS,MRL/PJR/PHH-REGISTER PATIENT ;1/27/07  13:08
     2 ;;5.3;Registration;**1,32,108,147,149,182,245,250,513,425,533,574,563,624,658,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11START ;
     12EN D LO^DGUTL S DGCLPR=""
     13 N DGDIV
     14 S DGDIV=$$PRIM^VASITE
     15 S:DGDIV %ZIS("B")=$P($G(^DG(40.8,+DGDIV,"DEV")),U,1)
     16 I $P(^DG(43,1,0),U,39) S %ZIS="NQ",%ZIS("A")="Select 1010 printer: " D ^%ZIS Q:POP  S (DGIO(10),DGIO("PRF"),DGIO("RT"),DGIO("HS"))=ION,DGASKDEV="" I $E(IOST,1,2)'["P-" W !,$C(7),"Not a printer" G DGREG
     17 K %ZIS("B")
     18 I '$D(DGIO),$P(^DG(43,1,0),U,30) S %ZIS="N",IOP="HOME" D ^%ZIS I $D(IOS),IOS,$D(^%ZIS(1,+IOS,99)),$D(^%ZIS(1,+^(99),0)) S Y=$P(^(0),U,1) W !,"Using closest printer ",Y,! F I=10,"PRF","RT","HS" S DGIO(I)=Y
     19A D ENDREG($G(DFN))
     20 ;
     21 ; ** VOE change 1 of 4: DAOU/WCJ 2/1/2005,VA/CJS,WV/TOAD 1/5/2006 **
     22 ;
     23 ; if not VA agency code, add DIC("DR") to default some identifiers and
     24 ; skip others also, improve readability
     25 ;
     26 ; before change:
     27 ; W !! S DIC=2,DIC(0)="ALEQM",DLAYGO=2 K DIC("S"),DIC("B") D ^DIC K DLAYGO G Q1:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) N Y D PAUSE^DG10 D BEGINREG(DFN) I DGNEW D NEW^DGRP
     28 ;
     29 ; after change:
     30 W !!
     31 N Y,DGREGY S DGREGY=1 D  I DGREGY<0 G Q1
     32 . N DIC S DIC=2 ; Patient file
     33 . S DIC(0)="ALEQM" ; ask, laygo, echo, question, and multi-index
     34 . N DLAYGO S DLAYGO=2 ; override file access by user: allow laygo
     35 . I $G(DUZ("AG"))'="V" D  ;adjust identifiers asked for VOE
     36 . . S DIC("DR")=".02;.03;994;.301///N;391///VISTA OFFICE EHR;1901///N;.09"
     37 . ;
     38 . D ^DIC ; Select Patient
     39 . ;
     40 . I Y<0 S DGREGY=-1 Q
     41 . K DIC("DR")
     42 . S (DFN,DA)=+Y
     43 . S DGNEW=$P(Y,"^",3) ; new patient?
     44 . N Y D PAUSE^DG10 ; prompt user before continuing
     45 . D BEGINREG(DFN) ; lock patient record
     46 ;
     47 ; ** end of VOE change 1 **
     48 ;
     49 ;; ask to continue if patient died - DG*5.3*563 - pjr 10/12/04
     50 S DOD="" I $G(DFN) S DOD=$P($G(^DPT(DFN,.35)),"^",1)
     51 I DOD S Y=DOD,DGPME=0 D DIED^DGPMV I DGPME K DFN,DGRPOUT G A
     52 ;
     53 D CIRN
     54 ;
     55 ; ** VOE change 2 of 4: DAOU/WCJ 2/1/2005,VA/CJS,WV/TOAD 1/5/2006 **
     56 ;
     57 I $G(DGNEW) D NEW^DGRP ; execute new patient DR string
     58 ;
     59 ; send CMOR query and display results only if VA agency code
     60 ;
     61 ; before change:
     62 ; I +$G(DGNEW) D
     63 ;
     64 ; after change:
     65 I $G(DGNEW),$G(DUZ("AG"))="V" D
     66 . ;
     67 . ; end of change
     68 . ;
     69 . ; query CMOR for Patient Record Flag Assignments if NEW patient and
     70 . ; display results.
     71 . I $$PRFQRY^DGPFAPI(DFN) D DISPPRF^DGPFAPI(DFN)
     72 ;
     73 ; before change:
     74 ; D ROMQRY
     75 ;
     76 ; after change:
     77 I $G(DUZ("AG"))="V" D ROMQRY
     78 ;
     79 ; ** end of VOE change 2 **
     80 ;
     81 S (DGFC,CURR)=0
     82 D:'$G(DGNEW) WARN S DA=DFN,DGFC="^1",VET=$S($D(^DPT(DFN,"VET")):^("VET")'="Y",1:0)
     83 S %ZIS="N",IOP="HOME" D ^%ZIS S DGELVER=0 D EN^DGRPD I $D(DGRPOUT) D ENDREG($G(DFN)) D HL7A08^VAFCDD01 K DFN,DGRPOUT G A
     84 D HINQ^DG10
     85 I $D(^DIC(195.4,1,"UP")) I ^("UP") D ADM^RTQ3
     86 ;
     87 ; ** VOE change 3 of 4: DAOU/WCJ 2/1/2005,VA/CJS,WV/TOAD 1/5/2006 **
     88 ;
     89 ; send financial query only for VA agency code
     90 ;
     91 ; before change:
     92 ; D REG^IVMCQ($G(DFN))  ; send financial query
     93 ;
     94 ; after change:
     95 I $G(DUZ("AG"))="V" D REG^IVMCQ($G(DFN)) ; send financial query
     96 ;
     97 ; ** end of VOE change 3 **
     98 ;
     99 G A1
     100 ;
     101RT I $D(^DIC(195.4,1,"UP")) I ^("UP") S $P(DGFC,U,1)=DIV D ADM^RTQ3
     102 Q
     103 ;
     104A1 W !,"Do you want to ",$S(DGNEW:"enter",1:"edit")," Patient Data" S %=1 D YN^DICN D  G H:'%,CK:%'=1 S DGRPV=0 D EN1^DGRP G Q:'$D(DA)
     105 .I +$G(DGNEW) Q
     106 .I $$ADD^DGADDUTL($G(DFN)) ;
     107 G CH
     108PR W !!,"Is the patient currently being followed in a clinic for the same condition" S %=0 D YN^DICN G Q:%=-1
     109 I '% W !?4,$C(7),"Enter 'Y' if the patient is being followed in clinic for condition for which",!?6,"registered, 'N' if not." G PR
     110 S CURR=% G SEEN
     111 ;
     112CK S DGEDCN=1 D ^DGRPC
     113CH S X=$S('$D(^DPT(DFN,.36)):1,$P(^(.36),"^",1)']"":1,1:0),X1=$S('$D(^DPT(DFN,.32)):1,$P(^(.32),"^",3)']"":1,1:0) I 'X,'X1 G CH1
     114CH1 S DA=DFN G PR:'$D(^DPT("ADA",1,DA)) W !!,"There is still an open disposition--register aborted.",$C(7),$C(7) G Q
     115SEEN W !!,"Is the patient to be examined in the medical center today" S %=1 D YN^DICN S SEEN=% G:%<0 Q I %'>0 W !!,"Enter 'Y' if the patient is to be examined today, 'N' if not.",$C(7) G SEEN
     116ABIL D ^DGREGG
     117ENR ; next line appears to be dead code.  left commented just to test.  mli 4/28/94
     118 ;S DE=0 F I=0:0 S I=$O(^DPT(DA,"DE",I)) Q:'I  I $P(^(I,0),"^",3)'?7N Q  D PR:'DE S L=+$P($S($D(^SC(L,0)):^(0),1:""),"^",1)
     119REG S (DIE,DIC)="^DPT("_DFN_",""DIS"",",%DT="PTEX",%DT("A")="Registration login date/time: NOW// "
     120 W !,%DT("A") R ANS:DTIME S:'$T ANS="^" S:ANS="" ANS="N" S X=ANS G Q:ANS="^" S DA(1)=DFN D CHK^DIE(2.101,.01,"E",X,.RESULT) G REG:RESULT="^"!('$D(RESULT)),PR3:'(RESULT#1) S Y=RESULT
     121 I (RESULT'="^") W "  ("_RESULT(0)_")"
     122 S DINUM=9999999-RESULT
     123 S (DFN1,Y1)=DINUM,APD=Y I $D(^DPT(DFN,"DIS",Y1)) W !!,"You must enter a date that does not exist.",$C(7),$C(7) G REG
     124 G:$D(^DPT("ADA",1,DA)) CH1 L @(DIE_DINUM_")"):2 G:'$T MSG S:'($D(^DPT(DA(1),"DIS",0))#2) ^(0)="^2.101D^^" S DIC(0)="L",X=+Y D ^DIC
     125 ;
     126 ;SAVE OFF DATE/TIME OF REGISTRATION FOR HL7 V2.3 MESSAGING, IN VAFCDDT
     127 S VAFCDDT=X
     128 ;
     129 S DA=DFN1,DIE("NO^")="",DA(1)=DFN,DP=2.101,DR="1///"_$S(SEEN=2:2,CURR=1:1,1:0)_";Q;2"_$S(CURR=1:"///3",1:"")_";2.1;3//"_$S($P(^DG(43,1,"GL"),"^",2):"",1:"/")_$S($D(^DG(40.8,+$P(^DG(43,1,"GL"),"^",3),0)):$P(^(0),"^",1),1:"")_";4////"_DUZ
     130 ;
     131 ; ** VOE change 4 of 4: DAOU/JLG 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
     132 ;
     133 ; for VOE or IHS agency codes, add the following:
     134 ; force TYPE OF CARE with ALL OTHER
     135 ;
     136 I $G(DUZ("AG"))="E"!($G(DUZ("AG"))="I") D
     137 . S DR="1///"_$S(SEEN=2:2,CURR=1:1,1:0)_";Q;2"_$S(CURR=1:"///3",1:"")_";2.1///5;3//"_$S($P(^DG(43,1,"GL"),"^",2):"",1:"/")_$S($D(^DG(40.8,+$P(^DG(43,1,"GL"),"^",3),0)):$P(^(0),"^",1),1:"")_";4////"_DUZ
     138 ;
     139 ; ** end of VOE change 4 **
     140 ;
     141 D EL K DIC("A") N DGNDLOCK S DGNDLOCK=DIE_DFN1_")" L +@DGNDLOCK:2 G:'$T MSG D ^DIE L -@DGNDLOCK
     142 I $D(DTOUT) D  G Q
     143 .K DTOUT
     144 .N DA,DIK
     145 .S DA(1)=DFN,DA=DFN1,DIK="^DPT("_DFN_",""DIS"","
     146 .D ^DIK
     147 .W !!?5,"User Time-out.  Required registration data could be missing."
     148 .W !,?5,"This registration has been deleted."
     149 ; check whether facility applying to (division) is inactive
     150 I '$$DIVCHK^DGREGFAC(DFN,DFN1) G CONT
     151ASKDIV W !!?5,"The facility chosen either has no pointer to an Institution"
     152 W !?5,"file record or the Institution file record is inactive."
     153 W !?5,"Please choose another division."
     154 S DA=DFN1,DIE("NO^")="",DA(1)=DFN,DP=2.101,DR="3" D ^DIE
     155 I $$DIVCHK^DGREGFAC(DFN,DFN1) G ASKDIV
     156CONT ; continue
     157 S DGXXXD=1 D EL^DGREGE I $P(^DPT(DFN,"DIS",DFN1,0),"^",3)=4 S DA=DFN,DIE="^DPT(",DR=".368;.369" D ^DIE S DIE="^DPT("_DFN_",""DIS"",",DA(1)=DFN,DA=DFN1
     158 S DA=DFN,DR="[DGREG]",DIE="^DPT(" D ^DIE K DIE("NO^")
     159 I $D(^DPT(DFN,"DIS",DFN1,2)),$P(^(2),"^",1)="Y" S DIE="^DPT(",DR="[DG EMPLOYER]",DA=DFN D ^DIE
     160 G ^DGREG0
     161PR2 W !!,"You can only enter new registrations through this option.",$C(7),$C(7) G REG
     162PR3 W !!,"Time is required to register the patient.",!!,$C(7),$C(7) G REG
     163H W !?5,"Enter 'YES' to enter/edit registration data or 'NO' to continue." G A1
     164Q K DG,DQ G Q1^DGREG0
     165Q1 K DGIO,DGASKDEV,DGFC,DGCLRP,CURR,DGELVER,DGNEW Q
     166EL S DR=DR_";13//" I $D(^DPT(DFN,.36)),$D(^DIC(8,+^(.36),0)) S DR=DR_$P(^(0),"^",1) Q
     167 S DR=DR_"HUMANITARIAN EMERGENCY" Q
     168FEE S DGRPFEE=1 D DGREG K DGRPFEE G Q1
     169 ;
     170WARN I $S('$D(^DPT(DFN,.1)):0,$P(^(.1),"^",1)']"":0,1:1) W !,$C(7),"***PATIENT IS CURRENTLY AN INPATIENT***",! H 2
     171 I $S('$D(^DPT(DFN,.107)):0,$P(^(.107),"^",1)']"":0,1:1) W !,$C(7),"***PATIENT IS CURRENTLY A LODGER***",! H 2
     172 Q
     173MSG W !,"Another user is editing, try later ..." G Q
     174 ;
     175BEGINREG(DFN) ;
     176 ;Description: This is called at the beginning of the registration process.
     177 ;Concurrent processes can check the lock to determine if the patient is
     178 ;currently being registered.
     179 ;
     180 Q:'$G(DFN) 0
     181 I $$QRY^DGENQRY(DFN) W !!,"Enrollment/Eligibility Query sent ...",!!
     182 L +^TMP(DFN,"REGISTRATION IN PROGRESS"):1
     183 I $$LOCK^DGENPTA1(DFN) ;try to lock the patient record
     184 Q
     185 ;
     186ENDREG(DFN) ;
     187 ;Description: releases the lock obtained by calling BEGINREG.
     188 ;
     189 Q:'$G(DFN)
     190 L -^TMP(DFN,"REGISTRATION IN PROGRESS")
     191 D UNLOCK^DGENPTA1(DFN)
     192 Q
     193 ;
     194IFREG(DFN) ;
     195 ;Description: tests whether the lock set by BEGINREG is set
     196 ;
     197 ;Input:  DFN
     198 ;Output:
     199 ;      Function Value = 1 if lock is set, 0 otherwise
     200 ;
     201 N RETURN
     202 Q:'$G(DFN) 0
     203 L +^TMP(DFN,"REGISTRATION IN PROGRESS"):1
     204 S RETURN='$T
     205 L -^TMP(DFN,"REGISTRATION IN PROGRESS")
     206 Q RETURN
     207 Q
     208CIRN ;MPI QUERY
     209 ;check to see if CIRN PD/MPI is installed
     210 N X S X="MPIFAPI" X ^%ZOSF("TEST") Q:'$T
     211 K MPIFRTN
     212 D MPIQ^MPIFAPI(DFN)
     213 K MPIFRTN
     214 Q
     215ROMQRY ;
     216 I +$G(DGNEW) D
     217 . ; query LST for Patient Demographic Information if NEW patient and
     218 . ; file into patient's record.
     219 . N A
     220 . I $$ROMQRY^DGROAPI(DFN) D
     221 . . ;display busy message to interactive users
     222 . .S DGMSG(1)="Data retrieval from LST site has been completed successfully"
     223 . .S DGMSG(2)="Thank you for your patience."
     224 . .D EN^DDIOL(.DGMSG) R A:5
     225 . E  D
     226 . . ;display busy message to interactive users
     227 . .S DGMSG(1)="Data retrieval from LST site has not been successful."
     228 . .S DGMSG(2)="Please continue the Registration Process."
     229 . .D EN^DDIOL(.DGMSG) R A:5
     230 . ;
     231 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGREGAED.m

    r613 r623  
    1 DGREGAED        ;ALB/DW/PHH - Address Edit API; 1/5/2006  23:03 ;10/10/06  08:05
    2         ;;5.3;Registration;**522,560,658,730,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19 EN(DFN,FLG)     ;Entry point
    20         ;Input:
    21         ;  DFN (required) - Internal Entry # of Patient File (#2)
    22         ;  FLG (optional) - Flags of 1 or 0; if null, 0 is assumed. Details:
    23         ;    FLG(1) - if 1, let user edit phone numbers (field #.131 and #.132)
    24         ;    FLG(2) - if 1, display before & after address for user confirmation
    25         K EASZIPLK
    26         N DGINPUT
    27         N I,X,Y
    28         I $G(DFN)="" Q
    29         I ($G(DFN)'?.N) Q
    30         S FLG(1)=$G(FLG(1)),FLG(2)=$G(FLG(2))
    31         D INPUT(.DGINPUT,DFN)
    32         I $G(DGINPUT)=-1 Q
    33         I $G(FLG(2))=1 D COMPARE(.DGINPUT,DFN)
    34         I '$$CONFIRM() W !,"Change aborted." D EOP Q
    35         N DGPRIOR
    36         D GETPRIOR^DGADDUTL(DFN,.DGPRIOR)
    37         D SAVE(.DGINPUT,DFN)
    38         I +$G(DGNEW) Q
    39         Q:'$$FILEYN^DGADDUTL(.DGPRIOR,.DGINPUT)
    40         D GETUPDTS^DGADDUTL(DFN,.DGINPUT)
    41         D UPDADDLG^DGADDUTL(DFN,.DGPRIOR,.DGINPUT)
    42         Q
    43 INPUT(DGINPUT,DFN)      ;Let user input address changes
    44         ;Output: DGINPUT(field#)=external^internal(if any)
    45         N DIR,X,Y,DA,DGR,DTOUT,DUOUT,DIROUT,DGN,POP
    46         S POP=0
    47         ;
    48         ; ** VOE change 1 of 3: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
    49         ;
    50         ; .134 is new field ALTERNATE PHONE for VOE
    51         ;
    52         ; before change:
    53         ;
    54         ; F DGN=.111,.112,.113,.1112,.131,.132,.121 Q:POP  D
    55         ;
    56         ; after change:
    57         ;
    58         F DGN=.111,.112,.113,.1112,.131,.132,.134,.121 Q:POP  D
    59         . ;
    60         . ; end change
    61         . ;
    62         . I ($G(DGINPUT(.111))="")&((DGN=.112)!(DGN=.113)) Q
    63         . I ($G(DGINPUT(.112))="")&(DGN=.113) Q
    64         . I ($G(FLG(1))'=1)&((DGN=.131)!(DGN=.132)) Q
    65         . I DGN=.1112 D  Q
    66         .. D EN^DGREGAZL(.DGR,DFN)
    67         .. I $G(DGR)=-1 S POP=1 Q
    68         .. N DGM F DGM=.1112,.114,.115,.117 S DGINPUT(DGM)=$G(DGR(DGM))
    69         . ;
    70         . ; new line:
    71         . ;
    72         . I DGN=.134,$G(DUZ("AG"))'="E" Q
    73         . ;
    74         . ; ** end of VOE change 1 **
    75         . ;
    76 AGN     . S DIR(0)=2_","_DGN
    77         . S DA=DFN
    78         . D ^DIR
    79         . I $D(DTOUT) S POP=1 Q
    80         . I $D(DUOUT)!$D(DIROUT) D UPCT G AGN
    81         . I DGN'=.121 S DGINPUT(DGN)=$G(Y)
    82         . I DGN=.121 D
    83         .. I $P($G(Y),U)=$$GET1^DIQ(2,DFN_",",DGN,"I") D
    84         ... S DGINPUT(DGN)=$$GET1^DIQ(2,DFN_",",DGN)_U_$P($G(Y),U)
    85         .. I $P($G(Y),U)'=$$GET1^DIQ(2,DFN_",",DGN,"I") D
    86         ... S DGINPUT(DGN)=$P($G(Y(0)),U)_U_$G(Y)
    87         I $G(POP)=1 S DGINPUT=-1
    88         Q
    89 COMPARE(DGINPUT,DFN)    ;Display before & after address fields.
    90         N DGCURR,DGN,DGCMP,DGM,DGCNTY,DGCIEN,DGST
    91         D GETS^DIQ(2,DFN_",",".111;.112;.113;.114;.115;.117;.1112;.131;.132;.121","EI","DGCURR")
    92         ;
    93         ; ** VOE change 2 of 3: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
    94         ;
    95         ; for VOE agency code, add new ALTERNATE PHONE field (.134)
    96         ; to DGCMP("OLD") array
    97         ;
    98         ; before change:
    99         ;
    100         ; F DGN=.111,.112,.113,.114,.115,.117,.1112,.131,.132,.121 D
    101         ; . S DGCMP("OLD",DGN)=$G(DGCURR(2,DFN_",",DGN,"E"))
    102         ;
    103         ; after change:
    104         ;
    105         I $G(DUZ("AG"))="E" D GETS^DIQ(2,DFN,.134,"EI","DGCURR")
    106         F DGN=.111,.112,.113,.114,.115,.117,.1112,.131,.132,.134,.121 D
    107         . I $G(DUZ("AG"))'="E",DGN=.134 Q  ; skip for non-VOE
    108         . ;
    109         . ; ** end of VOE change 2 **
    110         . ;
    111         . S DGCMP("OLD",DGN)=$G(DGCURR(2,DFN_",",DGN,"E"))
    112         S DGCIEN=$G(DGCURR(2,DFN_",",.117,"I"))
    113         S DGST=$G(DGCURR(2,DFN_",",.115,"I"))
    114         S DGCNTY=$$CNTY^DGREGAZL(DGST,DGCIEN)
    115         I DGCNTY=-1 S DGCNTY=""
    116         S DGCMP("OLD",.117)=$P(DGCNTY,U)_" "_$P(DGCNTY,U,3)
    117         M DGCMP("NEW")=DGINPUT
    118         S DGCNTY=$P($G(DGCMP("NEW",.117)),U)_" "_$P($G(DGCMP("NEW",.117)),U,3)
    119         S DGCMP("NEW",.117)=DGCNTY
    120         I ($L(DGCMP("NEW",.1112))>5)&($P(DGCMP("NEW",.1112),"-",2)="") S DGCMP("NEW",.1112)=$E(DGCMP("NEW",.1112),1,5)_"-"_$E(DGCMP("NEW",.1112),6,9)
    121         F DGM="OLD","NEW" D
    122         . W !,?2,"[",DGM," ADDRESS]"
    123         . W ?16,$P($G(DGCMP(DGM,.111)),U)
    124         . I $P($G(DGCMP(DGM,.112)),U)'="" W !,?16,$P($G(DGCMP(DGM,.112)),U)
    125         . I $P($G(DGCMP(DGM,.113)),U)'="" W !,?16,$P($G(DGCMP(DGM,.113)),U)
    126         . W !,?16,$P($G(DGCMP(DGM,.114)),U)
    127         . W:($P($G(DGCMP(DGM,.114)),U)'="")!($P($G(DGCMP(DGM,.115)),U)'="") ","
    128         . W $P($G(DGCMP(DGM,.115)),U)
    129         . W " ",$G(DGCMP(DGM,.1112))
    130         . I $P($G(DGCMP(DGM,.117)),U)'="" W !,?6,"  County: ",$P($G(DGCMP(DGM,.117)),U)
    131         . I $G(FLG(1))=1 D
    132         .. W !,?6,"   Phone: ",?16,$P($G(DGCMP(DGM,.131)),U)
    133         .. W !,?6,"  Office: ",?16,$P($G(DGCMP(DGM,.132)),U)
    134         .. ;
    135         .. ; ** VOE change 3 of 3: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
    136         .. ;
    137         .. ; for VOE agency code, display new ALTERNATE PHONE field (.134)
    138         .. ;
    139         .. ; insert line:
    140         .. ;
    141         .. I $G(DUZ("AG"))="E" W !,?6," Alt Phone: ",?16,$P($G(DGCMP(DGM,.134)),U)
    142         .. ;
    143         .. ; ** end of VOE change 3 **
    144         .. ;
    145         . W !,?6,"Bad Addr: ",?16,$P($G(DGCMP(DGM,.121)),U)
    146         . W !
    147         Q
    148 CONFIRM()       ;Confirm if user wants to save the change
    149         N DIR,X,Y,DTOUT,DUOUT,DIROUT
    150         S DIR(0)="Y"
    151         S DIR("A")="Are you sure that you want to save the above changes"
    152         S DIR("?")="Please answer Y for YES or N for NO."
    153         D ^DIR
    154         I $D(DTOUT)!($G(Y)=0) Q 0
    155         I $D(DUOUT)!$D(DIROUT) Q 0
    156         Q 1
    157 SAVE(DGINPUT,DFN)       ;Save changes
    158         N DGN,DGER,DGM
    159         S DGER=0
    160         F DGN=.111,.112,.113,.131,.132,.1112,.114,.115,.117,.121 D
    161         . I ($G(FLG(1))'=1)&((DGN=.131)!(DGN=.132)) Q
    162         . N DGCODE,DGNAME,FDA,MSG
    163         . S DGCODE=$P($G(DGINPUT(DGN)),U,2)
    164         . S DGNAME=$P($G(DGINPUT(DGN)),U)
    165         . S FDA(2,DFN_",",DGN)=$S(DGCODE:DGCODE,1:DGNAME)
    166         . D FILE^DIE($S(DGCODE:"",1:"E"),"FDA","MSG")
    167         . I $D(MSG) D
    168         .. S DGM="",DGER=1
    169         .. W !,"Please review the saved changes!!",!
    170         .. F  S DGM=$O(MSG("DIERR",1,"TEXT",DGM)) Q:DGM=""  D
    171         ... W $G(MSG("DIERR",1,"TEXT",DGM))
    172         I $G(DGER)=0 W !,"Change saved."
    173         D EOP
    174         Q
    175 EOP     ;End of page prompt
    176         N DIR,DTOUT,DUOUT,DIROUT,X,Y
    177         S DIR(0)="E"
    178         S DIR("A")="Press ENTER to continue"
    179         D ^DIR
    180         Q
    181 UPCT    ;Indicate "^" or "^^" are unacceptable inputs.
    182         W !,"EXIT NOT ALLOWED ??"
    183         Q
     1DGREGAED ;ALB/DW/PHH - Address Edit API; 1/5/2006  23:03 ;10/10/06  08:05
     2 ;;5.3;Registration;**522,560,658,730,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19EN(DFN,FLG) ;Entry point
     20 ;Input:
     21 ;  DFN (required) - Internal Entry # of Patient File (#2)
     22 ;  FLG (optional) - Flags of 1 or 0; if null, 0 is assumed. Details:
     23 ;    FLG(1) - if 1, let user edit phone numbers (field #.131 and #.132)
     24 ;    FLG(2) - if 1, display before & after address for user confirmation
     25 K EASZIPLK
     26 N DGINPUT
     27 N I,X,Y
     28 I $G(DFN)="" Q
     29 I ($G(DFN)'?.N) Q
     30 S FLG(1)=$G(FLG(1)),FLG(2)=$G(FLG(2))
     31 D INPUT(.DGINPUT,DFN)
     32 I $G(DGINPUT)=-1 Q
     33 I $G(FLG(2))=1 D COMPARE(.DGINPUT,DFN)
     34 I '$$CONFIRM() W !,"Change aborted." D EOP Q
     35 N DGPRIOR
     36 D GETPRIOR^DGADDUTL(DFN,.DGPRIOR)
     37 D SAVE(.DGINPUT,DFN)
     38 I +$G(DGNEW) Q
     39 Q:'$$FILEYN^DGADDUTL(.DGPRIOR,.DGINPUT)
     40 D GETUPDTS^DGADDUTL(DFN,.DGINPUT)
     41 D UPDADDLG^DGADDUTL(DFN,.DGPRIOR,.DGINPUT)
     42 Q
     43INPUT(DGINPUT,DFN) ;Let user input address changes
     44 ;Output: DGINPUT(field#)=external^internal(if any)
     45 N DIR,X,Y,DA,DGR,DTOUT,DUOUT,DIROUT,DGN,POP
     46 S POP=0
     47 ;
     48 ; ** VOE change 1 of 3: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
     49 ;
     50 ; .134 is new field ALTERNATE PHONE for VOE
     51 ;
     52 ; before change:
     53 ;
     54 ; F DGN=.111,.112,.113,.1112,.131,.132,.121 Q:POP  D
     55 ;
     56 ; after change:
     57 ;
     58 F DGN=.111,.112,.113,.1112,.131,.132,.134,.121 Q:POP  D
     59 . ;
     60 . ; end change
     61 . ;
     62 . I ($G(DGINPUT(.111))="")&((DGN=.112)!(DGN=.113)) Q
     63 . I ($G(DGINPUT(.112))="")&(DGN=.113) Q
     64 . I ($G(FLG(1))'=1)&((DGN=.131)!(DGN=.132)) Q
     65 . I DGN=.1112 D  Q
     66 .. D EN^DGREGAZL(.DGR,DFN)
     67 .. I $G(DGR)=-1 S POP=1 Q
     68 .. N DGM F DGM=.1112,.114,.115,.117 S DGINPUT(DGM)=$G(DGR(DGM))
     69 . ;
     70 . ; new line:
     71 . ;
     72 . I DGN=.134,$G(DUZ("AG"))'="E" Q
     73 . ;
     74 . ; ** end of VOE change 1 **
     75 . ;
     76AGN . S DIR(0)=2_","_DGN
     77 . S DA=DFN
     78 . D ^DIR
     79 . I $D(DTOUT) S POP=1 Q
     80 . I $D(DUOUT)!$D(DIROUT) D UPCT G AGN
     81 . I DGN'=.121 S DGINPUT(DGN)=$G(Y)
     82 . I DGN=.121 D
     83 .. I $P($G(Y),U)=$$GET1^DIQ(2,DFN_",",DGN,"I") D
     84 ... S DGINPUT(DGN)=$$GET1^DIQ(2,DFN_",",DGN)_U_$P($G(Y),U)
     85 .. I $P($G(Y),U)'=$$GET1^DIQ(2,DFN_",",DGN,"I") D
     86 ... S DGINPUT(DGN)=$P($G(Y(0)),U)_U_$G(Y)
     87 I $G(POP)=1 S DGINPUT=-1
     88 Q
     89COMPARE(DGINPUT,DFN) ;Display before & after address fields.
     90 N DGCURR,DGN,DGCMP,DGM,DGCNTY,DGCIEN,DGST
     91 D GETS^DIQ(2,DFN_",",".111;.112;.113;.114;.115;.117;.1112;.131;.132;.121","EI","DGCURR")
     92 ;
     93 ; ** VOE change 2 of 3: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
     94 ;
     95 ; for VOE agency code, add new ALTERNATE PHONE field (.134)
     96 ; to DGCMP("OLD") array
     97 ;
     98 ; before change:
     99 ;
     100 ; F DGN=.111,.112,.113,.114,.115,.117,.1112,.131,.132,.121 D
     101 ; . S DGCMP("OLD",DGN)=$G(DGCURR(2,DFN_",",DGN,"E"))
     102 ;
     103 ; after change:
     104 ;
     105 I $G(DUZ("AG"))="E" D GETS^DIQ(2,DFN,.134,"EI","DGCURR")
     106 F DGN=.111,.112,.113,.114,.115,.117,.1112,.131,.132,.134,.121 D
     107 . I $G(DUZ("AG"))'="E",DGN=.134 Q  ; skip for non-VOE
     108 . ;
     109 . ; ** end of VOE change 2 **
     110 . ;
     111 . S DGCMP("OLD",DGN)=$G(DGCURR(2,DFN_",",DGN,"E"))
     112 S DGCIEN=$G(DGCURR(2,DFN_",",.117,"I"))
     113 S DGST=$G(DGCURR(2,DFN_",",.115,"I"))
     114 S DGCNTY=$$CNTY^DGREGAZL(DGST,DGCIEN)
     115 I DGCNTY=-1 S DGCNTY=""
     116 S DGCMP("OLD",.117)=$P(DGCNTY,U)_" "_$P(DGCNTY,U,3)
     117 M DGCMP("NEW")=DGINPUT
     118 S DGCNTY=$P($G(DGCMP("NEW",.117)),U)_" "_$P($G(DGCMP("NEW",.117)),U,3)
     119 S DGCMP("NEW",.117)=DGCNTY
     120 I ($L(DGCMP("NEW",.1112))>5)&($P(DGCMP("NEW",.1112),"-",2)="") S DGCMP("NEW",.1112)=$E(DGCMP("NEW",.1112),1,5)_"-"_$E(DGCMP("NEW",.1112),6,9)
     121 F DGM="OLD","NEW" D
     122 . W !,?2,"[",DGM," ADDRESS]"
     123 . W ?16,$P($G(DGCMP(DGM,.111)),U)
     124 . I $P($G(DGCMP(DGM,.112)),U)'="" W !,?16,$P($G(DGCMP(DGM,.112)),U)
     125 . I $P($G(DGCMP(DGM,.113)),U)'="" W !,?16,$P($G(DGCMP(DGM,.113)),U)
     126 . W !,?16,$P($G(DGCMP(DGM,.114)),U)
     127 . W:($P($G(DGCMP(DGM,.114)),U)'="")!($P($G(DGCMP(DGM,.115)),U)'="") ","
     128 . W $P($G(DGCMP(DGM,.115)),U)
     129 . W " ",$G(DGCMP(DGM,.1112))
     130 . I $P($G(DGCMP(DGM,.117)),U)'="" W !,?6,"  County: ",$P($G(DGCMP(DGM,.117)),U)
     131 . I $G(FLG(1))=1 D
     132 .. W !,?6,"   Phone: ",?16,$P($G(DGCMP(DGM,.131)),U)
     133 .. W !,?6,"  Office: ",?16,$P($G(DGCMP(DGM,.132)),U)
     134 .. ;
     135 .. ; ** VOE change 3 of 3: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 1/5/2006 **
     136 .. ;
     137 .. ; for VOE agency code, display new ALTERNATE PHONE field (.134)
     138 .. ;
     139 .. ; insert line:
     140 .. ;
     141 .. I $G(DUZ("AG"))="E" W !,?6," Alt Phone: ",?16,$P($G(DGCMP(DGM,.134)),U)
     142 .. ;
     143 .. ; ** end of VOE change 3 **
     144 .. ;
     145 . W !,?6,"Bad Addr: ",?16,$P($G(DGCMP(DGM,.121)),U)
     146 . W !
     147 Q
     148CONFIRM() ;Confirm if user wants to save the change
     149 N DIR,X,Y,DTOUT,DUOUT,DIROUT
     150 S DIR(0)="Y"
     151 S DIR("A")="Are you sure that you want to save the above changes"
     152 S DIR("?")="Please answer Y for YES or N for NO."
     153 D ^DIR
     154 I $D(DTOUT)!($G(Y)=0) Q 0
     155 I $D(DUOUT)!$D(DIROUT) Q 0
     156 Q 1
     157SAVE(DGINPUT,DFN) ;Save changes
     158 N DGN,DGER,DGM
     159 S DGER=0
     160 F DGN=.111,.112,.113,.131,.132,.1112,.114,.115,.117,.121 D
     161 . I ($G(FLG(1))'=1)&((DGN=.131)!(DGN=.132)) Q
     162 . N DGCODE,DGNAME,FDA,MSG
     163 . S DGCODE=$P($G(DGINPUT(DGN)),U,2)
     164 . S DGNAME=$P($G(DGINPUT(DGN)),U)
     165 . S FDA(2,DFN_",",DGN)=$S(DGCODE:DGCODE,1:DGNAME)
     166 . D FILE^DIE($S(DGCODE:"",1:"E"),"FDA","MSG")
     167 . I $D(MSG) D
     168 .. S DGM="",DGER=1
     169 .. W !,"Please review the saved changes!!",!
     170 .. F  S DGM=$O(MSG("DIERR",1,"TEXT",DGM)) Q:DGM=""  D
     171 ... W $G(MSG("DIERR",1,"TEXT",DGM))
     172 I $G(DGER)=0 W !,"Change saved."
     173 D EOP
     174 Q
     175EOP ;End of page prompt
     176 N DIR,DTOUT,DUOUT,DIROUT,X,Y
     177 S DIR(0)="E"
     178 S DIR("A")="Press ENTER to continue"
     179 D ^DIR
     180 Q
     181UPCT ;Indicate "^" or "^^" are unacceptable inputs.
     182 W !,"EXIT NOT ALLOWED ??"
     183 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGREGAZL.m

    r613 r623  
    1 DGREGAZL        ;ALB/DW - ZIP LINKING UTILITY ; 5/27/04 10:54am
    2         ;;5.3;Registration;**522,560,581,730,760**;Aug 13, 1993;Build 11
    3         ;
    4 EN(RESULT,DFN)  ;Let user edit zip+4, city, state, county based on zip-linking
    5         ; Output: RESULT(field#) = User Input External ^ Internal
    6         K RESULT
    7         N DGIND,DGTOT
    8         I $G(DFN)="" S RESULT=-1 Q
    9         N DGR,DGDFLT,DGALW,DGZIP,DGN
    10         S DGN=""
    11         I $$FOREIGN() D  Q
    12         . D FRGNEDT(.DGR,DFN)
    13         . I $G(DGR)=-1 S RESULT=-1 Q
    14         . F DGN=.1112,.114,.115,.117 S RESULT(DGN)=$G(DGR(DGN))
    15         S DGZIP=$$ZIP(DFN)
    16         I DGZIP=-1 S RESULT=-1 Q
    17         S RESULT(.1112)=DGZIP
    18         S DGIND=$$CITY(.DGR,DGZIP,DFN)
    19         I DGIND=$G(DGTOT)+1 S DGIND=""
    20         I $G(DGR)=-1 S RESULT=-1 Q
    21         S RESULT(.114)=$G(DGR)
    22         S DGALW=$$ALWEDT^DGREGDD1($G(DUZ),DGZIP)
    23         I DGALW=1 D
    24         . K DGR D STCNTY(.DGR,DGZIP,DFN,DGIND)
    25         . I $G(DGR)=-1 S RESULT=-1 Q
    26         . S RESULT(.115)=$G(DGR(.115))
    27         . S RESULT(.117)=$G(DGR(.117))
    28         I DGALW=0 D
    29         . I DGZIP'="" D LINK(.DGDFLT,DGZIP,1)
    30         . S RESULT(.115)=$G(DGDFLT(.115))
    31         . S RESULT(.117)=$G(DGDFLT(.117))
    32         Q
    33 ZIP(DFN)        ;Let user input zip+4
    34 ZAGN    N DIR,DTOUT,DUOUT,DIROUT,DGDATA
    35         S DIR(0)="2,.1112"
    36         S DA=DFN
    37         D ^DIR
    38         I $D(DTOUT) Q -1
    39         I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G ZAGN
    40         S DGZIP=$G(Y)
    41         ;allow bogus zip:
    42         I $D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) Q DGZIP
    43         I DGZIP="" Q DGZIP
    44         D POSTALB^XIPUTIL(DGZIP,.DGDATA)
    45          ;DG*730 - later commented out by DG*760
    46         ;I $G(DGDATA(1,"CITY ABBREVIATION"))'="",$G(DGDATA(1,"CITY ABBREVIATION"))=$G(DGDATA(2,"CITY")) S DGDATA=1 K DGDATA(2)
    47         I $D(DGDATA("ERROR")) D  G ZAGN
    48         . W $C(7)," ??"
    49         Q DGZIP
    50 CITY(RESULT,ZIP,DFN)    ;Base on zip, let user input city(#.114)
    51         ; Input:
    52         ;   ZIP - user input zip for the patient primary address
    53         ;   DFN - Interal entry number of Patient File (#2)
    54         ; Output:RESULT=-1 (input error or timed or ^ out)
    55         ;        or    =user input city
    56         ;        Array index # of selected city.
    57         K RESULT
    58         N DGDATA,DIR,DA,Y,DTOUT,DUOUT,DIROUT,DGIND
    59         N DGCITY,DGST,DGCNTY,DGABRV,DGN,DGECH,DGSOC
    60         N DOLDCITY,DGSAME,DGELEVEN
    61         ; DG*760 brought in DGCITI
    62         N DGCITI
    63         S DGIND=""
    64         D POSTALB^XIPUTIL(ZIP,.DGDATA)
    65         ;DG*730 - later commented out by DG*760
    66         ;I $G(DGDATA(1,"CITY ABBREVIATION"))'="",$G(DGDATA(1,"CITY ABBREVIATION"))=$G(DGDATA(2,"CITY")) S DGDATA=1 K DGDATA(2)
    67         D FIELD^DID(2,.114,"N","LABEL","DGCITY")
    68         S DGN=""
    69         I '$D(DGDATA("ERROR")) D
    70         . S DOLDCITY=$$GET1^DIQ(2,DFN_",",.114)
    71         . S DGSAME=0
    72         . F  S DGN=$O(DGDATA(DGN)) Q:DGN=""  D
    73         .. S DGCITI=$P($G(DGDATA(DGN,"CITY")),"*",1)
    74         .. S DGABRV=$G(DGDATA(DGN,"CITY ABBREVIATION"))
    75         .. I DOLDCITY'="",DGCITI=DOLDCITY!(DGABRV=DOLDCITY) S DGSAME=1
    76         .. ; next 4 commented out lines done by DG*760
    77         .. ;I DGABRV="" S DGABRV=$P($G(DGDATA(DGN,"CITY")),"*",1)
    78         .. ;I DOLDCITY'="",DGABRV=DOLDCITY S DGSAME=1
    79         .. ;I $G(DGDATA(DGN,"CITY"))["*" S:DGABRV'="" DGABRV=DGABRV_"*"
    80         .. I $G(DGDATA(DGN,"CITY"))["*" S DGCITI=DGCITI_"*"
    81         .. ;S DGECH=DGN_":"_DGABRV
    82         .. S DGECH=DGN_":"_DGCITI
    83         .. S DGSOC=$S($G(DGSOC)="":DGECH,1:DGSOC_";"_DGECH)
    84         .. S DGTOT=DGN
    85         .I 'DGSAME S DGELEVEN=$G(^DPT(DFN,.11)) D
    86         ..Q:$P(DGELEVEN,U,6)'=$G(DGDATA(DGTOT,"POSTAL CODE"))
    87         ..Q:$P(DGELEVEN,U,14)'="VAMC"
    88         ..Q:$P(DGELEVEN,U,15)'=$$GETSITE^DGMTU4($G(DUZ))
    89         ..Q:$P(DGELEVEN,U,17)'>.5
    90         ..S DGN=DGTOT+1,DGECH=DGN_":"_DOLDCITY,DGSOC=DGSOC_";"_DGECH
    91         .;
    92         . I $D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) D
    93         .. S DGSOC=$G(DGSOC)_";"_99_":"_"FREE TEXT"
    94         . S DIR(0)="SO^"_$G(DGSOC)
    95         . ;if zip '= zip on file, default = ""; else default=city on file
    96         . ;I ($G(DFN)'="")&($E(ZIP,1,5)=$$GET1^DIQ(2,DFN_",",.116)) D
    97         . S DIR("B")=$$GET1^DIQ(2,DFN_",",.114)
    98         . S DIR("A")=$G(DGCITY("LABEL"))
    99 CAGN1   . D ^DIR
    100         . I $D(DTOUT) S RESULT=-1 Q
    101         . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G CAGN1
    102         . S RESULT=$P($G(Y(0)),"*")
    103         . S DGIND=$G(Y)
    104         I ($G(Y)=99)!($D(DGDATA("ERROR"))) D
    105 CAGN2   . I '$D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) Q
    106         . N DIR,X,Y
    107         . S DIR(0)="2,.114"
    108         . S DA=DFN
    109         . D ^DIR
    110         . I $D(DTOUT) S RESULT=-1 Q
    111         . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G CAGN2
    112         . S RESULT=$G(Y)
    113         I $L($G(RESULT))>15 D
    114         . S DGN=Y
    115         . S RESULT=$G(DGDATA(DGN,"CITY ABBREVIATION"))
    116         Q DGIND
    117         ;
    118 LINK(RESULT,ZIP,DGN)    ;From zip, get the linked state,county
    119         K RESULT
    120         N DGDATA,CNTYIEN
    121         S CNTYIEN=""
    122         S DGN=$G(DGN)
    123         I (DGN="")&($$MLT^DGREGDD1(ZIP)) S DGN=1
    124         I (DGN=99)&($$MLT^DGREGDD1(ZIP)) S DGN=1
    125         I (DGN="")!(DGN=99) Q
    126         D POSTALB^XIPUTIL(ZIP,.DGDATA)
    127         S:$G(DGDATA(DGN,"STATE POINTER"))'="" CNTYIEN=$$FIND1^DIC(5.01,","_$G(DGDATA(DGN,"STATE POINTER"))_",","MOXQ",$E($G(DGDATA(DGN,"FIPS CODE")),3,5),"C")
    128         D:'CNTYIEN  ;could be duplicate county codes in subfile #5.01
    129         .Q:'$D(^DIC(5,+$G(DGDATA(DGN,"STATE POINTER")),1))
    130         .Q:$E($G(DGDATA(DGN,"FIPS CODE")),3,5)=""
    131         .S CNTYIEN=$O(^DIC(5,$G(DGDATA(DGN,"STATE POINTER")),1,"C",$E($G(DGDATA(DGN,"FIPS CODE")),3,5),""))
    132         S RESULT(.115)=$G(DGDATA(DGN,"STATE"))_U_$G(DGDATA(DGN,"STATE POINTER"))
    133         S RESULT(.117)=$G(DGDATA(DGN,"COUNTY"))_U_$G(CNTYIEN)_U_$E($G(DGDATA(DGN,"FIPS CODE")),3,5)
    134         Q
    135         ;
    136 STCNTY(RESULT,ZIP,DFN,DGNUM)    ;Based on zip,input state (#.115) and county (#.117)
    137         K RESULT
    138         S DGNUM=$G(DGNUM)
    139         N DGN,DGDFLT,DGST,POP,DIR,X,Y,DTOUT,DUOUT,DIROUT
    140         S POP=0
    141         D LINK(.DGDFLT,ZIP,DGNUM)
    142         F DGN=.115,.117 Q:POP  D
    143 SCAGN   . I DGN=.115 S DIR(0)=2_","_DGN
    144         . I ($G(DGST)="")&(DGN=.117) Q
    145         . I DGN=.117 S DIR(0)="POA^DIC(5,DGST,1,:AEMQ"
    146         . S DIR("B")=$P($G(DGDFLT(DGN)),U)
    147         . D ^DIR
    148         . I $D(DTOUT) S POP=1 Q
    149         . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G SCAGN
    150         . S RESULT(DGN)=$P($G(Y),U,2)_U_$P($G(Y),U)
    151         . I DGN=.115 S DGST=$P($G(Y),U)
    152         . I DGN=.117 S RESULT(.117)=$$CNTY(DGST,$P($G(RESULT(.117)),U,2))
    153         I POP=1 S RESULT=-1
    154         Q
    155 CNTY(DGST,DGCIEN)       ;Return county name and code
    156         ;Input:state number and county IEN
    157         ;Output: CountyName^CountyIEN^CountyCode
    158         I ($G(DGST)="")!($G(DGCIEN)="") S RESULT=-1 Q RESULT
    159         N DGR,RESULT
    160         S DGR=$G(^DIC(5,DGST,1,DGCIEN,0))
    161         S RESULT=$P($G(DGR),U)_U_DGCIEN_U_$P($G(DGR),U,3)
    162         Q RESULT
    163 FOREIGN()       ;Manila (Philippines) doesn't need zip linking.
    164         ;Output: 1 - area need no zip linking
    165         ;        0 - zip-linking area
    166         I $$STA^XUAF4(+$$KSP^XUPARAM("INST"))=358 Q 1
    167         ;;;I $$STA^XUAF4(+$$KSP^XUPARAM("INST"))=500 Q 1 ;;HERE TEST
    168         Q 0
    169 FRGNEDT(DGINPUT,DFN)    ;Edit zip+4, city, state, county for no zip-linking area
    170         K DGINPUT
    171         N DGN,DIR,DTOUT,DUOUT,DIROUT,X,Y,POP,DGST
    172         S POP=0
    173         F DGN=.1112,.114,.115,.117 Q:POP  D
    174 FAGN    . I ($G(DGST)="")&(DGN=.117) Q
    175         . S DIR(0)=2_","_DGN
    176         . I DGN=.117 D
    177         .. S DIR(0)="POA^DIC(5,DGST,1,:AEMQ"
    178         .. S DIR("B")=$$GET1^DIQ(2,DFN_",",.117)
    179         . I DGN'=.117 S DA=DFN
    180         . D ^DIR
    181         . I $D(DTOUT) S POP=1 Q
    182         . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G FAGN
    183         . I (DGN=.114)!(DGN=.1112) S DGINPUT(DGN)=$G(Y)
    184         . I (DGN=.115) D
    185         .. S DGST=$P($G(Y),U)
    186         .. I DGST=$$GET1^DIQ(2,DFN_",",.115,"I") D
    187         ... S DGINPUT(.115)=$$GET1^DIQ(2,DFN_",",.115)_U_DGST
    188         .. I DGST'=$$GET1^DIQ(2,DFN_",",.115,"I") D
    189         ... S DGINPUT(.115)=$P($G(Y(0)),U)_U_DGST
    190         . I DGN=.117 S DGINPUT(DGN)=$P($G(Y),U,2)_U_$P($G(Y),U)
    191         I POP=1 S RESULT=-1
    192         Q
     1DGREGAZL ;ALB/DW - ZIP LINKING UTILITY ; 5/27/04 10:54am
     2 ;;5.3;Registration;**522,560,581,730**;Aug 13, 1993;Build 2
     3 ;
     4EN(RESULT,DFN) ;Let user edit zip+4, city, state, county based on zip-linking
     5 ; Output: RESULT(field#) = User Input External ^ Internal
     6 K RESULT
     7 N DGIND,DGTOT
     8 I $G(DFN)="" S RESULT=-1 Q
     9 N DGR,DGDFLT,DGALW,DGZIP,DGN
     10 S DGN=""
     11 I $$FOREIGN() D  Q
     12 . D FRGNEDT(.DGR,DFN)
     13 . I $G(DGR)=-1 S RESULT=-1 Q
     14 . F DGN=.1112,.114,.115,.117 S RESULT(DGN)=$G(DGR(DGN))
     15 S DGZIP=$$ZIP(DFN)
     16 I DGZIP=-1 S RESULT=-1 Q
     17 S RESULT(.1112)=DGZIP
     18 S DGIND=$$CITY(.DGR,DGZIP,DFN)
     19 I DGIND=$G(DGTOT)+1 S DGIND=""
     20 I $G(DGR)=-1 S RESULT=-1 Q
     21 S RESULT(.114)=$G(DGR)
     22 S DGALW=$$ALWEDT^DGREGDD1($G(DUZ),DGZIP)
     23 I DGALW=1 D
     24 . K DGR D STCNTY(.DGR,DGZIP,DFN,DGIND)
     25 . I $G(DGR)=-1 S RESULT=-1 Q
     26 . S RESULT(.115)=$G(DGR(.115))
     27 . S RESULT(.117)=$G(DGR(.117))
     28 I DGALW=0 D
     29 . I DGZIP'="" D LINK(.DGDFLT,DGZIP,1)
     30 . S RESULT(.115)=$G(DGDFLT(.115))
     31 . S RESULT(.117)=$G(DGDFLT(.117))
     32 Q
     33ZIP(DFN) ;Let user input zip+4
     34ZAGN N DIR,DTOUT,DUOUT,DIROUT,DGDATA
     35 S DIR(0)="2,.1112"
     36 S DA=DFN
     37 D ^DIR
     38 I $D(DTOUT) Q -1
     39 I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G ZAGN
     40 S DGZIP=$G(Y)
     41 ;allow bogus zip:
     42 I $D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) Q DGZIP
     43 I DGZIP="" Q DGZIP
     44 D POSTALB^XIPUTIL(DGZIP,.DGDATA)
     45  ;DG*730
     46 I $G(DGDATA(1,"CITY ABBREVIATION"))'="",$G(DGDATA(1,"CITY ABBREVIATION"))=$G(DGDATA(2,"CITY")) S DGDATA=1 K DGDATA(2)
     47 I $D(DGDATA("ERROR")) D  G ZAGN
     48 . W $C(7)," ??"
     49 Q DGZIP
     50CITY(RESULT,ZIP,DFN) ;Base on zip, let user input city(#.114)
     51 ; Input:
     52 ;   ZIP - user input zip for the patient primary address
     53 ;   DFN - Interal entry number of Patient File (#2)
     54 ; Output:RESULT=-1 (input error or times or ^ out)
     55 ;        or    =user input city
     56 ;        Array index # of selected city.
     57 K RESULT
     58 N DGDATA,DIR,DA,Y,DTOUT,DUOUT,DIROUT,DGIND
     59 N DGCITY,DGST,DGCNTY,DGABRV,DGN,DGECH,DGSOC
     60 N DOLDCITY,DGSAME,DGELEVEN
     61 S DGIND=""
     62 D POSTALB^XIPUTIL(ZIP,.DGDATA)
     63 ;DG*730
     64 I $G(DGDATA(1,"CITY ABBREVIATION"))'="",$G(DGDATA(1,"CITY ABBREVIATION"))=$G(DGDATA(2,"CITY")) S DGDATA=1 K DGDATA(2)
     65 D FIELD^DID(2,.114,"N","LABEL","DGCITY")
     66 S DGN=""
     67 I '$D(DGDATA("ERROR")) D
     68 . S DOLDCITY=$$GET1^DIQ(2,DFN_",",.114)
     69 . S DGSAME=0
     70 . F  S DGN=$O(DGDATA(DGN)) Q:DGN=""  D
     71 .. S DGABRV=$G(DGDATA(DGN,"CITY ABBREVIATION"))
     72 .. I DOLDCITY'="",DGABRV=DOLDCITY S DGSAME=1
     73 .. I DGABRV="" S DGABRV=$P($G(DGDATA(DGN,"CITY")),"*",1)
     74 .. I DOLDCITY'="",DGABRV=DOLDCITY S DGSAME=1
     75 .. I $G(DGDATA(DGN,"CITY"))["*" S:DGABRV'="" DGABRV=DGABRV_"*"
     76 .. S DGECH=DGN_":"_DGABRV
     77 .. S DGSOC=$S($G(DGSOC)="":DGECH,1:DGSOC_";"_DGECH)
     78 .. S DGTOT=DGN
     79 .I 'DGSAME S DGELEVEN=$G(^DPT(DFN,.11)) D
     80 ..Q:$P(DGELEVEN,U,6)'=$G(DGDATA(DGTOT,"POSTAL CODE"))
     81 ..Q:$P(DGELEVEN,U,14)'="VAMC"
     82 ..Q:$P(DGELEVEN,U,15)'=$$GETSITE^DGMTU4($G(DUZ))
     83 ..Q:$P(DGELEVEN,U,17)'>.5
     84 ..S DGN=DGTOT+1,DGECH=DGN_":"_DOLDCITY,DGSOC=DGSOC_";"_DGECH
     85 .;
     86 . I $D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) D
     87 .. S DGSOC=$G(DGSOC)_";"_99_":"_"FREE TEXT"
     88 . S DIR(0)="SO^"_$G(DGSOC)
     89 . ;if zip '= zip on file, default = ""; else default=city on file
     90 . ;I ($G(DFN)'="")&($E(ZIP,1,5)=$$GET1^DIQ(2,DFN_",",.116)) D
     91 . S DIR("B")=$$GET1^DIQ(2,DFN_",",.114)
     92 . S DIR("A")=$G(DGCITY("LABEL"))
     93CAGN1 . D ^DIR
     94 . I $D(DTOUT) S RESULT=-1 Q
     95 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G CAGN1
     96 . S RESULT=$P($G(Y(0)),"*")
     97 . S DGIND=$G(Y)
     98 I ($G(Y)=99)!($D(DGDATA("ERROR"))) D
     99CAGN2 . I '$D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) Q
     100 . N DIR,X,Y
     101 . S DIR(0)="2,.114"
     102 . S DA=DFN
     103 . D ^DIR
     104 . I $D(DTOUT) S RESULT=-1 Q
     105 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G CAGN2
     106 . S RESULT=$G(Y)
     107 I $L($G(RESULT))>15 S RESULT=$E(RESULT,1,15)
     108 Q DGIND
     109 ;
     110LINK(RESULT,ZIP,DGN) ;From zip, get the linked state,county
     111 K RESULT
     112 N DGDATA,CNTYIEN
     113 S CNTYIEN=""
     114 S DGN=$G(DGN)
     115 I (DGN="")&($$MLT^DGREGDD1(ZIP)) S DGN=1
     116 I (DGN=99)&($$MLT^DGREGDD1(ZIP)) S DGN=1
     117 I (DGN="")!(DGN=99) Q
     118 D POSTALB^XIPUTIL(ZIP,.DGDATA)
     119 S:$G(DGDATA(DGN,"STATE POINTER"))'="" CNTYIEN=$$FIND1^DIC(5.01,","_$G(DGDATA(DGN,"STATE POINTER"))_",","MOXQ",$E($G(DGDATA(DGN,"FIPS CODE")),3,5),"C")
     120 D:'CNTYIEN  ;could be duplicate county codes in subfile #5.01
     121 .Q:'$D(^DIC(5,+$G(DGDATA(DGN,"STATE POINTER")),1))
     122 .Q:$E($G(DGDATA(DGN,"FIPS CODE")),3,5)=""
     123 .S CNTYIEN=$O(^DIC(5,$G(DGDATA(DGN,"STATE POINTER")),1,"C",$E($G(DGDATA(DGN,"FIPS CODE")),3,5),""))
     124 S RESULT(.115)=$G(DGDATA(DGN,"STATE"))_U_$G(DGDATA(DGN,"STATE POINTER"))
     125 S RESULT(.117)=$G(DGDATA(DGN,"COUNTY"))_U_$G(CNTYIEN)_U_$E($G(DGDATA(DGN,"FIPS CODE")),3,5)
     126 Q
     127 ;
     128STCNTY(RESULT,ZIP,DFN,DGNUM) ;Based on zip,input state (#.115) and county (#.117)
     129 K RESULT
     130 S DGNUM=$G(DGNUM)
     131 N DGN,DGDFLT,DGST,POP,DIR,X,Y,DTOUT,DUOUT,DIROUT
     132 S POP=0
     133 D LINK(.DGDFLT,ZIP,DGNUM)
     134 F DGN=.115,.117 Q:POP  D
     135SCAGN . I DGN=.115 S DIR(0)=2_","_DGN
     136 . I ($G(DGST)="")&(DGN=.117) Q
     137 . I DGN=.117 S DIR(0)="POA^DIC(5,DGST,1,:AEMQ"
     138 . S DIR("B")=$P($G(DGDFLT(DGN)),U)
     139 . D ^DIR
     140 . I $D(DTOUT) S POP=1 Q
     141 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G SCAGN
     142 . S RESULT(DGN)=$P($G(Y),U,2)_U_$P($G(Y),U)
     143 . I DGN=.115 S DGST=$P($G(Y),U)
     144 . I DGN=.117 S RESULT(.117)=$$CNTY(DGST,$P($G(RESULT(.117)),U,2))
     145 I POP=1 S RESULT=-1
     146 Q
     147CNTY(DGST,DGCIEN) ;Return county name and code
     148 ;Input:state number and county IEN
     149 ;Output: CountyName^CountyIEN^CountyCode
     150 I ($G(DGST)="")!($G(DGCIEN)="") S RESULT=-1 Q RESULT
     151 N DGR,RESULT
     152 S DGR=$G(^DIC(5,DGST,1,DGCIEN,0))
     153 S RESULT=$P($G(DGR),U)_U_DGCIEN_U_$P($G(DGR),U,3)
     154 Q RESULT
     155FOREIGN() ;Manila (Philippines) doesn't need zip linking.
     156 ;Output: 1 - area need no zip linking
     157 ;        0 - zip-linking area
     158 I $$STA^XUAF4(+$$KSP^XUPARAM("INST"))=358 Q 1
     159 ;;;I $$STA^XUAF4(+$$KSP^XUPARAM("INST"))=500 Q 1 ;;HERE TEST
     160 Q 0
     161FRGNEDT(DGINPUT,DFN) ;Edit zip+4, city, state, county for no zip-linking area
     162 K DGINPUT
     163 N DGN,DIR,DTOUT,DUOUT,DIROUT,X,Y,POP,DGST
     164 S POP=0
     165 F DGN=.1112,.114,.115,.117 Q:POP  D
     166FAGN . I ($G(DGST)="")&(DGN=.117) Q
     167 . S DIR(0)=2_","_DGN
     168 . I DGN=.117 D
     169 .. S DIR(0)="POA^DIC(5,DGST,1,:AEMQ"
     170 .. S DIR("B")=$$GET1^DIQ(2,DFN_",",.117)
     171 . I DGN'=.117 S DA=DFN
     172 . D ^DIR
     173 . I $D(DTOUT) S POP=1 Q
     174 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G FAGN
     175 . I (DGN=.114)!(DGN=.1112) S DGINPUT(DGN)=$G(Y)
     176 . I (DGN=.115) D
     177 .. S DGST=$P($G(Y),U)
     178 .. I DGST=$$GET1^DIQ(2,DFN_",",.115,"I") D
     179 ... S DGINPUT(.115)=$$GET1^DIQ(2,DFN_",",.115)_U_DGST
     180 .. I DGST'=$$GET1^DIQ(2,DFN_",",.115,"I") D
     181 ... S DGINPUT(.115)=$P($G(Y(0)),U)_U_DGST
     182 . I DGN=.117 S DGINPUT(DGN)=$P($G(Y),U,2)_U_$P($G(Y),U)
     183 I POP=1 S RESULT=-1
     184 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRP1.m

    r613 r623  
    1 DGRP1   ;ALB/MRL - DEMOGRAPHIC DATA ;1/8/07  09:14
    2         ;;5.3;Registration;**109,161,506,244,546,570,629,638,649,700,653,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19         ;
    20         ; 2005 03 18 (VA/JT): DG*5.3*629, stop Missing Patient message based
    21         ; on questionable data in Missing Person Date fld (.153).
    22         ;
    23         ; 2005 04 25? (VA/MRY): DG*5.3*638, add Sex to IDs shown.
    24         ;
    25         ; 2005 04 27 (VA/JT): DG*5.3*649, change last $EXTRACT for Alias SSN in
    26         ; GETNCAL to 10 chars instead of 9, to preserve trailing P for pseudo-
    27         ; SSNs.
    28         ;
    29         ; 2006 04 21 (WV/TOAD, after DAOU/WCJ (2005 02 07) and
    30         ; VA/CJS (2005/12/23)): restore 6-part VOE change; space dots and
    31         ; semi-colons.
    32         ;
    33         ; 2006 05 09 (WV/TOAD): rewrite VOE change to fix bugs introduced by
    34         ; VA and VOE, and completely refactor bug-prone GETNCAL, and merge back
    35         ; into main subroutine body.
    36         ;
    37 EN      S (DGRPS,DGRPW)=1 D H^DGRPU F I=0,.11,.121,.13,.15,.24,57,"SSN" S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
    38         I $P(DGRP(.15),"^",2)]"" S Z="APPLICANT IS LISTED AS 'INELIGIBLE' FOR TREATMENT!",DGRPCM=1 D WW^DGRPV S DGRPCM=0
    39         ;I $P(DGRP(.15),"^",3)]"" S Z="APPLICANT IS LISTED AS 'MISSING'.  NOTIFY APPROPRIATE PERSONNEL!",DGRPCM=1 D WW^DGRPV S DGRPCM=0
    40         ;
    41         ; ** VOE change 1 of 3 **
    42         ;
    43         ; if EHR agency code, display Registration Date (Date Entered into
    44         ; File, .097)
    45         ;
    46         ; new lines:
    47         I $G(DUZ("AG"))="E" D
    48         . W !?58,"Reg Dt: ",$$FMTE^XLFDT($P(DGRP(0),U,16),"2D")
    49         ;
    50         ;
    51         ; show field groups 1 and 2 in two columns
    52         ;
    53         ; field groups 1 & 2 part 1: show Name, SSN, and DOB
    54         ;
    55         ;
    56         ; ** end of VOE change 1 **
    57         ;
    58         W ! S Z=1 D WW^DGRPV W "    Name: " S Z=$P(DGRP(0),"^",1),Z1=31 D WW1^DGRPV
    59         W "SS: " S X=$P(DGRP(0),"^",9),Z=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10),Z1=13 D WW1^DGRPV
    60         W ! S Z="",Z1=8 D WW1^DGRPV S Y=$P(DGRP(0),"^",3) X ^DD("DD") W "DOB: ",Y
    61         ;add Pseudo SSN Reason - DG*5.3*653, ERC
    62         I $P(DGRP(0),U,9)["P" D
    63         . N DGSPACE
    64         . S DGSPACE=10-$L(Y) ;adjust to maintain spacing on screen
    65         . S Z1=12+DGSPACE D WW1^DGRPV W "PSSN Reason: "
    66         . I $P(DGRP(0),U,9)["P" D
    67         . . N DGREAS D SSNREAS(.DGREAS)
    68         . . Q:$G(DGREAS)']""
    69         . . W DGREAS
    70         ;
    71         ; ** VOE change 2 of 3 **
    72         ;
    73         ; eliminate unnecessary subroutine GETNCAL and merge code back into
    74         ; the main subroutine, and make the following changes:
    75         ;
    76         ; For EHR or IHS agency code, show Health Record No. (.02) for the
    77         ; current Facility from the Health Record No. multiple field
    78         ; (4101/9000001.41) of the IHS Patient file (9000001) for the current
    79         ; patient.
    80         ;
    81         ; Move Sex field over so it shows up in the same location for
    82         ; VA, IHS, and EHR, leaving a blank for where HRN can appear.
    83         ;
    84         ; Fix the VA bug in which patients having five valid aliases
    85         ; were showing "< More alias entries on file >" instead of the fifth
    86         ; alias.
    87         ;
    88         ; Refactor entire subroutine: clean original design was broken
    89         ; by patching and had become fragile and confusing; tighten variable
    90         ; scopes, use clearer names, comment.
    91         ;
    92         ; before:
    93         ;
    94         ; D GETNCAL  ;Display name component, sex, and alias information
    95         ;
    96         ; after:
    97         ;
    98         ; field groups 1 & 2 part 2: load name components
    99         ;
    100         ;
    101         N DGLABEL S DGLABEL="^ Given^Middle^Prefix^Suffix^Degree" ; labels
    102         N DGCOMP S DGCOMP=+$G(^DPT(DFN,"NAME"))_"," ; Name Components fd (1.01)
    103         I DGCOMP D GETS^DIQ(20,DGCOMP,"1:6",,"DGCOMP") ; Name Components file
    104         ; loads Family (Last) Name (1), Given (First) Name (2),
    105         ; Middle Name (3), Prefix (4), Suffix (5), and Degree (6)
    106         ;
    107         ;
    108         ; field groups 1 & 2 part 3: load aliases
    109         ;
    110         ;
    111         N DGCOUNT S DGCOUNT=0 ; how many aliases do we find
    112         N DGALIAS S DGALIAS=0 ; IEN of Alias subfile (1/2.01) of Patient fl (2)
    113         ;                       and array of aliases found
    114         S DGALIAS=0 F  D  Q:'DGALIAS
    115         . ;
    116         . S DGALIAS=$O(^DPT(DFN,.01,DGALIAS))
    117         . Q:'DGALIAS  ; out of alias subrecords
    118         . N DGNODE S DGNODE=$G(^DPT(DFN,.01,DGALIAS,0)) ; 0-node of subrecord
    119         . Q:'$L(DGNODE)  ; bad node
    120         . ;
    121         . S DGCOUNT=DGCOUNT+1 ; another valid alias
    122         . I DGCOUNT=6 S DGALIAS=0 Q  ; can't show > 5, need to know if 6 or >
    123         . ;
    124         . S DGALIAS(DGCOUNT)=$P(DGNODE,U) ; Alias fld (.01)
    125         . ;
    126         . N DGSSN S DGSSN=$P(DGNODE,U,2) ; Alias SSN fld (1)
    127         . I $L(DGSSN) D
    128         . . S DGSSN=" "_$E(DGSSN,1,3)_"-"_$E(DGSSN,4,5)_"-"_$E(DGSSN,6,10)
    129         . . ; incl leading space to separate from alias name
    130         . . ; incl 10 chars to allow for P of pseudo-SSNs
    131         . . S $E(DGALIAS(DGCOUNT),20)=DGSSN ; truncate alias name & append SSN
    132         . ;
    133         . S DGALIAS(DGCOUNT)=$E(DGALIAS(DGCOUNT),1,32) ; truncate alias
    134         ;
    135         I DGCOUNT=0 S DGALIAS(1)="< No alias entries on file >"
    136         I DGCOUNT=6 S DGALIAS(5)="< More alias entries on file >"
    137         K DGCOUNT
    138         ;
    139         ;
    140         ; field groups 1 & 2 part 4: show 1st name component, and IDs HRN & Sex
    141         ;
    142         ;
    143         W !?5,"Family: "
    144         W $E($G(DGCOMP(20,DGCOMP,1)),1,27)
    145         ;
    146         I "EI"[$G(DUZ("AG")),$G(DUZ(2)) D
    147         . N DGNODE S DGNODE=$G(^AUPNPAT(DFN,41,DUZ(2),0)) ; get 0-node for the
    148         . ; current Facility from the Health Record No. multiple field
    149         . ; (4101/9000001.41) for DFN in the IHS Patient file (9000001)
    150         . N DGHRN S DGHRN=$P(DGNODE,U,2) ; Health Record No. (.02)
    151         . W ?42," HRN: ",DGHRN
    152         ;
    153         D
    154         . N DGSEX S DGSEX=$P(DGRP(0),U,2) ; Sex fld (.02) of Patient file (2)
    155         . W ?61,"Sex: ",$S(DGSEX="M":"MALE",DGSEX="F":"FEMALE",1:"UNANSWERED")
    156         ;
    157         ;
    158         ; field groups 1 & 2 part 5: show remaining name components and aliases
    159         ;
    160         ;
    161         N DGCOUNT F DGCOUNT=2:1:6 D
    162         . W !?5,$P(DGLABEL,U,DGCOUNT),": "
    163         . N DGNAME S DGNAME=$G(DGCOMP(20,DGCOMP,DGCOUNT)) ; next name component
    164         . W $E(DGNAME,1,$S(DGCOUNT=2:23,1:27)) ; 1st line leaves room for "[2]"
    165         . I DGCOUNT=2 D  ; header for aliases
    166         . . W ?37 N DGRPW,Z S DGRPW=0,Z=2 D WW^DGRPV ; write [2], suppress LF
    167         . . W " Alias: "
    168         . W ?47,$G(DGALIAS(DGCOUNT-1)) ; show next alias
    169         ;
    170         ;
    171         ; show field group 3: remarks
    172         ;
    173         ;
    174         ; ** end of VOE change 2 **
    175         ;
    176         S Z=3,DGRPX=DGRP(0) D WW^DGRPV W " Remarks: ",$S($P(DGRPX,"^",10)]"":$E($P(DGRPX,"^",10),1,65),1:"NO REMARKS ENTERED FOR THIS PATIENT") S DGAD=.11,(DGA1,DGA2)=1 D A^DGRPU I $P(DGRP(.121),"^",9)="Y" S DGAD=.121,DGA1=1,DGA2=2 D A^DGRPU
    177         S Z=4 D WW^DGRPV W " Permanent Address: " S Z=" ",Z1=17
    178         D WW1^DGRPV S Z=5,DGRPW=0 D WW^DGRPV W " Temporary Address: "
    179         W !?11
    180         S Z1=40,Z=$S($D(DGA(1)):DGA(1),1:"NONE ON FILE") D WW1^DGRPV W $S($D(DGA(2)):DGA(2),1:"NO TEMPORARY ADDRESS")
    181         S I=2 F I1=0:0 S I=$O(DGA(I)) Q:I=""  W:(I#2)!($X>50) !?11 W:'(I#2) ?51 W DGA(I)
    182         S DGCC=$S($D(^DIC(5,+$P(DGRP(.11),U,5),1,+$P(DGRP(.11),U,7),0)):$E($P(^(0),U,1),1,20)_$S($P(^(0),U,3)]"":" ("_$P(^(0),U,3)_")",1:""),1:DGRPU) W !?3,"County: ",DGCC K DGCC
    183         S DGCC=$S($P(DGRP(.121),U,9)'="Y":"NOT APPLICABLE",$D(^DIC(5,+$P(DGRP(.121),U,5),1,+$P(DGRP(.121),U,11),0)):$E($P(^(0),U,1),1,20)_$S($P(^(0),U,3)]"":" ("_$P(^(0),U,3)_")",1:""),1:DGRPU) W ?43,"County: ",DGCC K DGCC
    184         W !?4,"Phone: ",$S($P(DGRP(.13),U,1)]"":$P(DGRP(.13),U,1),1:DGRPU),?44,"Phone: ",$S($P(DGRP(.121),U,9)'="Y":"NOT APPLICABLE",$P(DGRP(.121),U,10)]"":$P(DGRP(.121),U,10),1:DGRPU)
    185         S X="NOT APPLICABLE" I $P(DGRP(.121),U,9)="Y" S Y=$P(DGRP(.121),U,7) X:Y]"" ^DD("DD") S X=$S(Y]"":Y,1:DGRPU)_"-",Y=$P(DGRP(.121),U,8) X:Y]"" ^DD("DD") S X=X_$S(Y]"":Y,1:DGRPU)
    186         W !?3,"Office: ",$S($P(DGRP(.13),U,2)]"":$P(DGRP(.13),U,2),1:DGRPU),?42,"From/To: ",X
    187         ;
    188         ; ** VOE change 3 of 3 **
    189         ;
    190         ; if EHR agency code, display Alternate Phone Number (.134)
    191         ;
    192         ; new lines:
    193         I $G(DUZ("AG"))="E" D
    194         . W !?1,"Alt Ph: ",$P($G(^DPT(DFN,.13)),U,4)
    195         ;
    196         ; ** end of VOE change 3 **
    197         ;
    198         W !?1,"Bad Addr: ",$$EXTERNAL^DILFD(2,.121,"",$P(DGRP(.11),U,16))
    199         ;
    200         ; ***  Additional displays added for Pre-Registration
    201         I $G(DGPRFLG)=1 D
    202         . W !
    203         . N I,MIS1,X,X1,SA1,TP1,X2,X3,ES1
    204         . I $D(^DIA(2,"B",DFN)) S X="" F I=1:1 S X=$O(^DIA(2,"B",DFN,X)) Q:X<1  I $P(^DIA(2,X,0),U,3)=.05 S MIS1=$P(^DIA(2,X,0),U,2)
    205         . W:$D(MIS1)>0 !," [MARITAL STATUS CHANGED:] "_$$FMTE^XLFDT(MIS1,"5D")
    206         . I $D(^DIA(2,"B",DFN)) S X1="" F I=1:1 S X1=$O(^DIA(2,"B",DFN,X1)) Q:X1<1  S:$P(^DIA(2,X1,0),U,3)=.111 SA1=$P(^DIA(2,X1,0),U,2)
    207         . W:$D(SA1)>0 !," [STREET ADDRESS LAST CHANGED:] "_$$FMTE^XLFDT(SA1,"5D")
    208         . I $D(^DIA(2,"B",DFN)) S X2="" F I=1:1 S X2=$O(^DIA(2,"B",DFN,X2)) Q:X2<1  S:$P(^DIA(2,X2,0),U,3)=.131 TP1=$P(^DIA(2,X2,0),U,2)
    209         . W:$D(TP1)>0 !," [HOME PHONE NUMBER CHANGED:] "_$$FMTE^XLFDT(TP1,"5D")
    210         . I $D(^DIA(2,"B",DFN)) S X3="" F I=1:1 S X3=$O(^DIA(2,"B",DFN,X3)) Q:X3<1  S:$P(^DIA(2,X3,0),U,3)=.31115 ES1=$P(^DIA(2,X3,0),U,2)
    211         . W:$D(ES1)>0 !," [EMPLOYMENT STATUS CHANGED:] "_$$FMTE^XLFDT(ES1,"5D")
    212         . ; The IB Insurance API does not provide date entered or edited information, so this information will not be displayed for preregistration
    213         . I $$INSUR^IBBAPI(DFN,"","AR",.DGDATA,"1,10,11") F DGI=0:0 S DGI=$O(DGDATA("IBBAPI","INSUR",DGI)) Q:'DGI  D
    214         .. W !," [INSURANCE:] ",$P(DGDATA("IBBAPI","INSUR",DGI,1),U,2)
    215         .. W "  EFFECTIVE DATE: ",$$FMTE^XLFDT(DGDATA("IBBAPI","INSUR",DGI,10),"5D"),"  EXPIRATION DATE: ",$$FMTE^XLFDT(DGDATA("IBBAPI","INSUR",DGI,11),"5D")
    216         ;
    217         G ^DGRPP
    218         ;
    219 SSNREAS(DGREAS) ;get Pseuso SSN Reason - DG*5.3*653, ERC
    220         S DGREAS=$P(DGRP("SSN"),U)
    221         I $G(DGREAS)']"" Q
    222         S DGREAS=$S(DGREAS="R":"Refused to Provide",DGREAS="S":"SSN Unknown/Follow-up Required",DGREAS="N":"No SSN Assigned",1:"< None Entered >")
    223         Q
     1DGRP1 ;ALB/MRL - DEMOGRAPHIC DATA ;1/8/07  09:14
     2 ;;5.3;Registration;**109,161,506,244,546,570,629,638,649,700,653,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 ;
     20 ; 2005 03 18 (VA/JT): DG*5.3*629, stop Missing Patient message based
     21 ; on questionable data in Missing Person Date fld (.153).
     22 ;
     23 ; 2005 04 25? (VA/MRY): DG*5.3*638, add Sex to IDs shown.
     24 ;
     25 ; 2005 04 27 (VA/JT): DG*5.3*649, change last $EXTRACT for Alias SSN in
     26 ; GETNCAL to 10 chars instead of 9, to preserve trailing P for pseudo-
     27 ; SSNs.
     28 ;
     29 ; 2006 04 21 (WV/TOAD, after DAOU/WCJ (2005 02 07) and
     30 ; VA/CJS (2005/12/23)): restore 6-part VOE change; space dots and
     31 ; semi-colons.
     32 ;
     33 ; 2006 05 09 (WV/TOAD): rewrite VOE change to fix bugs introduced by
     34 ; VA and VOE, and completely refactor bug-prone GETNCAL, and merge back
     35 ; into main subroutine body.
     36 ;
     37EN S (DGRPS,DGRPW)=1 D H^DGRPU F I=0,.11,.121,.13,.15,.24,57,"SSN" S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
     38 I $P(DGRP(.15),"^",2)]"" S Z="APPLICANT IS LISTED AS 'INELIGIBLE' FOR TREATMENT!",DGRPCM=1 D WW^DGRPV S DGRPCM=0
     39 ;I $P(DGRP(.15),"^",3)]"" S Z="APPLICANT IS LISTED AS 'MISSING'.  NOTIFY APPROPRIATE PERSONNEL!",DGRPCM=1 D WW^DGRPV S DGRPCM=0
     40 ;
     41 ; ** VOE change 1 of 3 **
     42 ;
     43 ; if EHR agency code, display Registration Date (Date Entered into
     44 ; File, .097)
     45 ;
     46 ; new lines:
     47 I $G(DUZ("AG"))="E" D
     48 . W !?58,"Reg Dt: ",$$FMTE^XLFDT($P(DGRP(0),U,16),"2D")
     49 ;
     50 ;
     51 ; show field groups 1 and 2 in two columns
     52 ;
     53 ; field groups 1 & 2 part 1: show Name, SSN, and DOB
     54 ;
     55 ;
     56 ; ** end of VOE change 1 **
     57 ;
     58 W ! S Z=1 D WW^DGRPV W "    Name: " S Z=$P(DGRP(0),"^",1),Z1=31 D WW1^DGRPV
     59 W "SS: " S X=$P(DGRP(0),"^",9),Z=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10),Z1=13 D WW1^DGRPV
     60 W ! S Z="",Z1=8 D WW1^DGRPV S Y=$P(DGRP(0),"^",3) X ^DD("DD") W "DOB: ",Y
     61 ;add Pseudo SSN Reason - DG*5.3*653, ERC
     62 I $P(DGRP(0),U,9)["P" D
     63 . N DGSPACE
     64 . S DGSPACE=10-$L(Y) ;adjust to maintain spacing on screen
     65 . S Z1=12+DGSPACE D WW1^DGRPV W "PSSN Reason: "
     66 . I $P(DGRP(0),U,9)["P" D
     67 . . N DGREAS D SSNREAS(.DGREAS)
     68 . . Q:$G(DGREAS)']""
     69 . . W DGREAS
     70 ;
     71 ; ** VOE change 2 of 3 **
     72 ;
     73 ; eliminate unnecessary subroutine GETNCAL and merge code back into
     74 ; the main subroutine, and make the following changes:
     75 ;
     76 ; For EHR or IHS agency code, show Health Record No. (.02) for the
     77 ; current Facility from the Health Record No. multiple field
     78 ; (4101/9000001.41) of the IHS Patient file (9000001) for the current
     79 ; patient.
     80 ;
     81 ; Move Sex field over so it shows up in the same location for
     82 ; VA, IHS, and EHR, leaving a blank for where HRN can appear.
     83 ;
     84 ; Fix the VA bug in which patients having five valid aliases
     85 ; were showing "< More alias entries on file >" instead of the fifth
     86 ; alias.
     87 ;
     88 ; Refactor entire subroutine: clean original design was broken
     89 ; by patching and had become fragile and confusing; tighten variable
     90 ; scopes, use clearer names, comment.
     91 ;
     92 ; before:
     93 ;
     94 ; D GETNCAL  ;Display name component, sex, and alias information
     95 ;
     96 ; after:
     97 ;
     98 ; field groups 1 & 2 part 2: load name components
     99 ;
     100 ;
     101 N DGLABEL S DGLABEL="^ Given^Middle^Prefix^Suffix^Degree" ; labels
     102 N DGCOMP S DGCOMP=+$G(^DPT(DFN,"NAME"))_"," ; Name Components fd (1.01)
     103 I DGCOMP D GETS^DIQ(20,DGCOMP,"1:6",,"DGCOMP") ; Name Components file
     104 ; loads Family (Last) Name (1), Given (First) Name (2),
     105 ; Middle Name (3), Prefix (4), Suffix (5), and Degree (6)
     106 ;
     107 ;
     108 ; field groups 1 & 2 part 3: load aliases
     109 ;
     110 ;
     111 N DGCOUNT S DGCOUNT=0 ; how many aliases do we find
     112 N DGALIAS S DGALIAS=0 ; IEN of Alias subfile (1/2.01) of Patient fl (2)
     113 ;                       and array of aliases found
     114 S DGALIAS=0 F  D  Q:'DGALIAS
     115 . ;
     116 . S DGALIAS=$O(^DPT(DFN,.01,DGALIAS))
     117 . Q:'DGALIAS  ; out of alias subrecords
     118 . N DGNODE S DGNODE=$G(^DPT(DFN,.01,DGALIAS,0)) ; 0-node of subrecord
     119 . Q:'$L(DGNODE)  ; bad node
     120 . ;
     121 . S DGCOUNT=DGCOUNT+1 ; another valid alias
     122 . I DGCOUNT=6 S DGALIAS=0 Q  ; can't show > 5, need to know if 6 or >
     123 . ;
     124 . S DGALIAS(DGCOUNT)=$P(DGNODE,U) ; Alias fld (.01)
     125 . ;
     126 . N DGSSN S DGSSN=$P(DGNODE,U,2) ; Alias SSN fld (1)
     127 . I $L(DGSSN) D
     128 . . S DGSSN=" "_$E(DGSSN,1,3)_"-"_$E(DGSSN,4,5)_"-"_$E(DGSSN,6,10)
     129 . . ; incl leading space to separate from alias name
     130 . . ; incl 10 chars to allow for P of pseudo-SSNs
     131 . . S $E(DGALIAS(DGCOUNT),20)=DGSSN ; truncate alias name & append SSN
     132 . ;
     133 . S DGALIAS(DGCOUNT)=$E(DGALIAS(DGCOUNT),1,32) ; truncate alias
     134 ;
     135 I DGCOUNT=0 S DGALIAS(1)="< No alias entries on file >"
     136 I DGCOUNT=6 S DGALIAS(5)="< More alias entries on file >"
     137 K DGCOUNT
     138 ;
     139 ;
     140 ; field groups 1 & 2 part 4: show 1st name component, and IDs HRN & Sex
     141 ;
     142 ;
     143 W !?5,"Family: "
     144 W $E($G(DGCOMP(20,DGCOMP,1)),1,27)
     145 ;
     146 I "EI"[$G(DUZ("AG")),$G(DUZ(2)) D
     147 . N DGNODE S DGNODE=$G(^AUPNPAT(DFN,41,DUZ(2),0)) ; get 0-node for the
     148 . ; current Facility from the Health Record No. multiple field
     149 . ; (4101/9000001.41) for DFN in the IHS Patient file (9000001)
     150 . N DGHRN S DGHRN=$P(DGNODE,U,2) ; Health Record No. (.02)
     151 . W ?42," HRN: ",DGHRN
     152 ;
     153 D
     154 . N DGSEX S DGSEX=$P(DGRP(0),U,2) ; Sex fld (.02) of Patient file (2)
     155 . W ?61,"Sex: ",$S(DGSEX="M":"MALE",DGSEX="F":"FEMALE",1:"UNANSWERED")
     156 ;
     157 ;
     158 ; field groups 1 & 2 part 5: show remaining name components and aliases
     159 ;
     160 ;
     161 N DGCOUNT F DGCOUNT=2:1:6 D
     162 . W !?5,$P(DGLABEL,U,DGCOUNT),": "
     163 . N DGNAME S DGNAME=$G(DGCOMP(20,DGCOMP,DGCOUNT)) ; next name component
     164 . W $E(DGNAME,1,$S(DGCOUNT=2:23,1:27)) ; 1st line leaves room for "[2]"
     165 . I DGCOUNT=2 D  ; header for aliases
     166 . . W ?37 N DGRPW,Z S DGRPW=0,Z=2 D WW^DGRPV ; write [2], suppress LF
     167 . . W " Alias: "
     168 . W ?47,$G(DGALIAS(DGCOUNT-1)) ; show next alias
     169 ;
     170 ;
     171 ; show field group 3: remarks
     172 ;
     173 ;
     174 ; ** end of VOE change 2 **
     175 ;
     176 S Z=3,DGRPX=DGRP(0) D WW^DGRPV W " Remarks: ",$S($P(DGRPX,"^",10)]"":$E($P(DGRPX,"^",10),1,65),1:"NO REMARKS ENTERED FOR THIS PATIENT") S DGAD=.11,(DGA1,DGA2)=1 D A^DGRPU I $P(DGRP(.121),"^",9)="Y" S DGAD=.121,DGA1=1,DGA2=2 D A^DGRPU
     177 S Z=4 D WW^DGRPV W " Permanent Address: " S Z=" ",Z1=17
     178 D WW1^DGRPV S Z=5,DGRPW=0 D WW^DGRPV W " Temporary Address: "
     179 W !?11
     180 S Z1=40,Z=$S($D(DGA(1)):DGA(1),1:"NONE ON FILE") D WW1^DGRPV W $S($D(DGA(2)):DGA(2),1:"NO TEMPORARY ADDRESS")
     181 S I=2 F I1=0:0 S I=$O(DGA(I)) Q:I=""  W:(I#2)!($X>50) !?11 W:'(I#2) ?51 W DGA(I)
     182 S DGCC=$S($D(^DIC(5,+$P(DGRP(.11),U,5),1,+$P(DGRP(.11),U,7),0)):$E($P(^(0),U,1),1,20)_$S($P(^(0),U,3)]"":" ("_$P(^(0),U,3)_")",1:""),1:DGRPU) W !?3,"County: ",DGCC K DGCC
     183 S DGCC=$S($P(DGRP(.121),U,9)'="Y":"NOT APPLICABLE",$D(^DIC(5,+$P(DGRP(.121),U,5),1,+$P(DGRP(.121),U,11),0)):$E($P(^(0),U,1),1,20)_$S($P(^(0),U,3)]"":" ("_$P(^(0),U,3)_")",1:""),1:DGRPU) W ?43,"County: ",DGCC K DGCC
     184 W !?4,"Phone: ",$S($P(DGRP(.13),U,1)]"":$P(DGRP(.13),U,1),1:DGRPU),?44,"Phone: ",$S($P(DGRP(.121),U,9)'="Y":"NOT APPLICABLE",$P(DGRP(.121),U,10)]"":$P(DGRP(.121),U,10),1:DGRPU)
     185 S X="NOT APPLICABLE" I $P(DGRP(.121),U,9)="Y" S Y=$P(DGRP(.121),U,7) X:Y]"" ^DD("DD") S X=$S(Y]"":Y,1:DGRPU)_"-",Y=$P(DGRP(.121),U,8) X:Y]"" ^DD("DD") S X=X_$S(Y]"":Y,1:DGRPU)
     186 W !?3,"Office: ",$S($P(DGRP(.13),U,2)]"":$P(DGRP(.13),U,2),1:DGRPU),?42,"From/To: ",X
     187 ;
     188 ; ** VOE change 3 of 3 **
     189 ;
     190 ; if EHR agency code, display Alternate Phone Number (.134)
     191 ;
     192 ; new lines:
     193 I $G(DUZ("AG"))="E" D
     194 . W !?1,"Alt Ph: ",$P($G(^DPT(DFN,.13)),U,4)
     195 ;
     196 ; ** end of VOE change 3 **
     197 ;
     198 W !?1,"Bad Addr: ",$$EXTERNAL^DILFD(2,.121,"",$P(DGRP(.11),U,16))
     199 ;
     200 ; ***  Additional displays added for Pre-Registration
     201 I $G(DGPRFLG)=1 D
     202 . W !
     203 . N I,MIS1,X,X1,SA1,TP1,X2,X3,ES1
     204 . I $D(^DIA(2,"B",DFN)) S X="" F I=1:1 S X=$O(^DIA(2,"B",DFN,X)) Q:X<1  I $P(^DIA(2,X,0),U,3)=.05 S MIS1=$P(^DIA(2,X,0),U,2)
     205 . W:$D(MIS1)>0 !," [MARITAL STATUS CHANGED:] "_$$FMTE^XLFDT(MIS1,"5D")
     206 . I $D(^DIA(2,"B",DFN)) S X1="" F I=1:1 S X1=$O(^DIA(2,"B",DFN,X1)) Q:X1<1  S:$P(^DIA(2,X1,0),U,3)=.111 SA1=$P(^DIA(2,X1,0),U,2)
     207 . W:$D(SA1)>0 !," [STREET ADDRESS LAST CHANGED:] "_$$FMTE^XLFDT(SA1,"5D")
     208 . I $D(^DIA(2,"B",DFN)) S X2="" F I=1:1 S X2=$O(^DIA(2,"B",DFN,X2)) Q:X2<1  S:$P(^DIA(2,X2,0),U,3)=.131 TP1=$P(^DIA(2,X2,0),U,2)
     209 . W:$D(TP1)>0 !," [HOME PHONE NUMBER CHANGED:] "_$$FMTE^XLFDT(TP1,"5D")
     210 . I $D(^DIA(2,"B",DFN)) S X3="" F I=1:1 S X3=$O(^DIA(2,"B",DFN,X3)) Q:X3<1  S:$P(^DIA(2,X3,0),U,3)=.31115 ES1=$P(^DIA(2,X3,0),U,2)
     211 . W:$D(ES1)>0 !," [EMPLOYMENT STATUS CHANGED:] "_$$FMTE^XLFDT(ES1,"5D")
     212 . ; The IB Insurance API does not provide date entered or edited information, so this information will not be displayed for preregistration
     213 . I $$INSUR^IBBAPI(DFN,"","AR",.DGDATA,"1,10,11") F DGI=0:0 S DGI=$O(DGDATA("IBBAPI","INSUR",DGI)) Q:'DGI  D
     214 .. W !," [INSURANCE:] ",$P(DGDATA("IBBAPI","INSUR",DGI,1),U,2)
     215 .. W "  EFFECTIVE DATE: ",$$FMTE^XLFDT(DGDATA("IBBAPI","INSUR",DGI,10),"5D"),"  EXPIRATION DATE: ",$$FMTE^XLFDT(DGDATA("IBBAPI","INSUR",DGI,11),"5D")
     216 ;
     217 G ^DGRPP
     218 ;
     219SSNREAS(DGREAS) ;get Pseuso SSN Reason - DG*5.3*653, ERC
     220 S DGREAS=$P(DGRP("SSN"),U)
     221 I $G(DGREAS)']"" Q
     222 S DGREAS=$S(DGREAS="R":"Refused to Provide",DGREAS="S":"SSN Unknown/Follow-up Required",DGREAS="N":"No SSN Assigned",1:"< None Entered >")
     223 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRP14.m

    r613 r623  
    1 DGRP14  ;ALB/MRL/EG/GAH - REGISTRATION SCREEN 14/APPOINTMENT INFORMATION ; 10/18/06
    2         ;;5.3;Registration;**568,585,725,770**;Aug 13, 1993;Build 4
    3         S DGRPS=14 D H^DGRPU S (Z,DGRPW)=1 D WW^DGRPV W " Enrollment Clinics: "
    4         S I1=""
    5         F I=0:0 S I=$O(^DPT(DFN,"DE",I)) Q:'I  D:$P(^(I,0),U,2)'="I"
    6         . S I1=1,X=$S($D(^SC(+^(0),0)):$P(^(0),U,1)_", ",1:"")
    7         . W:(79-$X)<$L(X) !?24 W X
    8         W:'I1 "NOT ACTIVELY ENROLLED IN ANY CLINICS AT THIS TIME"
    9         W ! S Z=2 D WW^DGRPV W "     Pending Appt's",?18,": " S I1="",I2=DT_".9999"
    10         N DGARRAY,APTDT,CLIFN,CLNAM
    11         S DGARRAY("FLDS")="1;2;3",DGARRAY(3)="R;I;NT",DGARRAY(4)=DFN,DGARRAY(1)=DT,DGARRAY("SORT")="P"
    12         S I1=$$SDAPI^SDAMA301(.DGARRAY)
    13         ;Check for appointment retrieval error.
    14         I I1<0 W $$FAPCHK^DGENRPD2 G Q
    15         S APTDT=0
    16         F  S APTDT=$O(^TMP($J,"SDAMA301",DFN,APTDT)) Q:'APTDT  D
    17         .;check to see if appointment is cancelled, if so
    18         .;ignore this appointment eg 01/25/2005
    19         .;I $$CANCEL(DFN,APTDT)="Y" Q TAKEN OUT IN PATCH 770.
    20         .S CLNAM=$P($P(^TMP($J,"SDAMA301",DFN,APTDT),U,2),";",2)
    21         .S X=$S(CLNAM]"":CLNAM,1:"UNKNOWN CLINIC")_" ("_$$FMTE^DILIBF(APTDT,"5U")_"), " W:(79-$X)<$L(X) !?24 W X
    22         .Q
    23         I 'I1 W "NO PENDING APPOINTMENTS ON FILE"
    24 Q       K I,I1,I2,X,Y,DGARRAY,APTDT,CLNAM,^TMP($J,"SDAMA301") G ^DGRPP
    25         ;
    26         ;input DFN - patient id
    27         ;      APPDATE - appointment date
    28         ;return Y - Yes
    29         ;       N - No
    30 CANCEL(DFN,APPDATE)     ;
    31         N X,STATUS,U
    32         S U="^"
    33         S X=$G(^DPT(DFN,"S",APPDATE,0))
    34         I X="" Q "Y"  ;probably bad data
    35         S STATUS=$P(X,U,2)
    36         I STATUS="" Q "N"
    37         I STATUS="I" Q "N"
    38         Q "Y"
     1DGRP14 ;ALB/MRL/EG/GAH - REGISTRATION SCREEN 14/APPOINTMENT INFORMATION ; 10/18/06
     2 ;;5.3;Registration;**568,585,725**;Aug 13, 1993;Build 12
     3 S DGRPS=14 D H^DGRPU S (Z,DGRPW)=1 D WW^DGRPV W " Enrollment Clinics: "
     4 S I1=""
     5 F I=0:0 S I=$O(^DPT(DFN,"DE",I)) Q:'I  D:$P(^(I,0),U,2)'="I"
     6 . S I1=1,X=$S($D(^SC(+^(0),0)):$P(^(0),U,1)_", ",1:"")
     7 . W:(79-$X)<$L(X) !?24 W X
     8 W:'I1 "NOT ACTIVELY ENROLLED IN ANY CLINICS AT THIS TIME"
     9 W ! S Z=2 D WW^DGRPV W "     Pending Appt's",?18,": " S I1="",I2=DT_".9999"
     10 N DGARRAY,APTDT,CLIFN,CLNAM
     11 S DGARRAY("FLDS")="1;2;3",DGARRAY(3)="R;I;NT",DGARRAY(4)=DFN,DGARRAY(1)=DT,DGARRAY("SORT")="P"
     12 S I1=$$SDAPI^SDAMA301(.DGARRAY)
     13 ;Check for appointment retrieval error.
     14 I I1<0 W $$FAPCHK^DGENRPD2 G Q
     15 S APTDT=0
     16 F  S APTDT=$O(^TMP($J,"SDAMA301",DFN,APTDT)) Q:'APTDT  D
     17 .;check to see if appointment is cancelled, if so
     18 .;ignore this appointment eg 01/25/2005
     19 .I $$CANCEL(DFN,APTDT)="Y" Q
     20 .S CLNAM=$P($P(^TMP($J,"SDAMA301",DFN,APTDT),U,2),";",2)
     21 .S X=$S(CLNAM]"":CLNAM,1:"UNKNOWN CLINIC")_" ("_$$FMTE^DILIBF(APTDT,"5U")_"), " W:(79-$X)<$L(X) !?24 W X
     22 .Q
     23 I 'I1 W "NO PENDING APPOINTMENTS ON FILE"
     24Q K I,I1,I2,X,Y,DGARRAY,APTDT,CLNAM,^TMP($J,"SDAMA301") G ^DGRPP
     25 ;
     26 ;input DFN - patient id
     27 ;      APPDATE - appointment date
     28 ;return Y - Yes
     29 ;       N - No
     30CANCEL(DFN,APPDATE) ;
     31 N X,STATUS,U
     32 S U="^"
     33 S X=$G(^DPT(DFN,"S",APPDATE,0))
     34 I X="" Q "Y"  ;probably bad data
     35 S STATUS=$P(X,U,2)
     36 I STATUS="" Q "N"
     37 I STATUS="I" Q "N"
     38 Q "Y"
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRP2.m

    r613 r623  
    1 DGRP2   ;ALB/MRL,BRM - REGISTRATION SCREEN 2/CONTACT INFORMATION ;1:15 PM  10 Dec 2008
    2         ;;5.3;Registration;**415,545,638,677,760,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19         S DGRPS=2 D H^DGRPU F I=0,.24,57,1010.15 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
    20         S DGRPX=DGRP(0)
    21         S (Z,DGRPW)=1 D WW^DGRPV W "  Marital: " S Z=$S($D(^DIC(11,+$P(DGRPX,"^",5),0)):$E($P(^(0),"^",1),1,28),1:DGRPU),Z1=30 D WW1^DGRPV
    22         ;S (Z,DGRPW)=1 D WW^DGRPV W "     Sex: " S X=$P(DGRP(0),"^",2),Z=$S(X="M":"MALE",X="F":"FEMALE",1:DGRPU),Z1=31 D WW1^DGRPV
    23         S DGD=$$DISP^DG1010P0(DGRP(0),11,0,1),DGNOCITY=DGUNK,DGD1=$$POINT^DG1010P0(DGRP(0),12,5,1,0,1)
    24         W ?41,"POB: ",$E($S((DGNOCITY&DGUNK):"UNANSWERED",1:DGD_$S(($L(DGD)):", ",1:"")_DGD1),1,29)
    25         ;S DGRPX=DGRP(0)
    26         W !?4,"Religion: ",$S($D(^DIC(13,+$P(DGRPX,"^",8),0)):$P(^(0),"^",1),1:DGRPU),?41,"Father: ",$S($P(DGRP(.24),"^",1)]"":$E($P(DGRP(.24),"^",1),1,29),1:DGRPU)
    27         S X=$P(DGRP(57),"^",4),X=$S(X']"":DGRPU,X="X":"NOT APPLICABLE",X=1:"PARA,",X=2:"QUAD,",X=3:"PARA,NON",1:"QUAD,NON"),X=$S("QP"[$E(X):X_"TRAUMATIC",1:X) W !?9,"SCI: ",X
    28         W ?41,"Mother: ",$S($P(DGRP(.24),"^",2)]"":$E($P(DGRP(.24),"^",2),1,29),1:DGRPU)
    29         W !,?35,"Mom's Maiden: ",$S($P(DGRP(.24),"^",3)]"":$E($P(DGRP(.24),"^",3),1,29),1:DGRPU)
    30         W ! S Z=2 D WW^DGRPV W " Previous Care Date      Location of Previous Care",!?4,"------------------      -------------------------" S DGRPX=DGRP(1010.15) I $P(DGRPX,"^",5)'="Y" S X="NONE INDICATED" W !?4,X,?28,X
    31         E  F I=1:1:4 S I1=$P(DGRPX,"^",I) X "I I#2 S Y=I1 X:Y]"""" ^DD(""DD"") W !?4,$S(Y]"""":Y,1:DGRPU)" I '(I#2) W ?28,$S($D(^DIC(4,+I1,0)):$P(^(0),"^",1),1:DGRPU)
    32         ;
    33         ; ** start of VOE change: DAOU,VA/CJS,WV/TOAD 1/5/2006 ** ;p634
    34         ;
    35         ; New VOE Patient fields
    36         ;
    37         ; insert 7 lines:
    38         ;
    39         I $G(DUZ("AG"))="E" D
    40         . W !?4,"Veteran: ",$$GET1^DIQ(2,DFN,19902)
    41         . W !,"Interpreter Language: "
    42         . N IL S IL=""
    43         . N I F I=1:1 S IL=$O(^DPT(DFN,19901,"B",IL)) Q:IL=""  D
    44         . . I I'=1 W ","
    45         . . W $$GET1^DIQ(.85,IL,1)
    46         ;
    47         ; next three groups of lines have been conditionalized to only display
    48         ; for VA agency code; also, refactored for clarity
    49         ;
    50         I $G(DUZ("AG"))="V" D
    51         . W ! S Z=2 D WW^DGRPV
    52         . W " Previous Care Date      Location of Previous Care"
    53         . W !?4,"------------------      -------------------------"
    54         . S DGRPX=DGRP(1010.15)
    55         . ;
    56         . I $P(DGRPX,"^",5)'="Y" D
    57         . . S X="NONE INDICATED"
    58         . . W !?4,X,?28,X
    59         . ;
    60         . E  F I=1:1:4 D
    61         . . S I1=$P(DGRPX,"^",I)
    62         . . X "I I#2 S Y=I1 X:Y]"""" ^DD(""DD"") W !?4,$S(Y]"""":Y,1:DGRPU)"
    63         . . I '(I#2) W ?28,$S($D(^DIC(4,+I1,0)):$P(^(0),"^",1),1:DGRPU)
    64         ;
    65         ; ** end of VOE change **; p634
    66         ;
    67         W ! S Z=3 D WW^DGRPV W " Ethnicity: " D
    68         .I '$O(^DPT(DFN,.06,0)) W "UNANSWERED" Q
    69         .N NODE,NUM,ETHNIC
    70         .S I=0
    71         .F NUM=0:1 S I=+$O(^DPT(DFN,.06,I)) Q:'I  D
    72         ..S NODE=$G(^DPT(DFN,.06,I,0))
    73         ..S X=$P($G(^DIC(10.2,+NODE,0)),"^",1)
    74         ..S ETHNIC=$S(X="":"?????",1:X)
    75         ..S X=$P($G(^DIC(10.3,+$P(NODE,"^",2),0)),"^",2)
    76         ..S ETHNIC=ETHNIC_" ("_$S(X="":"?",1:X)_")"
    77         ..I NUM S ETHNIC=", "_ETHNIC
    78         ..I ($X+$L(ETHNIC))>IOM D  W !?15
    79         ...F  S X=$P(ETHNIC," ",1)_" " Q:($X+$L(X))>IOM  W X S ETHNIC=$P(ETHNIC," ",2,999)
    80         ..W ETHNIC
    81         W !?9,"Race: " D
    82         .I '$O(^DPT(DFN,.02,0)) W "UNANSWERED" Q
    83         .N NODE,NUM,RACE
    84         .S I=0
    85         .F NUM=0:1 S I=+$O(^DPT(DFN,.02,I)) Q:'I  D
    86         ..S NODE=$G(^DPT(DFN,.02,I,0))
    87         ..S X=$P($G(^DIC(10,+NODE,0)),"^",1)
    88         ..S RACE=$S(X="":"?????",1:X)
    89         ..S X=$P($G(^DIC(10.3,+$P(NODE,"^",2),0)),"^",2)
    90         ..S RACE=RACE_" ("_$S(X="":"?",1:X)_")"
    91         ..I NUM S RACE=", "_RACE
    92         ..I ($X+$L(RACE))>IOM D  W !?15
    93         ...F  S X=$P(RACE," ",1)_" " Q:($X+$L(X))>IOM  W X S RACE=$P(RACE," ",2,999)
    94         ..W RACE
    95         D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","PDTHINFO")
    96         W !!
    97         W "<4> Date of Death Information"
    98         W !,?5,"Date of Death: ",$G(PDTHINFO(2,DFN_",",.351,"E"))
    99         W ?41,"Source of Notification: ",$G(PDTHINFO(2,DFN_",",.353,"E"))
    100         W !,?5,"Updated Date/Time: ",$G(PDTHINFO(2,DFN_",",.354,"E"))
    101         W ?41,"Last Edited By: ",$G(PDTHINFO(2,DFN_",",.355,"E")),!
    102         K PDTHINFO
    103         ;
    104         ;Emergency Response Indicator
    105         N DGEMRES S DGEMRES=$P($G(^DPT(DFN,.18)),"^")
    106         S Z=5 D WW^DGRPV W " Emergency Response: "_$$EXTERNAL^DILFD(2,.181,,DGEMRES)
    107         G ^DGRPP
     1DGRP2 ;ALB/MRL,BRM - REGISTRATION SCREEN 2/CONTACT INFORMATION ; 1/5/2006  23:54
     2 ;;5.3;Registration;**415,545,638,677,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 S DGRPS=2 D H^DGRPU F I=0,.24,57,1010.15 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
     20 S DGRPX=DGRP(0)
     21 S (Z,DGRPW)=1 D WW^DGRPV W "  Marital: " S Z=$S($D(^DIC(11,+$P(DGRPX,"^",5),0)):$E($P(^(0),"^",1),1,28),1:DGRPU),Z1=30 D WW1^DGRPV
     22 ;S (Z,DGRPW)=1 D WW^DGRPV W "     Sex: " S X=$P(DGRP(0),"^",2),Z=$S(X="M":"MALE",X="F":"FEMALE",1:DGRPU),Z1=31 D WW1^DGRPV
     23 S DGD=$$DISP^DG1010P0(DGRP(0),11,0,1),DGNOCITY=DGUNK,DGD1=$$POINT^DG1010P0(DGRP(0),12,5,1,0,1)
     24 W ?41,"POB: ",$E($S((DGNOCITY&DGUNK):"UNANSWERED",1:DGD_$S(($L(DGD)):", ",1:"")_DGD1),1,29)
     25 ;S DGRPX=DGRP(0)
     26 W !?4,"Religion: ",$S($D(^DIC(13,+$P(DGRPX,"^",8),0)):$P(^(0),"^",1),1:DGRPU),?41,"Father: ",$S($P(DGRP(.24),"^",1)]"":$E($P(DGRP(.24),"^",1),1,29),1:DGRPU)
     27 S X=$P(DGRP(57),"^",4),X=$S(X']"":DGRPU,X="X":"NOT APPLICABLE",X=1:"PARA,",X=2:"QUAD,",X=3:"PARA,NON",1:"QUAD,NON"),X=$S("QD"[$E(X):X_"TRAUMATIC",1:X) W !?9,"SCI: ",X
     28 W ?41,"Mother: ",$S($P(DGRP(.24),"^",2)]"":$E($P(DGRP(.24),"^",2),1,29),1:DGRPU)
     29 W !,?35,"Mom's Maiden: ",$S($P(DGRP(.24),"^",3)]"":$E($P(DGRP(.24),"^",3),1,29),1:DGRPU)
     30 ;
     31 ; ** start of VOE change: DAOU,VA/CJS,WV/TOAD 1/5/2006 **
     32 ;
     33 ; New VOE Patient fields
     34 ;
     35 ; insert 7 lines:
     36 ;
     37 I $G(DUZ("AG"))="E" D
     38 . W !?4,"Veteran: ",$$GET1^DIQ(2,DFN,19902)
     39 . W !,"Interpreter Language: "
     40 . N IL S IL=""
     41 . N I F I=1:1 S IL=$O(^DPT(DFN,19901,"B",IL)) Q:IL=""  D
     42 . . I I'=1 W ","
     43 . . W $$GET1^DIQ(.85,IL,1)
     44 ;
     45 ; next three groups of lines have been conditionalized to only display
     46 ; for VA agency code; also, refactored for clarity
     47 ;
     48 I $G(DUZ("AG"))="V" D
     49 . W ! S Z=2 D WW^DGRPV
     50 . W " Previous Care Date      Location of Previous Care"
     51 . W !?4,"------------------      -------------------------"
     52 . S DGRPX=DGRP(1010.15)
     53 . ;
     54 . I $P(DGRPX,"^",5)'="Y" D
     55 . . S X="NONE INDICATED"
     56 . . W !?4,X,?28,X
     57 . ;
     58 . E  F I=1:1:4 D
     59 . . S I1=$P(DGRPX,"^",I)
     60 . . X "I I#2 S Y=I1 X:Y]"""" ^DD(""DD"") W !?4,$S(Y]"""":Y,1:DGRPU)"
     61 . . I '(I#2) W ?28,$S($D(^DIC(4,+I1,0)):$P(^(0),"^",1),1:DGRPU)
     62 ;
     63 ; ** end of VOE change **
     64 ;
     65 W ! S Z=3 D WW^DGRPV W " Ethnicity: " D
     66 .I '$O(^DPT(DFN,.06,0)) W "UNANSWERED" Q
     67 .N NODE,NUM,ETHNIC
     68 .S I=0
     69 .F NUM=0:1 S I=+$O(^DPT(DFN,.06,I)) Q:'I  D
     70 ..S NODE=$G(^DPT(DFN,.06,I,0))
     71 ..S X=$P($G(^DIC(10.2,+NODE,0)),"^",1)
     72 ..S ETHNIC=$S(X="":"?????",1:X)
     73 ..S X=$P($G(^DIC(10.3,+$P(NODE,"^",2),0)),"^",2)
     74 ..S ETHNIC=ETHNIC_" ("_$S(X="":"?",1:X)_")"
     75 ..I NUM S ETHNIC=", "_ETHNIC
     76 ..I ($X+$L(ETHNIC))>IOM D  W !?15
     77 ...F  S X=$P(ETHNIC," ",1)_" " Q:($X+$L(X))>IOM  W X S ETHNIC=$P(ETHNIC," ",2,999)
     78 ..W ETHNIC
     79 W !?9,"Race: " D
     80 .I '$O(^DPT(DFN,.02,0)) W "UNANSWERED" Q
     81 .N NODE,NUM,RACE
     82 .S I=0
     83 .F NUM=0:1 S I=+$O(^DPT(DFN,.02,I)) Q:'I  D
     84 ..S NODE=$G(^DPT(DFN,.02,I,0))
     85 ..S X=$P($G(^DIC(10,+NODE,0)),"^",1)
     86 ..S RACE=$S(X="":"?????",1:X)
     87 ..S X=$P($G(^DIC(10.3,+$P(NODE,"^",2),0)),"^",2)
     88 ..S RACE=RACE_" ("_$S(X="":"?",1:X)_")"
     89 ..I NUM S RACE=", "_RACE
     90 ..I ($X+$L(RACE))>IOM D  W !?15
     91 ...F  S X=$P(RACE," ",1)_" " Q:($X+$L(X))>IOM  W X S RACE=$P(RACE," ",2,999)
     92 ..W RACE
     93 D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","PDTHINFO")
     94 W !!
     95 W "<4> Date of Death Information"
     96 W !,?5,"Date of Death: ",$G(PDTHINFO(2,DFN_",",.351,"E"))
     97 W ?41,"Source of Notification: ",$G(PDTHINFO(2,DFN_",",.353,"E"))
     98 W !,?5,"Updated Date/Time: ",$G(PDTHINFO(2,DFN_",",.354,"E"))
     99 W ?41,"Last Edited By: ",$G(PDTHINFO(2,DFN_",",.355,"E")),!
     100 K PDTHINFO
     101 ;
     102 ;Emergency Response Indicator
     103 N DGEMRES S DGEMRES=$P($G(^DPT(DFN,.18)),"^")
     104 S Z=5 D WW^DGRPV W " Emergency Response: "_$$EXTERNAL^DILFD(2,.181,,DGEMRES)
     105 G ^DGRPP
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRP3.m

    r613 r623  
    1 DGRP3   ;ALB/MRL - REGISTRATION SCREEN 3/CONTACT INFORMATION ;11/5/06  20:31
    2         ;;5.3;Registration;**634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19         S DGRPW=1,DGRPS=3 D H^DGRPU F I=.21,.211,.33,.331,.34 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
    20         S DGAD=.21,DGA1=3,DGA2=1 D:$P(DGRP(.21),"^",1)]"" AL^DGRPU(24) S DGAD=.211,DGA1=3,DGA2=2 D:$P(DGRP(.211),"^",1)]"" AL^DGRPU(27)
    21         F DGRPI=.21,.211 S DGRPI1=$S(DGRPI=".21":"X",1:"X1") D SET
    22         S Z=1 D WW^DGRPV W "      NOK: " S Z=$E($P(X,"^",1),1,22),Z1=28 D WW1^DGRPV S DGRPW=0,Z=2 D WW^DGRPV W " NOK-2: ",$E($P(X1,"^",1),1,25) D AW
    23         S DGRPW=1,DGAD=.33,DGA1=3,DGA2=1 D:$P(DGRP(.33),"^",1)]"" AL^DGRPU(24) S DGAD=.331,DGA1=3,DGA2=2 D:$P(DGRP(.331),"^",1)]"" AL^DGRPU(27)
    24         F DGRPI=.33,.331 S DGRPI1=$S(DGRPI=".33":"X",1:"X1") D SET
    25         S Z=3 D WW^DGRPV W "  E-Cont.: " S Z=$E($P(X,"^",1),1,25),Z1=25 D WW1^DGRPV S DGRPW=0,Z=4 D WW^DGRPV W " E2-Cont.: ",$E($P(X1,"^",1),1,25) D AW
    26         K DGA S DGRPW=1,DGAD=.34,DGA1=3,DGA2=1 D:$P(DGRP(.34),"^",1)]"" AL^DGRPU(24) S DGRPI=.34,DGRPI1="X" D SET S Z=5 D WW^DGRPV W " Designee: ",$E($P(X,"^",1),1,25),?50,"Relation: ",$E($P(X,"^",2),1,25)
    27         F I=0:0 S I=$O(DGA(I)) Q:'I  S Z="              "_$E(DGA(I),1,27) W !,Z
    28         W !?7,"Phone: ",$P(X,"^",3),?41,"Work Phone: ",$P(X,"^",4)
    29         ;New EHR code    ;DAOU/WCJ  2/7/05
    30         ;New fields for agency EHR
    31         I $G(DUZ("AG"))="E" S DGRPW=0,Z=6 W ! D WW^DGRPV S DGRPI=$G(^DPT(DFN,19900)) D
    32         .W "Year arrived in U.S.: ",$P(DGRPI,"^",6),!
    33         .W "Mother's Country of Birth: ",$P(DGRPI,"^",4),!
    34         .W "Father's Country of Birth: ",$P(DGRPI,"^",5),!
    35         ;End EHR modifications
    36 Q       K DGRPI,DGRPI1
    37         G ^DGRPP
    38         ;
    39 SET     S DGRPX=DGRPU_"^"_DGRPU_"^"_DGRPU_"^"_DGRPU
    40         F DGRPX1=1,2,9,11 I $P(DGRP(DGRPI),"^",DGRPX1)]"" S $P(DGRPX,"^",$S(DGRPX1=1:1,DGRPX1=2:2,DGRPX1=9:3,1:4))=$P(DGRP(DGRPI),"^",DGRPX1)
    41         S @DGRPI1=DGRPX
    42         K DGRPX,DGRPX1
    43         Q
    44 AW      W !?4,"Relation: ",$E($P(X,"^",2),1,25),?43,"Relation: ",$E($P(X1,"^",2),1,25) F I=0:0 S I=$O(DGA(I)) Q:'I  S Z=$E(DGA(I),1,27) S:(I#2) Z="              "_Z W:(I#2)!($X>50) ! W:(I#2) Z I '(I#2) W ?53,Z
    45         W !?7,"Phone: ",$P(X,"^",3),?46,"Phone: ",$P(X1,"^",3)
    46         W !?2,"Work Phone: ",$P(X,"^",4),?41,"Work Phone: ",$P(X1,"^",4)
    47         K DGA
    48         Q
     1DGRP3 ;ALB/MRL - REGISTRATION SCREEN 3/CONTACT INFORMATION ;11/5/06  20:31
     2 ;;5.3;Registration;**634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 S DGRPW=1,DGRPS=3 D H^DGRPU F I=.21,.211,.33,.331,.34 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
     20 S DGAD=.21,DGA1=3,DGA2=1 D:$P(DGRP(.21),"^",1)]"" AL^DGRPU(24) S DGAD=.211,DGA1=3,DGA2=2 D:$P(DGRP(.211),"^",1)]"" AL^DGRPU(27)
     21 F DGRPI=.21,.211 S DGRPI1=$S(DGRPI=".21":"X",1:"X1") D SET
     22 S Z=1 D WW^DGRPV W "      NOK: " S Z=$E($P(X,"^",1),1,22),Z1=28 D WW1^DGRPV S DGRPW=0,Z=2 D WW^DGRPV W " NOK-2: ",$E($P(X1,"^",1),1,25) D AW
     23 S DGRPW=1,DGAD=.33,DGA1=3,DGA2=1 D:$P(DGRP(.33),"^",1)]"" AL^DGRPU(24) S DGAD=.331,DGA1=3,DGA2=2 D:$P(DGRP(.331),"^",1)]"" AL^DGRPU(27)
     24 F DGRPI=.33,.331 S DGRPI1=$S(DGRPI=".33":"X",1:"X1") D SET
     25 S Z=3 D WW^DGRPV W "  E-Cont.: " S Z=$E($P(X,"^",1),1,25),Z1=25 D WW1^DGRPV S DGRPW=0,Z=4 D WW^DGRPV W " E2-Cont.: ",$E($P(X1,"^",1),1,25) D AW
     26 K DGA S DGRPW=1,DGAD=.34,DGA1=3,DGA2=1 D:$P(DGRP(.34),"^",1)]"" AL^DGRPU(24) S DGRPI=.34,DGRPI1="X" D SET S Z=5 D WW^DGRPV W " Designee: ",$E($P(X,"^",1),1,25),?50,"Relation: ",$E($P(X,"^",2),1,25)
     27 F I=0:0 S I=$O(DGA(I)) Q:'I  S Z="              "_$E(DGA(I),1,27) W !,Z
     28 W !?7,"Phone: ",$P(X,"^",3),?41,"Work Phone: ",$P(X,"^",4)
     29 ;New EHR code    ;DAOU/WCJ  2/7/05
     30 ;New fields for agency EHR
     31 I $G(DUZ("AG"))="E" S DGRPW=0,Z=6 W ! D WW^DGRPV S DGRPI=$G(^DPT(DFN,19900)) D
     32 .W "Year arrived in U.S.: ",$P(DGRPI,"^",6),!
     33 .W "Mother's Country of Birth: ",$P(DGRPI,"^",4),!
     34 .W "Father's Country of Birth: ",$P(DGRPI,"^",5),!
     35 ;End EHR modifications
     36Q K DGRPI,DGRPI1
     37 G ^DGRPP
     38 ;
     39SET S DGRPX=DGRPU_"^"_DGRPU_"^"_DGRPU_"^"_DGRPU
     40 F DGRPX1=1,2,9,11 I $P(DGRP(DGRPI),"^",DGRPX1)]"" S $P(DGRPX,"^",$S(DGRPX1=1:1,DGRPX1=2:2,DGRPX1=9:3,1:4))=$P(DGRP(DGRPI),"^",DGRPX1)
     41 S @DGRPI1=DGRPX
     42 K DGRPX,DGRPX1
     43 Q
     44AW W !?4,"Relation: ",$E($P(X,"^",2),1,25),?43,"Relation: ",$E($P(X1,"^",2),1,25) F I=0:0 S I=$O(DGA(I)) Q:'I  S Z=$E(DGA(I),1,27) S:(I#2) Z="              "_Z W:(I#2)!($X>50) ! W:(I#2) Z I '(I#2) W ?53,Z
     45 W !?7,"Phone: ",$P(X,"^",3),?46,"Phone: ",$P(X1,"^",3)
     46 W !?2,"Work Phone: ",$P(X,"^",4),?41,"Work Phone: ",$P(X1,"^",4)
     47 K DGA
     48 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPCE.m

    r613 r623  
    1 DGRPCE  ;ALB/MRL,KV,PJR,BRM - CONSISTENCY CHECKER, EDIT INCONSISTENCIES ; 12/14/04 9:42am
    2         ;;5.3;Registration;**121,122,175,297,342,451,626,689,653,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19         ;
    20         ;KV;11/15/00;DG*5.3*297;Disable addition of CD Elig Code in Reg. Screens
    21         ;                      ;Adding CD Elig Codes in Load/Edit Screen used to
    22         ;                      ;cause undefined line tag error.
    23         ;
    24         S DGVTYN=$P($G(^DPT(DFN,"VET")),"^",1),DGDR="DR",(DR,DGD,DGDRC,DGCCF)="",DGASK=",",DGER=","_DGER D ^DGRPCE1
    25         S DGEK=0 F I=9,10,11,12,13,14,18,19,20,22,24,36,51 Q:DGEK  I DGER[(","_I_",") S DGEK=1 Q
    26         I 'DGKEY(1) D:DGEK ELDR S I=15 D SASK S I=23 D SASK
    27         ;New EHR code  DAOU/WCJ  2/5/05
    28         ;skip veteran related fields for agency EHR
    29         G NKEY:$G(DUZ("AG"))="E"
    30         ;End EHR new code
    31         F I=29,30,31,32,33,43,44,45,48,56 D SASK,MON:DGCCF S DGCCF=0
    32         G NKEY:DGKEY(3) F I=25,26,27,28,34,35 D SASK
    33         I DGASK'[26 F I=41,42 I DGASK'[41 D SASK
    34         I DGASK'[27 S I=60 I DGASK'[25 D SASK
    35         I DGASK'[34 F I=37,38 I DGASK'[37 D SASK
    36         I DGASK'[35 F I=39,40 I DGASK'[39 D SASK
    37 NKEY    D ^DGRPCE1
    38         I $S(DGER[49:1,(DGER[50):1,(DGER[52):1,1:0) D
    39         .I $G(DGPRFLG) D PREG^IBCNBME(DFN) Q
    40         .D REG^IBCNBME(DFN)
    41         .Q
    42         D Q S DIE="^DPT(",(DA,Y)=DFN D ^DIE:$D(DR)
    43         I DGER[54 D GETREL^DGMTU11(DFN,"SD",$$LYR^DGMTSCU1(DT)) D
    44         . I $D(DGREL("S")),($$SSN^DGMTU1(+DGREL("S"))']"") D ASKSSN(DGREL("S"))
    45         . F DGDEP=0:0 S DGDEP=$O(DGREL("D",DGDEP)) Q:'DGDEP  I $$SSN^DGMTU1(+DGREL("D",DGDEP))']"" D ASKSSN(DGREL("D",DGDEP))
    46         ;
    47         I DGER[59 D CATDIB
    48         I DGER["82" D EN2^DGRP6CL
    49         ;
    50         K DGREL,DGDEP
    51 KVAR    K DR,DGEDCN,DGCT,DGER,DGINC55,DGRPADI,DGRPOUT,DGVTYN
    52 Q       K %,C,DA,DGASK,DGCCF,DGCT1,DGCT2,DGCT3,DGD,DGD1,DGD2,DGDR,DGDRC,DGECODE,DGEDIT,DGEK,DGKEY,DGP,DGRPADI,DGRPE,DIC,DIE,DIK,I,I1,J,X,X1,X2
    53         K DGCOMLOC,DGCOMBR,FRDT,DGFRDT
    54         D KVAR^VADPT
    55         Q
    56 SASK    I DGER[(","_I_","),DGASK'[(","_I_",") S DGD=$P($T(@I),";;",2,999),DGASK=DGASK_I_",",DGCCF=1 D SAVE
    57         Q
    58 SAVE    I $L(@DGDR)+$L(DGD)<241 S @DGDR=@DGDR_DGD,DGD="" Q
    59         S DGDRC=DGDRC+1,DGDR="DR(1,2,"_DGDRC_")",@DGDR=DGD,DGD="" Q
    60 ELDR    S DGASK=DGASK_"9,10,11,12,13,14,18,19,20,24,29,30,31,34,36,37,38,"
    61         ;Previous VA code prior to EHR changes
    62         ;I 'DGKEY(1) S DGD="391;1901;S DGVTYN=$S($D(^DPT(DFN,""VET"")):$P(^(""VET""),""^"",1),1:"""");S:X'=""Y"" Y=""@1"";.301;S:X'=""Y"" Y=""@1"";.302;@1;" D SAVE
    63         ;I 'DGKEY(2) F I=29,30,31 S DGD=$P($T(@I),";;",2,999) D SAVE
    64         ;D:DGD]"" SAVE I 'DGKEY(3) S DGD=$P($T(34),";;",2,999) D SAVE S DGD=$P($T(51),";;",2,999) D SAVE
    65         ;New code  DAOU/WCJ 2/5/05  Skip veteran specific fields
    66         I 'DGKEY(1),$G(DUZ("AG"))'="E"  S DGD="391;1901;S DGVTYN=$S($D(^DPT(DFN,""VET"")):$P(^(""VET""),""^"",1),1:"""");S:X'=""Y"" Y=""@1"";.301;S:X'=""Y"" Y=""@1"";.302;@1;" D SAVE
    67         I 'DGKEY(2),$G(DUZ("AG"))'="E"  F I=29,30,31 S DGD=$P($T(@I),";;",2,999) D SAVE
    68         D:DGD]"" SAVE I 'DGKEY(3),$G(DUZ("AG"))'="E"  S DGD=$P($T(34),";;",2,999) D SAVE S DGD=$P($T(51),";;",2,999) D SAVE
    69         ;End new code  DAOU/WCJ  2/5/05
    70         I 'DGKEY(1) D ELIG^DGRPCE1
    71         Q
    72 MON     I $S(I<40:1,I=56:1,1:0) D SAVE Q
    73         I $S(I<46:1,1:0),DGASK'[(","_(I-14)_",") D SAVE Q
    74         I DGASK'[(","_(I-15)_",") D SAVE
    75         Q
    76         ;
    77 15      ;;.152;S:X']"" Y="@15";S DIE("NO^")="";.307;I X']"" W !!,*7,"But I need a reason why this applicant is ineligible!" S Y=.152;@15;K DIE("NO^");
    78 23      ;;.3611;S:X'="V" Y="@23";.3612;S DIE("NO^")="";I X']"" W !!,*7,"But I need to know the date eligibility was verifed!";@23;K DIE("NO^");
    79 25      ;;.323;.32102;S:X'="Y" Y="@25";.32107;.3211;.32109;.3213;@25;
    80 26      ;;
    81 27      ;;
    82 28      ;;
    83 29      ;;.36205;S:X'="Y" Y="@29";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim A&A" S Y=.36205;.36295;@29;
    84 30      ;;.36215;S:X'="Y" Y="@30";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim HOUSEBOUND" S Y=.36215;.36295;@30;
    85 31      ;;.36235;S:X'="Y" Y="@31";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim VA PENSION" S Y=.36235;.36295;@31;
    86 32      ;;.36255;S:X'="Y" Y="@32";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim MIL. RET." S Y=.36255;.3625;@32;
    87 33      ;;
    88 34      ;;.525;S:X'="Y" Y="@34";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim POW STATUS" S Y=.525;.526:.528;@34;
    89 35      ;;
    90 37      ;;.525;S:X'="Y" Y="@37";.526:.528;@37;
    91 38      ;;.525;S:X'="Y" Y="@38";.526:.528;@38;
    92 39      ;;.5291;S:X'="Y" Y="@39";.5292:.5294;@39;
    93 40      ;;.5291;S:X'="Y" Y="@40";.5292:.5294;@40;
    94 41      ;;.32101;S:X'="Y" Y="@41";.32104;.32105;@41;
    95 42      ;;.32101;S:X'="Y" Y="@42";.32104;.32105;@42;
    96 43      ;;
    97 44      ;;
    98 45      ;;
    99 46      ;;
    100 47      ;;
    101 48      ;;.36265;S:X'="Y" Y="@48";.3626;@48;
    102 51      ;;I DGVTYN'="Y" S Y="@51";.324:.328;@51;
    103 56      ;;.3025;S:X'="Y" Y="@56";.36295;@56;
    104 60      ;;.32102;S:X'="Y" Y="@60";.32107;.3211;.32109;.3213;@60;
    105         ;
    106         ; NOTE: #46 & 47 REMOVED WITH PIMS5.3
    107         ;
    108 ASKSSN(DEP)     ;edit ssns if missing
    109         ;
    110         ; input:  DEP as string for dependent (from GETREL)
    111         ;
    112         W !,$$NAME^DGMTU1(+DEP)
    113         S DA=+$P(DEP,"^",2),DIE="^DGPR(408.13,",DR=.09 D ^DIE
    114 PS      ;
    115         S DA=+$P(DEP,"^",2),DIE="^DGPR(408.13,",DR=.09 D ^DIE
    116         I $$GET1^DIQ(408.13,DA_",",.09)["P" D
    117         . S DR=.1,DA=$P(DA,";") D ^DIE
    118         . I X']"" W !,"If SSN is a Pseudo SSN, the Pseudo SSN Reason field is required." G PS
    119         K DA,DR,DIE
    120         Q
    121         ;
    122 CATDIB  ;
    123         ;Could be inconsistent because there is the catastrophic disability
    124         ;code without supporting information, or visa versa
    125         ;
    126         N DGCDIS,CODE,INFO
    127         S (INFO,CODE)=0
    128         I $$GET^DGENCDA(DFN,.DGCDIS),DGCDIS("DATE") S INFO=1
    129         S CODE=$$HASCAT^DGENCDA(DFN)
    130         I CODE D  Q
    131         .W !!,">>> Catastrophically Disabled eligibilty requires additional information <<<"
    132         .D EDITCD^DGENCD(DFN)
    133         I INFO D
    134         . ;KV;11/15/00;DG*5.3*297;Start of modifications
    135         . W !!,"The patient record indicates that a  determination was made "
    136         . W "that the patient",!,"is catastrophically disabled."
    137         . W !!,"To add Catastrophic Disability Eligibility Code(s), please use "
    138         . W "the menu option",!,"DGEN PATIENT ENROLLMENT.",!!
    139         .I $$ASKDEL() D
    140         .. I $$DELETE^DGENCDA1(DFN) D
    141         ...W !,">>> Determination Deleted <<<"
    142         ..;
    143         ..;could fail if lock could not be obtained
    144         ..E  W !,"Catastrophic disability determination can not be deleted at this time.",!,"Please try again later."
    145         ;KV;11/15/00;DG*5.3*297;End of modifications
    146         Q
    147         ;
    148 ASKDEL()        ;
    149         ;ask whether to delete catastrphic disability determination
    150         N DIR
    151         S DIR(0)="Y"
    152         ;KV;11/15/00;DG*5.3*297;Cosmetic change for DIR("A")
    153         S DIR("A")="Do you want to delete the determination showing that patient is catastrophically disabled"
    154         S DIR("B")="YES"
    155         D ^DIR
    156         Q:$D(DIRUT) 0
    157         Q $S(Y=1:1,1:0)
     1DGRPCE ;ALB/MRL,KV,PJR,BRM - CONSISTENCY CHECKER, EDIT INCONSISTENCIES ; 12/14/04 9:42am
     2 ;;5.3;Registration;**121,122,175,297,342,451,626,689,653,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 ;
     20 ;KV;11/15/00;DG*5.3*297;Disable addition of CD Elig Code in Reg. Screens
     21 ;                      ;Adding CD Elig Codes in Load/Edit Screen used to
     22 ;                      ;cause undefined line tag error.
     23 ;
     24 S DGVTYN=$P($G(^DPT(DFN,"VET")),"^",1),DGDR="DR",(DR,DGD,DGDRC,DGCCF)="",DGASK=",",DGER=","_DGER D ^DGRPCE1
     25 S DGEK=0 F I=9,10,11,12,13,14,18,19,20,22,24,36,51 Q:DGEK  I DGER[(","_I_",") S DGEK=1 Q
     26 I 'DGKEY(1) D:DGEK ELDR S I=15 D SASK S I=23 D SASK
     27 ;New EHR code  DAOU/WCJ  2/5/05
     28 ;skip veteran related fields for agency EHR
     29 G NKEY:$G(DUZ("AG"))="E"
     30 ;End EHR new code
     31 F I=29,30,31,32,33,43,44,45,48,56 D SASK,MON:DGCCF S DGCCF=0
     32 G NKEY:DGKEY(3) F I=25,26,27,28,34,35 D SASK
     33 I DGASK'[26 F I=41,42 I DGASK'[41 D SASK
     34 I DGASK'[27 S I=60 I DGASK'[25 D SASK
     35 I DGASK'[34 F I=37,38 I DGASK'[37 D SASK
     36 I DGASK'[35 F I=39,40 I DGASK'[39 D SASK
     37NKEY D ^DGRPCE1
     38 I $S(DGER[49:1,(DGER[50):1,(DGER[52):1,1:0) D
     39 .I $G(DGPRFLG) D PREG^IBCNBME(DFN) Q
     40 .D REG^IBCNBME(DFN)
     41 .Q
     42 D Q S DIE="^DPT(",(DA,Y)=DFN D ^DIE:$D(DR)
     43 I DGER[54 D GETREL^DGMTU11(DFN,"SD",$$LYR^DGMTSCU1(DT)) D
     44 . I $D(DGREL("S")),($$SSN^DGMTU1(+DGREL("S"))']"") D ASKSSN(DGREL("S"))
     45 . F DGDEP=0:0 S DGDEP=$O(DGREL("D",DGDEP)) Q:'DGDEP  I $$SSN^DGMTU1(+DGREL("D",DGDEP))']"" D ASKSSN(DGREL("D",DGDEP))
     46 ;
     47 I DGER[59 D CATDIB
     48 I DGER["82" D EN2^DGRP6CL
     49 ;
     50 K DGREL,DGDEP
     51KVAR K DR,DGEDCN,DGCT,DGER,DGINC55,DGRPADI,DGRPOUT,DGVTYN
     52Q K %,C,DA,DGASK,DGCCF,DGCT1,DGCT2,DGCT3,DGD,DGD1,DGD2,DGDR,DGDRC,DGECODE,DGEDIT,DGEK,DGKEY,DGP,DGRPADI,DGRPE,DIC,DIE,DIK,I,I1,J,X,X1,X2
     53 K DGCOMLOC,DGCOMBR,FRDT,DGFRDT
     54 D KVAR^VADPT
     55 Q
     56SASK I DGER[(","_I_","),DGASK'[(","_I_",") S DGD=$P($T(@I),";;",2,999),DGASK=DGASK_I_",",DGCCF=1 D SAVE
     57 Q
     58SAVE I $L(@DGDR)+$L(DGD)<241 S @DGDR=@DGDR_DGD,DGD="" Q
     59 S DGDRC=DGDRC+1,DGDR="DR(1,2,"_DGDRC_")",@DGDR=DGD,DGD="" Q
     60ELDR S DGASK=DGASK_"9,10,11,12,13,14,18,19,20,24,29,30,31,34,36,37,38,"
     61 ;Previous VA code prior to EHR changes
     62 ;I 'DGKEY(1) S DGD="391;1901;S DGVTYN=$S($D(^DPT(DFN,""VET"")):$P(^(""VET""),""^"",1),1:"""");S:X'=""Y"" Y=""@1"";.301;S:X'=""Y"" Y=""@1"";.302;@1;" D SAVE
     63 ;I 'DGKEY(2) F I=29,30,31 S DGD=$P($T(@I),";;",2,999) D SAVE
     64 ;D:DGD]"" SAVE I 'DGKEY(3) S DGD=$P($T(34),";;",2,999) D SAVE S DGD=$P($T(51),";;",2,999) D SAVE
     65 ;New code  DAOU/WCJ 2/5/05  Skip veteran specific fields
     66 I 'DGKEY(1),$G(DUZ("AG"))'="E"  S DGD="391;1901;S DGVTYN=$S($D(^DPT(DFN,""VET"")):$P(^(""VET""),""^"",1),1:"""");S:X'=""Y"" Y=""@1"";.301;S:X'=""Y"" Y=""@1"";.302;@1;" D SAVE
     67 I 'DGKEY(2),$G(DUZ("AG"))'="E"  F I=29,30,31 S DGD=$P($T(@I),";;",2,999) D SAVE
     68 D:DGD]"" SAVE I 'DGKEY(3),$G(DUZ("AG"))'="E"  S DGD=$P($T(34),";;",2,999) D SAVE S DGD=$P($T(51),";;",2,999) D SAVE
     69 ;End new code  DAOU/WCJ  2/5/05
     70 I 'DGKEY(1) D ELIG^DGRPCE1
     71 Q
     72MON I $S(I<40:1,I=56:1,1:0) D SAVE Q
     73 I $S(I<46:1,1:0),DGASK'[(","_(I-14)_",") D SAVE Q
     74 I DGASK'[(","_(I-15)_",") D SAVE
     75 Q
     76 ;
     7715 ;;.152;S:X']"" Y="@15";S DIE("NO^")="";.307;I X']"" W !!,*7,"But I need a reason why this applicant is ineligible!" S Y=.152;@15;K DIE("NO^");
     7823 ;;.3611;S:X'="V" Y="@23";.3612;S DIE("NO^")="";I X']"" W !!,*7,"But I need to know the date eligibility was verifed!";@23;K DIE("NO^");
     7925 ;;.323;.32102;S:X'="Y" Y="@25";.32107;.3211;.32109;.3213;@25;
     8026 ;;
     8127 ;;
     8228 ;;
     8329 ;;.36205;S:X'="Y" Y="@29";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim A&A" S Y=.36205;.36295;@29;
     8430 ;;.36215;S:X'="Y" Y="@30";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim HOUSEBOUND" S Y=.36215;.36295;@30;
     8531 ;;.36235;S:X'="Y" Y="@31";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim VA PENSION" S Y=.36235;.36295;@31;
     8632 ;;.36255;S:X'="Y" Y="@32";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim MIL. RET." S Y=.36255;.3625;@32;
     8733 ;;
     8834 ;;.525;S:X'="Y" Y="@34";I DGVTYN'="Y" W !,"Patient not a veteran-can't claim POW STATUS" S Y=.525;.526:.528;@34;
     8935 ;;
     9037 ;;.525;S:X'="Y" Y="@37";.526:.528;@37;
     9138 ;;.525;S:X'="Y" Y="@38";.526:.528;@38;
     9239 ;;.5291;S:X'="Y" Y="@39";.5292:.5294;@39;
     9340 ;;.5291;S:X'="Y" Y="@40";.5292:.5294;@40;
     9441 ;;.32101;S:X'="Y" Y="@41";.32104;.32105;@41;
     9542 ;;.32101;S:X'="Y" Y="@42";.32104;.32105;@42;
     9643 ;;
     9744 ;;
     9845 ;;
     9946 ;;
     10047 ;;
     10148 ;;.36265;S:X'="Y" Y="@48";.3626;@48;
     10251 ;;I DGVTYN'="Y" S Y="@51";.324:.328;@51;
     10356 ;;.3025;S:X'="Y" Y="@56";.36295;@56;
     10460 ;;.32102;S:X'="Y" Y="@60";.32107;.3211;.32109;.3213;@60;
     105 ;
     106 ; NOTE: #46 & 47 REMOVED WITH PIMS5.3
     107 ;
     108ASKSSN(DEP) ;edit ssns if missing
     109 ;
     110 ; input:  DEP as string for dependent (from GETREL)
     111 ;
     112 W !,$$NAME^DGMTU1(+DEP)
     113 S DA=+$P(DEP,"^",2),DIE="^DGPR(408.13,",DR=.09 D ^DIE
     114PS ;
     115 S DA=+$P(DEP,"^",2),DIE="^DGPR(408.13,",DR=.09 D ^DIE
     116 I $$GET1^DIQ(408.13,DA_",",.09)["P" D
     117 . S DR=.1,DA=$P(DA,";") D ^DIE
     118 . I X']"" W !,"If SSN is a Pseudo SSN, the Pseudo SSN Reason field is required." G PS
     119 K DA,DR,DIE
     120 Q
     121 ;
     122CATDIB ;
     123 ;Could be inconsistent because there is the catastrophic disability
     124 ;code without supporting information, or visa versa
     125 ;
     126 N DGCDIS,CODE,INFO
     127 S (INFO,CODE)=0
     128 I $$GET^DGENCDA(DFN,.DGCDIS),DGCDIS("DATE") S INFO=1
     129 S CODE=$$HASCAT^DGENCDA(DFN)
     130 I CODE D  Q
     131 .W !!,">>> Catastrophically Disabled eligibilty requires additional information <<<"
     132 .D EDITCD^DGENCD(DFN)
     133 I INFO D
     134 . ;KV;11/15/00;DG*5.3*297;Start of modifications
     135 . W !!,"The patient record indicates that a  determination was made "
     136 . W "that the patient",!,"is catastrophically disabled."
     137 . W !!,"To add Catastrophic Disability Eligibility Code(s), please use "
     138 . W "the menu option",!,"DGEN PATIENT ENROLLMENT.",!!
     139 .I $$ASKDEL() D
     140 .. I $$DELETE^DGENCDA1(DFN) D
     141 ...W !,">>> Determination Deleted <<<"
     142 ..;
     143 ..;could fail if lock could not be obtained
     144 ..E  W !,"Catastrophic disability determination can not be deleted at this time.",!,"Please try again later."
     145 ;KV;11/15/00;DG*5.3*297;End of modifications
     146 Q
     147 ;
     148ASKDEL() ;
     149 ;ask whether to delete catastrphic disability determination
     150 N DIR
     151 S DIR(0)="Y"
     152 ;KV;11/15/00;DG*5.3*297;Cosmetic change for DIR("A")
     153 S DIR("A")="Do you want to delete the determination showing that patient is catastrophically disabled"
     154 S DIR("B")="YES"
     155 D ^DIR
     156 Q:$D(DIRUT) 0
     157 Q $S(Y=1:1,1:0)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPD.m

    r613 r623  
    1 DGRPD   ;ALB/MRL/MLR/JAN/LBD/EG/BRM/JRC-PATIENT INQUIRY (NEW) ;1/27/07  13:14
    2         ;;5.3;Registration;**109,124,121,57,161,149,286,358,436,445,489,498,506,513,518,550,545,568,585,677,703,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA
    4         ; GPL Copyright (C) 2007 WorldVistA
    5         ;  *286*  Newing variables X,Y in OKLINE subroutine
    6        
    7 SEL     K DFN,DGRPOUT W ! S DIC="^DPT(",DIC(0)="AEQMZ" D ^DIC G Q:Y'>0 S DFN=+Y N Y W ! S DIR(0)="E" D ^DIR G SEL:$D(DTOUT)!($D(DUOUT)) D EN G SEL
    8         ;
    9 EN      ;call to display patient inquiry - input DFN
    10         ;MPI/PD CHANGE
    11         S DGCMOR="UNSPECIFIED",DGMPI=$G(^DPT(+DFN,"MPI"))
    12         S DGLOCATN=$$FIND1^DIC(4,"","MX","`"_+$P(DGMPI,U,3)),DGLOCATN=$S(+DGLOCATN>0:$P($$NS^XUAF4(DGLOCATN),U),1:"NOT LISTED")
    13         I $D(DGMPI),$D(DGLOCATN) S DGCMOR=$P(DGLOCATN,"^")
    14         ;END MPI/PD CHANGE
    15         K DGRPOUT,DGHOW S DGABBRV=$S($D(^DG(43,1,0)):+$P(^(0),"^",38),1:0),DGRPU="UNSPECIFIED" D DEM^VADPT,HDR F I=0,.11,.13,.121,.31,.32,.36,.361,.141,.3 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
    16         S DGAD=.11,(DGA1,DGA2)=1 D A^DGRPU S DGTMPAD=0 I $P(DGRP(.121),"^",9)="Y" S DGTMPAD=$S('$P(DGRP(.121),"^",8):1,$P(DGRP(.121),"^",8)'<DT:1,1:0) I DGTMPAD S DGAD=.121,DGA1=1,DGA2=2 D A^DGRPU
    17         W ?1,"Address: ",$S($D(DGA(1)):DGA(1),1:"NONE ON FILE"),?40,"Temporary: ",$S($D(DGA(2)):DGA(2),1:"NO TEMPORARY ADDRESS")
    18         S I=2 F I1=0:0 S I=$O(DGA(I)) Q:I=""  W:(I#2)!($X>50) !?10 W:'(I#2) ?51 W DGA(I)
    19         S DGCC=+$P(DGRP(.11),U,7),DGST=+$P(DGRP(.11),U,5),DGCC=$S($D(^DIC(5,DGST,1,DGCC,0)):$E($P(^(0),U,1),1,20)_$S($P(^(0),U,3)]"":" ("_$P(^(0),U,3)_")",1:""),1:DGRPU) W !?2,"County: ",DGCC
    20         S X="NOT APPLICABLE" I DGTMPAD S Y=$P(DGRP(.121),U,7) X:Y]"" ^DD("DD") S X=$S(Y]"":Y,1:DGRPU)_"-",Y=$P(DGRP(.121),U,8) X:Y]"" ^DD("DD") S X=X_$S(Y]"":Y,1:DGRPU)
    21         W ?42,"From/To: ",X,!?3,"Phone: ",$S($P(DGRP(.13),U,1)]"":$P(DGRP(.13),U,1),1:DGRPU),?44,"Phone: ",$S('DGTMPAD:X,$P(DGRP(.121),U,10)]"":$P(DGRP(.121),U,10),1:DGRPU) K DGTMPAD
    22         W !?2,"Office: ",$S($P(DGRP(.13),U,2)]"":$P(DGRP(.13),U,2),1:DGRPU)
    23         W !?4,"Cell: ",$S($P(DGRP(.13),U,4)]"":$P(DGRP(.13),U,4),1:DGRPU)
    24         W !?2,"E-mail: ",$S($P(DGRP(.13),U,3)]"":$P(DGRP(.13),U,3),1:DGRPU)
    25         W !,"Bad Addr: ",$$EXTERNAL^DILFD(2,.121,"",$$BADADR^DGUTL3(+DFN))
    26         D CA
    27         N DGEMER S DGEMER=$$EXTERNAL^DILFD(2,.181,"",$P($G(^DPT(DFN,.18)),"^"))
    28         W:DGEMER]"" !?32,"Emergency Response: ",DGEMER
    29         I 'DGABBRV W !!?4,"POS: ",$S($D(^DIC(21,+$P(DGRP(.32),"^",3),0)):$P(^(0),"^",1),1:DGRPU),?42,"Claim #: ",$S($P(DGRP(.31),"^",3)]"":$P(DGRP(.31),"^",3),1:"UNSPECIFIED")
    30         I 'DGABBRV W !?2,"Relig: ",$S($D(^DIC(13,+$P(DGRP(0),"^",8),0)):$P(^(0),"^",1),1:DGRPU),?46,"Sex: ",$S($P(VADM(5),"^",2)]"":$P(VADM(5),"^",2),1:"UNSPECIFIED")
    31         I 'DGABBRV W ! D
    32         .N RACE,ETHNIC,PTR,VAL,X,DIWL,DIWR,DIWF
    33         .K ^UTILITY($J,"W")
    34         .S PTR=0 F  S PTR=+$O(^DPT(DFN,.02,PTR)) Q:'PTR  D
    35         ..S VAL=+$G(^DPT(DFN,.02,PTR,0))
    36         ..Q:$$INACTIVE^DGUTL4(VAL,1)
    37         ..S VAL=$$PTR2TEXT^DGUTL4(VAL,1) S:+$O(^DPT(DFN,.02,PTR)) VAL=VAL_", "
    38         ..S X=VAL,DIWL=0,DIWR=30,DIWF="" D ^DIWP
    39         .M RACE=^UTILITY($J,"W",0) S:$G(RACE(1,0))="" RACE(1,0)="UNANSWERED"
    40         .K ^UTILITY($J,"W")
    41         .S PTR=0 F  S PTR=+$O(^DPT(DFN,.06,PTR)) Q:'PTR  D
    42         ..S VAL=+$G(^DPT(DFN,.06,PTR,0))
    43         ..Q:$$INACTIVE^DGUTL4(VAL,2)
    44         ..S VAL=$$PTR2TEXT^DGUTL4(VAL,2) S:+$O(^DPT(DFN,.06,PTR)) VAL=VAL_", "
    45         ..S X=VAL,DIWL=0,DIWR=30,DIWF="" D ^DIWP
    46         .M ETHNIC=^UTILITY($J,"W",0) S:$G(ETHNIC(1,0))="" ETHNIC(1,0)="UNANSWERED"
    47         .K ^UTILITY($J,"W")
    48         .W ?3,"Race: ",RACE(1,0),?40,"Ethnicity: ",ETHNIC(1,0)
    49         .F X=2:1 Q:'$D(RACE(X,0))&'$D(ETHNIC(X,0))  W !,?9,$G(RACE(X,0)),?51,$G(ETHNIC(X,0))
    50         I '$$OKLINE(16) G Q
    51         ;
    52         ; VOE change
    53         ;
    54         I DUZ("AG")="V" D
    55         . ;display cv status #4156
    56         . N DGCV S DGCV=$$CVEDT^DGCV(+DFN)
    57         . W !!,?2,"Combat Vet Status: "_$S($P(DGCV,U,3)=1:"ELIGIBLE",$P(DGCV,U,3)="":"NOT ELIGIBLE",1:"EXPIRED") I DGCV>0 W ?45,"End Date: "_$$FMTE^XLFDT($P(DGCV,U,2),"5DZ")
    58         ;
    59         ; end VOE change
    60         ;
    61         ;display primary eligibility
    62         S X1=DGRP(.36),X=$P(DGRP(.361),"^",1) W !,"Primary Eligibility: ",$S($D(^DIC(8,+X1,0)):$P(^(0),"^",1)_" ("_$S(X="V":"VERIFIED",X="P":"PENDING VERIFICATION",X="R":"PENDING REVERIFICATION",1:"NOT VERIFIED")_")",1:DGRPU)
    63         W !,"Other Eligibilities: " F I=0:0 S I=$O(^DIC(8,I)) Q:'I  I $D(^DIC(8,I,0)),I'=+X1 S X=$P(^(0),"^",1)_", " I $D(^DPT("AEL",DFN,I)) W:$X+$L(X)>79 !?21 W X
    64         I '$$OKLINE(16) G Q
    65         ;employability status
    66         W !?6,"Unemployable: ",$S($P(DGRP(.3),U,5)="Y":"YES",1:"NO")
    67         ;display the catastrophic disability review date if there is one
    68         D CATDIS^DGRPD1
    69         I $G(DGPRFLG)=1 G Q:'$$OKLINE(19) D
    70         . N DGPDT,DGPTM
    71         . W !,$$REPEAT^XLFSTR("-",78)
    72         . S DGPDT="",DGPDT=$O(^DGS(41.41,"ADC",DFN,DGPDT),-1)
    73         . W !,"[PRE-REGISTER DATE:]  "_$S(DGPDT]"":$$FMTE^XLFDT(DGPDT,"1D"),1:"NONE ON FILE")
    74         . S DGPTM=$$PCTEAM^DGSDUTL(DFN)
    75         . I $P(DGPTM,U,2)]"" W !,"[PRIMARY CARE TEAM:] "_$P(DGPTM,U,2)
    76         . W !,$$REPEAT^XLFSTR("-",78)
    77         ; Check if patient is an inpatient and on a DOM ward
    78         ; If inpatient is on a DOM ward, don't display MT or CP messages
    79         ; If inpatient is NOT on a DOM ward, don't display CP message
    80         N DGDOM,DGDOM1,VAHOW,VAROOT,VAINDT,VAIP,VAERR
    81         G Q:'$$OKLINE(14)
    82         D DOM^DGMTR
    83         I '$G(DGDOM) D
    84         .D DIS^DGMTU(DFN)
    85         .D IN5^VADPT
    86         .I $G(VAIP(1))="" D DISP^IBARXEU(DFN,DT,3,1)
    87         ;I 'DGABBRV,$E(IOST,1,2)="C-" F I=$Y:1:20 W !
    88         D DIS^EASECU(DFN)   ;Added for LTC III (DG*5.3*518)
    89         S VAIP("L")=""
    90         I $$OKLINE(14) D INP
    91         I '$G(DGRPOUT),($$OKLINE(17)) D SA
    92         ;MPI/PD CHANGE
    93 Q       D KVA^VADPT K %DT,D0,D1,DGA,DGA1,DGA2,DGABBRV,DGAD,DGCC,DGCMOR,DGDOM,DGLOCATN,DGMPI,DGRP,DGRPU,DGS,DGST,DGXFR0,DIC,DIR,DTOUT,DUOUT,DIRUT,DIROUT,I,I1,L,LDM,POP,SDCT,VA,X,X1,Y Q
    94 CA      ;Confidential Address
    95         W !!?1,"Confidential Address:  ",?44,"Confidential Address Categories:"
    96         N DGCABEG,DGCAEND,DGA,DGARRAY,DGERROR
    97         S DGCABEG=$P(DGRP(.141),U,7),DGCAEND=$P(DGRP(.141),U,8)
    98         I 'DGCABEG!(DGCABEG>DT)!(DGCAEND&(DGCAEND<DT)) D  Q
    99         .W !?9,"NO CONFIDENTIAL ADDRESS"
    100         .W !?1,"From/To: NOT APPLICABLE"
    101         S DGAD=.141,(DGA1,DGA2)=1
    102         D AL^DGRPU(30)
    103         D GETS^DIQ(2,DFN,".141*,","E","DGARRAY","DGERROR")
    104         ;Format Confidential Address categories
    105         N DGIEN,DGCAST
    106         S DGIEN=0
    107         S DGA2=2
    108         F  S DGIEN=$O(DGARRAY(2.141,DGIEN)) Q:'DGIEN  D
    109         .S DGA(DGA2)=DGARRAY(2.141,DGIEN,.01,"E")
    110         .S DGCAST=DGARRAY(2.141,DGIEN,1,"E")
    111         .S DGA(DGA2)=DGA(DGA2)_"("_$S(DGCAST="YES":"Active",1:"Inactive")_")"
    112         .S DGA2=DGA2+2
    113         S I=0 F I1=0:0 S I=$O(DGA(I)) Q:I=""  W:(I#2)!($X>43) !?9 W:'(I#2) ?44 W DGA(I)
    114         W !?1,"From/To:  ",$$FMTE^XLFDT(DGCABEG)_"-"_$S(DGCAEND'="":$$FMTE^XLFDT(DGCAEND),1:"UNANSWERED")
    115         Q
    116 HDR     I '$D(IOF) S IOP="HOME" D ^%ZIS K IOP
    117         ;MPI/PD CHANGE
    118         ; VOE CHANGE
    119         ; W @IOF,!,$P(VADM(1),"^",1),?40,$P(VADM(2),"^",2),?65,$P(VADM(3),"^",2) S X="",$P(X,"=",78)="" W !,X,!?15,"COORDINATING MASTER OF RECORD: ",DGCMOR,! Q
    120         W @IOF,!,$P(VADM(1),"^",1),?32,$P(VADM(2),"^",2),?50,$$HRNV(DFN),?65,$P(VADM(3),"^",2) S X="",$P(X,"=",78)="" W !,X,!?15,"COORDINATING MASTER OF RECORD: ",DGCMOR,! Q
    121         ;END MPI/PD CHANGE
    122 HRNV(DFN)       ;
    123         N IRET
    124         S IRET=$$HRN^DGLBPID(DFN)
    125         I IRET="#" Q ""
    126         S IRET="HRN "_IRET
    127         Q IRET
    128         ; END VOE CHANGE
    129         ;
    130 INP     S VAIP("D")="L" D INP^DGPMV10
    131         S DGPMT=0
    132         D CS^DGPMV10 K DGPMT,DGPMIFN K:'$D(DGSWITCH) DGPMVI,DGPMDCD Q
    133 SA      F I=0:0 S I=$O(^DGS(41.1,"B",DFN,I)) G CL:'I S X=^DGS(41.1,I,0) I $P(X,"^",2)>(DT-1),$P(X,"^",13)']"",'$P(X,"^",17) S L=$P(X,"^",2) D:$$OKLINE(17) SAA Q:$G(DGRPOUT)
    134         Q
    135 SAA     ;Scheduled Admit Data
    136         W !!?14,"Scheduled Admit"
    137         W:$D(^DIC(42,+$P(X,U,8),0)) " on ward "_$P(^(0),U)
    138         W:$D(^DIC(45.7,+$P(X,U,9),0)) " for treating specialty "_$P(^(0),U)
    139         W " on "_$$FMTE^XLFDT(L,"5DZ")
    140         Q  ;SAA
    141         ;
    142 CL      G FA:$O(^DPT(DFN,"DE",0))="" S SDCT=0 F I=0:0 S I=$O(^DPT(DFN,"DE",I)) Q:'I  I $D(^(I,0)),$P(^(0),"^",2)'="I",$O(^(0)) S SDCT=SDCT+1 W:SDCT=1 !!,"Currently enrolled in " W:$X>50 !?22 W $S($D(^SC(+^(0),0)):$P(^(0),"^",1)_", ",1:"")
    143         ;
    144 FA      G:'$$OKLINE(20) RMK
    145         ;
    146         N DGARRAY,SDCNT
    147         S DGARRAY("FLDS")="1;2;3;18",DGARRAY(4)=DFN,DGARRAY(1)=DT,DGARRAY("SORT")="P"
    148         S SDCNT=$$SDAPI^SDAMA301(.DGARRAY),CT=0 W !!,"Future Appointments: "
    149         ;if there is lower subscripts hanging from the 101 node,
    150         ;then it is a valid appointment, otherwise it is
    151         ;an error eg 01/20/2005
    152         I $D(^TMP($J,"SDAMA301",101))=1 W "Appointment Database is Unavailable" G RMK
    153         I $O(^TMP($J,"SDAMA301",DFN,DT))'>0 W "NONE" G RMK
    154         ;
    155         W ?22,"Date",?33,"Time",?39,"Clinic",!?22 F I=22:1:75 W "="
    156         F FA=DT:0 S FA=$O(^TMP($J,"SDAMA301",DFN,FA)) G RMK:'FA D  Q:CT>5
    157         .N STAT S STAT=$P($P(^TMP($J,"SDAMA301",DFN,FA),U,3),";")
    158         .S C=+$P(^TMP($J,"SDAMA301",DFN,FA),U,2) I STAT'["C" D
    159         ..D COV
    160         ..N DGAPPT S DGAPPT=$$FMTE^XLFDT($E(FA,1,12),"5Z")
    161         ..W !?22,$P(DGAPPT,"@"),?33,$P(DGAPPT,"@",2)
    162         ..W ?39,$P($P(^TMP($J,"SDAMA301",DFN,FA),U,2),";",2)," ",COV
    163         ..Q
    164         I $O(^TMP($J,"SDAMA301",DFN,FA))>0 W !,"See Scheduling options for additional appointments."
    165 RMK     I '$G(DGRPOUT),($$OKLINE(21)) W !!,"Remarks: ",$P(^DPT(DFN,0),"^",10)
    166         D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","PDTHINFO")
    167         W !!
    168         W "Date of Death Information"
    169         W !,?5,"Date of Death: ",$G(PDTHINFO(2,DFN_",",.351,"E"))
    170         W !,?5,"Source of Notification: ",$G(PDTHINFO(2,DFN_",",.353,"E"))
    171         W !,?5,"Updated Date/Time: ",$G(PDTHINFO(2,DFN_",",.354,"E"))
    172         W !,?5,"Last Edited By: ",$G(PDTHINFO(2,DFN_",",.355,"E")),!
    173         I $$OKLINE(14) D EC^DGRPD1
    174         K DGARRAY,SDCNT,^TMP($J,"SDAMA301"),ADM,L,TRN,DIS,SSN,FA,C,COV,NOW,CT,DGD,DGD1,I ;Y killed after dghinqky
    175         Q
    176 COV     S COV=$S(+$P(^TMP($J,"SDAMA301",DFN,FA),U,18)=7:" (Collateral) ",1:"")
    177         S COV=COV_$S(STAT["NT":" * NO ACTION TAKEN *",STAT["N":" * NO-SHOW *",1:""),CT=CT+1 Q
    178         Q
    179         ;
    180 OREN    S XQORQUIT=1 Q:'$D(ORVP)  S DFN=+ORVP D EN R !!,"Press RETURN to CONTINUE: ",X:DTIME
    181         Q
    182 OKLINE(DGLINE)  ;DOES PAUSE/HEADER IF $Y EXCEEDS DGLINE
    183         ;
    184         ;IN:   DGLINE --MAX LINE COUNT W/O PAUSE
    185         ;OUT:  DGLINE[RETURNED] -- 0 IF TIMEOUT/UP ARROW
    186         ;      DGRPOUT[SET]     -- 1 IF "
    187         N X,Y  ;**286** MLR 09/25/00  Newing X & Y variables prior to ^DIR
    188         I $G(IOST)["P-" Q DGLINE ; if printer, quit
    189         I $Y>DGLINE N DIR S DIR(0)="E" D ^DIR D:Y HDR I 'Y S DGRPOUT=1,DGLINE=0
    190         Q DGLINE
    191         ;
     1DGRPD ;ALB/MRL/MLR/JAN/LBD/EG/BRM/JRC-PATIENT INQUIRY (NEW) ;1/27/07  13:14
     2 ;;5.3;Registration;**109,124,121,57,161,149,286,358,436,445,489,498,506,513,518,550,545,568,585,677,703,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA
     4 ; GPL Copyright (C) 2007 WorldVistA
     5 ;  *286*  Newing variables X,Y in OKLINE subroutine
     6 
     7SEL K DFN,DGRPOUT W ! S DIC="^DPT(",DIC(0)="AEQMZ" D ^DIC G Q:Y'>0 S DFN=+Y N Y W ! S DIR(0)="E" D ^DIR G SEL:$D(DTOUT)!($D(DUOUT)) D EN G SEL
     8 ;
     9EN ;call to display patient inquiry - input DFN
     10 ;MPI/PD CHANGE
     11 S DGCMOR="UNSPECIFIED",DGMPI=$G(^DPT(+DFN,"MPI"))
     12 S DGLOCATN=$$FIND1^DIC(4,"","MX","`"_+$P(DGMPI,U,3)),DGLOCATN=$S(+DGLOCATN>0:$P($$NS^XUAF4(DGLOCATN),U),1:"NOT LISTED")
     13 I $D(DGMPI),$D(DGLOCATN) S DGCMOR=$P(DGLOCATN,"^")
     14 ;END MPI/PD CHANGE
     15 K DGRPOUT,DGHOW S DGABBRV=$S($D(^DG(43,1,0)):+$P(^(0),"^",38),1:0),DGRPU="UNSPECIFIED" D DEM^VADPT,HDR F I=0,.11,.13,.121,.31,.32,.36,.361,.141,.3 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
     16 S DGAD=.11,(DGA1,DGA2)=1 D A^DGRPU S DGTMPAD=0 I $P(DGRP(.121),"^",9)="Y" S DGTMPAD=$S('$P(DGRP(.121),"^",8):1,$P(DGRP(.121),"^",8)'<DT:1,1:0) I DGTMPAD S DGAD=.121,DGA1=1,DGA2=2 D A^DGRPU
     17 W ?1,"Address: ",$S($D(DGA(1)):DGA(1),1:"NONE ON FILE"),?40,"Temporary: ",$S($D(DGA(2)):DGA(2),1:"NO TEMPORARY ADDRESS")
     18 S I=2 F I1=0:0 S I=$O(DGA(I)) Q:I=""  W:(I#2)!($X>50) !?10 W:'(I#2) ?51 W DGA(I)
     19 S DGCC=+$P(DGRP(.11),U,7),DGST=+$P(DGRP(.11),U,5),DGCC=$S($D(^DIC(5,DGST,1,DGCC,0)):$E($P(^(0),U,1),1,20)_$S($P(^(0),U,3)]"":" ("_$P(^(0),U,3)_")",1:""),1:DGRPU) W !?2,"County: ",DGCC
     20 S X="NOT APPLICABLE" I DGTMPAD S Y=$P(DGRP(.121),U,7) X:Y]"" ^DD("DD") S X=$S(Y]"":Y,1:DGRPU)_"-",Y=$P(DGRP(.121),U,8) X:Y]"" ^DD("DD") S X=X_$S(Y]"":Y,1:DGRPU)
     21 W ?42,"From/To: ",X,!?3,"Phone: ",$S($P(DGRP(.13),U,1)]"":$P(DGRP(.13),U,1),1:DGRPU),?44,"Phone: ",$S('DGTMPAD:X,$P(DGRP(.121),U,10)]"":$P(DGRP(.121),U,10),1:DGRPU) K DGTMPAD
     22 W !?2,"Office: ",$S($P(DGRP(.13),U,2)]"":$P(DGRP(.13),U,2),1:DGRPU)
     23 W !?4,"Cell: ",$S($P(DGRP(.13),U,4)]"":$P(DGRP(.13),U,4),1:DGRPU)
     24 W !?2,"E-mail: ",$S($P(DGRP(.13),U,3)]"":$P(DGRP(.13),U,3),1:DGRPU)
     25 W !,"Bad Addr: ",$$EXTERNAL^DILFD(2,.121,"",$$BADADR^DGUTL3(+DFN))
     26 D CA
     27 N DGEMER S DGEMER=$$EXTERNAL^DILFD(2,.181,"",$P($G(^DPT(DFN,.18)),"^"))
     28 W:DGEMER]"" !?32,"Emergency Response: ",DGEMER
     29 I 'DGABBRV W !!?4,"POS: ",$S($D(^DIC(21,+$P(DGRP(.32),"^",3),0)):$P(^(0),"^",1),1:DGRPU),?42,"Claim #: ",$S($P(DGRP(.31),"^",3)]"":$P(DGRP(.31),"^",3),1:"UNSPECIFIED")
     30 I 'DGABBRV W !?2,"Relig: ",$S($D(^DIC(13,+$P(DGRP(0),"^",8),0)):$P(^(0),"^",1),1:DGRPU),?46,"Sex: ",$S($P(VADM(5),"^",2)]"":$P(VADM(5),"^",2),1:"UNSPECIFIED")
     31 I 'DGABBRV W ! D
     32 .N RACE,ETHNIC,PTR,VAL,X,DIWL,DIWR,DIWF
     33 .K ^UTILITY($J,"W")
     34 .S PTR=0 F  S PTR=+$O(^DPT(DFN,.02,PTR)) Q:'PTR  D
     35 ..S VAL=+$G(^DPT(DFN,.02,PTR,0))
     36 ..Q:$$INACTIVE^DGUTL4(VAL,1)
     37 ..S VAL=$$PTR2TEXT^DGUTL4(VAL,1) S:+$O(^DPT(DFN,.02,PTR)) VAL=VAL_", "
     38 ..S X=VAL,DIWL=0,DIWR=30,DIWF="" D ^DIWP
     39 .M RACE=^UTILITY($J,"W",0) S:$G(RACE(1,0))="" RACE(1,0)="UNANSWERED"
     40 .K ^UTILITY($J,"W")
     41 .S PTR=0 F  S PTR=+$O(^DPT(DFN,.06,PTR)) Q:'PTR  D
     42 ..S VAL=+$G(^DPT(DFN,.06,PTR,0))
     43 ..Q:$$INACTIVE^DGUTL4(VAL,2)
     44 ..S VAL=$$PTR2TEXT^DGUTL4(VAL,2) S:+$O(^DPT(DFN,.06,PTR)) VAL=VAL_", "
     45 ..S X=VAL,DIWL=0,DIWR=30,DIWF="" D ^DIWP
     46 .M ETHNIC=^UTILITY($J,"W",0) S:$G(ETHNIC(1,0))="" ETHNIC(1,0)="UNANSWERED"
     47 .K ^UTILITY($J,"W")
     48 .W ?3,"Race: ",RACE(1,0),?40,"Ethnicity: ",ETHNIC(1,0)
     49 .F X=2:1 Q:'$D(RACE(X,0))&'$D(ETHNIC(X,0))  W !,?9,$G(RACE(X,0)),?51,$G(ETHNIC(X,0))
     50 I '$$OKLINE(16) G Q
     51 ;
     52 ; VOE change
     53 ;
     54 I DUZ("AG")="V" D
     55 . ;display cv status #4156
     56 . N DGCV S DGCV=$$CVEDT^DGCV(+DFN)
     57 . W !!,?2,"Combat Vet Status: "_$S($P(DGCV,U,3)=1:"ELIGIBLE",$P(DGCV,U,3)="":"NOT ELIGIBLE",1:"EXPIRED") I DGCV>0 W ?45,"End Date: "_$$FMTE^XLFDT($P(DGCV,U,2),"5DZ")
     58 ;
     59 ; end VOE change
     60 ;
     61 ;display primary eligibility
     62 S X1=DGRP(.36),X=$P(DGRP(.361),"^",1) W !,"Primary Eligibility: ",$S($D(^DIC(8,+X1,0)):$P(^(0),"^",1)_" ("_$S(X="V":"VERIFIED",X="P":"PENDING VERIFICATION",X="R":"PENDING REVERIFICATION",1:"NOT VERIFIED")_")",1:DGRPU)
     63 W !,"Other Eligibilities: " F I=0:0 S I=$O(^DIC(8,I)) Q:'I  I $D(^DIC(8,I,0)),I'=+X1 S X=$P(^(0),"^",1)_", " I $D(^DPT("AEL",DFN,I)) W:$X+$L(X)>79 !?21 W X
     64 I '$$OKLINE(16) G Q
     65 ;employability status
     66 W !?6,"Unemployable: ",$S($P(DGRP(.3),U,5)="Y":"YES",1:"NO")
     67 ;display the catastrophic disability review date if there is one
     68 D CATDIS^DGRPD1
     69 I $G(DGPRFLG)=1 G Q:'$$OKLINE(19) D
     70 . N DGPDT,DGPTM
     71 . W !,$$REPEAT^XLFSTR("-",78)
     72 . S DGPDT="",DGPDT=$O(^DGS(41.41,"ADC",DFN,DGPDT),-1)
     73 . W !,"[PRE-REGISTER DATE:]  "_$S(DGPDT]"":$$FMTE^XLFDT(DGPDT,"1D"),1:"NONE ON FILE")
     74 . S DGPTM=$$PCTEAM^DGSDUTL(DFN)
     75 . I $P(DGPTM,U,2)]"" W !,"[PRIMARY CARE TEAM:] "_$P(DGPTM,U,2)
     76 . W !,$$REPEAT^XLFSTR("-",78)
     77 ; Check if patient is an inpatient and on a DOM ward
     78 ; If inpatient is on a DOM ward, don't display MT or CP messages
     79 ; If inpatient is NOT on a DOM ward, don't display CP message
     80 N DGDOM,DGDOM1,VAHOW,VAROOT,VAINDT,VAIP,VAERR
     81 G Q:'$$OKLINE(14)
     82 D DOM^DGMTR
     83 I '$G(DGDOM) D
     84 .D DIS^DGMTU(DFN)
     85 .D IN5^VADPT
     86 .I $G(VAIP(1))="" D DISP^IBARXEU(DFN,DT,3,1)
     87 ;I 'DGABBRV,$E(IOST,1,2)="C-" F I=$Y:1:20 W !
     88 D DIS^EASECU(DFN)   ;Added for LTC III (DG*5.3*518)
     89 S VAIP("L")=""
     90 I $$OKLINE(14) D INP
     91 I '$G(DGRPOUT),($$OKLINE(17)) D SA
     92 ;MPI/PD CHANGE
     93Q D KVA^VADPT K %DT,D0,D1,DGA,DGA1,DGA2,DGABBRV,DGAD,DGCC,DGCMOR,DGDOM,DGLOCATN,DGMPI,DGRP,DGRPU,DGS,DGST,DGXFR0,DIC,DIR,DTOUT,DUOUT,DIRUT,DIROUT,I,I1,L,LDM,POP,SDCT,VA,X,X1,Y Q
     94CA ;Confidential Address
     95 W !!?1,"Confidential Address:  ",?44,"Confidential Address Categories:"
     96 N DGCABEG,DGCAEND,DGA,DGARRAY,DGERROR
     97 S DGCABEG=$P(DGRP(.141),U,7),DGCAEND=$P(DGRP(.141),U,8)
     98 I 'DGCABEG!(DGCABEG>DT)!(DGCAEND&(DGCAEND<DT)) D  Q
     99 .W !?9,"NO CONFIDENTIAL ADDRESS"
     100 .W !?1,"From/To: NOT APPLICABLE"
     101 S DGAD=.141,(DGA1,DGA2)=1
     102 D AL^DGRPU(30)
     103 D GETS^DIQ(2,DFN,".141*,","E","DGARRAY","DGERROR")
     104 ;Format Confidential Address categories
     105 N DGIEN,DGCAST
     106 S DGIEN=0
     107 S DGA2=2
     108 F  S DGIEN=$O(DGARRAY(2.141,DGIEN)) Q:'DGIEN  D
     109 .S DGA(DGA2)=DGARRAY(2.141,DGIEN,.01,"E")
     110 .S DGCAST=DGARRAY(2.141,DGIEN,1,"E")
     111 .S DGA(DGA2)=DGA(DGA2)_"("_$S(DGCAST="YES":"Active",1:"Inactive")_")"
     112 .S DGA2=DGA2+2
     113 S I=0 F I1=0:0 S I=$O(DGA(I)) Q:I=""  W:(I#2)!($X>43) !?9 W:'(I#2) ?44 W DGA(I)
     114 W !?1,"From/To:  ",$$FMTE^XLFDT(DGCABEG)_"-"_$S(DGCAEND'="":$$FMTE^XLFDT(DGCAEND),1:"UNANSWERED")
     115 Q
     116HDR I '$D(IOF) S IOP="HOME" D ^%ZIS K IOP
     117 ;MPI/PD CHANGE
     118 ; VOE CHANGE
     119 ; W @IOF,!,$P(VADM(1),"^",1),?40,$P(VADM(2),"^",2),?65,$P(VADM(3),"^",2) S X="",$P(X,"=",78)="" W !,X,!?15,"COORDINATING MASTER OF RECORD: ",DGCMOR,! Q
     120 W @IOF,!,$P(VADM(1),"^",1),?32,$P(VADM(2),"^",2),?50,$$HRNV(DFN),?65,$P(VADM(3),"^",2) S X="",$P(X,"=",78)="" W !,X,!?15,"COORDINATING MASTER OF RECORD: ",DGCMOR,! Q
     121 ;END MPI/PD CHANGE
     122HRNV(DFN) ;
     123 N IRET
     124 S IRET=$$HRN^DGLBPID(DFN)
     125 I IRET="#" Q ""
     126 S IRET="HRN "_IRET
     127 Q IRET
     128 ; END VOE CHANGE
     129 ;
     130INP S VAIP("D")="L" D INP^DGPMV10
     131 S DGPMT=0
     132 D CS^DGPMV10 K DGPMT,DGPMIFN K:'$D(DGSWITCH) DGPMVI,DGPMDCD Q
     133SA F I=0:0 S I=$O(^DGS(41.1,"B",DFN,I)) G CL:'I S X=^DGS(41.1,I,0) I $P(X,"^",2)>(DT-1),$P(X,"^",13)']"",'$P(X,"^",17) S L=$P(X,"^",2) D:$$OKLINE(17) SAA Q:$G(DGRPOUT)
     134 Q
     135SAA ;Scheduled Admit Data
     136 W !!?14,"Scheduled Admit"
     137 W:$D(^DIC(42,+$P(X,U,8),0)) " on ward "_$P(^(0),U)
     138 W:$D(^DIC(45.7,+$P(X,U,9),0)) " for treating specialty "_$P(^(0),U)
     139 W " on "_$$FMTE^XLFDT(L,"5DZ")
     140 Q  ;SAA
     141 ;
     142CL G FA:$O(^DPT(DFN,"DE",0))="" S SDCT=0 F I=0:0 S I=$O(^DPT(DFN,"DE",I)) Q:'I  I $D(^(I,0)),$P(^(0),"^",2)'="I",$O(^(0)) S SDCT=SDCT+1 W:SDCT=1 !!,"Currently enrolled in " W:$X>50 !?22 W $S($D(^SC(+^(0),0)):$P(^(0),"^",1)_", ",1:"")
     143 ;
     144FA G:'$$OKLINE(20) RMK
     145 ;
     146 N DGARRAY,SDCNT
     147 S DGARRAY("FLDS")="1;2;3;18",DGARRAY(4)=DFN,DGARRAY(1)=DT,DGARRAY("SORT")="P"
     148 S SDCNT=$$SDAPI^SDAMA301(.DGARRAY),CT=0 W !!,"Future Appointments: "
     149 ;if there is lower subscripts hanging from the 101 node,
     150 ;then it is a valid appointment, otherwise it is
     151 ;an error eg 01/20/2005
     152 I $D(^TMP($J,"SDAMA301",101))=1 W "Appointment Database is Unavailable" G RMK
     153 I $O(^TMP($J,"SDAMA301",DFN,DT))'>0 W "NONE" G RMK
     154 ;
     155 W ?22,"Date",?33,"Time",?39,"Clinic",!?22 F I=22:1:75 W "="
     156 F FA=DT:0 S FA=$O(^TMP($J,"SDAMA301",DFN,FA)) G RMK:'FA D  Q:CT>5
     157 .N STAT S STAT=$P($P(^TMP($J,"SDAMA301",DFN,FA),U,3),";")
     158 .S C=+$P(^TMP($J,"SDAMA301",DFN,FA),U,2) I STAT'["C" D
     159 ..D COV
     160 ..N DGAPPT S DGAPPT=$$FMTE^XLFDT($E(FA,1,12),"5Z")
     161 ..W !?22,$P(DGAPPT,"@"),?33,$P(DGAPPT,"@",2)
     162 ..W ?39,$P($P(^TMP($J,"SDAMA301",DFN,FA),U,2),";",2)," ",COV
     163 ..Q
     164 I $O(^TMP($J,"SDAMA301",DFN,FA))>0 W !,"See Scheduling options for additional appointments."
     165RMK I '$G(DGRPOUT),($$OKLINE(21)) W !!,"Remarks: ",$P(^DPT(DFN,0),"^",10)
     166 D GETS^DIQ(2,DFN_",",".351;.353;.354;.355","E","PDTHINFO")
     167 W !!
     168 W "Date of Death Information"
     169 W !,?5,"Date of Death: ",$G(PDTHINFO(2,DFN_",",.351,"E"))
     170 W !,?5,"Source of Notification: ",$G(PDTHINFO(2,DFN_",",.353,"E"))
     171 W !,?5,"Updated Date/Time: ",$G(PDTHINFO(2,DFN_",",.354,"E"))
     172 W !,?5,"Last Edited By: ",$G(PDTHINFO(2,DFN_",",.355,"E")),!
     173 I $$OKLINE(14) D EC^DGRPD1
     174 K DGARRAY,SDCNT,^TMP($J,"SDAMA301"),ADM,L,TRN,DIS,SSN,FA,C,COV,NOW,CT,DGD,DGD1,I ;Y killed after dghinqky
     175 Q
     176COV S COV=$S(+$P(^TMP($J,"SDAMA301",DFN,FA),U,18)=7:" (Collateral) ",1:"")
     177 S COV=COV_$S(STAT["NT":" * NO ACTION TAKEN *",STAT["N":" * NO-SHOW *",1:""),CT=CT+1 Q
     178 Q
     179 ;
     180OREN S XQORQUIT=1 Q:'$D(ORVP)  S DFN=+ORVP D EN R !!,"Press RETURN to CONTINUE: ",X:DTIME
     181 Q
     182OKLINE(DGLINE) ;DOES PAUSE/HEADER IF $Y EXCEEDS DGLINE
     183 ;
     184 ;IN:   DGLINE --MAX LINE COUNT W/O PAUSE
     185 ;OUT:  DGLINE[RETURNED] -- 0 IF TIMEOUT/UP ARROW
     186 ;      DGRPOUT[SET]     -- 1 IF "
     187 N X,Y  ;**286** MLR 09/25/00  Newing X & Y variables prior to ^DIR
     188 I $G(IOST)["P-" Q DGLINE ; if printer, quit
     189 I $Y>DGLINE N DIR S DIR(0)="E" D ^DIR D:Y HDR I 'Y S DGRPOUT=1,DGLINE=0
     190 Q DGLINE
     191 ;
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPDB.m

    r613 r623  
    1 DGRPDB  ;ALB/AAS,JAN,ERC,PHH - VIEW ONLY SCREEN TO DETERMINE BILLING ELIGIBILITY ; 3/23/06 8:16am
    2         ;;5.3;Registration;**26,50,358,570,631,709,713,749**;Aug 13, 1993;Build 10
    3         ;
    4 %       S:'$D(DGQUIT) DGQUIT=0
    5         G:DGQUIT END S DIC="^DPT(",DIC(0)="AEQMN" D ^DIC G:+Y<1 END S DFN=+Y D EN
    6         G %
    7         ;
    8 EN      ;entry with DFN defined.
    9         Q:'$D(DFN)  D HOME^%ZIS,2^VADPT,HDR
    10         D MT,AOIR,ELIG,DIS
    11         N DGINS
    12         I $$INSUR^IBBAPI(DFN,"","AR",.DGINS,1)
    13         S C="",C=$O(DGINS("IBBAPI","INSUR",C),-1),C=+C+6
    14         D:($Y>(IOSL-C)) PAUSE,HDR:'DGQUIT Q:DGQUIT  D INS,PAUSE
    15         Q
    16         ;
    17 ELIG    ;eligibility code(s)
    18         W !!," Primary Elig. Code: ",$P(VAEL(1),"^",2),"  --  ",$S(VAEL(8)']"":"NOT VERIFIED",1:$P(VAEL(8),"^",2))
    19         I VAEL(8)]"" S Y=$S($D(^DPT(DFN,.361)):$P(^(.361),"^",2),1:"") W "  " D DT^DIQ
    20         W !,"Other Elig. Code(s): " I $D(VAEL(1))>9 S I1=0 F I=0:0 S I=$O(VAEL(1,I)) Q:'I  S I1=I1+1 W:I1>1 !?21 W $P(VAEL(1,I),"^",2)
    21         E  W "NO ADDITIONAL ELIGIBILITIES IDENTIFIED"
    22         Q
    23         ;
    24 DIS     ;rated disabilities - Integration Agreement #700
    25         ;
    26         ;  This is called from the FEE and MCCR package!!!
    27         ;
    28         ;  Input:  DFN as IEN of PATIENT file
    29         ;          VAEL array (if no passed, it is set) of eligibility info
    30         ;
    31         I '$D(VAEL) D ELIG^VADPT S DGKVAR=1
    32         W:'+VAEL(3) !!,"  Service Connected: NO" W:+VAEL(3) !!,"         SC Percent: ",$P(VAEL(3),"^",2)_"%"
    33         N DGQUIT
    34         W !," Rated Disabilities: " I 'VAEL(4),$S('$D(^DG(391,+VAEL(6),0)):1,$P(^(0),"^",2):0,1:1) W "NOT A VETERAN" G DISQ
    35         S I3=0 F I=0:0 S I=$O(^DPT(DFN,.372,I)) Q:'I!($G(DGQUIT)=1)  D
    36         . S I1=^(I,0),I2=$S($D(^DIC(31,+I1,0)):$P(^(0),"^",1)_" ("_+$P(I1,"^",2)_"%-"_$S($P(I1,"^",3):"SC",$P(I1,"^",3)']"":"not specified",1:"NSC")_")",1:""),I3=I3+1
    37         . I $Y>(IOSL-3) D PAUSE I $G(DGQUIT)=0 W @IOF
    38         . I $G(DGQUIT)=1 Q
    39         . W:I3>1 !?21 W I2
    40         W:'I3 "NONE STATED"
    41 DISQ    I $D(DGKVAR) D KVAR^VADPT K DGKVAR
    42         K I,I1,I2,I3
    43         Q
    44         ;
    45 INS     ;insurance information
    46         ;
    47         ;  This is called form the FEE package!!!
    48         ;
    49         ;  Input:  DFN as IEN of PATIENT file
    50         ;          DGINSDT as date to compute insurance flag as of (default DT)
    51         ;
    52         Q:'$D(DFN)
    53         W !!,"    Health Insurance: "
    54         S Z=$$INSUR^IBBAPI(DFN,$S($D(DGINSDT):DGINSDT,1:DT))
    55         W $S(Z:"YES",1:"NO")
    56         D DISP^DGIBDSP
    57 INSQ    K I,I1,DGX,Z
    58         Q
    59         ;
    60 IN      ; Old code
    61         Q
    62         ;
    63 AOIR    ;Agent Orange/ionizing radiation
    64         N DGEC,NTA
    65         S DGX=$S($D(^DPT(DFN,.321)):^(.321),1:"")
    66         F I=2,3 S X=$P(DGX,"^",I) W:I=2 !,"           A/O Exp.: " W:I=3 "ION Rad.: " W $S(X="Y":"YES",X="N":"NO",X="U":"UNKNOWN",1:"NOT ANSWERED"),"   "
    67         S X=$G(^DPT(DFN,.38)),X1=$P(X,"^",1) W "Medicaid Elig: ",$S(X1="":"NOT ANSWERED",'X1:"NO",1:"YES") I ($X+15)'>IOM W " - " S Y=$P(X,"^",2) D D^DIQ W $P(Y,"@")
    68         S DGEC=$S($D(^DPT(DFN,.322)):^DPT(DFN,.322),1:"")
    69         S X=$P(DGEC,U,13) W !,"        Env Contam.: " W $S(X="Y":"YES",X="N":"NO",X="U":"UNKNOWN",1:"NOT ANSWERED"),"   "
    70         S NTA=$S($$GETCUR^DGNTAPI(DFN,"DGNTARR")>0:DGNTARR("INTRP"),1:"")
    71         K DGNTARR
    72         W "N/T Radium: " W $S(NTA'="":NTA,1:"NOT ANSWERED")
    73         Q
    74         ;
    75 PAUSE   F J=1:1 Q:($Y>(IOSL-3))  W !
    76         S DGX1="" I $E(IOST,1,2)["C-" N DIR S DIR(0)="E" D ^DIR S DGQUIT='Y
    77         Q
    78         ;
    79 HDR     ;Screen Header
    80         W @IOF I $P(VAEL(6),"^",2)]"" S DGTYPE=$P(VAEL(6),"^",2)
    81         W $P(VADM(1),"^",1),?32,VA("PID"),?47,$P(VADM(3),"^",2) S X=$S($D(DGTYPE):$P(DGTYPE,"^",1),1:"PATIENT TYPE UNKNOWN"),X1=79-$L(X) W ?X1,X
    82         S X="",$P(X,"=",80)="" W !,X Q
    83         Q
    84         ;
    85 MT      I '$O(^DGMT(408.31,"AD",1,DFN,0)) W !,"  Means Test Status:  NOT IN MEANS TEST FILE" Q
    86         ;if patient is on a DOM ward, don't display Means Test required message
    87         D DOM^DGMTR D:'$G(DGDOM) DIS^DGMTU(DFN) K DGDOM
    88         Q
    89         ;
    90 END     D KVAR^VADPT
    91         K A,C,I,I1,I2,I3,J,DIC,DIR,DFN,DGA1,DGMT,DGMTL,DGMTLA,DGX,DGX1,DGT,DGTYPE,DGQUIT,DGMTLL,X,X1,VAROOT,VA,Y,Z
    92         Q
    93         ;
    94 RDIS(DGDFN,DGARR)       ;API to return all Rated Disabilities from the
    95         ;Patient file for a patient using an array.  Returned in descending Service Connected percent.
    96         ;
    97         ; Integration Agreement #4807
    98         ;
    99         ;Input          DGDFN - IEN of patient file (required)
    100         ;Input/Output   DGARR - name of array for returned disability info (required)
    101         ;               piece 1 - Disability IEN (in file 31)
    102         ;               piece 2 - Disability %
    103         ;               piece 3 - SC? (1,0)
    104         ;               piece 4 - extremity affected
    105         ;               piece 5 - original effective date
    106         ;               piece 6 - current effective date
    107         ;Output 1=successful and array returned with data
    108         ;       0=unsuccessful and no array
    109         ;         
    110         N DGARR1,DGC,DGCC,DGERR,DGNODE,DGCT,DGE,DGEE
    111         K DGW,DGARR
    112         I $G(DGDFN)']"" Q 0
    113         I '$D(^DPT(DGDFN,0)) Q 0
    114         D GETS^DIQ(2,DGDFN,".3721*","I","DGARR1","DGERR")
    115         I $D(DGERR) Q 0
    116         S DGCC=0
    117         S DGCC=$O(^DPT(DGDFN,.372,DGCC))
    118         I 'DGCC Q 0
    119         S DGC=""
    120         F  S DGC=$O(DGARR1(2.04,DGC)) Q:DGC']""  D
    121         . S DGNODE=DGC
    122         . S DGARR(DGC)=DGARR1(2.04,DGNODE,.01,"I")_"^"_DGARR1(2.04,DGNODE,2,"I")_"^"_DGARR1(2.04,DGNODE,3,"I")_"^"_DGARR1(2.04,DGNODE,4,"I")_"^"_DGARR1(2.04,DGNODE,5,"I")_"^"_DGARR1(2.04,DGNODE,6,"I")
    123         S DGE=""
    124         F  S DGE=$O(DGARR(DGE)) Q:'DGE  D
    125         . I $P(DGARR(DGE),U,2)="" S $P(DGARR(DGE),U,2)=0
    126         . S DGW($P(DGARR(DGE),U,2),$P(DGE,",",1))=DGARR(DGE)
    127         S DGE="",DGCT=1
    128         K DGARR
    129         F  S DGE=$O(DGW(DGE),-1) Q:DGE']""  D
    130         . F DGEE=0:0 S DGEE=$O(DGW(DGE,DGEE)) Q:DGEE'>0  D
    131         . . S DGARR(DGCT)=DGW(DGE,DGEE) S DGCT=DGCT+1
    132         K DGW
    133         Q 1
    134         ;
     1DGRPDB ;ALB/AAS,JAN,ERC,PHH - VIEW ONLY SCREEN TO DETERMINE BILLING ELIGIBILITY ; 3/23/06 8:16am
     2 ;;5.3;Registration;**26,50,358,570,631,709,713**;Aug 13, 1993
     3 ;
     4% S:'$D(DGQUIT) DGQUIT=0
     5 G:DGQUIT END S DIC="^DPT(",DIC(0)="AEQMN" D ^DIC G:+Y<1 END S DFN=+Y D EN
     6 G %
     7 ;
     8EN ;entry with DFN defined.
     9 Q:'$D(DFN)  D HOME^%ZIS,2^VADPT,HDR
     10 D MT,AOIR,ELIG,DIS
     11 N DGINS
     12 I $$INSUR^IBBAPI(DFN,"","AR",.DGINS,1)
     13 S C="",C=$O(DGINS("IBBAPI","INSUR",C),-1),C=+C+6
     14 D:($Y>(IOSL-C)) PAUSE,HDR:'DGQUIT Q:DGQUIT  D INS,PAUSE
     15 Q
     16 ;
     17ELIG ;eligibility code(s)
     18 W !!," Primary Elig. Code: ",$P(VAEL(1),"^",2),"  --  ",$S(VAEL(8)']"":"NOT VERIFIED",1:$P(VAEL(8),"^",2))
     19 I VAEL(8)]"" S Y=$S($D(^DPT(DFN,.361)):$P(^(.361),"^",2),1:"") W "  " D DT^DIQ
     20 W !,"Other Elig. Code(s): " I $D(VAEL(1))>9 S I1=0 F I=0:0 S I=$O(VAEL(1,I)) Q:'I  S I1=I1+1 W:I1>1 !?21 W $P(VAEL(1,I),"^",2)
     21 E  W "NO ADDITIONAL ELIGIBILITIES IDENTIFIED"
     22 Q
     23 ;
     24DIS ;rated disabilities - Integration Agreement #700
     25 ;
     26 ;  This is called from the FEE and MCCR package!!!
     27 ;
     28 ;  Input:  DFN as IEN of PATIENT file
     29 ;          VAEL array (if no passed, it is set) of eligibility info
     30 ;
     31 I '$D(VAEL) D ELIG^VADPT S DGKVAR=1
     32 W:'+VAEL(3) !!,"  Service Connected: NO" W:+VAEL(3) !!,"         SC Percent: ",$P(VAEL(3),"^",2)_"%"
     33 N DGQUIT
     34 W !," Rated Disabilities: " I 'VAEL(4),$S('$D(^DG(391,+VAEL(6),0)):1,$P(^(0),"^",2):0,1:1) W "NOT A VETERAN" G DISQ
     35 S I3=0 F I=0:0 S I=$O(^DPT(DFN,.372,I)) Q:'I!($G(DGQUIT)=1)  D
     36 . S I1=^(I,0),I2=$S($D(^DIC(31,+I1,0)):$P(^(0),"^",1)_" ("_+$P(I1,"^",2)_"%-"_$S($P(I1,"^",3):"SC",$P(I1,"^",3)']"":"not specified",1:"NSC")_")",1:""),I3=I3+1
     37 . I $Y>(IOSL-3) D PAUSE I $G(DGQUIT)=0 W @IOF
     38 . I $G(DGQUIT)=1 Q
     39 . W:I3>1 !?21 W I2
     40 W:'I3 "NONE STATED"
     41DISQ I $D(DGKVAR) D KVAR^VADPT K DGKVAR
     42 K I,I1,I2,I3
     43 Q
     44 ;
     45INS ;insurance information
     46 ;
     47 ;  This is called form the FEE package!!!
     48 ;
     49 ;  Input:  DFN as IEN of PATIENT file
     50 ;          DGINSDT as date to compute insurance flag as of (default DT)
     51 ;
     52 Q:'$D(DFN)
     53 W !!,"    Health Insurance: "
     54 S Z=$$INSUR^IBBAPI(DFN,$S($D(DGINSDT):DGINSDT,1:DT))
     55 W $S(Z:"YES",1:"NO")
     56 D DISP^DGIBDSP
     57INSQ K I,I1,DGX,Z
     58 Q
     59 ;
     60IN ; Old code
     61 Q
     62 ;
     63AOIR ;Agent Orange/ionizing radiation
     64 S DGX=$S($D(^DPT(DFN,.321)):^(.321),1:"")
     65 F I=2,3 S X=$P(DGX,"^",I) W:I=2 !,"           A/O Exp.: " W:I=3 "ION Rad.: " W $S(X="Y":"YES",X="N":"NO",X="U":"UNKNOWN",1:"NOT ANSWERED"),"   "
     66 S X=$G(^DPT(DFN,.38)),X1=$P(X,"^",1) W "Medicaid Elig: ",$S(X1="":"NOT ANSWERED",'X1:"NO",1:"YES") I ($X+15)'>IOM W " - " S Y=$P(X,"^",2) D D^DIQ W $P(Y,"@")
     67 Q
     68 ;
     69PAUSE F J=1:1 Q:($Y>(IOSL-3))  W !
     70 S DGX1="" I $E(IOST,1,2)["C-" N DIR S DIR(0)="E" D ^DIR S DGQUIT='Y
     71 Q
     72 ;
     73HDR ;Screen Header
     74 W @IOF I $P(VAEL(6),"^",2)]"" S DGTYPE=$P(VAEL(6),"^",2)
     75 W $P(VADM(1),"^",1),?32,VA("PID"),?47,$P(VADM(3),"^",2) S X=$S($D(DGTYPE):$P(DGTYPE,"^",1),1:"PATIENT TYPE UNKNOWN"),X1=79-$L(X) W ?X1,X
     76 S X="",$P(X,"=",80)="" W !,X Q
     77 Q
     78 ;
     79MT I '$O(^DGMT(408.31,"AD",1,DFN,0)) W !,"  Means Test Status:  NOT IN MEANS TEST FILE" Q
     80 ;if patient is on a DOM ward, don't display Means Test required message
     81 D DOM^DGMTR D:'$G(DGDOM) DIS^DGMTU(DFN) K DGDOM
     82 Q
     83 ;
     84END D KVAR^VADPT
     85 K A,C,I,I1,I2,I3,J,DIC,DIR,DFN,DGA1,DGMT,DGMTL,DGMTLA,DGX,DGX1,DGT,DGTYPE,DGQUIT,DGMTLL,X,X1,VAROOT,VA,Y,Z
     86 Q
     87 ;
     88RDIS(DGDFN,DGARR) ;API to return all Rated Disabilities from the
     89 ;Patient file for a patient using an array.  Returned in descending Service Connected percent.
     90 ;
     91 ; Integration Agreement #4807
     92 ;
     93 ;Input          DGDFN - IEN of patient file (required)
     94 ;Input/Output   DGARR - name of array for returned disability info (required)
     95 ;               piece 1 - Disability IEN (in file 31)
     96 ;               piece 2 - Disability %
     97 ;               piece 3 - SC? (1,0)
     98 ;               piece 4 - extremity affected
     99 ;               piece 5 - original effective date
     100 ;               piece 6 - current effective date
     101 ;Output 1=successful and array returned with data
     102 ;       0=unsuccessful and no array
     103 ;         
     104 N DGARR1,DGC,DGCC,DGERR,DGNODE,DGCT,DGE,DGEE
     105 K DGW,DGARR
     106 I $G(DGDFN)']"" Q 0
     107 I '$D(^DPT(DGDFN,0)) Q 0
     108 D GETS^DIQ(2,DGDFN,".3721*","I","DGARR1","DGERR")
     109 I $D(DGERR) Q 0
     110 S DGCC=0
     111 S DGCC=$O(^DPT(DGDFN,.372,DGCC))
     112 I 'DGCC Q 0
     113 S DGC=""
     114 F  S DGC=$O(DGARR1(2.04,DGC)) Q:DGC']""  D
     115 . S DGNODE=DGC
     116 . S DGARR(DGC)=DGARR1(2.04,DGNODE,.01,"I")_"^"_DGARR1(2.04,DGNODE,2,"I")_"^"_DGARR1(2.04,DGNODE,3,"I")_"^"_DGARR1(2.04,DGNODE,4,"I")_"^"_DGARR1(2.04,DGNODE,5,"I")_"^"_DGARR1(2.04,DGNODE,6,"I")
     117 S DGE=""
     118 F  S DGE=$O(DGARR(DGE)) Q:'DGE  D
     119 . I $P(DGARR(DGE),U,2)="" S $P(DGARR(DGE),U,2)=0
     120 . S DGW($P(DGARR(DGE),U,2),$P(DGE,",",1))=DGARR(DGE)
     121 S DGE="",DGCT=1
     122 K DGARR
     123 F  S DGE=$O(DGW(DGE),-1) Q:DGE']""  D
     124 . F DGEE=0:0 S DGEE=$O(DGW(DGE,DGEE)) Q:DGEE'>0  D
     125 . . S DGARR(DGCT)=DGW(DGE,DGEE) S DGCT=DGCT+1
     126 K DGW
     127 Q 1
     128 ;
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPE.m

    r613 r623  
    1 DGRPE   ;ALB/MRL,LBD,BRM,TMK - REGISTRATIONS EDITS ;1/27/07  13:11
    2         ;;5.3;Registration;**32,114,139,169,175,247,190,343,397,342,454,415,489,506,244,547,522,528,555,508,451,626,638,624,677,672,702,689,735,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ;
    12         ; VOE changes: DAOU,VA/CJS,WV/TOAD 5/9/2006
    13         ; conditionally add edit fields to the following lines:
    14         ;    201: Is Patient a Veteran (19902), Interpreter Language (19906)
    15         ;    202: skip line if agency code for IHS or VOE
    16         ; 305002+1: for VOE, Mother's Country of Birth (19903), Father's Country
    17         ;         of Birth (19904), Year Arrived in U.S. (19905)
    18         ;
    19         ;DGDR contains a string of edits; edit=screen*10+item #
    20         ;
    21         ;line tag screen*10+item*1000 = continuation line
    22         ;
    23         I DGRPS=1,DGDR["101," D CEDITS^DGRPECE(DFN)
    24         I DGRPS=8 D ^DGRPEIS,Q Q  ; family demographic edit...not conventional!!  :)
    25         I DGRPS=9 D EDIT9^DGRPEIS2,Q Q  ; income screening data ($$$)
    26         I DGRPS=5,DGDR["501," D
    27         .I $G(DGPRFLG) D PREG^IBCNBME(DFN) Q
    28         .D REG^IBCNBME(DFN)
    29         .Q
    30         N QUIT S QUIT=0
    31         I DGRPS=6,$S(DGDR["602,"!(DGDR["603,"):1,1:0) D  I QUIT D Q Q  ;Screen 6 subscreens
    32         . I DGDR["601," D  Q:QUIT
    33         .. D SETDR("601,",.DR)
    34         .. S (DA,Y)=DFN,DIE="^DPT("
    35         .. D ^DIE I $D(Y) S QUIT=1
    36         .. S DGDR=$P(DGDR,"601,",1)_$P(DGDR,"601,",2,999)
    37         . I DGDR["602," D EN^DGRP6CL(DFN,.QUIT)  Q:QUIT  ; Conflicts
    38         . I DGDR["603," D EN^DGRP6EF(DFN,.QUIT)  Q:QUIT  ; Exposures
    39         ;-- Tricare screen #15
    40         I DGRPS=15 D EDIT^DGRP15,Q Q
    41         ;
    42         N DGPH,DGPHFLG
    43         K DR S (DA,Y)=DFN,DIE="^DPT(",DR="",DGDRS="DR",DGCT=0
    44         G ^DGRPE1:DGRPS>6
    45         I DGRPS=4 D ^DGRPE4
    46         D SETDR(DGDR,.DR)
    47         S (DA,Y)=DFN,DIE="^DPT("
    48         D ^DIE
    49         ;check for Combat Vet status
    50         I $G(DGCVFLG)=1,($P($$CVEDT^DGCV(DFN),U,2)']"") D
    51         . W !!,"**NOTE-Change(s) made in this session deleted the veteran's Combat Vet status!"
    52         . S DIR(0)="EA" D ^DIR K DIR
    53         I $G(DGPHFLG)>0 D EDITPH1^DGRPLE()
    54 Q       K DA,DIE,DR,DGCT,DGCVFLG,DGDR,DGDRD,DGDRS,DGRPADI,I,J,J1,DGCOMLOC,DIPA
    55         Q
    56         ;
    57 SETDR(DGDR,DR)  ; Set up DR string(s) for edit groups selected
    58         N DGCT,DGDRS,J1,J2
    59         K DR S DR="",DGDRS="DR",DGCT=0
    60         F I=1:1 S J=$P(DGDR,",",I) Q:J=""  S J1=J D:$T(@J1)
    61         . S DGDRD=$P($T(@J1),";;",2) D S
    62         . N J2
    63         . F J2=0:1 S J1=J*1000+J2 Q:'$T(@J1)  S DGDRD=$P($T(@J1),";;",2) D S
    64         Q
    65         ;
    66 S       I $L(@DGDRS)+$L(DGDRD)<241 S @DGDRS=@DGDRS_DGDRD Q
    67         S DGCT=DGCT+1,DGDRS="DR(1,2,"_DGCT_")",@DGDRS=DGDRD Q
    68         Q
    69         ;
    70         ; VOE changes at lines 201, 202, 304 & after 305002
    71         ;
    72 SETFLDS(DGDR)   ; Set up fields to edit
    73         Q
    74         ;
    75 101     ;;
    76 102     ;;1;
    77 103     ;;.091;
    78 104     ;;N FLG S (FLG(1),FLG(2))=1 D EN^DGREGAED(DFN,.FLG);
    79 105     ;;.12105//NO;S:X="N" Y="@15" S:X="Y" DIE("NO^")="";.1217;I X']"" W !?4,$C(7),"But I need a Start Date for this Temporary Address." S Y=.12105;.1218;.1211;I X']"" W !?4,$C(7),"But I need at least one line of a Temporary address." S Y=.12105;
    80 105000  ;;.1212;S:X']"" Y=.1214;.1213:.1215;.12112;Q;.12111;.1219;@15;K DIE("NO^");
    81 109     ;;N FLG S (FLG(1),FLG(2))=1 D EN^DGREGAED(DFN,.FLG);.02;D DR109^DGRPE;6;2;K DR(2,2.02),DR(2,2.06);.05;.08;K DIE("NO^");
    82 111     ;;.14105//NO;S:X="N" Y="@111" S:X="Y" DIE("NO^")="";.1417;I X']"" W !?4,$C(7),"But I need a Start Date." S Y=.14105;.1418;D DR111^DGRPE;.141;I '$P($$CAACT^DGRPCADD(DFN),U,2) W !?4,"But I need at least one active category." S Y=.14105;
    83 111000  ;;K DR(2,2.141);.1411;I X']"" W !?4,$C(7),"I need at least one line of Address." S Y=.14105;.1412;S:X']"" Y=.1414;.1413;.1414;.1415;.1416;Q;.14111;@111;K DIE("NO^");
    84 112     ;;.134;.135;.133
    85 201     ;;.05;.08;.092;.093;.2401:.2403;57.4//NOT APPLICABLE;;S:$G(DUZ("AG"))'="E" Y="@21";19902;19906;@21
    86 202     ;;S:"IE"[$G(DUZ("AG")) Y="@22";1010.15//NO;S:X'="Y" Y="@22";S DIE("NO^")="";1010.152;I X']"" W !?4,*7,"But I need to know where you were treated most recently." S Y=1010.15;1010.151;1010.154;S:X']"" Y="@22";1010.153;@22;K DIE("NO^");
    87 203     ;;D DR203^DGRPE;6ETHNICITY;2RACE;K DR(2,2.02),DR(2,2.06);
    88 205     ;;.181;
    89 301     ;;.211;S:X']"" Y="@31";.212;.2125//NO;I X="Y" S DGADD=".21" D AD^DGRPE S Y=.21011;.213;S:X']"" Y=.216;.214;S:X']"" Y=.216;.215:.217;.2207;.219;.21011;@31;
    90 302     ;;.2191;S:X']"" Y="@32";.2192;.21925//NO;I X="Y" S DGADD=".211" D AD^DGRPE S Y=.211011;
    91 302000  ;;.2193;S:X']"" Y=.2196;.2194;S:X']"" Y=.2196;.2195:.2197;.2203;.2199;.211011;@32;
    92 303     ;;N DGX1,DGX2;I '$L($P($G(^DPT(DFN,.21)),U)) S Y="@33";.3305//NO;I X="Y" S Y="@34",DGX1=1 S:$D(^DPT(DFN,.22)) $P(^(.22),U,1)=$P(^(.22),U,7);@33;.331;S:X']"" DGX1=2,Y="@34";.332;@34;
    93 303000  ;;S:$G(DGX1) Y="@341";.333;S:X']"" Y=.336;.334;S:X']"" Y=.336;.335:.337;.2201;.339;.33011;S DGX1=2;@341;
    94 303001  ;;S:$G(DGX1)=2 Y="@35";S DGX2=$G(^DPT(DA,.21));.331///^S X=$P(DGX2,U);.332///^S X=$P(DGX2,U,2);.333////^S X=$P(DGX2,U,3);.334///^S X=$P(DGX2,U,4);@35;
    95 303002  ;;S:$G(DGX1)=2 Y="@351";.335///^S X=$P(DGX2,U,5);.336///^S X=$P(DGX2,U,6);.337///^S X=$P(DGX2,U,7);.338///^S X=$P(DGX2,U,8);.339///^S X=$P(DGX2,U,9);.33011///^S X=$P(DGX2,U,11);@351;K DGX1,DGX2;
    96 304     ;;.3311;S:X']"" Y="@36";.3312;.3313;S:X']"" Y=.3316;.3314;S:X']"" Y=.3316;.3315:.3317;.2204;.3319;.331011;@36;       
    97 305     ;;N DGX1,DGX2;I '$L($P($G(^DPT(DFN,.21)),U)) S Y="@37";.3405//NO;I X="Y" S DGX1=1,Y="@371" S:$D(^DPT(DFN,.22)) $P(^(.22),U,2)=$P(^(.22),U,7);@37;.341;S:X']"" DGX1=2,Y="@371";.342;@371;
    98 305000  ;;S:$G(DGX1) Y="@38";.343;S:X']"" Y=.346;.344;S:X']"" Y=.346;.345:.347;.2202;.349;.34011;S DGX1=2;@38;
    99 305001  ;;S:$G(DGX1)=2 Y="@381";S DGX2=$G(^DPT(DA,.21));.341///^S X=$P(DGX2,U);.342///^S X=$P(DGX2,U,2);.343///^S X=$P(DGX2,U,3);.344///^S X=$P(DGX2,U,4);@381
    100 305002  ;;S:$G(DGX1)=2 Y="@39";.345///^S X=$P(DGX2,U,5);.346///^S X=$P(DGX2,U,6);.347///^S X=$P(DGX2,U,7);.348///^S X=$P(DGX2,U,8);.349///^S X=$P(DGX2,U,9);.34011///^S X=$P(DGX2,U,11);@39;K DGX1,DGX2;
    101         ;;S:$G(DUZ("AG"))'="E" Y="@36";19903;19904;19905;@36401 ;;.01;.31115;S:($S(X']"":1,X=3:1,X=9:1,1:0)) Y="@41" S:(X'=5) Y=.3111;.31116;.3111;S:X']"" Y="@41";.3113;S:X']"" Y=.3116;.3114;S:X']"" Y=.3116;.3115:.3117;.2205;.3119;@41;
    102 401     ;;.01;.31115;S:($S(X']"":1,X=3:1,X=9:1,1:0)) Y="@41" S:(X'=5) Y=.3111;.31116;.3111;S:X']"" Y="@41";.3113;S:X']"" Y=.3116;.3114;S:X']"" Y=.3116;.3115:.3117;.2205;.3119;@41;
    103 402     ;;.2514;.2515;S:($S(X']"":1,X=3:1,X=9:1,1:0)) Y="@42" S:(X'=5) Y=.251;.2516;.251;S:X']"" Y="@42";.252;S:X']"" Y=.255;.253;S:X']"" Y=.255;.254:.256;.2206;.258;@42;
    104 501     ;;
    105 502     ;;.381;.382///NOW;
    106 503     ;;.383;
    107 601     ;;@60101;D SET32^DGRPE(DA,.DIPA,1);.325;S DIPA("X1")=X S:X="" Y="@60199" I X'="" S:$$FV^DGRPMS(X)'=1 Y="@60111";.3214;I X="" D PRF^DGRPE S Y="@60101";S Y="@6011";
    108 601000  ;;@60111;D:DIPA("X1")'="" WARN32^DGRPE(DIPA("X1"),.DIPA,1,.Y);.32911;@6011;.328;.326;.327;.324;.3285//NO;S:X'="Y" Y="@60199";
    109 601001  ;;@60102;D SET32^DGRPE(DA,.DIPA,2);.3291;S DIPA("X2")=X S:X="" Y="@60199" I X'="" S:$$FV^DGRPMS(X)'=1 Y="@60112";.3214;I X="" D PRF^DGRPE S Y="@60102";S Y="@6012";
    110 601002  ;;@60112;D:DIPA("X2")'="" WARN32^DGRPE(DIPA("X2"),.DIPA,2,.Y);.32912;@6012;.3294;.3292;.3293;.329;.32945//NO;S:X'="Y" Y="@60199";
    111 601003  ;;@60103;D SET32^DGRPE(DA,.DIPA,3);.3296;S DIPA("X3")=X S:X="" Y="@60199" I X'="" S:$$FV^DGRPMS(X)'=1 Y="@60113";.3214;I X="" D PRF^DGRPE S Y="@60103";S Y="@6013";
    112 601004  ;;@60113;D:DIPA("X3")'="" WARN32^DGRPE(DIPA("X3"),.DIPA,3,.Y);.32913;@6013;.3299;.3297;.3298;.3295;@60199;
    113 602     ;;Q;
    114 603     ;;Q;
    115 604     ;;.525//NO;S:X'="Y" Y="@62";.526:.528;@62;
    116 605     ;;.5291//NO;S:X'="Y" Y="@63";.5292:.5294;@63;
    117 606     ;;I $P($G(^DPT(DFN,.361)),U,3)="H" S Y="@6131";.3602//NO;.3603//NO;S Y="@6132";@6131;.3602;.3603;@6132;
    118 607     ;;.368//NO;.369//NO;I $S('$D(^DPT(DA,.36)):1,$P(^(.36),U,8)="Y"!($P(^(.36),U,9)="Y"):0,1:1) S Y="@614";.37;@614;
    119 608     ;;S DGPHFLG=0;.531;S:X'="Y" DGX=X,Y="@616";.532///^S X="PENDING";S Y="@6161";@616;S:DGX'="N" Y="@6162";.533///^S X="VAMC";@6161;S DGPHFLG=1;.535///^S X=$$DIV^DGRPLE();@6162;
    120 AD      N DGZ4,DGPC
    121         S X=$S($D(^DPT(DA,.11)):^(.11),1:""),DGZ4=$P(X,U,12),DGPHONE=$S($D(^(.13)):$P(^(.13),U,1),1:""),Y=$S($D(^(DGADD)):^(DGADD),1:""),^(DGADD)=$P(Y,U,1)_U_$P(Y,U,2)_U_$P(X,U,1,6)_U_DGPHONE_U_$P(Y,U,10)
    122         I DGZ4 S DGPC=$S((DGADD=.33):1,(DGADD=.34):2,(DGADD=.211):3,(DGADD=.331):4,(DGADD=.311):5,(DGADD=.25):6,(DGADD=.21):7,1:0) S:DGPC $P(^DPT(DFN,.22),U,DGPC)=DGZ4
    123         K DGADD,DGPHONE Q
    124 DR109   ;Drop through (use same logic as DR203)
    125 DR203   S DR(2,2.02)=".01RACE;I $P($G(^DIC(10.3,+$P($G(^DPT(DA(1),.02,DA,0)),""^"",2),0)),""^"",2)=""S"" S Y=""@2031"";.02;@2031;"
    126         S DR(2,2.06)=".01ETHNICITY;I $P($G(^DIC(10.3,+$P($G(^DPT(DA(1),.06,DA,0)),""^"",2),0)),""^"",2)=""S"" S Y=""@2032"";.02;@2032;"
    127         Q
    128 DR111   ;Set DR string for Confidential Address categories
    129         S DR(2,2.141)=".01;1//YES;"
    130         Q
    131 PRF     ; Write Proof needed for FV
    132         W !?4,$C(7),"Proof is required for Filipino vet."
    133         Q
    134         ;
    135 SET32(DA,DIPA,SEQ)      ; Extract the .32 node from patient file and set DIPA
    136         ; array with the BOS and component data for the SEQ military service
    137         ; episode (1-3)
    138         N I,Q,Z
    139         K DIPA(32,SEQ)
    140         S Q=$G(^DPT(DA,.32)),Z=$G(^(.3291))
    141         S DIPA(32,SEQ)=$P(Q,U,SEQ*5)_U_$P(Z,U,SEQ),DIPA("X"_SEQ)=$P(DIPA(32,SEQ),U)
    142         Q
    143         ;
    144 WARN32(X,DIPA,SEQ,Y)    ; Warn if the BOS is changed, then the component will
    145         ; be deleted
    146         ; Returns Y to skip component if the component should not be asked
    147         ;   for this branch of service
    148         N Z
    149         I '$$CMP(X) S Y="@601"_SEQ
    150         S Z=$G(DIPA(32,SEQ))
    151         Q:$S($P(Z,U,2)=""!($P(Z,U)=""):1,1:$P(Z,U)=X)
    152         ;
    153         I '$D(DIQUIET) W !!,*7,"** WARNING - BRANCH OF SERVICE WAS CHANGED SO THE COMPONENT WAS DELETED",!
    154         Q
    155         ;
    156 CMP(X)  ; Function to determine if service component is valid for
    157         ; branch of service ien in X   0 = invalid  1 = valid 
    158         ; Component only valid for ARMY/AIR FORCE/MARINES/COAST GUARD/NOAA/USPHS
    159         Q $S('$G(X):0,X'>5!(X=9)!(X=10):1,1:0)
    160         ;
     1DGRPE ;ALB/MRL,LBD,BRM,TMK - REGISTRATIONS EDITS ;1/27/07  13:11
     2 ;;5.3;Registration;**32,114,139,169,175,247,190,343,397,342,454,415,489,506,244,547,522,528,555,508,451,626,638,624,677,672,702,689,735,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ;
     12 ; VOE changes: DAOU,VA/CJS,WV/TOAD 5/9/2006
     13 ; conditionally add edit fields to the following lines:
     14 ;    201: Is Patient a Veteran (19902), Interpreter Language (19906)
     15 ;    202: skip line if agency code for IHS or VOE
     16 ; 305002+1: for VOE, Mother's Country of Birth (19903), Father's Country
     17 ;         of Birth (19904), Year Arrived in U.S. (19905)
     18 ;
     19 ;DGDR contains a string of edits; edit=screen*10+item #
     20 ;
     21 ;line tag screen*10+item*1000 = continuation line
     22 ;
     23 I DGRPS=1,DGDR["101," D CEDITS^DGRPECE(DFN)
     24 I DGRPS=8 D ^DGRPEIS,Q Q  ; family demographic edit...not conventional!!  :)
     25 I DGRPS=9 D EDIT9^DGRPEIS2,Q Q  ; income screening data ($$$)
     26 I DGRPS=5,DGDR["501," D
     27 .I $G(DGPRFLG) D PREG^IBCNBME(DFN) Q
     28 .D REG^IBCNBME(DFN)
     29 .Q
     30 N QUIT S QUIT=0
     31 I DGRPS=6,$S(DGDR["602,"!(DGDR["603,"):1,1:0) D  I QUIT D Q Q  ;Screen 6 subscreens
     32 . I DGDR["601," D  Q:QUIT
     33 .. D SETDR("601,",.DR)
     34 .. S (DA,Y)=DFN,DIE="^DPT("
     35 .. D ^DIE I $D(Y) S QUIT=1
     36 .. S DGDR=$P(DGDR,"601,",1)_$P(DGDR,"601,",2,999)
     37 . I DGDR["602," D EN^DGRP6CL(DFN,.QUIT)  Q:QUIT  ; Conflicts
     38 . I DGDR["603," D EN^DGRP6EF(DFN,.QUIT)  Q:QUIT  ; Exposures
     39 ;-- Tricare screen #15
     40 I DGRPS=15 D EDIT^DGRP15,Q Q
     41 ;
     42 N DGPH,DGPHFLG
     43 K DR S (DA,Y)=DFN,DIE="^DPT(",DR="",DGDRS="DR",DGCT=0
     44 G ^DGRPE1:DGRPS>6
     45 I DGRPS=4 D ^DGRPE4
     46 D SETDR(DGDR,.DR)
     47 S (DA,Y)=DFN,DIE="^DPT("
     48 D ^DIE
     49 ;check for Combat Vet status
     50 I $G(DGCVFLG)=1,($P($$CVEDT^DGCV(DFN),U,2)']"") D
     51 . W !!,"**NOTE-Change(s) made in this session deleted the veteran's Combat Vet status!"
     52 . S DIR(0)="EA" D ^DIR K DIR
     53 I $G(DGPHFLG)>0 D EDITPH1^DGRPLE()
     54Q K DA,DIE,DR,DGCT,DGCVFLG,DGDR,DGDRD,DGDRS,DGRPADI,I,J,J1,DGCOMLOC,DIPA
     55 Q
     56 ;
     57SETDR(DGDR,DR) ; Set up DR string(s) for edit groups selected
     58 N DGCT,DGDRS,J1,J2
     59 K DR S DR="",DGDRS="DR",DGCT=0
     60 F I=1:1 S J=$P(DGDR,",",I) Q:J=""  S J1=J D:$T(@J1)
     61 . S DGDRD=$P($T(@J1),";;",2) D S
     62 . N J2
     63 . F J2=0:1 S J1=J*1000+J2 Q:'$T(@J1)  S DGDRD=$P($T(@J1),";;",2) D S
     64 Q
     65 ;
     66S I $L(@DGDRS)+$L(DGDRD)<241 S @DGDRS=@DGDRS_DGDRD Q
     67 S DGCT=DGCT+1,DGDRS="DR(1,2,"_DGCT_")",@DGDRS=DGDRD Q
     68 Q
     69 ;
     70 ; VOE changes at lines 201, 202, 304 & after 305002
     71 ;
     72SETFLDS(DGDR) ; Set up fields to edit
     73 Q
     74 ;
     75101 ;;
     76102 ;;1;
     77103 ;;.091;
     78104 ;;N FLG S (FLG(1),FLG(2))=1 D EN^DGREGAED(DFN,.FLG);
     79105 ;;.12105//NO;S:X="N" Y="@15" S:X="Y" DIE("NO^")="";.1217;I X']"" W !?4,$C(7),"But I need a Start Date for this Temporary Address." S Y=.12105;.1218;.1211;I X']"" W !?4,$C(7),"But I need at least one line of a Temporary address." S Y=.12105;
     80105000 ;;.1212;S:X']"" Y=.1214;.1213:.1215;.12112;Q;.12111;.1219;@15;K DIE("NO^");
     81109 ;;N FLG S (FLG(1),FLG(2))=1 D EN^DGREGAED(DFN,.FLG);.02;D DR109^DGRPE;6;2;K DR(2,2.02),DR(2,2.06);.05;.08;K DIE("NO^");
     82111 ;;.14105//NO;S:X="N" Y="@111" S:X="Y" DIE("NO^")="";.1417;I X']"" W !?4,$C(7),"But I need a Start Date." S Y=.14105;.1418;D DR111^DGRPE;.141;I '$P($$CAACT^DGRPCADD(DFN),U,2) W !?4,"But I need at least one active category." S Y=.14105;
     83111000 ;;K DR(2,2.141);.1411;I X']"" W !?4,$C(7),"I need at least one line of Address." S Y=.14105;.1412;S:X']"" Y=.1414;.1413;.1414;.1415;.1416;Q;.14111;@111;K DIE("NO^");
     84112 ;;.134;.135;.133
     85201 ;;.05;.08;.092;.093;.2401:.2403;57.4//NOT APPLICABLE;;S:$G(DUZ("AG"))'="E" Y="@21";19902;19906;@21
     86202 ;;S:"IE"[$G(DUZ("AG")) Y="@22";1010.15//NO;S:X'="Y" Y="@22";S DIE("NO^")="";1010.152;I X']"" W !?4,*7,"But I need to know where you were treated most recently." S Y=1010.15;1010.151;1010.154;S:X']"" Y="@22";1010.153;@22;K DIE("NO^");
     87203 ;;D DR203^DGRPE;6ETHNICITY;2RACE;K DR(2,2.02),DR(2,2.06);
     88205 ;;.181;
     89301 ;;.211;S:X']"" Y="@31";.212;.2125//NO;I X="Y" S DGADD=".21" D AD^DGRPE S Y=.21011;.213;S:X']"" Y=.216;.214;S:X']"" Y=.216;.215:.217;.2207;.219;.21011;@31;
     90302 ;;.2191;S:X']"" Y="@32";.2192;.21925//NO;I X="Y" S DGADD=".211" D AD^DGRPE S Y=.211011;
     91302000 ;;.2193;S:X']"" Y=.2196;.2194;S:X']"" Y=.2196;.2195:.2197;.2203;.2199;.211011;@32;
     92303 ;;N DGX1,DGX2;I '$L($P($G(^DPT(DFN,.21)),U)) S Y="@33";.3305//NO;I X="Y" S Y="@34",DGX1=1 S:$D(^DPT(DFN,.22)) $P(^(.22),U,1)=$P(^(.22),U,7);@33;.331;S:X']"" DGX1=2,Y="@34";.332;@34;
     93303000 ;;S:$G(DGX1) Y="@341";.333;S:X']"" Y=.336;.334;S:X']"" Y=.336;.335:.337;.2201;.339;.33011;S DGX1=2;@341;
     94303001 ;;S:$G(DGX1)=2 Y="@35";S DGX2=$G(^DPT(DA,.21));.331///^S X=$P(DGX2,U);.332///^S X=$P(DGX2,U,2);.333////^S X=$P(DGX2,U,3);.334///^S X=$P(DGX2,U,4);@35;
     95303002 ;;S:$G(DGX1)=2 Y="@351";.335///^S X=$P(DGX2,U,5);.336///^S X=$P(DGX2,U,6);.337///^S X=$P(DGX2,U,7);.338///^S X=$P(DGX2,U,8);.339///^S X=$P(DGX2,U,9);.33011///^S X=$P(DGX2,U,11);@351;K DGX1,DGX2;
     96304 ;;.3311;S:X']"" Y="@36";.3312;.3313;S:X']"" Y=.3316;.3314;S:X']"" Y=.3316;.3315:.3317;.2204;.3319;.331011;@36;       
     97305 ;;N DGX1,DGX2;I '$L($P($G(^DPT(DFN,.21)),U)) S Y="@37";.3405//NO;I X="Y" S DGX1=1,Y="@371" S:$D(^DPT(DFN,.22)) $P(^(.22),U,2)=$P(^(.22),U,7);@37;.341;S:X']"" DGX1=2,Y="@371";.342;@371;
     98305000 ;;S:$G(DGX1) Y="@38";.343;S:X']"" Y=.346;.344;S:X']"" Y=.346;.345:.347;.2202;.349;.34011;S DGX1=2;@38;
     99305001 ;;S:$G(DGX1)=2 Y="@381";S DGX2=$G(^DPT(DA,.21));.341///^S X=$P(DGX2,U);.342///^S X=$P(DGX2,U,2);.343///^S X=$P(DGX2,U,3);.344///^S X=$P(DGX2,U,4);@381
     100305002 ;;S:$G(DGX1)=2 Y="@39";.345///^S X=$P(DGX2,U,5);.346///^S X=$P(DGX2,U,6);.347///^S X=$P(DGX2,U,7);.348///^S X=$P(DGX2,U,8);.349///^S X=$P(DGX2,U,9);.34011///^S X=$P(DGX2,U,11);@39;K DGX1,DGX2;
     101 ;;S:$G(DUZ("AG"))'="E" Y="@36";19903;19904;19905;@36401 ;;.01;.31115;S:($S(X']"":1,X=3:1,X=9:1,1:0)) Y="@41" S:(X'=5) Y=.3111;.31116;.3111;S:X']"" Y="@41";.3113;S:X']"" Y=.3116;.3114;S:X']"" Y=.3116;.3115:.3117;.2205;.3119;@41;
     102401 ;;.01;.31115;S:($S(X']"":1,X=3:1,X=9:1,1:0)) Y="@41" S:(X'=5) Y=.3111;.31116;.3111;S:X']"" Y="@41";.3113;S:X']"" Y=.3116;.3114;S:X']"" Y=.3116;.3115:.3117;.2205;.3119;@41;
     103402 ;;.2514;.2515;S:($S(X']"":1,X=3:1,X=9:1,1:0)) Y="@42" S:(X'=5) Y=.251;.2516;.251;S:X']"" Y="@42";.252;S:X']"" Y=.255;.253;S:X']"" Y=.255;.254:.256;.2206;.258;@42;
     104501 ;;
     105502 ;;.381;.382///NOW;
     106503 ;;.383;
     107601 ;;@60101;D SET32^DGRPE(DA,.DIPA,1);.325;S DIPA("X1")=X S:X="" Y="@60199" I X'="" S:$$FV^DGRPMS(X)'=1 Y="@60111";.3214;I X="" D PRF^DGRPE S Y="@60101";S Y="@6011";
     108601000 ;;@60111;D:DIPA("X1")'="" WARN32^DGRPE(DIPA("X1"),.DIPA,1,.Y);.32911;@6011;.328;.326;.327;.324;.3285//NO;S:X'="Y" Y="@60199";
     109601001 ;;@60102;D SET32^DGRPE(DA,.DIPA,2);.3291;S DIPA("X2")=X S:X="" Y="@60199" I X'="" S:$$FV^DGRPMS(X)'=1 Y="@60112";.3214;I X="" D PRF^DGRPE S Y="@60102";S Y="@6012";
     110601002 ;;@60112;D:DIPA("X2")'="" WARN32^DGRPE(DIPA("X2"),.DIPA,2,.Y);.32912;@6012;.3294;.3292;.3293;.329;.32945//NO;S:X'="Y" Y="@60199";
     111601003 ;;@60103;D SET32^DGRPE(DA,.DIPA,3);.3296;S DIPA("X3")=X S:X="" Y="@60199" I X'="" S:$$FV^DGRPMS(X)'=1 Y="@60113";.3214;I X="" D PRF^DGRPE S Y="@60103";S Y="@6013";
     112601004 ;;@60113;D:DIPA("X3")'="" WARN32^DGRPE(DIPA("X3"),.DIPA,3,.Y);.32913;@6013;.3299;.3297;.3298;.3295;@60199;
     113602 ;;Q;
     114603 ;;Q;
     115604 ;;.525//NO;S:X'="Y" Y="@62";.526:.528;@62;
     116605 ;;.5291//NO;S:X'="Y" Y="@63";.5292:.5294;@63;
     117606 ;;I $P($G(^DPT(DFN,.361)),U,3)="H" S Y="@6131";.3602//NO;.3603//NO;S Y="@6132";@6131;.3602;.3603;@6132;
     118607 ;;.368//NO;.369//NO;I $S('$D(^DPT(DA,.36)):1,$P(^(.36),U,8)="Y"!($P(^(.36),U,9)="Y"):0,1:1) S Y="@614";.37;@614;
     119608 ;;S DGPHFLG=0;.531;S:X'="Y" DGX=X,Y="@616";.532///^S X="PENDING";S Y="@6161";@616;S:DGX'="N" Y="@6162";.533///^S X="VAMC";@6161;S DGPHFLG=1;.535///^S X=$$DIV^DGRPLE();@6162;
     120AD N DGZ4,DGPC
     121 S X=$S($D(^DPT(DA,.11)):^(.11),1:""),DGZ4=$P(X,U,12),DGPHONE=$S($D(^(.13)):$P(^(.13),U,1),1:""),Y=$S($D(^(DGADD)):^(DGADD),1:""),^(DGADD)=$P(Y,U,1)_U_$P(Y,U,2)_U_$P(X,U,1,6)_U_DGPHONE_U_$P(Y,U,10)
     122 I DGZ4 S DGPC=$S((DGADD=.33):1,(DGADD=.34):2,(DGADD=.211):3,(DGADD=.331):4,(DGADD=.311):5,(DGADD=.25):6,(DGADD=.21):7,1:0) S:DGPC $P(^DPT(DFN,.22),U,DGPC)=DGZ4
     123 K DGADD,DGPHONE Q
     124DR109 ;Drop through (use same logic as DR203)
     125DR203 S DR(2,2.02)=".01RACE;I $P($G(^DIC(10.3,+$P($G(^DPT(DA(1),.02,DA,0)),""^"",2),0)),""^"",2)=""S"" S Y=""@2031"";.02;@2031;"
     126 S DR(2,2.06)=".01ETHNICITY;I $P($G(^DIC(10.3,+$P($G(^DPT(DA(1),.06,DA,0)),""^"",2),0)),""^"",2)=""S"" S Y=""@2032"";.02;@2032;"
     127 Q
     128DR111 ;Set DR string for Confidential Address categories
     129 S DR(2,2.141)=".01;1//YES;"
     130 Q
     131PRF ; Write Proof needed for FV
     132 W !?4,$C(7),"Proof is required for Filipino vet."
     133 Q
     134 ;
     135SET32(DA,DIPA,SEQ) ; Extract the .32 node from patient file and set DIPA
     136 ; array with the BOS and component data for the SEQ military service
     137 ; episode (1-3)
     138 N I,Q,Z
     139 K DIPA(32,SEQ)
     140 S Q=$G(^DPT(DA,.32)),Z=$G(^(.3291))
     141 S DIPA(32,SEQ)=$P(Q,U,SEQ*5)_U_$P(Z,U,SEQ),DIPA("X"_SEQ)=$P(DIPA(32,SEQ),U)
     142 Q
     143 ;
     144WARN32(X,DIPA,SEQ,Y) ; Warn if the BOS is changed, then the component will
     145 ; be deleted
     146 ; Returns Y to skip component if the component should not be asked
     147 ;   for this branch of service
     148 N Z
     149 I '$$CMP(X) S Y="@601"_SEQ
     150 S Z=$G(DIPA(32,SEQ))
     151 Q:$S($P(Z,U,2)=""!($P(Z,U)=""):1,1:$P(Z,U)=X)
     152 ;
     153 I '$D(DIQUIET) W !!,*7,"** WARNING - BRANCH OF SERVICE WAS CHANGED SO THE COMPONENT WAS DELETED",!
     154 Q
     155 ;
     156CMP(X) ; Function to determine if service component is valid for
     157 ; branch of service ien in X   0 = invalid  1 = valid 
     158 ; Component only valid for ARMY/AIR FORCE/MARINES/COAST GUARD/NOAA/USPHS
     159 Q $S('$G(X):0,X'>5!(X=9)!(X=10):1,1:0)
     160 ;
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPECE.m

    r613 r623  
    1 DGRPECE ;ALB/MRY - REGISTRATION CATASTROPHIC EDITS ;1/6/07  13:28
    2         ;;5.3;Registration;**638,682,700,720,653,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19         ;
    20 CEDITS(DFN)     ;catastrophic edits  - buffer values, save after check
    21         ;Input;
    22         ;  DFN  := patient ien
    23         ;Catastrophic edits will prompt for name, ssn, dob, and sex.  Placing
    24         ;responses into a buffer space.  User will be alerted on catastrophic
    25         ;edits on the following conditions:
    26         ; 1. Two or more catastrophic edits will generate a warning message.
    27         ; 2. Acceptance of two or more catastrophic edits will generate an alert
    28         ; to appropriate supervising staff holding the DG CATASTROPHIC EDIT key.
    29         ; 3. Acceptance of <2 catastrophic edits will process normally.
    30         ;
    31         ; Arrays: BEFORE - Holds patient values before the edit process
    32         ;                  (before snapshot).
    33         ;         BUFFER - initialized with BEFORE array, holds edited changes
    34         ;                  (after snapshot).
    35         ;         SAVE   - holds only edited changes for filing into file #2.
    36         ;
    37         N DA,DIR,DIRUT,Y,BUFFER,BEFORE,SAVE,DG20IEN
    38         D BEFORE(DFN,.BEFORE,.BUFFER) ;retrieve before patient values
    39         ;buffer - get name
    40         K DG20NAME
    41         S BUFFER("NAME")=$$NCEDIT^DPTNAME(DFN,,.DG20NAME)
    42         I BUFFER("NAME")="" S BUFFER("NAME")=BEFORE("NAME")
    43         I $D(DG20NAME("FAMILY")) S BUFFER("FAMILY")=DG20NAME("FAMILY")
    44         I $D(DG20NAME("GIVEN")) S BUFFER("GIVEN")=DG20NAME("GIVEN")
    45         I $D(DG20NAME("MIDDLE")) S BUFFER("MIDDLE")=DG20NAME("MIDDLE")
    46         I $D(DG20NAME("SUFFIX")) S BUFFER("SUFFIX")=DG20NAME("SUFFIX")
    47         ; the formal name is last name, first name, middle name and suffix
    48         ; the prefix and degree are only stored in file 20
    49         I $D(DG20NAME("PREFIX")) S BUFFER("PREFIX")=DG20NAME("PREFIX")
    50         I $D(DG20NAME("DEGREE")) S BUFFER("DEGREE")=DG20NAME("DEGREE")
    51         K DG20NAME
    52         ;buffer - get ssn
    53         S DIR(0)="2,.09^^"
    54         S DA=DFN D ^DIR
    55         I $D(DIRUT),DUZ("AG")="V" D CECHECK Q  ; VOE modification, SSN may be null
    56         I $D(DTOUT)!$D(DUOUT) D CECHECK Q  ; VOE modification
    57         S BUFFER("SSN")=Y
    58         ;if SSN is pseudo, Pseudo SSN Reason is req. - DG*5.3*653, ERC
    59         I $G(BUFFER("SSN"))["P" D  I $D(DIRUT) D CECHECK Q
    60 REAS    . ;
    61         . N DGREA,DGQSSN,DIR
    62         . S DGQSSN=0
    63         . S DGREA=$P($G(^DPT(DFN,"SSN")),U)
    64         . S DIR(0)="2,.0906^^"
    65         . S DA=DFN
    66         . D ^DIR
    67         . I ($D(DUOUT)!($D(DTOUT))!($D(DIRUT))),($G(BUFFER("SSNREAS"))']"") D
    68         . . W !?10,"PSSN Reason Required if SSN is a Pseudo."
    69         . . I $G(BEFORE("SSN"))["P" G REAS
    70         . . I $G(BEFORE("SSN"))']"" G REAS
    71         . . S DIR(0)="YA",DIR("A")="          Delete Pseudo SSN?: ",DIR("?")="If the SSN is a Pseudo SSN there must be a Pseudo SSN Reason.",DIR("B")="YES"
    72         . . D ^DIR
    73         . . I Y=1 S BUFFER("SSN")=BEFORE("SSN"),DGQSSN=1,Y="" Q
    74         . . G REAS
    75         . I DGQSSN=1 Q
    76         . S BUFFER("SSNREAS")=Y
    77         . I $D(DIRUT)!('$D(BUFFER("SSN"))) D CECHECK Q
    78 DOB     ;buffer - get dob
    79         S DIR(0)="2,.03^^"
    80         S DA=DFN D ^DIR
    81         I $D(DIRUT),DUZ("AG")="V" D CECHECK Q
    82         I $D(DTOUT)!$D(DUOUT) D CECHECK Q  ; VOE modification
    83         S BUFFER("DOB")=Y
    84 SEX     ;buffer - get sex
    85         S DIR(0)="2,.02^^"
    86         S DA=DFN D ^DIR
    87         I $D(DIRUT),DUZ("AG")="V" D CECHECK Q
    88         I $D(DTOUT)!$D(DUOUT) D CECHECK Q  ; VOE modification
    89         S BUFFER("SEX")=Y
    90 MBI     ; buffer - get MBI (multiple birth indicator)
    91         S DIR(0)="2,994^^"
    92         S DA=DFN D ^DIR
    93         S BUFFER("MBI")=Y
    94         I $D(DIRUT) D CECHECK Q
    95 CECHECK ;do catastrophic edit checks, alert, and save
    96         N DGCNT,DGCEFLG
    97         ;Compare before/buffer arrays, putting edits into save array.
    98         S DGCNT=$$AFTER(.BEFORE,.BUFFER,.SAVE)
    99         ;   DGCNT:  0  = no changes
    100         ;           1  = only one edit change, ok to save w/o CE message
    101         ;           >1 = more then 1 edit, give CE message
    102         I DGCNT>1 D  ;give CE message
    103         . S DGCEFLG=$$WARNING()
    104         . ;    DGCEFLG: 0  = exit without saving changes
    105         . ;             1  = send alert and save
    106         . I DGCEFLG=0 S DGCNT=0
    107         I DGCNT>0 D SAVE(DFN) I $D(DGCEFLG),DGCEFLG D ALERT
    108         Q
    109         ;
    110 SAVE(DFN)       ;store accepted/edited values into patient file
    111         N FDATA,DIERR
    112         I $D(SAVE("NAME")) S FDATA(2,+DFN_",",.01)=SAVE("NAME")
    113         I $D(SAVE("DOB")) S FDATA(2,+DFN_",",.03)=SAVE("DOB")
    114         I $D(SAVE("SEX")) S FDATA(2,+DFN_",",.02)=SAVE("SEX")
    115         I $D(SAVE("SSN")) S FDATA(2,+DFN_",",.09)=SAVE("SSN")
    116         I $D(SAVE("SSNREAS")) S FDATA(2,+DFN_",",.0906)=SAVE("SSNREAS")
    117         I $D(SAVE("MBI")) S FDATA(2,+DFN_",",994)=SAVE("MBI")
    118         D FILE^DIE("","FDATA","DIERR")
    119         K FDATA,DIERR
    120         I '$D(^VA(20,DG20IEN)) S DG20IEN=$$GET1^DIQ(2,+DFN_",",1.01,"I")
    121         I $D(SAVE("NAME")) D
    122         .S FDATA(20,+DG20IEN_",",1)=BUFFER("FAMILY")
    123         .S FDATA(20,+DG20IEN_",",2)=BUFFER("GIVEN")
    124         .S FDATA(20,+DG20IEN_",",3)=BUFFER("MIDDLE")
    125         .S FDATA(20,+DG20IEN_",",5)=BUFFER("SUFFIX")
    126         .D FILE^DIE("","FDATA","DIERR")
    127         .K FDATA,DIERR
    128         I $D(BUFFER("PREFIX")) S FDATA(20,+DG20IEN_",",4)=BUFFER("PREFIX")
    129         I $D(BUFFER("DEGREE")) S FDATA(20,+DG20IEN_",",6)=BUFFER("DEGREE")
    130         I $D(SAVE("PREFIX")) S FDATA(20,+DG20IEN_",",4)=SAVE("PREFIX")
    131         I $D(SAVE("DEGREE")) S FDATA(20,+DG20IEN_",",6)=SAVE("DEGREE")
    132         D FILE^DIE("","FDATA","DIERR")
    133         K FDATA,DIERR
    134         Q
    135         ;
    136 BEFORE(IEN,BEF,BUF)     ;save original name, ssn, dob, sex, mbi, prefix, degree
    137         N DG20
    138         S BEF("NAME")=$$GET1^DIQ(2,+IEN_",",.01),BUF("NAME")=BEF("NAME")
    139         S BEF("SSN")=$$GET1^DIQ(2,+IEN_",",.09),BUF("SSN")=BEF("SSN")
    140         S BEF("SSNREAS")=$$GET1^DIQ(2,+IEN_",",.0906),BUF("SSNREAS")=BEF("SSNREAS")
    141         S BEF("DOB")=$$GET1^DIQ(2,+IEN_",",.03,"I"),BUF("DOB")=BEF("DOB")
    142         S BEF("SEX")=$$GET1^DIQ(2,+IEN_",",.02,"I"),BUF("SEX")=BEF("SEX")
    143         S BEF("MBI")=$$GET1^DIQ(2,+IEN_",",994,"I"),BUF("MBI")=BEF("MBI")
    144         D GETS^DIQ(2,+IEN_",",1.01,"I","DG20")
    145         S BEF("FAMILY")="",BEF("GIVEN")="",BUF("FAMILY")="",BUF("GIVEN")=""
    146         S BEF("MIDDLE")="",BEF("SUFFIX")="",BUF("MIDDLE")="",BUF("SUFFIX")=""
    147         S BEF("PREFIX")="",BEF("DEGREE")="",BUF("PREFIX")="",BUF("DEGREE")=""
    148         S DG20IEN=DG20(2,+IEN_",",1.01,"I")
    149         I $$GET1^DIQ(20,+DG20IEN_",",.03)[+IEN D
    150         . S BEF("FAMILY")=$$GET1^DIQ(20,+DG20IEN_",",1),BUF("FAMILY")=BEF("FAMILY")
    151         . S BEF("GIVEN")=$$GET1^DIQ(20,+DG20IEN_",",2),BUF("GIVEN")=BEF("GIVEN")
    152         . S BEF("MIDDLE")=$$GET1^DIQ(20,+DG20IEN_",",3),BUF("MIDDLE")=BEF("MIDDLE")
    153         . S BEF("SUFFIX")=$$GET1^DIQ(20,+DG20IEN_",",5),BUF("SUFFIX")=BEF("SUFFIX")
    154         . S BEF("PREFIX")=$$GET1^DIQ(20,+DG20IEN_",",4),BUF("PREFIX")=BEF("PREFIX")
    155         . S BEF("DEGREE")=$$GET1^DIQ(20,+DG20IEN_",",6),BUF("DEGREE")=BEF("DEGREE")
    156         ;add some demographic information (before snapshot)
    157         S BEF("MAIDEN")=$E($$GET1^DIQ(2,+IEN_",",.2403),1,17)
    158         S BEF("POBCITY")=$E($$GET1^DIQ(2,+IEN_",",.092),1,15)
    159         S BEF("POBSTATE")=$$GET1^DIQ(2,+IEN_",",.093,"I")
    160         Q
    161         ;
    162 AFTER(BEF,BUF,SAV)      ;prevent catastrophic edit checks
    163         N DGCNT,DG20CNT S (DGCNT,DG20CNT)=0
    164         I $D(BUF("FAMILY")),BUF("FAMILY")'="",BUF("FAMILY")'=BEF("FAMILY") D
    165         . S DG20CNT=DG20CNT+1
    166         . S SAV("NAME")=BUF("NAME")
    167         I $D(BUF("GIVEN")),BUF("GIVEN")'="",BUF("GIVEN")'=BEF("GIVEN") D
    168         . S DG20CNT=DG20CNT+1
    169         . S SAV("NAME")=BUF("NAME")
    170         I $D(BUF("MIDDLE")),BUF("MIDDLE")'=BEF("MIDDLE") D
    171         . S SAV("NAME")=BUF("NAME") ; minor change doesn't count
    172         I $D(BUF("SUFFIX")),BUF("SUFFIX")'=BEF("SUFFIX") D
    173         . S SAV("NAME")=BUF("NAME") ; minor change doesn't count
    174         I DG20CNT>0 S DGCNT=1
    175         I $D(BUF("PREFIX")),BUF("PREFIX")'=BEF("PREFIX") D
    176         . S SAV("PREFIX")=BUF("PREFIX")
    177         I $D(BUF("DEGREE")),BUF("DEGREE")'=BEF("DEGREE") D
    178         . S SAV("DEGREE")=BUF("DEGREE")
    179         I $D(BUF("DOB")),BUF("DOB")'="",BUF("DOB")'=BEF("DOB") D
    180         . S SAV("DOB")=BUF("DOB"),DGCNT=DGCNT+1
    181         I $D(BUF("SEX")),BUF("SEX")'="",BUF("SEX")'=BEF("SEX") D
    182         . S SAV("SEX")=BUF("SEX"),DGCNT=DGCNT+1
    183         I $D(BUF("SSN")),BUF("SSN")'="",BUF("SSN")'=BEF("SSN") D
    184         . S SAV("SSN")=BUF("SSN"),DGCNT=DGCNT+1
    185         I $D(BUF("SSNREAS")),BUF("SSNREAS")'="",BUF("SSNREAS")'=BEF("SSNREAS") D
    186         . S SAV("SSNREAS")=BUF("SSNREAS"),DGCNT=DGCNT+1
    187         I $D(BUF("MBI")),BUF("MBI")'=BEF("MBI") D
    188         . S SAV("MBI")=BUF("MBI")
    189         I DGCNT=0,$D(SAV("NAME")) Q 1 ;minor name change (i.e. middle name or suffix)
    190         I DGCNT=0,$D(SAV("PREFIX"))!($D(SAV("DEGREE"))) Q 1 ; prefix or degree change
    191         I DGCNT=0,$D(SAV("MBI")) Q 1 ; multiple birth indicator change
    192         I DGCNT=0 Q 0 ;no changes
    193         I DGCNT<2 Q 1 ;make one change w/o CE message
    194         I DGCNT>1 Q 2 ;more than 1 change, send CE message
    195         ;
    196 WARNING()       ;CE warning message
    197         ;Output     0  = exit without saving changes
    198         ;           1  = send alert and save
    199         W !!,?25,"**WARNING!!**"
    200         W !!,"The edits you are about to make, may potentially change the identity of"
    201         W !,"this patient.  Please verify that you have selected the correct patient"
    202         W !,"and ensure that supporting documentation exists for these changes.  If"
    203         W !,"you continue with these edits, an alert will be generated and sent to"
    204         W !,"your Supervisor and ADPAC, notifying them of the changes."
    205         N DIR,DGANS,Y
    206         S DIR(0)="Y",DIR("A")="Do you wish to continue and save your edits:"
    207         S DIR("B")="NO" D ^DIR K DIR S DGANS=Y
    208         S DGANS=$S(Y=1:1,1:0) ;0=don't save, 1=save with CE alert
    209         Q DGANS
    210         ;
    211 ALERT   ;Queue alert
    212         X ^%ZOSF("UCI") S ZTUCI=Y,ZTRTN="ALERT^DGRPECE1",ZTDTH=$H,ZTIO="",IEN=DFN
    213         F V="IEN","BEFORE(","BUFFER(","SAVE(","XQY" S ZTSAVE(V)=""
    214         S ZTDESC="Patient Catastrophic Edits alert" K V,ZTSK N X D ^%ZTLOAD  Q
    215         ;D ALERT^DGRPECE1(DFN,.BEFORE,.BUFFER,.SAVE)
    216         Q
     1DGRPECE ;ALB/MRY - REGISTRATION CATASTROPHIC EDITS ;1/6/07  13:28
     2 ;;5.3;Registration;**638,682,700,720,653,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 ;
     20CEDITS(DFN) ;catastrophic edits  - buffer values, save after check
     21 ;Input;
     22 ;  DFN  := patient ien
     23 ;Catastrophic edits will prompt for name, ssn, dob, and sex.  Placing
     24 ;responses into a buffer space.  User will be alerted on catastrophic
     25 ;edits on the following conditions:
     26 ; 1. Two or more catastrophic edits will generate a warning message.
     27 ; 2. Acceptance of two or more catastrophic edits will generate an alert
     28 ; to appropriate supervising staff holding the DG CATASTROPHIC EDIT key.
     29 ; 3. Acceptance of <2 catastrophic edits will process normally.
     30 ;
     31 ; Arrays: BEFORE - Holds patient values before the edit process
     32 ;                  (before snapshot).
     33 ;         BUFFER - initialized with BEFORE array, holds edited changes
     34 ;                  (after snapshot).
     35 ;         SAVE   - holds only edited changes for filing into file #2.
     36 ;
     37 N DA,DIR,DIRUT,Y,BUFFER,BEFORE,SAVE,DG20IEN
     38 D BEFORE(DFN,.BEFORE,.BUFFER) ;retrieve before patient values
     39 ;buffer - get name
     40 K DG20NAME
     41 S BUFFER("NAME")=$$NCEDIT^DPTNAME(DFN,,.DG20NAME)
     42 I BUFFER("NAME")="" S BUFFER("NAME")=BEFORE("NAME")
     43 I $D(DG20NAME("FAMILY")) S BUFFER("FAMILY")=DG20NAME("FAMILY")
     44 I $D(DG20NAME("GIVEN")) S BUFFER("GIVEN")=DG20NAME("GIVEN")
     45 I $D(DG20NAME("MIDDLE")) S BUFFER("MIDDLE")=DG20NAME("MIDDLE")
     46 I $D(DG20NAME("SUFFIX")) S BUFFER("SUFFIX")=DG20NAME("SUFFIX")
     47 ; the formal name is last name, first name, middle name and suffix
     48 ; the prefix and degree are only stored in file 20
     49 I $D(DG20NAME("PREFIX")) S BUFFER("PREFIX")=DG20NAME("PREFIX")
     50 I $D(DG20NAME("DEGREE")) S BUFFER("DEGREE")=DG20NAME("DEGREE")
     51 K DG20NAME
     52 ;buffer - get ssn
     53 S DIR(0)="2,.09^^"
     54 S DA=DFN D ^DIR
     55 I $D(DIRUT),DUZ("AG")="V" D CECHECK Q  ; VOE modification, SSN may be null
     56 I $D(DTOUT)!$D(DUOUT) D CECHECK Q  ; VOE modification
     57 S BUFFER("SSN")=Y
     58 ;if SSN is pseudo, Pseudo SSN Reason is req. - DG*5.3*653, ERC
     59 I $G(BUFFER("SSN"))["P" D  I $D(DIRUT) D CECHECK Q
     60REAS . ;
     61 . N DGREA,DGQSSN,DIR
     62 . S DGQSSN=0
     63 . S DGREA=$P($G(^DPT(DFN,"SSN")),U)
     64 . S DIR(0)="2,.0906^^"
     65 . S DA=DFN
     66 . D ^DIR
     67 . I ($D(DUOUT)!($D(DTOUT))!($D(DIRUT))),($G(BUFFER("SSNREAS"))']"") D
     68 . . W !?10,"PSSN Reason Required if SSN is a Pseudo."
     69 . . I $G(BEFORE("SSN"))["P" G REAS
     70 . . I $G(BEFORE("SSN"))']"" G REAS
     71 . . S DIR(0)="YA",DIR("A")="          Delete Pseudo SSN?: ",DIR("?")="If the SSN is a Pseudo SSN there must be a Pseudo SSN Reason.",DIR("B")="YES"
     72 . . D ^DIR
     73 . . I Y=1 S BUFFER("SSN")=BEFORE("SSN"),DGQSSN=1,Y="" Q
     74 . . G REAS
     75 . I DGQSSN=1 Q
     76 . S BUFFER("SSNREAS")=Y
     77 . I $D(DIRUT)!('$D(BUFFER("SSN"))) D CECHECK Q
     78DOB ;buffer - get dob
     79 S DIR(0)="2,.03^^"
     80 S DA=DFN D ^DIR
     81 I $D(DIRUT),DUZ("AG")="V" D CECHECK Q
     82 I $D(DTOUT)!$D(DUOUT) D CECHECK Q  ; VOE modification
     83 S BUFFER("DOB")=Y
     84SEX ;buffer - get sex
     85 S DIR(0)="2,.02^^"
     86 S DA=DFN D ^DIR
     87 I $D(DIRUT),DUZ("AG")="V" D CECHECK Q
     88 I $D(DTOUT)!$D(DUOUT) D CECHECK Q  ; VOE modification
     89 S BUFFER("SEX")=Y
     90MBI ; buffer - get MBI (multiple birth indicator)
     91 S DIR(0)="2,994^^"
     92 S DA=DFN D ^DIR
     93 S BUFFER("MBI")=Y
     94 I $D(DIRUT) D CECHECK Q
     95CECHECK ;do catastrophic edit checks, alert, and save
     96 N DGCNT,DGCEFLG
     97 ;Compare before/buffer arrays, putting edits into save array.
     98 S DGCNT=$$AFTER(.BEFORE,.BUFFER,.SAVE)
     99 ;   DGCNT:  0  = no changes
     100 ;           1  = only one edit change, ok to save w/o CE message
     101 ;           >1 = more then 1 edit, give CE message
     102 I DGCNT>1 D  ;give CE message
     103 . S DGCEFLG=$$WARNING()
     104 . ;    DGCEFLG: 0  = exit without saving changes
     105 . ;             1  = send alert and save
     106 . I DGCEFLG=0 S DGCNT=0
     107 I DGCNT>0 D SAVE(DFN) I $D(DGCEFLG),DGCEFLG D ALERT
     108 Q
     109 ;
     110SAVE(DFN) ;store accepted/edited values into patient file
     111 N FDATA,DIERR
     112 I $D(SAVE("NAME")) S FDATA(2,+DFN_",",.01)=SAVE("NAME")
     113 I $D(SAVE("DOB")) S FDATA(2,+DFN_",",.03)=SAVE("DOB")
     114 I $D(SAVE("SEX")) S FDATA(2,+DFN_",",.02)=SAVE("SEX")
     115 I $D(SAVE("SSN")) S FDATA(2,+DFN_",",.09)=SAVE("SSN")
     116 I $D(SAVE("SSNREAS")) S FDATA(2,+DFN_",",.0906)=SAVE("SSNREAS")
     117 I $D(SAVE("MBI")) S FDATA(2,+DFN_",",994)=SAVE("MBI")
     118 D FILE^DIE("","FDATA","DIERR")
     119 K FDATA,DIERR
     120 I '$D(^VA(20,DG20IEN)) S DG20IEN=$$GET1^DIQ(2,+DFN_",",1.01,"I")
     121 I $D(SAVE("NAME")) D
     122 .S FDATA(20,+DG20IEN_",",1)=BUFFER("FAMILY")
     123 .S FDATA(20,+DG20IEN_",",2)=BUFFER("GIVEN")
     124 .S FDATA(20,+DG20IEN_",",3)=BUFFER("MIDDLE")
     125 .S FDATA(20,+DG20IEN_",",5)=BUFFER("SUFFIX")
     126 .D FILE^DIE("","FDATA","DIERR")
     127 .K FDATA,DIERR
     128 I $D(BUFFER("PREFIX")) S FDATA(20,+DG20IEN_",",4)=BUFFER("PREFIX")
     129 I $D(BUFFER("DEGREE")) S FDATA(20,+DG20IEN_",",6)=BUFFER("DEGREE")
     130 I $D(SAVE("PREFIX")) S FDATA(20,+DG20IEN_",",4)=SAVE("PREFIX")
     131 I $D(SAVE("DEGREE")) S FDATA(20,+DG20IEN_",",6)=SAVE("DEGREE")
     132 D FILE^DIE("","FDATA","DIERR")
     133 K FDATA,DIERR
     134 Q
     135 ;
     136BEFORE(IEN,BEF,BUF) ;save original name, ssn, dob, sex, mbi, prefix, degree
     137 N DG20
     138 S BEF("NAME")=$$GET1^DIQ(2,+IEN_",",.01),BUF("NAME")=BEF("NAME")
     139 S BEF("SSN")=$$GET1^DIQ(2,+IEN_",",.09),BUF("SSN")=BEF("SSN")
     140 S BEF("SSNREAS")=$$GET1^DIQ(2,+IEN_",",.0906),BUF("SSNREAS")=BEF("SSNREAS")
     141 S BEF("DOB")=$$GET1^DIQ(2,+IEN_",",.03,"I"),BUF("DOB")=BEF("DOB")
     142 S BEF("SEX")=$$GET1^DIQ(2,+IEN_",",.02,"I"),BUF("SEX")=BEF("SEX")
     143 S BEF("MBI")=$$GET1^DIQ(2,+IEN_",",994,"I"),BUF("MBI")=BEF("MBI")
     144 D GETS^DIQ(2,+IEN_",",1.01,"I","DG20")
     145 S BEF("FAMILY")="",BEF("GIVEN")="",BUF("FAMILY")="",BUF("GIVEN")=""
     146 S BEF("MIDDLE")="",BEF("SUFFIX")="",BUF("MIDDLE")="",BUF("SUFFIX")=""
     147 S BEF("PREFIX")="",BEF("DEGREE")="",BUF("PREFIX")="",BUF("DEGREE")=""
     148 S DG20IEN=DG20(2,+IEN_",",1.01,"I")
     149 I $$GET1^DIQ(20,+DG20IEN_",",.03)[+IEN D
     150 . S BEF("FAMILY")=$$GET1^DIQ(20,+DG20IEN_",",1),BUF("FAMILY")=BEF("FAMILY")
     151 . S BEF("GIVEN")=$$GET1^DIQ(20,+DG20IEN_",",2),BUF("GIVEN")=BEF("GIVEN")
     152 . S BEF("MIDDLE")=$$GET1^DIQ(20,+DG20IEN_",",3),BUF("MIDDLE")=BEF("MIDDLE")
     153 . S BEF("SUFFIX")=$$GET1^DIQ(20,+DG20IEN_",",5),BUF("SUFFIX")=BEF("SUFFIX")
     154 . S BEF("PREFIX")=$$GET1^DIQ(20,+DG20IEN_",",4),BUF("PREFIX")=BEF("PREFIX")
     155 . S BEF("DEGREE")=$$GET1^DIQ(20,+DG20IEN_",",6),BUF("DEGREE")=BEF("DEGREE")
     156 ;add some demographic information (before snapshot)
     157 S BEF("MAIDEN")=$E($$GET1^DIQ(2,+IEN_",",.2403),1,17)
     158 S BEF("POBCITY")=$E($$GET1^DIQ(2,+IEN_",",.092),1,15)
     159 S BEF("POBSTATE")=$$GET1^DIQ(2,+IEN_",",.093,"I")
     160 Q
     161 ;
     162AFTER(BEF,BUF,SAV) ;prevent catastrophic edit checks
     163 N DGCNT,DG20CNT S (DGCNT,DG20CNT)=0
     164 I $D(BUF("FAMILY")),BUF("FAMILY")'="",BUF("FAMILY")'=BEF("FAMILY") D
     165 . S DG20CNT=DG20CNT+1
     166 . S SAV("NAME")=BUF("NAME")
     167 I $D(BUF("GIVEN")),BUF("GIVEN")'="",BUF("GIVEN")'=BEF("GIVEN") D
     168 . S DG20CNT=DG20CNT+1
     169 . S SAV("NAME")=BUF("NAME")
     170 I $D(BUF("MIDDLE")),BUF("MIDDLE")'=BEF("MIDDLE") D
     171 . S SAV("NAME")=BUF("NAME") ; minor change doesn't count
     172 I $D(BUF("SUFFIX")),BUF("SUFFIX")'=BEF("SUFFIX") D
     173 . S SAV("NAME")=BUF("NAME") ; minor change doesn't count
     174 I DG20CNT>0 S DGCNT=1
     175 I $D(BUF("PREFIX")),BUF("PREFIX")'=BEF("PREFIX") D
     176 . S SAV("PREFIX")=BUF("PREFIX")
     177 I $D(BUF("DEGREE")),BUF("DEGREE")'=BEF("DEGREE") D
     178 . S SAV("DEGREE")=BUF("DEGREE")
     179 I $D(BUF("DOB")),BUF("DOB")'="",BUF("DOB")'=BEF("DOB") D
     180 . S SAV("DOB")=BUF("DOB"),DGCNT=DGCNT+1
     181 I $D(BUF("SEX")),BUF("SEX")'="",BUF("SEX")'=BEF("SEX") D
     182 . S SAV("SEX")=BUF("SEX"),DGCNT=DGCNT+1
     183 I $D(BUF("SSN")),BUF("SSN")'="",BUF("SSN")'=BEF("SSN") D
     184 . S SAV("SSN")=BUF("SSN"),DGCNT=DGCNT+1
     185 I $D(BUF("SSNREAS")),BUF("SSNREAS")'="",BUF("SSNREAS")'=BEF("SSNREAS") D
     186 . S SAV("SSNREAS")=BUF("SSNREAS"),DGCNT=DGCNT+1
     187 I $D(BUF("MBI")),BUF("MBI")'=BEF("MBI") D
     188 . S SAV("MBI")=BUF("MBI")
     189 I DGCNT=0,$D(SAV("NAME")) Q 1 ;minor name change (i.e. middle name or suffix)
     190 I DGCNT=0,$D(SAV("PREFIX"))!($D(SAV("DEGREE"))) Q 1 ; prefix or degree change
     191 I DGCNT=0,$D(SAV("MBI")) Q 1 ; multiple birth indicator change
     192 I DGCNT=0 Q 0 ;no changes
     193 I DGCNT<2 Q 1 ;make one change w/o CE message
     194 I DGCNT>1 Q 2 ;more than 1 change, send CE message
     195 ;
     196WARNING() ;CE warning message
     197 ;Output     0  = exit without saving changes
     198 ;           1  = send alert and save
     199 W !!,?25,"**WARNING!!**"
     200 W !!,"The edits you are about to make, may potentially change the identity of"
     201 W !,"this patient.  Please verify that you have selected the correct patient"
     202 W !,"and ensure that supporting documentation exists for these changes.  If"
     203 W !,"you continue with these edits, an alert will be generated and sent to"
     204 W !,"your Supervisor and ADPAC, notifying them of the changes."
     205 N DIR,DGANS,Y
     206 S DIR(0)="Y",DIR("A")="Do you wish to continue and save your edits:"
     207 S DIR("B")="NO" D ^DIR K DIR S DGANS=Y
     208 S DGANS=$S(Y=1:1,1:0) ;0=don't save, 1=save with CE alert
     209 Q DGANS
     210 ;
     211ALERT ;Queue alert
     212 X ^%ZOSF("UCI") S ZTUCI=Y,ZTRTN="ALERT^DGRPECE1",ZTDTH=$H,ZTIO="",IEN=DFN
     213 F V="IEN","BEFORE(","BUFFER(","SAVE(","XQY" S ZTSAVE(V)=""
     214 S ZTDESC="Patient Catastrophic Edits alert" K V,ZTSK N X D ^%ZTLOAD  Q
     215 ;D ALERT^DGRPECE1(DFN,.BEFORE,.BUFFER,.SAVE)
     216 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX.m

    r613 r623  
    1 DGRPTX ; GENERATED FROM 'DGRPT 10-10T REGISTRATION' INPUT TEMPLATE(#1476), FILE 2;12/13/08
     1DGRPTX ; GENERATED FROM 'DGRPT 10-10T REGISTRATION' INPUT TEMPLATE(#1476), FILE 2;04/21/06
    22 D DE G BEGIN
    33DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    44 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,2) S:%]"" DE(3)=%
    5  I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,1) S:%]"" DE(7)=% S %=$P(%Z,U,2) S:%]"" DE(9)=% S %=$P(%Z,U,3) S:%]"" DE(11)=%
     5 I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,1) S:%]"" DE(7)=% S %=$P(%Z,U,2) S:%]"" DE(9)=%
    66 I $D(^("TYPE")) S %Z=^("TYPE") S %=$P(%Z,U,1) S:%]"" DE(4)=%
    77 I $D(^("VET")) S %Z=^("VET") S %=$P(%Z,U,1) S:%]"" DE(5)=%
     
    9494C3F1 Q
    9595X3 Q
    96 4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW="TYPE;1",DV="P391'a",DU="",DLB="TYPE",DIFLD=391
     964 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW="TYPE;1",DV="RP391'a",DU="",DLB="TYPE",DIFLD=391
    9797 S DE(DW)="C4^DGRPTX",DE(DW,"INDEX")=1
    9898 S DU="DG(391,"
     
    118118C4F2 Q
    119119X4 Q
    120 5 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW="VET;1",DV="SXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
     1205 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW="VET;1",DV="RSXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
    121121 S DE(DW)="C5^DGRPTX"
    122122 S DU="Y:YES;N:NO;"
     
    126126 S DFN=DA D EN^DGMTCOR K DGMTCOR
    127127 S X=DE(5),DIC=DIE
    128  S DFN=DA D EN^DGRP7CC
    129  S X=DE(5),DIC=DIE
    130128 ;
    131129 S X=DE(5),DIC=DIE
     
    139137 S X=DG(DQ),DIC=DIE
    140138 S DFN=DA D EN^DGMTCOR K DGMTCOR
    141  S X=DG(DQ),DIC=DIE
    142  S DFN=DA D EN^DGRP7CC
    143139 S X=DG(DQ),DIC=DIE
    144140 X ^DD(2,1901,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X=DIV S X="N" X ^DD(2,1901,1,3,1.4)
     
    175171 S X=DE(7),DIIX=2_U_DIFLD D AUDIT^DIET
    176172C7S S X="" G:DG(DQ)=X C7F1 K DB
    177  S X=DG(DQ),DIC=DIE
    178  ;
    179  S X=DG(DQ),DIC=DIE
    180  S A1B2TAG="PAT" D ^A1B2XFR
    181  S X=DG(DQ),DIC=DIE
    182  D EVENT^IVMPLOG(DA)
    183  S X=DG(DQ),DIC=DIE
    184  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    185  S X=DG(DQ),DIC=DIE
    186  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    187  S X=DG(DQ),DIC=DIE
    188  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".111;" D AVAFC^VAFCDD01(DA)
    189  S X=DG(DQ),DIC=DIE
    190  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    191  I $D(DE(7))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     173 D ^DGRPTX1
    192174C7F1 N X,X1,X2 S DIXR=230 D C7X1(U) K X2 M X2=X D C7X1("O") K X1 M X1=X
    193175 D
     
    212194 G RE
    213195C9 G C9S:$D(DE(9))[0 K DB
    214  D ^DGRPTX1
     196 D ^DGRPTX2
    215197C9S S X="" G:DG(DQ)=X C9F1 K DB
    216  D ^DGRPTX2
     198 D ^DGRPTX3
    217199C9F1 N X,X1,X2 S DIXR=232 D C9X1(U) K X2 M X2=X D C9X1("O") K X1 M X1=X
    218200 D
     
    233215X10 S:X="" Y="@1112"
    234216 Q
    235 11 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".11;3",DV="Fa",DU="",DLB="STREET ADDRESS [LINE 3]",DIFLD=.113
    236  S DE(DW)="C11^DGRPTX",DE(DW,"INDEX")=1
    237  G RE
    238 C11 G C11S:$D(DE(11))[0 K DB
    239  D ^DGRPTX3
    240 C11S S X="" G:DG(DQ)=X C11F1 K DB
    241  D ^DGRPTX4
    242 C11F1 N X,X1,X2 S DIXR=233 D C11X1(U) K X2 M X2=X D C11X1("O") K X1 M X1=X
    243  D
    244  . D FC^DGFCPROT(.DA,2,.113,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    245  K X M X=X2 D
    246  . D FC^DGFCPROT(.DA,2,.113,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    247  G C11F2
    248 C11X1(DION) K X
    249  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.113,DION),$P($G(^DPT(DA,.11)),U,3))
    250  S X=$G(X(1))
    251  Q
    252 C11F2 Q
    253 X11 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X
    254  I $D(X),X'?.ANP K X
    255  Q
    256  ;
    257 12 S DQ=13 ;@1112
    258 13 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    259 X13 S EASZIPLK=1
    260  Q
    261 14 D:$D(DG)>9 F^DIE17 G ^DGRPTX5
     21711 D:$D(DG)>9 F^DIE17 G ^DGRPTX4
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX1.m

    r613 r623  
    1 DGRPTX1 ; ;12/13/08
    2  S X=DE(9),DIC=DIE
    3  X "S DGXRF=.112 D ^DGDDC Q"
    4  S X=DE(9),DIC=DIE
     1DGRPTX1 ; ;04/21/06
     2 S X=DG(DQ),DIC=DIE
     3 ;
     4 S X=DG(DQ),DIC=DIE
    55 S A1B2TAG="PAT" D ^A1B2XFR
    6  S X=DE(9),DIC=DIE
     6 S X=DG(DQ),DIC=DIE
    77 D EVENT^IVMPLOG(DA)
    8  S X=DE(9),DIC=DIE
     8 S X=DG(DQ),DIC=DIE
    99 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    10  S X=DE(9),DIC=DIE
     10 S X=DG(DQ),DIC=DIE
    1111 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    12  S X=DE(9),DIC=DIE
    13  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".112;" D AVAFC^VAFCDD01(DA)
    14  S X=DE(9),DIC=DIE
     12 S X=DG(DQ),DIC=DIE
     13 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".111;" D AVAFC^VAFCDD01(DA)
     14 S X=DG(DQ),DIC=DIE
    1515 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    16  S X=DE(9),DIIX=2_U_DIFLD D AUDIT^DIET
     16 I $D(DE(7))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX10.m

    r613 r623  
    1 DGRPTX10 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  D EVENT^IVMPLOG(DA)
    4  S X=DG(DQ),DIC=DIE
    5  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    6  S X=DG(DQ),DIC=DIE
    7  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".132;" D AVAFC^VAFCDD01(DA)
    8  S X=DG(DQ),DIC=DIE
    9  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    10  I $D(DE(7))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     1DGRPTX10 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(.21)) S %Z=^(.21) S %=$P(%Z,U,2) S:%]"" DE(1)=% S %=$P(%Z,U,3) S:%]"" DE(5)=% S %=$P(%Z,U,4) S:%]"" DE(7)=% S %=$P(%Z,U,5) S:%]"" DE(9)=% S %=$P(%Z,U,6) S:%]"" DE(10)=% S %=$P(%Z,U,7) S:%]"" DE(11)=% S %=$P(%Z,U,9) S:%]"" DE(13)=%
     5 I  S %=$P(%Z,U,10) S:%]"" DE(3)=% S %=$P(%Z,U,11) S:%]"" DE(14)=%
     6 I $D(^(.22)) S %Z=^(.22) S %=$P(%Z,U,7) S:%]"" DE(12)=%
     7 K %Z Q
     8 ;
     9W W !?DL+DL-2,DLB_": "
     10 Q
     11O D W W Y W:$X>45 !?9
     12 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     13 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     14TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     15 Q
     16A K DQ(DQ) S DQ=DQ+1
     17B G @DQ
     18RE G PR:$D(DE(DQ)) D W,TR
     19N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     20RD G QS:X?."?" I X["^" D D G ^DIE17
     21 I X="@" D D G Z^DIE2
     22 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     23T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     24 K DDER G X
     25P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     26 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     27 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     28V D @("X"_DQ) K YS
     29Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     30X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     31 S X="?BAD"
     32QS S DZ=X D D,QQ^DIEQ G B
     33D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     34Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     35PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     36R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     37 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     38 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     39RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     40I I DV'["I",DV'["#" G RD
     41 D E^DIE0 G RD:$D(X),PR
     42 Q
     43SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     44 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     45 D ^DIR I 'DDER S %=Y(0),X=Y
     46 Q
     47SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     48 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     49 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     50 Q
     51NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     52KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     53BEGIN S DNM="DGRPTX10",DQ=1
     541 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".21;2",DV="FX",DU="",DLB="K-RELATIONSHIP TO PATIENT",DIFLD=.212
     55 S DE(DW)="C1^DGRPTX10",DE(DW,"INDEX")=1
     56 G RE
     57C1 G C1S:$D(DE(1))[0 K DB
     58 S X=DE(1),DIC=DIE
     59 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     60C1S S X="" G:DG(DQ)=X C1F1 K DB
     61 S X=DG(DQ),DIC=DIE
     62 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     63C1F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     64 F DIXR=602 S DIEZRXR(2,DIXR)=""
     65 Q
     66X1 K:$L(X)>30!($L(X)<1) X I $D(X) S DFN=DA D K1^DGLOCK2
     67 I $D(X),X'?.ANP K X
     68 Q
     69 ;
     702 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 G A
     713 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".21;10",DV="RSX",DU="",DLB="K-ADDRESS SAME AS PATIENT'S?",DIFLD=.2125
     72 S DE(DW)="C3^DGRPTX10",DE(DW,"INDEX")=1
     73 S DU="Y:YES;N:NO;"
     74 S Y="NO"
     75 G Y
     76C3 G C3S:$D(DE(3))[0 K DB
     77C3S S X="" G:DG(DQ)=X C3F1 K DB
     78C3F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     79 F DIXR=602 S DIEZRXR(2,DIXR)=""
     80 Q
     81X3 I $D(X),X="Y" S DFN=DA D K1^DGLOCK2
     82 Q
     83 ;
     844 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     85X4 I X="Y" S DGADD=".21" D AD^DGRPE S Y=.21011
     86 Q
     875 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".21;3",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 1]",DIFLD=.213
     88 S DE(DW)="C5^DGRPTX10",DE(DW,"INDEX")=1
     89 G RE
     90C5 G C5S:$D(DE(5))[0 K DB
     91 S X=DE(5),DIC=DIE
     92 X "S DGXRF=.213 D ^DGDDC Q"
     93 S X=DE(5),DIC=DIE
     94 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     95C5S S X="" G:DG(DQ)=X C5F1 K DB
     96 S X=DG(DQ),DIC=DIE
     97 ;
     98 S X=DG(DQ),DIC=DIE
     99 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     100C5F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     101 F DIXR=602 S DIEZRXR(2,DIXR)=""
     102 Q
     103X5 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
     104 I $D(X),X'?.ANP K X
     105 Q
     106 ;
     1076 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     108X6 S:X="" Y=.216
     109 Q
     1107 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".21;4",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 2]",DIFLD=.214
     111 S DE(DW)="C7^DGRPTX10",DE(DW,"INDEX")=1
     112 G RE
     113C7 G C7S:$D(DE(7))[0 K DB
     114 S X=DE(7),DIC=DIE
     115 X "S DGXRF=.214 D ^DGDDC Q"
     116 S X=DE(7),DIC=DIE
     117 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     118C7S S X="" G:DG(DQ)=X C7F1 K DB
     119 S X=DG(DQ),DIC=DIE
     120 ;
     121 S X=DG(DQ),DIC=DIE
     122 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     123C7F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     124 F DIXR=602 S DIEZRXR(2,DIXR)=""
     125 Q
     126X7 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
     127 I $D(X),X'?.ANP K X
     128 Q
     129 ;
     1308 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     131X8 S:X="" Y=.216
     132 Q
     1339 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".21;5",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 3]",DIFLD=.215
     134 S DE(DW)="C9^DGRPTX10",DE(DW,"INDEX")=1
     135 G RE
     136C9 G C9S:$D(DE(9))[0 K DB
     137C9S S X="" G:DG(DQ)=X C9F1 K DB
     138C9F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     139 F DIXR=602 S DIEZRXR(2,DIXR)=""
     140 Q
     141X9 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
     142 I $D(X),X'?.ANP K X
     143 Q
     144 ;
     14510 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".21;6",DV="FX",DU="",DLB="K-CITY",DIFLD=.216
     146 S DE(DW)="C10^DGRPTX10",DE(DW,"INDEX")=1
     147 G RE
     148C10 G C10S:$D(DE(10))[0 K DB
     149 S X=DE(10),DIC=DIE
     150 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     151C10S S X="" G:DG(DQ)=X C10F1 K DB
     152 S X=DG(DQ),DIC=DIE
     153 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     154C10F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     155 F DIXR=602 S DIEZRXR(2,DIXR)=""
     156 Q
     157X10 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
     158 I $D(X),X'?.ANP K X
     159 Q
     160 ;
     16111 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".21;7",DV="P5'X",DU="",DLB="K-STATE",DIFLD=.217
     162 S DE(DW)="C11^DGRPTX10",DE(DW,"INDEX")=1
     163 S DU="DIC(5,"
     164 G RE
     165C11 G C11S:$D(DE(11))[0 K DB
     166 S X=DE(11),DIC=DIE
     167 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     168C11S S X="" G:DG(DQ)=X C11F1 K DB
     169 S X=DG(DQ),DIC=DIE
     170 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     171C11F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     172 F DIXR=602 S DIEZRXR(2,DIXR)=""
     173 Q
     174X11 I $D(X) S DFN=DA D K1^DGLOCK2
     175 Q
     176 ;
     17712 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".22;7",DV="FOX",DU="",DLB="K-ZIP+4",DIFLD=.2207
     178 S DQ(12,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
     179 S DE(DW)="C12^DGRPTX10",DE(DW,"INDEX")=1
     180 G RE
     181C12 G C12S:$D(DE(12))[0 K DB
     182 S X=DE(12),DIC=DIE
     183 D KILL^DGREGDD1(DA,.218,.21,8,$E(X,1,5))
     184C12S S X="" G:DG(DQ)=X C12F1 K DB
     185 S X=DG(DQ),DIC=DIE
     186 D SET^DGREGDD1(DA,.218,.21,8,$E(X,1,5))
     187C12F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     188 F DIXR=602 S DIEZRXR(2,DIXR)=""
     189 Q
     190X12 K:X[""""!($A(X)=45) X I $D(X) S DFN=DA D K1^DGLOCK2 I $D(X) K:$L(X)>15!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
     191 I $D(X),X'?.ANP K X
     192 Q
     193 ;
     19413 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".21;9",DV="FXa",DU="",DLB="K-PHONE NUMBER",DIFLD=.219
     195 S DE(DW)="C13^DGRPTX10"
     196 G RE
     197C13 G C13S:$D(DE(13))[0 K DB
     198 D ^DGRPTX11
     199C13S S X="" G:DG(DQ)=X C13F1 K DB
     200 D ^DGRPTX12
     201C13F1 Q
     202X13 K:$L(X)>20!($L(X)<4) X I $D(X) S DFN=DA D K1^DGLOCK2
     203 I $D(X),X'?.ANP K X
     204 Q
     205 ;
     20614 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".21;11",DV="F",DU="",DLB="K-WORK PHONE NUMBER",DIFLD=.21011
     207 G RE
     208X14 K:$L(X)>20!($L(X)<4) X
     209 I $D(X),X'?.ANP K X
     210 Q
     211 ;
     21215 S DQ=16 ;@30
     21316 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     214X16 I $S('$D(^DPT(DFN,.21)):1,$P(^(.21),U,1)="":1,1:0) S Y=.331
     215 Q
     21617 D:$D(DG)>9 F^DIE17 G ^DGRPTX13
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX11.m

    r613 r623  
    1 DGRPTX11 ; ;12/13/08
    2  S X=DE(8),DIC=DIE
    3  D EVENT^IVMPLOG(DA)
    4  S X=DE(8),DIC=DIE
    5  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     1DGRPTX11 ; ;04/21/06
     2 S X=DE(13),DIC=DIE
     3 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".219;" D AVAFC^VAFCDD01(DA)
     4 S X=DE(13),DIC=DIE
     5 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     6 S X=DE(13),DIIX=2_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX12.m

    r613 r623  
    1 DGRPTX12 ; ;12/13/08
     1DGRPTX12 ; ;04/21/06
    22 S X=DG(DQ),DIC=DIE
    3  D EVENT^IVMPLOG(DA)
     3 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".219;" D AVAFC^VAFCDD01(DA)
    44 S X=DG(DQ),DIC=DIE
    5  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     5 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     6 I $D(DE(13))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX13.m

    r613 r623  
    1 DGRPTX13 ; ;12/13/08
     1DGRPTX13 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(.22)) S %Z=^(.22) S %=$P(%Z,U,1) S:%]"" DE(16)=%
     5 I $D(^(.33)) S %Z=^(.33) S %=$P(%Z,U,1) S:%]"" DE(6)=% S %=$P(%Z,U,2) S:%]"" DE(8)=% S %=$P(%Z,U,3) S:%]"" DE(9)=% S %=$P(%Z,U,4) S:%]"" DE(11)=% S %=$P(%Z,U,5) S:%]"" DE(13)=% S %=$P(%Z,U,6) S:%]"" DE(14)=% S %=$P(%Z,U,7) S:%]"" DE(15)=%
     6 I  S %=$P(%Z,U,10) S:%]"" DE(1)=%
     7 K %Z Q
     8 ;
     9W W !?DL+DL-2,DLB_": "
     10 Q
     11O D W W Y W:$X>45 !?9
     12 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     13 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     14TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     15 Q
     16A K DQ(DQ) S DQ=DQ+1
     17B G @DQ
     18RE G PR:$D(DE(DQ)) D W,TR
     19N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     20RD G QS:X?."?" I X["^" D D G ^DIE17
     21 I X="@" D D G Z^DIE2
     22 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     23T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     24 K DDER G X
     25P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     26 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     27 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     28V D @("X"_DQ) K YS
     29Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     30X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     31 S X="?BAD"
     32QS S DZ=X D D,QQ^DIEQ G B
     33D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     34Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     35PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     36R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     37 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     38 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     39RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     40I I DV'["I",DV'["#" G RD
     41 D E^DIE0 G RD:$D(X),PR
     42 Q
     43SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     44 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     45 D ^DIR I 'DDER S %=Y(0),X=Y
     46 Q
     47SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     48 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     49 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     50 Q
     51NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     52KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     53BEGIN S DNM="DGRPTX13",DQ=1
     541 S DW=".33;10",DV="RSX",DU="",DLB="E-EMER. CONTACT SAME AS NOK?",DIFLD=.3305
     55 S DE(DW)="C1^DGRPTX13",DE(DW,"INDEX")=1
     56 S DU="Y:YES;N:NO;"
     57 S Y="NO"
     58 G Y
     59C1 G C1S:$D(DE(1))[0 K DB
     60C1S S X="" G:DG(DQ)=X C1F1 K DB
     61C1F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     62 F DIXR=604 S DIEZRXR(2,DIXR)=""
     63 Q
     64X1 I $D(X),X="Y" D K1^DGLOCK2
     65 Q
     66 ;
     672 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     68X2 I X'="Y" S Y=.331
     69 Q
     703 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     71X3 S X=$S($D(^DPT(DA,.21)):^(.21),1:"") S:X'="" ^(.33)=$P(X_"^^^^^^^^^^^",U,1,9)_U_$P(^(.33),U,10)_U_$P(X,U,11)
     72 Q
     734 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     74X4 S:$D(^DPT(DFN,.22)) $P(^(.22),U,1)=$P(^(.22),U,7)
     75 Q
     765 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     77X5 S Y=.33011
     78 Q
     796 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".33;1",DV="F",DU="",DLB="E-NAME",DIFLD=.331
     80 S DE(DW)="C6^DGRPTX13",DE(DW,"INDEX")=1
     81 G RE
     82C6 G C6S:$D(DE(6))[0 K DB
     83 S X=DE(6),DIC=DIE
     84 X "S DGXRF=.331 D ^DGDDC Q"
     85C6S S X="" G:DG(DQ)=X C6F1 K DB
     86 S X=DG(DQ),DIC=DIE
     87 ;
     88C6F1 N X,X1,X2 S DIXR=595 D C6X1(U) K X2 M X2=X D C6X1("O") K X1 M X1=X
     89 I $G(X(1))]"" D
     90 . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1 D DELCOMP^XLFNAME2(2,.DA,.331,1.07) Q
     91 K X M X=X2 I $G(X(1))]"" D
     92 . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1,DG20NAME=X D NARY^XLFNAME7(.DG20NAME),UPDCOMP^XLFNAME2(2,.DA,.331,.DG20NAME,1.07,+$P($G(^DPT(DA,"NAME")),U,7),"CL35") K DG20NAME Q
     93 G C6F2
     94C6X1(DION) K X
     95 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.331,DION),$P($G(^DPT(DA,.33)),U,1))
     96 S X=$G(X(1))
     97 Q
     98C6F2 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     99 F DIXR=604 S DIEZRXR(2,DIXR)=""
     100 Q
     101X6 K:$L(X)>35!($L(X)<3) X I $D(X) S DG20NAME=X,(X,DG20NAME)=$$FORMAT^XLFNAME7(.DG20NAME,3,35) K:'$L(X) X,DG20NAME
     102 I $D(X),X'?.ANP K X
     103 Q
     104 ;
     1057 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     106X7 S:X="" Y="@40"
     107 Q
     1088 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW=".33;2",DV="FX",DU="",DLB="E-RELATIONSHIP TO PATIENT",DIFLD=.332
     109 S DE(DW)="C8^DGRPTX13",DE(DW,"INDEX")=1
     110 G RE
     111C8 G C8S:$D(DE(8))[0 K DB
     112C8S S X="" G:DG(DQ)=X C8F1 K DB
     113C8F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     114 F DIXR=604 S DIEZRXR(2,DIXR)=""
     115 Q
     116X8 K:$L(X)>30!($L(X)<2) X I $D(X) S DFN=DA D E1^DGLOCK2
     117 I $D(X),X'?.ANP K X
     118 Q
     119 ;
     1209 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".33;3",DV="FX",DU="",DLB="E-STREET ADDRESS [LINE 1]",DIFLD=.333
     121 S DE(DW)="C9^DGRPTX13",DE(DW,"INDEX")=1
     122 G RE
     123C9 G C9S:$D(DE(9))[0 K DB
    2124 S X=DE(9),DIC=DIE
    3  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".05;" D AVAFC^VAFCDD01(DA)
    4  S X=DE(9),DIC=DIE
    5  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    6  S X=DE(9),DIC=DIE
    7  D EVENT^IVMPLOG(DA)
    8  S X=DE(9),DIIX=2_U_DIFLD D AUDIT^DIET
     125 X "S DGXRF=.333 D ^DGDDC Q"
     126C9S S X="" G:DG(DQ)=X C9F1 K DB
     127 S X=DG(DQ),DIC=DIE
     128 ;
     129C9F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     130 F DIXR=604 S DIEZRXR(2,DIXR)=""
     131 Q
     132X9 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
     133 I $D(X),X'?.ANP K X
     134 Q
     135 ;
     13610 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=10 D X10 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     137X10 S:X="" Y=.336
     138 Q
     13911 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".33;4",DV="FX",DU="",DLB="E-STREET ADDRESS [LINE 2]",DIFLD=.334
     140 S DE(DW)="C11^DGRPTX13",DE(DW,"INDEX")=1
     141 G RE
     142C11 G C11S:$D(DE(11))[0 K DB
     143 S X=DE(11),DIC=DIE
     144 X "S DGXRF=.334 D ^DGDDC Q"
     145C11S S X="" G:DG(DQ)=X C11F1 K DB
     146 S X=DG(DQ),DIC=DIE
     147 ;
     148C11F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     149 F DIXR=604 S DIEZRXR(2,DIXR)=""
     150 Q
     151X11 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
     152 I $D(X),X'?.ANP K X
     153 Q
     154 ;
     15512 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=12 D X12 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     156X12 S:X="" Y=.336
     157 Q
     15813 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".33;5",DV="FX",DU="",DLB="E-STREET ADDRESS [LINE 3]",DIFLD=.335
     159 S DE(DW)="C13^DGRPTX13",DE(DW,"INDEX")=1
     160 G RE
     161C13 G C13S:$D(DE(13))[0 K DB
     162C13S S X="" G:DG(DQ)=X C13F1 K DB
     163C13F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     164 F DIXR=604 S DIEZRXR(2,DIXR)=""
     165 Q
     166X13 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
     167 I $D(X),X'?.ANP K X
     168 Q
     169 ;
     17014 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".33;6",DV="FX",DU="",DLB="E-CITY",DIFLD=.336
     171 S DE(DW)="C14^DGRPTX13",DE(DW,"INDEX")=1
     172 G RE
     173C14 G C14S:$D(DE(14))[0 K DB
     174C14S S X="" G:DG(DQ)=X C14F1 K DB
     175C14F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     176 F DIXR=604 S DIEZRXR(2,DIXR)=""
     177 Q
     178X14 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
     179 I $D(X),X'?.ANP K X
     180 Q
     181 ;
     18215 D:$D(DG)>9 F^DIE17,DE S DQ=15,DW=".33;7",DV="P5'X",DU="",DLB="E-STATE",DIFLD=.337
     183 S DE(DW)="C15^DGRPTX13",DE(DW,"INDEX")=1
     184 S DU="DIC(5,"
     185 G RE
     186C15 G C15S:$D(DE(15))[0 K DB
     187C15S S X="" G:DG(DQ)=X C15F1 K DB
     188C15F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     189 F DIXR=604 S DIEZRXR(2,DIXR)=""
     190 Q
     191X15 I $D(X) S DFN=DA D E1^DGLOCK2
     192 Q
     193 ;
     19416 D:$D(DG)>9 F^DIE17,DE S DQ=16,DW=".22;1",DV="FOX",DU="",DLB="E-ZIP+4",DIFLD=.2201
     195 S DQ(16,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
     196 S DE(DW)="C16^DGRPTX13",DE(DW,"INDEX")=1
     197 G RE
     198C16 G C16S:$D(DE(16))[0 K DB
     199 D ^DGRPTX14
     200C16S S X="" G:DG(DQ)=X C16F1 K DB
     201 D ^DGRPTX15
     202C16F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     203 F DIXR=604 S DIEZRXR(2,DIXR)=""
     204 Q
     205X16 K:X[""""!($A(X)=45) X I $D(X) S DFN=DA D E1^DGLOCK2 I $D(X) K:$L(X)>15!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
     206 I $D(X),X'?.ANP K X
     207 Q
     208 ;
     20917 D:$D(DG)>9 F^DIE17 G ^DGRPTX16
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX14.m

    r613 r623  
    1 DGRPTX14 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".05;" D AVAFC^VAFCDD01(DA)
    4  S X=DG(DQ),DIC=DIE
    5  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    6  S X=DG(DQ),DIC=DIE
    7  D EVENT^IVMPLOG(DA)
    8  I $D(DE(9))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     1DGRPTX14 ; ;04/21/06
     2 S X=DE(16),DIC=DIE
     3 D KILL^DGREGDD1(DA,.338,.33,8,$E(X,1,5))
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX15.m

    r613 r623  
    1 DGRPTX15 ; ;12/13/08
    2  S X=DE(10),DIC=DIE
    3  X "S DGXRF=.211 D ^DGDDC Q"
    4  S X=DE(10),DIC=DIE
    5  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".211;" D AVAFC^VAFCDD01(DA)
    6  S X=DE(10),DIC=DIE
    7  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    8  S X=DE(10),DIIX=2_U_DIFLD D AUDIT^DIET
     1DGRPTX15 ; ;04/21/06
     2 S X=DG(DQ),DIC=DIE
     3 D SET^DGREGDD1(DA,.338,.33,8,$E(X,1,5))
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX16.m

    r613 r623  
    1 DGRPTX16 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  ;
    4  S X=DG(DQ),DIC=DIE
    5  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".211;" D AVAFC^VAFCDD01(DA)
    6  S X=DG(DQ),DIC=DIE
    7  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    8  I $D(DE(10))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     1DGRPTX16 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,5) S:%]"" DE(4)=% S %=$P(%Z,U,8) S:%]"" DE(5)=%
     5 I $D(^(.33)) S %Z=^(.33) S %=$P(%Z,U,9) S:%]"" DE(1)=% S %=$P(%Z,U,11) S:%]"" DE(2)=%
     6 I $D(^(.52)) S %Z=^(.52) S %=$P(%Z,U,5) S:%]"" DE(6)=%
     7 I $D(^(.53)) S %Z=^(.53) S %=$P(%Z,U,1) S:%]"" DE(8)=% S %=$P(%Z,U,2) S:%]"" DE(13)=% S %=$P(%Z,U,3) S:%]"" DE(17)=% S %=$P(%Z,U,4) S:%]"" DE(14)=%
     8 K %Z Q
     9 ;
     10W W !?DL+DL-2,DLB_": "
     11 Q
     12O D W W Y W:$X>45 !?9
     13 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     14 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     15TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     16 Q
     17A K DQ(DQ) S DQ=DQ+1
     18B G @DQ
     19RE G PR:$D(DE(DQ)) D W,TR
     20N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     21RD G QS:X?."?" I X["^" D D G ^DIE17
     22 I X="@" D D G Z^DIE2
     23 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     24T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     25 K DDER G X
     26P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     27 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     28 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     29V D @("X"_DQ) K YS
     30Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     31X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     32 S X="?BAD"
     33QS S DZ=X D D,QQ^DIEQ G B
     34D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     35Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     36PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     37R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     38 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     39 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     40RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     41I I DV'["I",DV'["#" G RD
     42 D E^DIE0 G RD:$D(X),PR
     43 Q
     44SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     45 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     46 D ^DIR I 'DDER S %=Y(0),X=Y
     47 Q
     48SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     49 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     50 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     51 Q
     52NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     53KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     54BEGIN S DNM="DGRPTX16",DQ=1
     551 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".33;9",DV="FX",DU="",DLB="E-PHONE NUMBER",DIFLD=.339
     56 G RE
     57X1 K:$L(X)>20!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
     58 I $D(X),X'?.ANP K X
     59 Q
     60 ;
     612 S DW=".33;11",DV="F",DU="",DLB="E-WORK PHONE NUMBER",DIFLD=.33011
     62 G RE
     63X2 K:$L(X)>20!($L(X)<4) X
     64 I $D(X),X'?.ANP K X
     65 Q
     66 ;
     673 S DQ=4 ;@40
     684 S DW=".32;5",DV="P23'X",DU="",DLB="SERVICE BRANCH [LAST]",DIFLD=.325
     69 S DE(DW)="C4^DGRPTX16",DE(DW,"INDEX")=1
     70 S DU="DIC(23,"
     71 G RE
     72C4 G C4S:$D(DE(4))[0 K DB
     73 S X=DE(4),DIC=DIE
     74 S A1B2TAG="PAT" D ^A1B2XFR
     75 S X=DE(4),DIC=DIE
     76 I $P($G(^DPT(DA,.321)),U,14)]"" D FVP^DGRPMS
     77 S X=DE(4),DIC=DIE
     78 D EVENT^IVMPLOG(DA)
     79C4S S X="" G:DG(DQ)=X C4F1 K DB
     80 S X=DG(DQ),DIC=DIE
     81 S A1B2TAG="PAT" D ^A1B2XFR
     82 S X=DG(DQ),DIC=DIE
     83 ;
     84 S X=DG(DQ),DIC=DIE
     85 D EVENT^IVMPLOG(DA)
     86C4F1 N X,X1,X2 S DIXR=408 D C4X1(U) K X2 M X2=X D C4X1("O") K X1 M X1=X
     87 D
     88 . N DIEXARR M DIEXARR=X S DIEZCOND=1
     89 . S X=X2(1)=""
     90 . S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
     91 . D DELMSE^DGRPMS(DFN,1)
     92 G C4F2
     93C4X1(DION) K X
     94 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.325,DION),$P($G(^DPT(DA,.32)),U,5))
     95 S X=$G(X(1))
     96 Q
     97C4F2 Q
     98X4 S DFN=DA K:X=$O(^DIC(23,"B","B.E.C.","")) X I $D(X) D SV^DGLOCK S DGCOMBR=$G(Y) Q
     99 Q
     100 ;
     1015 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".32;8",DV="FX",DU="",DLB="SERVICE NUMBER [LAST]",DIFLD=.328
     102 S DE(DW)="C5^DGRPTX16"
     103 G RE
     104C5 G C5S:$D(DE(5))[0 K DB
     105 S X=DE(5),DIC=DIE
     106 D EVENT^IVMPLOG(DA)
     107C5S S X="" G:DG(DQ)=X C5F1 K DB
     108 S X=DG(DQ),DIC=DIE
     109 D EVENT^IVMPLOG(DA)
     110C5F1 Q
     111X5 S DFN=DA D SV^DGLOCK I $D(X) S:X?1"SS".E L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E "  ",L S:X?1"SS".E X=L K:$L(X)>15!($L(X)<1)!'(X?.N) X
     112 I $D(X),X'?.ANP K X
     113 Q
     114 ;
     1156 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".52;5",DV="RSX",DU="",DLB="POW STATUS INDICATED?",DIFLD=.525
     116 S DE(DW)="C6^DGRPTX16",DE(DW,"INDEX")=1
     117 S DU="Y:YES;N:NO;U:UNKNOWN;"
     118 G RE
     119C6 G C6S:$D(DE(6))[0 K DB
     120 S X=DE(6),DIC=DIE
     121 ;
     122 S X=DE(6),DIC=DIE
     123 ;
     124 S X=DE(6),DIC=DIE
     125 ;
     126 S X=DE(6),DIC=DIE
     127 D AUTOUPD^DGENA2(DA)
     128 S X=DE(6),DIC=DIE
     129 X "S DFN=DA D EN^DGMTR K DGREQF"
     130 S X=DE(6),DIC=DIE
     131 D EVENT^IVMPLOG(DA)
     132C6S S X="" G:DG(DQ)=X C6F1 K DB
     133 S X=DG(DQ),DIC=DIE
     134 X ^DD(2,.525,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$S('$D(^DIC(22,+$P(Y(1),U,6),0)):"",1:$P(^(0),U,1)) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,1,1.4)
     135 S X=DG(DQ),DIC=DIE
     136 X ^DD(2,.525,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$P(Y(1),U,7) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,2,1.4)
     137 S X=DG(DQ),DIC=DIE
     138 X ^DD(2,.525,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$P(Y(1),U,8) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,3,1.4)
     139 S X=DG(DQ),DIC=DIE
     140 D AUTOUPD^DGENA2(DA)
     141 S X=DG(DQ),DIC=DIE
     142 X "S DFN=DA D EN^DGMTR K DGREQF"
     143 S X=DG(DQ),DIC=DIE
     144 D EVENT^IVMPLOG(DA)
     145C6F1 N X,X1,X2 S DIXR=646 D C6X1(U) K X2 M X2=X D C6X1("O") K X1 M X1=X
     146 D
     147 . D FC^DGFCPROT(.DA,2,.525,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     148 K X M X=X2 D
     149 . D FC^DGFCPROT(.DA,2,.525,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     150 G C6F2
     151C6X1(DION) K X
     152 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.525,DION),$P($G(^DPT(DA,.52)),U,5))
     153 S X=$G(X(1))
     154 Q
     155C6F2 Q
     156X6 S DFN=DA D SV^DGLOCK
     157 Q
     158 ;
     1597 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     160X7 I $P($G(^DPT(DFN,.53)),U)]"" S Y="@53"
     161 Q
     1628 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW=".53;1",DV="SX",DU="",DLB="CURRENT PH INDICATOR",DIFLD=.531
     163 S DE(DW)="C8^DGRPTX16"
     164 S DU="Y:YES;N:NO;"
     165 G RE
     166C8 G C8S:$D(DE(8))[0 K DB
     167 S X=DE(8),DIC=DIE
     168 K ^DPT("D",$E(X,1,30),DA)
     169 S X=DE(8),DIC=DIE
     170 D AUTOUPD^DGENA2(DA)
     171C8S S X="" G:DG(DQ)=X C8F1 K DB
     172 S X=DG(DQ),DIC=DIE
     173 S ^DPT("D",$E(X,1,30),DA)=""
     174 S X=DG(DQ),DIC=DIE
     175 D AUTOUPD^DGENA2(DA)
     176C8F1 Q
     177X8 S DFN=DA D VET^DGLOCK
     178 Q
     179 ;
     1809 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=9 D X9 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     181X9 I X="Y" S Y="@532",DGPHMULT=1
     182 Q
     18310 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=10 D X10 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     184X10 I X="N" S Y="@533",DGPHMULT=1
     185 Q
     18611 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     187X11 S:X="" Y="@53"
     188 Q
     18912 S DQ=13 ;@532
     19013 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".53;2",DV="S",DU="",DLB="CURRENT PURPLE HEART STATUS",DIFLD=.532
     191 S DE(DW)="C13^DGRPTX16"
     192 S DU="1:PENDING;2:IN PROCESS;3:CONFIRMED;"
     193 S X="PENDING"
     194 S Y=X
     195 S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
     196 G RD
     197C13 G C13S:$D(DE(13))[0 K DB
     198 S X=DE(13),DIC=DIE
     199 K ^DPT("C",$E(X,1,30),DA)
     200C13S S X="" G:DG(DQ)=X C13F1 K DB
     201 S X=DG(DQ),DIC=DIE
     202 S ^DPT("C",$E(X,1,30),DA)=""
     203C13F1 Q
     204X13 Q
     20514 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".53;4",DV="P4'",DU="",DLB="PH DIVISION",DIFLD=.535
     206 S DU="DIC(4,"
     207 S X=$$DIV^DGRPLE()
     208 S Y=X
     209 S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
     210 G RD
     211X14 Q
     21215 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=15 D X15 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     213X15 S Y="@53"
     214 Q
     21516 S DQ=17 ;@533
     21617 S DW=".53;3",DV="S",DU="",DLB="CURRENT PURPLE HEART REMARKS",DIFLD=.533
     217 S DU="1:UNACCEPTABLE DOCUMENTATION;2:NO DOCUMENTATION REC'D;3:ENTERED IN ERROR;4:UNSUPPORTED PURPLE HEART;5:VAMC;6:UNDELIVERABLE MAIL;"
     218 S X="VAMC"
     219 S Y=X
     220 S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
     221 G RD
     222X17 Q
     22318 D:$D(DG)>9 F^DIE17 G ^DGRPTX17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX17.m

    r613 r623  
    1 DGRPTX17 ; ;12/13/08
     1DGRPTX17 ; ;04/21/06
    22 D DE G BEGIN
    33DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.21)) S %Z=^(.21) S %=$P(%Z,U,2) S:%]"" DE(1)=% S %=$P(%Z,U,3) S:%]"" DE(5)=% S %=$P(%Z,U,4) S:%]"" DE(7)=% S %=$P(%Z,U,5) S:%]"" DE(9)=% S %=$P(%Z,U,6) S:%]"" DE(10)=% S %=$P(%Z,U,7) S:%]"" DE(11)=% S %=$P(%Z,U,9) S:%]"" DE(13)=%
    5  I  S %=$P(%Z,U,10) S:%]"" DE(3)=% S %=$P(%Z,U,11) S:%]"" DE(14)=%
    6  I $D(^(.22)) S %Z=^(.22) S %=$P(%Z,U,7) S:%]"" DE(12)=%
    7  I $D(^(.33)) S %Z=^(.33) S %=$P(%Z,U,1) S:%]"" DE(22)=% S %=$P(%Z,U,10) S:%]"" DE(17)=%
     4 I $D(^(.3)) S %Z=^(.3) S %=$P(%Z,U,1) S:%]"" DE(7)=% S %=$P(%Z,U,2) S:%]"" DE(9)=%
     5 I $D(^(.321)) S %Z=^(.321) S %=$P(%Z,U,2) S:%]"" DE(3)=% S %=$P(%Z,U,3) S:%]"" DE(4)=%
     6 I $D(^(.322)) S %Z=^(.322) S %=$P(%Z,U,13) S:%]"" DE(5)=%
     7 I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,2) S:%]"" DE(6)=%
     8 I $D(^(.362)) S %Z=^(.362) S %=$P(%Z,U,12) S:%]"" DE(11)=% S %=$P(%Z,U,13) S:%]"" DE(12)=%
     9 I $D(^(.53)) S %Z=^(.53) S %=$P(%Z,U,4) S:%]"" DE(1)=%
    810 K %Z Q
    911 ;
     
    5355KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    5456BEGIN S DNM="DGRPTX17",DQ=1
    55 1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".21;2",DV="FX",DU="",DLB="K-RELATIONSHIP TO PATIENT",DIFLD=.212
    56  S DE(DW)="C1^DGRPTX17",DE(DW,"INDEX")=1
    57  G RE
    58 C1 G C1S:$D(DE(1))[0 K DB
    59  S X=DE(1),DIC=DIE
    60  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    61 C1S S X="" G:DG(DQ)=X C1F1 K DB
    62  S X=DG(DQ),DIC=DIE
    63  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    64 C1F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    65  F DIXR=602 S DIEZRXR(2,DIXR)=""
    66  Q
    67 X1 K:$L(X)>30!($L(X)<1) X I $D(X) S DFN=DA D K1^DGLOCK2
    68  I $D(X),X'?.ANP K X
    69  Q
    70  ;
    71 2 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 G A
    72 3 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".21;10",DV="RSX",DU="",DLB="K-ADDRESS SAME AS PATIENT'S?",DIFLD=.2125
    73  S DE(DW)="C3^DGRPTX17",DE(DW,"INDEX")=1
    74  S DU="Y:YES;N:NO;"
    75  S Y="NO"
    76  G Y
     571 S DW=".53;4",DV="P4'",DU="",DLB="PH DIVISION",DIFLD=.535
     58 S DU="DIC(4,"
     59 S X=$$DIV^DGRPLE()
     60 S Y=X
     61 S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
     62 G RD
     63X1 Q
     642 S DQ=3 ;@53
     653 S DW=".321;2",DV="RSX",DU="",DLB="AGENT ORANGE EXPOS. INDICATED?",DIFLD=.32102
     66 S DE(DW)="C3^DGRPTX17"
     67 S DU="Y:YES;N:NO;U:UNKNOWN;"
     68 G RE
    7769C3 G C3S:$D(DE(3))[0 K DB
     70 S X=DE(3),DIC=DIE
     71 ;
     72 S X=DE(3),DIC=DIE
     73 ;
     74 S X=DE(3),DIC=DIE
     75 ;
     76 S X=DE(3),DIC=DIE
     77 D AUTOUPD^DGENA2(DA)
     78 S X=DE(3),DIC=DIE
     79 ;
    7880C3S S X="" G:DG(DQ)=X C3F1 K DB
    79 C3F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    80  F DIXR=602 S DIEZRXR(2,DIXR)=""
    81  Q
    82 X3 I $D(X),X="Y" S DFN=DA D K1^DGLOCK2
    83  Q
    84  ;
    85 4 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    86 X4 I X="Y" S DGADD=".21" D AD^DGRPE S Y=.21011
    87  Q
    88 5 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".21;3",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 1]",DIFLD=.213
    89  S DE(DW)="C5^DGRPTX17",DE(DW,"INDEX")=1
     81 S X=DG(DQ),DIC=DIE
     82 X ^DD(2,.32102,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,7) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32102,1,1,1.4)
     83 S X=DG(DQ),DIC=DIE
     84 X ^DD(2,.32102,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,9) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32102,1,2,1.4)
     85 S X=DG(DQ),DIC=DIE
     86 X ^DD(2,.32102,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,10) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32102,1,3,1.4)
     87 S X=DG(DQ),DIC=DIE
     88 D AUTOUPD^DGENA2(DA)
     89 S X=DG(DQ),DIC=DIE
     90 X ^DD(2,.32102,1,5,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.321)),DIV=X S $P(^(.321),U,13)=DIV,DIH=2,DIG=.3213 D ^DICR
     91C3F1 Q
     92X3 S DFN=DA D SV^DGLOCK
     93 Q
     94 ;
     954 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".321;3",DV="RSX",DU="",DLB="RADIATION EXPOSURE INDICATED?",DIFLD=.32103
     96 S DE(DW)="C4^DGRPTX17"
     97 S DU="Y:YES;N:NO;U:UNKNOWN;"
     98 G RE
     99C4 G C4S:$D(DE(4))[0 K DB
     100 S X=DE(4),DIC=DIE
     101 ;
     102 S X=DE(4),DIC=DIE
     103 ;
     104 S X=DE(4),DIC=DIE
     105 D AUTOUPD^DGENA2(DA)
     106C4S S X="" G:DG(DQ)=X C4F1 K DB
     107 S X=DG(DQ),DIC=DIE
     108 X ^DD(2,.32103,1,1,1.3) I X S X=DIV S Y(2)=";"_$S($D(^DD(2,.3212,0)):$P(^(0),U,3),1:""),Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P($P(Y(2),";"_$P(Y(1),U,12)_":",2),";",1) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32103,1,1,1.4)
     109 S X=DG(DQ),DIC=DIE
     110 X ^DD(2,.32103,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,11) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32103,1,2,1.4)
     111 S X=DG(DQ),DIC=DIE
     112 D AUTOUPD^DGENA2(DA)
     113C4F1 Q
     114X4 S DFN=DA D SV^DGLOCK
     115 Q
     116 ;
     1175 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".322;13",DV="RSX",DU="",DLB="ENVIRONMENTAL CONTAMINANTS?",DIFLD=.322013
     118 S DE(DW)="C5^DGRPTX17"
     119 S DU="Y:YES;N:NO;U:UNKNOWN;"
    90120 G RE
    91121C5 G C5S:$D(DE(5))[0 K DB
    92122 S X=DE(5),DIC=DIE
    93  X "S DGXRF=.213 D ^DGDDC Q"
     123 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,14),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,1,2.4)
    94124 S X=DE(5),DIC=DIE
     125 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,2,2.4)
     126 S X=DE(5),DIC=DIE
     127 D AUTOUPD^DGENA2(DA)
     128C5S S X="" G:DG(DQ)=X C5F1 K DB
     129 S X=DG(DQ),DIC=DIE
     130 X ^DD(2,.322013,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,14),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,1,1.4)
     131 S X=DG(DQ),DIC=DIE
     132 X ^DD(2,.322013,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,2,1.4)
     133 S X=DG(DQ),DIC=DIE
     134 D AUTOUPD^DGENA2(DA)
     135C5F1 Q
     136X5 S DFN=DA D SV^DGLOCK
     137 Q
     138 ;
     1396 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".36;2",DV="RSX",DU="",DLB="DISABILITY RET. FROM MILITARY?",DIFLD=.362
     140 S DE(DW)="C6^DGRPTX17"
     141 S DU="0:NO;1:YES, RECEIVING MILITARY RETIREMENT;2:YES, RECEIVING MILITARY RETIREMENT IN LIEU OF VA COMPENSATION;3:UNKNOWN;"
     142 G RE
     143C6 G C6S:$D(DE(6))[0 K DB
     144 S X=DE(6),DIC=DIE
     145 ;
     146 S X=DE(6),DIC=DIE
     147 D AUTOUPD^DGENA2(DA)
     148C6S S X="" G:DG(DQ)=X C6F1 K DB
     149 S X=DG(DQ),DIC=DIE
     150 X "S DFN=DA D EN^DGMTR K DGREQF"
     151 S X=DG(DQ),DIC=DIE
     152 D AUTOUPD^DGENA2(DA)
     153C6F1 Q
     154X6 S DFN=DA D SV^DGLOCK
     155 Q
     156 ;
     1577 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".3;1",DV="RSXa",DU="",DLB="SERVICE CONNECTED?",DIFLD=.301
     158 S DE(DW)="C7^DGRPTX17"
     159 S DU="Y:YES;N:NO;"
     160 G RE
     161C7 G C7S:$D(DE(7))[0 K DB
     162 S X=DE(7),DIC=DIE
     163 ;
     164 S X=DE(7),DIC=DIE
     165 ;
     166 S X=DE(7),DIC=DIE
     167 D AUTOUPD^DGENA2(DA)
     168 S X=DE(7),DIC=DIE
     169 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".301;" D AVAFC^VAFCDD01(DA)
     170 S X=DE(7),DIC=DIE
    95171 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    96 C5S S X="" G:DG(DQ)=X C5F1 K DB
    97  S X=DG(DQ),DIC=DIE
    98  ;
    99  S X=DG(DQ),DIC=DIE
     172 S X=DE(7),DIIX=2_U_DIFLD D AUDIT^DIET
     173C7S S X="" G:DG(DQ)=X C7F1 K DB
     174 D ^DGRPTX18
     175C7F1 Q
     176X7 S DFN=DA D EV^DGLOCK I $D(X),X="Y" D VET^DGLOCK
     177 Q
     178 ;
     1798 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     180X8 S:X'="Y" Y="@50"
     181 Q
     1829 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".3;2",DV="NJ3,0Xa",DU="",DLB="SERVICE CONNECTED PERCENTAGE",DIFLD=.302
     183 S DE(DW)="C9^DGRPTX17"
     184 G RE
     185C9 G C9S:$D(DE(9))[0 K DB
     186 S X=DE(9),DIC=DIE
     187 ;
     188 S X=DE(9),DIC=DIE
     189 D AUTOUPD^DGENA2(DA)
     190 S X=DE(9),DIC=DIE
     191 ;
     192 S X=DE(9),DIC=DIE
     193 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".302;" D AVAFC^VAFCDD01(DA)
     194 S X=DE(9),DIC=DIE
    100195 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    101 C5F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    102  F DIXR=602 S DIEZRXR(2,DIXR)=""
    103  Q
    104 X5 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
    105  I $D(X),X'?.ANP K X
    106  Q
    107  ;
    108 6 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    109 X6 S:X="" Y=.216
    110  Q
    111 7 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".21;4",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 2]",DIFLD=.214
    112  S DE(DW)="C7^DGRPTX17",DE(DW,"INDEX")=1
    113  G RE
    114 C7 G C7S:$D(DE(7))[0 K DB
    115  S X=DE(7),DIC=DIE
    116  X "S DGXRF=.214 D ^DGDDC Q"
    117  S X=DE(7),DIC=DIE
    118  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    119 C7S S X="" G:DG(DQ)=X C7F1 K DB
    120  S X=DG(DQ),DIC=DIE
    121  ;
    122  S X=DG(DQ),DIC=DIE
    123  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    124 C7F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    125  F DIXR=602 S DIEZRXR(2,DIXR)=""
    126  Q
    127 X7 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
    128  I $D(X),X'?.ANP K X
    129  Q
    130  ;
    131 8 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    132 X8 S:X="" Y=.216
    133  Q
    134 9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".21;5",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 3]",DIFLD=.215
    135  S DE(DW)="C9^DGRPTX17",DE(DW,"INDEX")=1
    136  G RE
    137 C9 G C9S:$D(DE(9))[0 K DB
     196 S X=DE(9),DIIX=2_U_DIFLD D AUDIT^DIET
    138197C9S S X="" G:DG(DQ)=X C9F1 K DB
    139 C9F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    140  F DIXR=602 S DIEZRXR(2,DIXR)=""
    141  Q
    142 X9 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
    143  I $D(X),X'?.ANP K X
    144  Q
    145  ;
    146 10 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".21;6",DV="FX",DU="",DLB="K-CITY",DIFLD=.216
    147  S DE(DW)="C10^DGRPTX17",DE(DW,"INDEX")=1
    148  G RE
    149 C10 G C10S:$D(DE(10))[0 K DB
    150  S X=DE(10),DIC=DIE
    151  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    152 C10S S X="" G:DG(DQ)=X C10F1 K DB
    153  S X=DG(DQ),DIC=DIE
    154  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    155 C10F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    156  F DIXR=602 S DIEZRXR(2,DIXR)=""
    157  Q
    158 X10 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
    159  I $D(X),X'?.ANP K X
    160  Q
    161  ;
    162 11 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".21;7",DV="P5'X",DU="",DLB="K-STATE",DIFLD=.217
    163  S DE(DW)="C11^DGRPTX17",DE(DW,"INDEX")=1
    164  S DU="DIC(5,"
     198 D ^DGRPTX19
     199C9F1 Q
     200X9 S DFN=DA D EV^DGLOCK Q:'$D(X)  K:+X'=X!(X>100)!(X<0)!(X?.E1"."1N.N) X I $D(X),$D(^DPT(DA,.3)),$P(^(.3),U,1)'="Y" W !?4,*7,"Only applies to service-connected applicants." K X
     201 Q
     202 ;
     20310 S DQ=11 ;@50
     20411 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".362;12",DV="SX",DU="",DLB="RECEIVING A&A BENEFITS?",DIFLD=.36205
     205 S DE(DW)="C11^DGRPTX17"
     206 S DU="Y:YES;N:NO;U:UNKNOWN;"
    165207 G RE
    166208C11 G C11S:$D(DE(11))[0 K DB
    167  S X=DE(11),DIC=DIE
    168  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     209 D ^DGRPTX20
    169210C11S S X="" G:DG(DQ)=X C11F1 K DB
    170  S X=DG(DQ),DIC=DIE
    171  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    172 C11F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    173  F DIXR=602 S DIEZRXR(2,DIXR)=""
    174  Q
    175 X11 I $D(X) S DFN=DA D K1^DGLOCK2
    176  Q
    177  ;
    178 12 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".22;7",DV="FOX",DU="",DLB="K-ZIP+4",DIFLD=.2207
    179  S DQ(12,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
    180  S DE(DW)="C12^DGRPTX17",DE(DW,"INDEX")=1
     211 D ^DGRPTX21
     212C11F1 Q
     213X11 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
     214 Q
     215 ;
     21612 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".362;13",DV="SX",DU="",DLB="RECEIVING HOUSEBOUND BENEFITS?",DIFLD=.36215
     217 S DE(DW)="C12^DGRPTX17"
     218 S DU="Y:YES;N:NO;U:UNKNOWN;"
    181219 G RE
    182220C12 G C12S:$D(DE(12))[0 K DB
    183  S X=DE(12),DIC=DIE
    184  D KILL^DGREGDD1(DA,.218,.21,8,$E(X,1,5))
     221 D ^DGRPTX22
    185222C12S S X="" G:DG(DQ)=X C12F1 K DB
    186  S X=DG(DQ),DIC=DIE
    187  D SET^DGREGDD1(DA,.218,.21,8,$E(X,1,5))
    188 C12F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    189  F DIXR=602 S DIEZRXR(2,DIXR)=""
    190  Q
    191 X12 K:X[""""!($A(X)=45) X I $D(X) S DFN=DA D K1^DGLOCK2 I $D(X) K:$L(X)>15!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
    192  I $D(X),X'?.ANP K X
    193  Q
    194  ;
    195 13 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".21;9",DV="FXa",DU="",DLB="K-PHONE NUMBER",DIFLD=.219
    196  S DE(DW)="C13^DGRPTX17"
    197  G RE
    198 C13 G C13S:$D(DE(13))[0 K DB
    199  S X=DE(13),DIC=DIE
    200  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".219;" D AVAFC^VAFCDD01(DA)
    201  S X=DE(13),DIC=DIE
    202  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    203  S X=DE(13),DIIX=2_U_DIFLD D AUDIT^DIET
    204 C13S S X="" G:DG(DQ)=X C13F1 K DB
    205  S X=DG(DQ),DIC=DIE
    206  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".219;" D AVAFC^VAFCDD01(DA)
    207  S X=DG(DQ),DIC=DIE
    208  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    209  I $D(DE(13))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    210 C13F1 Q
    211 X13 K:$L(X)>20!($L(X)<4) X I $D(X) S DFN=DA D K1^DGLOCK2
    212  I $D(X),X'?.ANP K X
    213  Q
    214  ;
    215 14 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".21;11",DV="F",DU="",DLB="K-WORK PHONE NUMBER",DIFLD=.21011
    216  G RE
    217 X14 K:$L(X)>20!($L(X)<4) X
    218  I $D(X),X'?.ANP K X
    219  Q
    220  ;
    221 15 S DQ=16 ;@30
    222 16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    223 X16 I $S('$D(^DPT(DFN,.21)):1,$P(^(.21),U,1)="":1,1:0) S Y=.331
    224  Q
    225 17 S DW=".33;10",DV="RSX",DU="",DLB="E-EMER. CONTACT SAME AS NOK?",DIFLD=.3305
    226  S DE(DW)="C17^DGRPTX17",DE(DW,"INDEX")=1
    227  S DU="Y:YES;N:NO;"
    228  S Y="NO"
    229  G Y
    230 C17 G C17S:$D(DE(17))[0 K DB
    231 C17S S X="" G:DG(DQ)=X C17F1 K DB
    232 C17F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    233  F DIXR=604 S DIEZRXR(2,DIXR)=""
    234  Q
    235 X17 I $D(X),X="Y" D K1^DGLOCK2
    236  Q
    237  ;
    238 18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    239 X18 I X'="Y" S Y=.331
    240  Q
    241 19 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=19 D X19 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    242 X19 S X=$S($D(^DPT(DA,.21)):^(.21),1:"") S:X'="" ^(.33)=$P(X_"^^^^^^^^^^^",U,1,9)_U_$P(^(.33),U,10)_U_$P(X,U,11)
    243  Q
    244 20 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    245 X20 S:$D(^DPT(DFN,.22)) $P(^(.22),U,1)=$P(^(.22),U,7)
    246  Q
    247 21 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=21 D X21 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    248 X21 S Y=.33011
    249  Q
    250 22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW=".33;1",DV="F",DU="",DLB="E-NAME",DIFLD=.331
    251  S DE(DW)="C22^DGRPTX17",DE(DW,"INDEX")=1
    252  G RE
    253 C22 G C22S:$D(DE(22))[0 K DB
    254  D ^DGRPTX18
    255 C22S S X="" G:DG(DQ)=X C22F1 K DB
    256  D ^DGRPTX19
    257 C22F1 N X,X1,X2 S DIXR=595 D C22X1(U) K X2 M X2=X D C22X1("O") K X1 M X1=X
    258  I $G(X(1))]"" D
    259  . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1 D DELCOMP^XLFNAME2(2,.DA,.331,1.07) Q
    260  K X M X=X2 I $G(X(1))]"" D
    261  . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1,DG20NAME=X D NARY^XLFNAME7(.DG20NAME),UPDCOMP^XLFNAME2(2,.DA,.331,.DG20NAME,1.07,+$P($G(^DPT(DA,"NAME")),U,7),"CL35") K DG20NAME Q
    262  G C22F2
    263 C22X1(DION) K X
    264  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.331,DION),$P($G(^DPT(DA,.33)),U,1))
    265  S X=$G(X(1))
    266  Q
    267 C22F2 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    268  F DIXR=604 S DIEZRXR(2,DIXR)=""
    269  Q
    270 X22 K:$L(X)>35!($L(X)<3) X I $D(X) S DG20NAME=X,(X,DG20NAME)=$$FORMAT^XLFNAME7(.DG20NAME,3,35) K:'$L(X) X,DG20NAME
    271  I $D(X),X'?.ANP K X
    272  Q
    273  ;
    274 23 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    275 X23 S:X="" Y="@40"
    276  Q
    277 24 D:$D(DG)>9 F^DIE17 G ^DGRPTX20
     223 D ^DGRPTX23
     224C12F1 Q
     225X12 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
     226 Q
     227 ;
     22813 D:$D(DG)>9 F^DIE17 G ^DGRPTX24
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX18.m

    r613 r623  
    1 DGRPTX18 ; ;12/13/08
    2  S X=DE(22),DIC=DIE
    3  X "S DGXRF=.331 D ^DGDDC Q"
     1DGRPTX18 ; ;04/21/06
     2 S X=DG(DQ),DIC=DIE
     3 X ^DD(2,.301,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.301,1,1,1.4)
     4 S X=DG(DQ),DIC=DIE
     5 X ^DD(2,.301,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,12),X=X S DIU=X K Y S X="" X ^DD(2,.301,1,2,1.4)
     6 S X=DG(DQ),DIC=DIE
     7 D AUTOUPD^DGENA2(DA)
     8 S X=DG(DQ),DIC=DIE
     9 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".301;" D AVAFC^VAFCDD01(DA)
     10 S X=DG(DQ),DIC=DIE
     11 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     12 I $D(DE(7))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX19.m

    r613 r623  
    1 DGRPTX19 ; ;12/13/08
     1DGRPTX19 ; ;04/21/06
    22 S X=DG(DQ),DIC=DIE
    33 ;
     4 S X=DG(DQ),DIC=DIE
     5 D AUTOUPD^DGENA2(DA)
     6 S X=DG(DQ),DIC=DIE
     7 X "S DFN=DA D EN^DGMTR K DGREQF"
     8 S X=DG(DQ),DIC=DIE
     9 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".302;" D AVAFC^VAFCDD01(DA)
     10 S X=DG(DQ),DIC=DIE
     11 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     12 I $D(DE(9))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX2.m

    r613 r623  
    1 DGRPTX2 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  ;
    4  S X=DG(DQ),DIC=DIE
     1DGRPTX2 ; ;04/21/06
     2 S X=DE(9),DIC=DIE
     3 X "S DGXRF=.112 D ^DGDDC Q"
     4 S X=DE(9),DIC=DIE
    55 S A1B2TAG="PAT" D ^A1B2XFR
    6  S X=DG(DQ),DIC=DIE
     6 S X=DE(9),DIC=DIE
    77 D EVENT^IVMPLOG(DA)
    8  S X=DG(DQ),DIC=DIE
     8 S X=DE(9),DIC=DIE
    99 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    10  S X=DG(DQ),DIC=DIE
     10 S X=DE(9),DIC=DIE
    1111 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    12  S X=DG(DQ),DIC=DIE
     12 S X=DE(9),DIC=DIE
    1313 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".112;" D AVAFC^VAFCDD01(DA)
    14  S X=DG(DQ),DIC=DIE
     14 S X=DE(9),DIC=DIE
    1515 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    16  I $D(DE(9))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     16 S X=DE(9),DIIX=2_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX20.m

    r613 r623  
    1 DGRPTX20 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.22)) S %Z=^(.22) S %=$P(%Z,U,1) S:%]"" DE(9)=%
    5  I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,5) S:%]"" DE(13)=% S %=$P(%Z,U,8) S:%]"" DE(14)=%
    6  I $D(^(.33)) S %Z=^(.33) S %=$P(%Z,U,2) S:%]"" DE(1)=% S %=$P(%Z,U,3) S:%]"" DE(2)=% S %=$P(%Z,U,4) S:%]"" DE(4)=% S %=$P(%Z,U,5) S:%]"" DE(6)=% S %=$P(%Z,U,6) S:%]"" DE(7)=% S %=$P(%Z,U,7) S:%]"" DE(8)=% S %=$P(%Z,U,9) S:%]"" DE(10)=%
    7  I  S %=$P(%Z,U,11) S:%]"" DE(11)=%
    8  I $D(^(.52)) S %Z=^(.52) S %=$P(%Z,U,5) S:%]"" DE(15)=%
    9  I $D(^(.53)) S %Z=^(.53) S %=$P(%Z,U,1) S:%]"" DE(17)=%
    10  K %Z Q
    11  ;
    12 W W !?DL+DL-2,DLB_": "
    13  Q
    14 O D W W Y W:$X>45 !?9
    15  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    16  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    17 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    18  Q
    19 A K DQ(DQ) S DQ=DQ+1
    20 B G @DQ
    21 RE G PR:$D(DE(DQ)) D W,TR
    22 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    23 RD G QS:X?."?" I X["^" D D G ^DIE17
    24  I X="@" D D G Z^DIE2
    25  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    26 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    27  K DDER G X
    28 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    29  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    30  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    31 V D @("X"_DQ) K YS
    32 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    33 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    34  S X="?BAD"
    35 QS S DZ=X D D,QQ^DIEQ G B
    36 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    37 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    38 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    39 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    40  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    41  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    42 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    43 I I DV'["I",DV'["#" G RD
    44  D E^DIE0 G RD:$D(X),PR
    45  Q
    46 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    47  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    48  D ^DIR I 'DDER S %=Y(0),X=Y
    49  Q
    50 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    51  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    52  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    53  Q
    54 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    55 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    56 BEGIN S DNM="DGRPTX20",DQ=1
    57 1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".33;2",DV="FX",DU="",DLB="E-RELATIONSHIP TO PATIENT",DIFLD=.332
    58  S DE(DW)="C1^DGRPTX20",DE(DW,"INDEX")=1
    59  G RE
    60 C1 G C1S:$D(DE(1))[0 K DB
    61 C1S S X="" G:DG(DQ)=X C1F1 K DB
    62 C1F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    63  F DIXR=604 S DIEZRXR(2,DIXR)=""
    64  Q
    65 X1 K:$L(X)>30!($L(X)<2) X I $D(X) S DFN=DA D E1^DGLOCK2
    66  I $D(X),X'?.ANP K X
    67  Q
    68  ;
    69 2 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".33;3",DV="FX",DU="",DLB="E-STREET ADDRESS [LINE 1]",DIFLD=.333
    70  S DE(DW)="C2^DGRPTX20",DE(DW,"INDEX")=1
    71  G RE
    72 C2 G C2S:$D(DE(2))[0 K DB
    73  S X=DE(2),DIC=DIE
    74  X "S DGXRF=.333 D ^DGDDC Q"
    75 C2S S X="" G:DG(DQ)=X C2F1 K DB
    76  S X=DG(DQ),DIC=DIE
    77  ;
    78 C2F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    79  F DIXR=604 S DIEZRXR(2,DIXR)=""
    80  Q
    81 X2 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
    82  I $D(X),X'?.ANP K X
    83  Q
    84  ;
    85 3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    86 X3 S:X="" Y=.336
    87  Q
    88 4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".33;4",DV="FX",DU="",DLB="E-STREET ADDRESS [LINE 2]",DIFLD=.334
    89  S DE(DW)="C4^DGRPTX20",DE(DW,"INDEX")=1
    90  G RE
    91 C4 G C4S:$D(DE(4))[0 K DB
    92  S X=DE(4),DIC=DIE
    93  X "S DGXRF=.334 D ^DGDDC Q"
    94 C4S S X="" G:DG(DQ)=X C4F1 K DB
    95  S X=DG(DQ),DIC=DIE
    96  ;
    97 C4F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    98  F DIXR=604 S DIEZRXR(2,DIXR)=""
    99  Q
    100 X4 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
    101  I $D(X),X'?.ANP K X
    102  Q
    103  ;
    104 5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    105 X5 S:X="" Y=.336
    106  Q
    107 6 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".33;5",DV="FX",DU="",DLB="E-STREET ADDRESS [LINE 3]",DIFLD=.335
    108  S DE(DW)="C6^DGRPTX20",DE(DW,"INDEX")=1
    109  G RE
    110 C6 G C6S:$D(DE(6))[0 K DB
    111 C6S S X="" G:DG(DQ)=X C6F1 K DB
    112 C6F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    113  F DIXR=604 S DIEZRXR(2,DIXR)=""
    114  Q
    115 X6 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
    116  I $D(X),X'?.ANP K X
    117  Q
    118  ;
    119 7 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".33;6",DV="FX",DU="",DLB="E-CITY",DIFLD=.336
    120  S DE(DW)="C7^DGRPTX20",DE(DW,"INDEX")=1
    121  G RE
    122 C7 G C7S:$D(DE(7))[0 K DB
    123 C7S S X="" G:DG(DQ)=X C7F1 K DB
    124 C7F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    125  F DIXR=604 S DIEZRXR(2,DIXR)=""
    126  Q
    127 X7 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
    128  I $D(X),X'?.ANP K X
    129  Q
    130  ;
    131 8 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW=".33;7",DV="P5'X",DU="",DLB="E-STATE",DIFLD=.337
    132  S DE(DW)="C8^DGRPTX20",DE(DW,"INDEX")=1
    133  S DU="DIC(5,"
    134  G RE
    135 C8 G C8S:$D(DE(8))[0 K DB
    136 C8S S X="" G:DG(DQ)=X C8F1 K DB
    137 C8F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    138  F DIXR=604 S DIEZRXR(2,DIXR)=""
    139  Q
    140 X8 I $D(X) S DFN=DA D E1^DGLOCK2
    141  Q
    142  ;
    143 9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".22;1",DV="FOX",DU="",DLB="E-ZIP+4",DIFLD=.2201
    144  S DQ(9,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
    145  S DE(DW)="C9^DGRPTX20",DE(DW,"INDEX")=1
    146  G RE
    147 C9 G C9S:$D(DE(9))[0 K DB
    148  S X=DE(9),DIC=DIE
    149  D KILL^DGREGDD1(DA,.338,.33,8,$E(X,1,5))
    150 C9S S X="" G:DG(DQ)=X C9F1 K DB
    151  S X=DG(DQ),DIC=DIE
    152  D SET^DGREGDD1(DA,.338,.33,8,$E(X,1,5))
    153 C9F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    154  F DIXR=604 S DIEZRXR(2,DIXR)=""
    155  Q
    156 X9 K:X[""""!($A(X)=45) X I $D(X) S DFN=DA D E1^DGLOCK2 I $D(X) K:$L(X)>15!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
    157  I $D(X),X'?.ANP K X
    158  Q
    159  ;
    160 10 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".33;9",DV="FX",DU="",DLB="E-PHONE NUMBER",DIFLD=.339
    161  G RE
    162 X10 K:$L(X)>20!($L(X)<3) X I $D(X) S DFN=DA D E1^DGLOCK2
    163  I $D(X),X'?.ANP K X
    164  Q
    165  ;
    166 11 S DW=".33;11",DV="F",DU="",DLB="E-WORK PHONE NUMBER",DIFLD=.33011
    167  G RE
    168 X11 K:$L(X)>20!($L(X)<4) X
    169  I $D(X),X'?.ANP K X
    170  Q
    171  ;
    172 12 S DQ=13 ;@40
    173 13 S DW=".32;5",DV="P23'X",DU="",DLB="SERVICE BRANCH [LAST]",DIFLD=.325
    174  S DE(DW)="C13^DGRPTX20",DE(DW,"INDEX")=1
    175  S DU="DIC(23,"
    176  G RE
    177 C13 G C13S:$D(DE(13))[0 K DB
    178  S X=DE(13),DIC=DIE
    179  S A1B2TAG="PAT" D ^A1B2XFR
    180  S X=DE(13),DIC=DIE
    181  I $P($G(^DPT(DA,.321)),U,14)]"" D FVP^DGRPMS
    182  S X=DE(13),DIC=DIE
    183  D EVENT^IVMPLOG(DA)
    184  S X=DE(13),DIC=DIE
    185  X "S DGXRF=.325 D ^DGDDC Q"
    186 C13S S X="" G:DG(DQ)=X C13F1 K DB
    187  S X=DG(DQ),DIC=DIE
    188  S A1B2TAG="PAT" D ^A1B2XFR
    189  S X=DG(DQ),DIC=DIE
    190  ;
    191  S X=DG(DQ),DIC=DIE
    192  D EVENT^IVMPLOG(DA)
    193  S X=DG(DQ),DIC=DIE
    194  ;
    195 C13F1 N X,X1,X2 S DIXR=408 D C13X1(U) K X2 M X2=X D C13X1("O") K X1 M X1=X
    196  D
    197  . N DIEXARR M DIEXARR=X S DIEZCOND=1
    198  . S X=X2(1)=""
    199  . S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
    200  . D DELMSE^DGRPMS(DA,1)
    201  G C13F2
    202 C13X1(DION) K X
    203  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.325,DION),$P($G(^DPT(DA,.32)),U,5))
    204  S X=$G(X(1))
    205  Q
    206 C13F2 Q
    207 X13 S DFN=DA K:X=$O(^DIC(23,"B","B.E.C.","")) X I $D(X) D SV^DGLOCK S DGCOMBR=$G(Y) Q
    208  Q
    209  ;
    210 14 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".32;8",DV="FX",DU="",DLB="SERVICE NUMBER [LAST]",DIFLD=.328
    211  S DE(DW)="C14^DGRPTX20"
    212  G RE
    213 C14 G C14S:$D(DE(14))[0 K DB
    214  S X=DE(14),DIC=DIE
    215  D EVENT^IVMPLOG(DA)
    216 C14S S X="" G:DG(DQ)=X C14F1 K DB
    217  S X=DG(DQ),DIC=DIE
    218  D EVENT^IVMPLOG(DA)
    219 C14F1 Q
    220 X14 S DFN=DA D SV^DGLOCK I $D(X) S:X?1"SS".E L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E "  ",L S:X?1"SS".E X=L K:$L(X)>15!($L(X)<1)!'(X?.N) X
    221  I $D(X),X'?.ANP K X
    222  Q
    223  ;
    224 15 D:$D(DG)>9 F^DIE17,DE S DQ=15,DW=".52;5",DV="RSX",DU="",DLB="POW STATUS INDICATED?",DIFLD=.525
    225  S DE(DW)="C15^DGRPTX20",DE(DW,"INDEX")=1
    226  S DU="Y:YES;N:NO;U:UNKNOWN;"
    227  G RE
    228 C15 G C15S:$D(DE(15))[0 K DB
    229  S X=DE(15),DIC=DIE
    230  ;
    231  S X=DE(15),DIC=DIE
    232  ;
    233  S X=DE(15),DIC=DIE
    234  ;
    235  S X=DE(15),DIC=DIE
     1DGRPTX20 ; ;04/21/06
     2 S X=DE(11),DIC=DIE
     3 X ^DD(2,.36205,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,2.4)
     4 S X=DE(11),DIC=DIE
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
     6 S X=DE(11),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,2.4)
     8 S X=DE(11),DIC=DIE
    2369 D AUTOUPD^DGENA2(DA)
    237  S X=DE(15),DIC=DIE
    238  X "S DFN=DA D EN^DGMTR K DGREQF"
    239  S X=DE(15),DIC=DIE
    240  D EVENT^IVMPLOG(DA)
    241 C15S S X="" G:DG(DQ)=X C15F1 K DB
    242  D ^DGRPTX21
    243 C15F1 N X,X1,X2 S DIXR=646 D C15X1(U) K X2 M X2=X D C15X1("O") K X1 M X1=X
    244  D
    245  . D FC^DGFCPROT(.DA,2,.525,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    246  K X M X=X2 D
    247  . D FC^DGFCPROT(.DA,2,.525,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    248  G C15F2
    249 C15X1(DION) K X
    250  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.525,DION),$P($G(^DPT(DA,.52)),U,5))
    251  S X=$G(X(1))
    252  Q
    253 C15F2 Q
    254 X15 S DFN=DA D SV^DGLOCK
    255  Q
    256  ;
    257 16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    258 X16 I $P($G(^DPT(DFN,.53)),U)]"" S Y="@53"
    259  Q
    260 17 D:$D(DG)>9 F^DIE17,DE S DQ=17,DW=".53;1",DV="SX",DU="",DLB="CURRENT PH INDICATOR",DIFLD=.531
    261  S DE(DW)="C17^DGRPTX20"
    262  S DU="Y:YES;N:NO;"
    263  G RE
    264 C17 G C17S:$D(DE(17))[0 K DB
    265  S X=DE(17),DIC=DIE
    266  K ^DPT("D",$E(X,1,30),DA)
    267  S X=DE(17),DIC=DIE
    268  D AUTOUPD^DGENA2(DA)
    269 C17S S X="" G:DG(DQ)=X C17F1 K DB
    270  S X=DG(DQ),DIC=DIE
    271  S ^DPT("D",$E(X,1,30),DA)=""
    272  S X=DG(DQ),DIC=DIE
    273  D AUTOUPD^DGENA2(DA)
    274 C17F1 Q
    275 X17 S DFN=DA D VET^DGLOCK
    276  Q
    277  ;
    278 18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    279 X18 I X="Y" S Y="@532",DGPHMULT=1
    280  Q
    281 19 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=19 D X19 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    282 X19 I X="N" S Y="@533",DGPHMULT=1
    283  Q
    284 20 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    285 X20 S:X="" Y="@53"
    286  Q
    287 21 S DQ=22 ;@532
    288 22 D:$D(DG)>9 F^DIE17 G ^DGRPTX22
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX21.m

    r613 r623  
    1 DGRPTX21 ; ;12/13/08
     1DGRPTX21 ; ;04/21/06
    22 S X=DG(DQ),DIC=DIE
    3  X ^DD(2,.525,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$S('$D(^DIC(22,+$P(Y(1),U,6),0)):"",1:$P(^(0),U,1)) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,1,1.4)
     3 X ^DD(2,.36205,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,1.4)
    44 S X=DG(DQ),DIC=DIE
    5  X ^DD(2,.525,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$P(Y(1),U,7) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,2,1.4)
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
    66 S X=DG(DQ),DIC=DIE
    7  X ^DD(2,.525,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$P(Y(1),U,8) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,3,1.4)
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,1.4)
    88 S X=DG(DQ),DIC=DIE
    99 D AUTOUPD^DGENA2(DA)
    10  S X=DG(DQ),DIC=DIE
    11  X "S DFN=DA D EN^DGMTR K DGREQF"
    12  S X=DG(DQ),DIC=DIE
    13  D EVENT^IVMPLOG(DA)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX22.m

    r613 r623  
    1 DGRPTX22 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.3)) S %Z=^(.3) S %=$P(%Z,U,1) S:%]"" DE(12)=% S %=$P(%Z,U,2) S:%]"" DE(14)=%
    5  I $D(^(.321)) S %Z=^(.321) S %=$P(%Z,U,2) S:%]"" DE(8)=% S %=$P(%Z,U,3) S:%]"" DE(9)=%
    6  I $D(^(.322)) S %Z=^(.322) S %=$P(%Z,U,13) S:%]"" DE(10)=%
    7  I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,2) S:%]"" DE(11)=%
    8  I $D(^(.362)) S %Z=^(.362) S %=$P(%Z,U,12) S:%]"" DE(16)=% S %=$P(%Z,U,13) S:%]"" DE(17)=%
    9  I $D(^(.53)) S %Z=^(.53) S %=$P(%Z,U,2) S:%]"" DE(1)=% S %=$P(%Z,U,3) S:%]"" DE(5)=% S %=$P(%Z,U,4) S:%]"" DE(2)=%,DE(6)=%
    10  K %Z Q
    11  ;
    12 W W !?DL+DL-2,DLB_": "
    13  Q
    14 O D W W Y W:$X>45 !?9
    15  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    16  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    17 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    18  Q
    19 A K DQ(DQ) S DQ=DQ+1
    20 B G @DQ
    21 RE G PR:$D(DE(DQ)) D W,TR
    22 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    23 RD G QS:X?."?" I X["^" D D G ^DIE17
    24  I X="@" D D G Z^DIE2
    25  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    26 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    27  K DDER G X
    28 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    29  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    30  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    31 V D @("X"_DQ) K YS
    32 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    33 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    34  S X="?BAD"
    35 QS S DZ=X D D,QQ^DIEQ G B
    36 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    37 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    38 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    39 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    40  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    41  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    42 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    43 I I DV'["I",DV'["#" G RD
    44  D E^DIE0 G RD:$D(X),PR
    45  Q
    46 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    47  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    48  D ^DIR I 'DDER S %=Y(0),X=Y
    49  Q
    50 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    51  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    52  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    53  Q
    54 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    55 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    56 BEGIN S DNM="DGRPTX22",DQ=1
    57 1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".53;2",DV="S",DU="",DLB="CURRENT PURPLE HEART STATUS",DIFLD=.532
    58  S DE(DW)="C1^DGRPTX22"
    59  S DU="1:PENDING;2:IN PROCESS;3:CONFIRMED;"
    60  S X="PENDING"
    61  S Y=X
    62  S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
    63  G RD
    64 C1 G C1S:$D(DE(1))[0 K DB
    65  S X=DE(1),DIC=DIE
    66  K ^DPT("C",$E(X,1,30),DA)
    67  S X=DE(1),DIC=DIE
    68  D EVENT^IVMPLOG(DA)
    69 C1S S X="" G:DG(DQ)=X C1F1 K DB
    70  S X=DG(DQ),DIC=DIE
    71  S ^DPT("C",$E(X,1,30),DA)=""
    72  S X=DG(DQ),DIC=DIE
    73  D EVENT^IVMPLOG(DA)
    74 C1F1 Q
    75 X1 Q
    76 2 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".53;4",DV="P4'",DU="",DLB="PH DIVISION",DIFLD=.535
    77  S DU="DIC(4,"
    78  S X=$$DIV^DGRPLE()
    79  S Y=X
    80  S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
    81  G RD
    82 X2 Q
    83 3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    84 X3 S Y="@53"
    85  Q
    86 4 S DQ=5 ;@533
    87 5 S DW=".53;3",DV="S",DU="",DLB="CURRENT PURPLE HEART REMARKS",DIFLD=.533
    88  S DE(DW)="C5^DGRPTX22"
    89  S DU="1:UNACCEPTABLE DOCUMENTATION;2:NO DOCUMENTATION REC'D;3:ENTERED IN ERROR;4:UNSUPPORTED PURPLE HEART;5:VAMC;6:UNDELIVERABLE MAIL;"
    90  S X="VAMC"
    91  S Y=X
    92  S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
    93  G RD
    94 C5 G C5S:$D(DE(5))[0 K DB
    95  S X=DE(5),DIC=DIE
    96  D EVENT^IVMPLOG(DA)
    97 C5S S X="" G:DG(DQ)=X C5F1 K DB
    98  S X=DG(DQ),DIC=DIE
    99  D EVENT^IVMPLOG(DA)
    100 C5F1 Q
    101 X5 Q
    102 6 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".53;4",DV="P4'",DU="",DLB="PH DIVISION",DIFLD=.535
    103  S DU="DIC(4,"
    104  S X=$$DIV^DGRPLE()
    105  S Y=X
    106  S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
    107  G RD
    108 X6 Q
    109 7 S DQ=8 ;@53
    110 8 S DW=".321;2",DV="RSX",DU="",DLB="AGENT ORANGE EXPOS. INDICATED?",DIFLD=.32102
    111  S DE(DW)="C8^DGRPTX22"
    112  S DU="Y:YES;N:NO;U:UNKNOWN;"
    113  G RE
    114 C8 G C8S:$D(DE(8))[0 K DB
    115  S X=DE(8),DIC=DIE
    116  ;
    117  S X=DE(8),DIC=DIE
    118  ;
    119  S X=DE(8),DIC=DIE
    120  ;
    121  S X=DE(8),DIC=DIE
    122  D AUTOUPD^DGENA2(DA)
    123  S X=DE(8),DIC=DIE
    124  ;
    125 C8S S X="" G:DG(DQ)=X C8F1 K DB
    126  S X=DG(DQ),DIC=DIE
    127  X ^DD(2,.32102,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,7) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32102,1,1,1.4)
    128  S X=DG(DQ),DIC=DIE
    129  X ^DD(2,.32102,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,9) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32102,1,2,1.4)
    130  S X=DG(DQ),DIC=DIE
    131  X ^DD(2,.32102,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,10) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32102,1,3,1.4)
    132  S X=DG(DQ),DIC=DIE
    133  D AUTOUPD^DGENA2(DA)
    134  S X=DG(DQ),DIC=DIE
    135  X ^DD(2,.32102,1,5,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.321)),DIV=X S $P(^(.321),U,13)=DIV,DIH=2,DIG=.3213 D ^DICR
    136 C8F1 Q
    137 X8 S DFN=DA D SV^DGLOCK
    138  Q
    139  ;
    140 9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".321;3",DV="RSX",DU="",DLB="RADIATION EXPOSURE INDICATED?",DIFLD=.32103
    141  S DE(DW)="C9^DGRPTX22"
    142  S DU="Y:YES;N:NO;U:UNKNOWN;"
    143  G RE
    144 C9 G C9S:$D(DE(9))[0 K DB
    145  S X=DE(9),DIC=DIE
    146  ;
    147  S X=DE(9),DIC=DIE
    148  ;
    149  S X=DE(9),DIC=DIE
    150  D AUTOUPD^DGENA2(DA)
    151 C9S S X="" G:DG(DQ)=X C9F1 K DB
    152  S X=DG(DQ),DIC=DIE
    153  X ^DD(2,.32103,1,1,1.3) I X S X=DIV S Y(2)=";"_$S($D(^DD(2,.3212,0)):$P(^(0),U,3),1:""),Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P($P(Y(2),";"_$P(Y(1),U,12)_":",2),";",1) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32103,1,1,1.4)
    154  S X=DG(DQ),DIC=DIE
    155  X ^DD(2,.32103,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.321)):^(.321),1:"") S X=$P(Y(1),U,11) S DIU=X K Y S X=DIV S X="" X ^DD(2,.32103,1,2,1.4)
    156  S X=DG(DQ),DIC=DIE
    157  D AUTOUPD^DGENA2(DA)
    158 C9F1 Q
    159 X9 S DFN=DA D SV^DGLOCK
    160  Q
    161  ;
    162 10 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".322;13",DV="RSX",DU="",DLB="ENVIRONMENTAL CONTAMINANTS?",DIFLD=.322013
    163  S DE(DW)="C10^DGRPTX22"
    164  S DU="Y:YES;N:NO;U:UNKNOWN;"
    165  G RE
    166 C10 G C10S:$D(DE(10))[0 K DB
    167  S X=DE(10),DIC=DIE
    168  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,14),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,1,2.4)
    169  S X=DE(10),DIC=DIE
    170  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,2,2.4)
    171  S X=DE(10),DIC=DIE
    172  D AUTOUPD^DGENA2(DA)
    173 C10S S X="" G:DG(DQ)=X C10F1 K DB
    174  S X=DG(DQ),DIC=DIE
    175  X ^DD(2,.322013,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,14),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,1,1.4)
    176  S X=DG(DQ),DIC=DIE
    177  X ^DD(2,.322013,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.322)):^(.322),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X="" X ^DD(2,.322013,1,2,1.4)
    178  S X=DG(DQ),DIC=DIE
    179  D AUTOUPD^DGENA2(DA)
    180 C10F1 Q
    181 X10 S DFN=DA D SV^DGLOCK
    182  Q
    183  ;
    184 11 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".36;2",DV="RSX",DU="",DLB="DISABILITY RET. FROM MILITARY?",DIFLD=.362
    185  S DE(DW)="C11^DGRPTX22"
    186  S DU="0:NO;1:YES, RECEIVING MILITARY RETIREMENT;2:YES, RECEIVING MILITARY RETIREMENT IN LIEU OF VA COMPENSATION;3:UNKNOWN;"
    187  G RE
    188 C11 G C11S:$D(DE(11))[0 K DB
    189  S X=DE(11),DIC=DIE
    190  ;
    191  S X=DE(11),DIC=DIE
    192  D AUTOUPD^DGENA2(DA)
    193 C11S S X="" G:DG(DQ)=X C11F1 K DB
    194  S X=DG(DQ),DIC=DIE
    195  X "S DFN=DA D EN^DGMTR K DGREQF"
    196  S X=DG(DQ),DIC=DIE
    197  D AUTOUPD^DGENA2(DA)
    198 C11F1 Q
    199 X11 S DFN=DA D SV^DGLOCK
    200  Q
    201  ;
    202 12 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".3;1",DV="SXa",DU="",DLB="SERVICE CONNECTED?",DIFLD=.301
    203  S DE(DW)="C12^DGRPTX22"
    204  S DU="Y:YES;N:NO;"
    205  G RE
    206 C12 G C12S:$D(DE(12))[0 K DB
     1DGRPTX22 ; ;04/21/06
    2072 S X=DE(12),DIC=DIE
    208  ;
     3 X ^DD(2,.36215,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,2.4)
    2094 S X=DE(12),DIC=DIE
    210  ;
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
     6 S X=DE(12),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,2.4)
    2118 S X=DE(12),DIC=DIE
    2129 D AUTOUPD^DGENA2(DA)
    213  S X=DE(12),DIC=DIE
    214  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".301;" D AVAFC^VAFCDD01(DA)
    215  S X=DE(12),DIC=DIE
    216  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    217  S X=DE(12),DIIX=2_U_DIFLD D AUDIT^DIET
    218 C12S S X="" G:DG(DQ)=X C12F1 K DB
    219  S X=DG(DQ),DIC=DIE
    220  X ^DD(2,.301,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.301,1,1,1.4)
    221  S X=DG(DQ),DIC=DIE
    222  X ^DD(2,.301,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,12),X=X S DIU=X K Y S X="" X ^DD(2,.301,1,2,1.4)
    223  S X=DG(DQ),DIC=DIE
    224  D AUTOUPD^DGENA2(DA)
    225  S X=DG(DQ),DIC=DIE
    226  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".301;" D AVAFC^VAFCDD01(DA)
    227  S X=DG(DQ),DIC=DIE
    228  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    229  I $D(DE(12))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    230 C12F1 Q
    231 X12 S DFN=DA D EV^DGLOCK I $D(X),X="Y" D VET^DGLOCK
    232  Q
    233  ;
    234 13 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    235 X13 S:X'="Y" Y="@50"
    236  Q
    237 14 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".3;2",DV="NJ3,0Xa",DU="",DLB="SERVICE CONNECTED PERCENTAGE",DIFLD=.302
    238  S DE(DW)="C14^DGRPTX22"
    239  G RE
    240 C14 G C14S:$D(DE(14))[0 K DB
    241  D ^DGRPTX23
    242 C14S S X="" G:DG(DQ)=X C14F1 K DB
    243  D ^DGRPTX24
    244 C14F1 Q
    245 X14 S DFN=DA D EV^DGLOCK Q:'$D(X)  K:+X'=X!(X>100)!(X<0)!(X?.E1"."1N.N) X I $D(X),$D(^DPT(DA,.3)),$P(^(.3),U,1)'="Y" W !?4,*7,"Only applies to service-connected applicants." K X
    246  Q
    247  ;
    248 15 S DQ=16 ;@50
    249 16 D:$D(DG)>9 F^DIE17,DE S DQ=16,DW=".362;12",DV="SX",DU="",DLB="RECEIVING A&A BENEFITS?",DIFLD=.36205
    250  S DE(DW)="C16^DGRPTX22"
    251  S DU="Y:YES;N:NO;U:UNKNOWN;"
    252  G RE
    253 C16 G C16S:$D(DE(16))[0 K DB
    254  D ^DGRPTX25
    255 C16S S X="" G:DG(DQ)=X C16F1 K DB
    256  D ^DGRPTX26
    257 C16F1 Q
    258 X16 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
    259  Q
    260  ;
    261 17 D:$D(DG)>9 F^DIE17,DE S DQ=17,DW=".362;13",DV="SX",DU="",DLB="RECEIVING HOUSEBOUND BENEFITS?",DIFLD=.36215
    262  S DE(DW)="C17^DGRPTX22"
    263  S DU="Y:YES;N:NO;U:UNKNOWN;"
    264  G RE
    265 C17 G C17S:$D(DE(17))[0 K DB
    266  D ^DGRPTX27
    267 C17S S X="" G:DG(DQ)=X C17F1 K DB
    268  D ^DGRPTX28
    269 C17F1 Q
    270 X17 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
    271  Q
    272  ;
    273 18 D:$D(DG)>9 F^DIE17 G ^DGRPTX29
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX23.m

    r613 r623  
    1 DGRPTX23 ; ;12/13/08
    2  S X=DE(14),DIC=DIE
    3  ;
    4  S X=DE(14),DIC=DIE
     1DGRPTX23 ; ;04/21/06
     2 S X=DG(DQ),DIC=DIE
     3 X ^DD(2,.36215,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,1.4)
     4 S X=DG(DQ),DIC=DIE
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
     6 S X=DG(DQ),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,1.4)
     8 S X=DG(DQ),DIC=DIE
    59 D AUTOUPD^DGENA2(DA)
    6  S X=DE(14),DIC=DIE
    7  ;
    8  S X=DE(14),DIC=DIE
    9  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".302;" D AVAFC^VAFCDD01(DA)
    10  S X=DE(14),DIC=DIE
    11  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    12  S X=DE(14),DIIX=2_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX24.m

    r613 r623  
    1 DGRPTX24 ; ;12/13/08
     1DGRPTX24 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,3) S:%]"" DE(4)=%
     5 I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,1) S:%]"" DE(2)=%
     6 I $D(^(.362)) S %Z=^(.362) S %=$P(%Z,U,14) S:%]"" DE(1)=%
     7 K %Z Q
     8 ;
     9W W !?DL+DL-2,DLB_": "
     10 Q
     11O D W W Y W:$X>45 !?9
     12 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     13 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     14TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     15 Q
     16A K DQ(DQ) S DQ=DQ+1
     17B G @DQ
     18RE G PR:$D(DE(DQ)) D W,TR
     19N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     20RD G QS:X?."?" I X["^" D D G ^DIE17
     21 I X="@" D D G Z^DIE2
     22 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     23T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     24 K DDER G X
     25P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     26 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     27 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     28V D @("X"_DQ) K YS
     29Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     30X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     31 S X="?BAD"
     32QS S DZ=X D D,QQ^DIEQ G B
     33D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     34Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     35PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     36R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     37 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     38 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     39RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     40I I DV'["I",DV'["#" G RD
     41 D E^DIE0 G RD:$D(X),PR
     42 Q
     43SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     44 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     45 D ^DIR I 'DDER S %=Y(0),X=Y
     46 Q
     47SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     48 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     49 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     50 Q
     51NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     52KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     53BEGIN S DNM="DGRPTX24",DQ=1
     541 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".362;14",DV="SX",DU="",DLB="RECEIVING A VA PENSION?",DIFLD=.36235
     55 S DE(DW)="C1^DGRPTX24"
     56 S DU="Y:YES;N:NO;U:UNKNOWN;"
     57 G RE
     58C1 G C1S:$D(DE(1))[0 K DB
     59 S X=DE(1),DIC=DIE
     60 X ^DD(2,.36235,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,2.4)
     61 S X=DE(1),DIC=DIE
     62 S DFN=DA D EN^DGMTCOR K DGMTCOR
     63 S X=DE(1),DIC=DIE
     64 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,2.4)
     65 S X=DE(1),DIC=DIE
     66 D AUTOUPD^DGENA2(DA)
     67C1S S X="" G:DG(DQ)=X C1F1 K DB
     68 S X=DG(DQ),DIC=DIE
     69 X ^DD(2,.36235,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,1.4)
     70 S X=DG(DQ),DIC=DIE
     71 S DFN=DA D EN^DGMTCOR K DGMTCOR
     72 S X=DG(DQ),DIC=DIE
     73 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,1.4)
     74 S X=DG(DQ),DIC=DIE
     75 D AUTOUPD^DGENA2(DA)
     76C1F1 Q
     77X1 S DFN=DA D MV^DGLOCK
     78 Q
     79 ;
     802 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".36;1",DV="*P8'Xa",DU="",DLB="PRIMARY ELIGIBILITY CODE",DIFLD=.361
     81 S DE(DW)="C2^DGRPTX24"
     82 S DU="DIC(8,"
     83 G RE
     84C2 G C2S:$D(DE(2))[0 K DB
     85 S X=DE(2),DIC=DIE
     86 ;
     87 S X=DE(2),DIC=DIE
     88 K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,2.2) I DIV(1)>0 S DIK(0)=DA,DIK="^DPT(DIV(0),""E"",",DA(1)=DIV(0),DA=DIV(1) D ^DIK S DA=DIK(0) K DIK
     89 S X=DE(2),DIC=DIE
     90 X "I $S('$D(^DIC(8,+X,0)):0,$P(^(0),""^"",1)[""DOM"":0,'$D(^DPT(DA,.36)):1,'$D(^DIC(8,+^(.36),0)):1,$P(^(0),""^"",1)'[""DOM"":1,1:0) S DGXRF=.361 D ^DGDDC Q"
     91 S X=DE(2),DIC=DIE
     92 K ^DPT("AEL",DA,+X)
     93 S X=DE(2),DIC=DIE
     94 D AUTOUPD^DGENA2(DA)
     95 S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
     96C2S S X="" G:DG(DQ)=X C2F1 K DB
     97 S X=DG(DQ),DIC=DIE
     98 X "S DFN=DA D EN^DGMTR K DGREQF"
     99 S X=DG(DQ),DIC=DIE
     100 K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,89.4) S Y(102)=$S($D(^DPT(D0,"E",D1,0)):^(0),1:"") S X=$S('$D(^DIC(8,+$P(Y(102),U,1),0)):"",1:$P(^(0),U,1)) S D0=I(0,0) S D1=I(1,0) S DIU=X K Y S X=DIV S X=DIV,X=X X ^DD(2,.361,1,2,1.4)
    2101 S X=DG(DQ),DIC=DIE
    3102 ;
    4103 S X=DG(DQ),DIC=DIE
     104 S ^DPT("AEL",DA,+X)=""
     105 S X=DG(DQ),DIC=DIE
    5106 D AUTOUPD^DGENA2(DA)
     107 I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     108C2F1 Q
     109X2 S DFN=DA D EV^DGLOCK I $D(X) D ECD^DGLOCK1
     110 Q
     111 ;
     1123 D:$D(DG)>9 F^DIE17,DE S DQ=3,D=0 K DE(1) ;361
     113 S DIFLD=361,DGO="^DGRPTX25",DC="3^2.0361IP^E^",DV="2.0361M*P8'X",DW="0;1",DOW="ELIGIBILITY",DLB="Select "_DOW S:D DC=DC_D
     114 S DU="DIC(8,"
     115 G RE:D I $D(DSC(2.0361))#2,$P(DSC(2.0361),"I $D(^UTILITY(",1)="" X DSC(2.0361) S D=$O(^(0)) S:D="" D=-1 G M3
     116 S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
     117M3 I D>0 S DC=DC_D I $D(^DPT(DA,"E",+D,0)) S DE(3)=$P(^(0),U,1)
     118 G RE
     119R3 D DE
     120 S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),1:1) G 3+1
     121 ;
     1224 S DW=".32;3",DV="*P21'Xa",DU="",DLB="PERIOD OF SERVICE",DIFLD=.323
     123 S DE(DW)="C4^DGRPTX24"
     124 S DU="DIC(21,"
     125 G RE
     126C4 G C4S:$D(DE(4))[0 K DB
     127 S X=DE(4),DIC=DIE
     128 K ^DPT("APOS",$E(X,1,30),DA)
     129 S X=DE(4),DIC=DIE
     130 ;
     131 S X=DE(4),DIC=DIE
     132 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
     133 S X=DE(4),DIIX=2_U_DIFLD D AUDIT^DIET
     134C4S S X="" G:DG(DQ)=X C4F1 K DB
    6135 S X=DG(DQ),DIC=DIE
    7  X "S DFN=DA D EN^DGMTR K DGREQF"
     136 S ^DPT("APOS",$E(X,1,30),DA)=""
    8137 S X=DG(DQ),DIC=DIE
    9  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".302;" D AVAFC^VAFCDD01(DA)
     138 X ^DD(2,.323,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,"ODS")):^("ODS"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y X ^DD(2,.323,1,2,1.1) X ^DD(2,.323,1,2,1.4)
    10139 S X=DG(DQ),DIC=DIE
    11  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    12  I $D(DE(14))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     140 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
     141 I $D(DE(4))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     142C4F1 Q
     143X4 S DFN=DA D POS^DGLOCK1
     144 Q
     145 ;
     1465 S DQ=6 ;@98
     1476 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     148X6 S DGFIN=""
     149 Q
     1507 G 0^DIE17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX25.m

    r613 r623  
    1 DGRPTX25 ; ;12/13/08
    2  S X=DE(16),DIC=DIE
    3  X ^DD(2,.36205,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,2.4)
    4  S X=DE(16),DIC=DIE
    5  S DFN=DA D EN^DGMTCOR K DGMTCOR
    6  S X=DE(16),DIC=DIE
    7  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,2.4)
    8  S X=DE(16),DIC=DIE
    9  D AUTOUPD^DGENA2(DA)
     1DGRPTX25 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(D0,""E"",",DIC=DIE,DP=2.0361,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^DPT(D0,"E",DA,""))=""
     4 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=%
     5 K %Z Q
     6 ;
     7W W !?DL+DL-2,DLB_": "
     8 Q
     9O D W W Y W:$X>45 !?9
     10 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     11 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     12TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     13 Q
     14A K DQ(DQ) S DQ=DQ+1
     15B G @DQ
     16RE G PR:$D(DE(DQ)) D W,TR
     17N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     18RD G QS:X?."?" I X["^" D D G ^DIE17
     19 I X="@" D D G Z^DIE2
     20 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     21T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     22 K DDER G X
     23P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     24 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     25 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     26V D @("X"_DQ) K YS
     27Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     28X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     29 S X="?BAD"
     30QS S DZ=X D D,QQ^DIEQ G B
     31D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     32Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     33PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     34R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     35 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     36 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     37RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     38I I DV'["I",DV'["#" G RD
     39 D E^DIE0 G RD:$D(X),PR
     40 Q
     41SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     42 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     43 D ^DIR I 'DDER S %=Y(0),X=Y
     44 Q
     45SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     46 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     47 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     48 Q
     49NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     50KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     51BEGIN S DNM="DGRPTX25",DQ=1+D G B
     521 S DW="0;1",DV="M*P8'X#",DU="",DLB="ELIGIBILITY",DIFLD=.01
     53 S DE(DW)="C1^DGRPTX25"
     54 S DU="DIC(8,"
     55 G RE:'D S DQ=2 G 2
     56C1 G C1S:$D(DE(1))[0 K DB
     57 S X=DE(1),DIC=DIE
     58 K ^DPT(DA(1),"E","B",$E(X,1,30),DA)
     59 S X=DE(1),DIC=DIE
     60 K ^DPT("AEL",DA(1),+X)
     61 S X=DE(1),DIC=DIE
     62 D E32^VADPT62
     63 S X=DE(1),DIC=DIE
     64 X "S DFN=DA(1) D EN^DGMTR K DGREQF"
     65 S X=DE(1),DIC=DIE
     66 D AUTOUPD^DGENA2(DA(1))
     67C1S S X="" G:DG(DQ)=X C1F1 K DB
     68 S X=DG(DQ),DIC=DIE
     69 S ^DPT(DA(1),"E","B",$E(X,1,30),DA)=""
     70 S X=DG(DQ),DIC=DIE
     71 S ^DPT("AEL",DA(1),+X)=""
     72 S X=DG(DQ),DIC=DIE
     73 D E31^VADPT62
     74 S X=DG(DQ),DIC=DIE
     75 X "S DFN=DA(1) D EN^DGMTR K DGREQF"
     76 S X=DG(DQ),DIC=DIE
     77 D AUTOUPD^DGENA2(DA(1))
     78C1F1 Q
     79X1 S DIC("S")="I '$P(^(0),U,7),$S($P(^(0),U,8):1,'$D(^DPT(D0,.36)):0,1:Y=+^(.36)),$$ELGCHK^DGRPTU(D0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X I $D(X) S DINUM=X
     80 Q
     81 ;
     822 G 1^DIE17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX26.m

    r613 r623  
    1 DGRPTX26 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  X ^DD(2,.36205,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,1.4)
    4  S X=DG(DQ),DIC=DIE
    5  S DFN=DA D EN^DGMTCOR K DGMTCOR
    6  S X=DG(DQ),DIC=DIE
    7  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,1.4)
    8  S X=DG(DQ),DIC=DIE
    9  D AUTOUPD^DGENA2(DA)
     1DGRPTX26 ; ;04/21/06
     2 ;;
     31 N X,X1,X2 S DIXR=602 D X1(U) K X2 M X2=X D X1("F") K X1 M X1=X
     4 D
     5 . D PNOK^DGDDDTTM
     6 K X M X=X2 D
     7 . D PNOK^DGDDDTTM
     8 Q
     9X1(DION) K X
     10 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.211,DION),$P($G(^DPT(DA,.21)),U,1))
     11 S X(2)=$G(@DIEZTMP@("V",2,DIIENS,.212,DION),$P($G(^DPT(DA,.21)),U,2))
     12 S X(3)=$G(@DIEZTMP@("V",2,DIIENS,.213,DION),$P($G(^DPT(DA,.21)),U,3))
     13 S X(4)=$G(@DIEZTMP@("V",2,DIIENS,.214,DION),$P($G(^DPT(DA,.21)),U,4))
     14 S X(5)=$G(@DIEZTMP@("V",2,DIIENS,.215,DION),$P($G(^DPT(DA,.21)),U,5))
     15 S X(6)=$G(@DIEZTMP@("V",2,DIIENS,.216,DION),$P($G(^DPT(DA,.21)),U,6))
     16 S X(7)=$G(@DIEZTMP@("V",2,DIIENS,.217,DION),$P($G(^DPT(DA,.21)),U,7))
     17 S X(8)=$G(@DIEZTMP@("V",2,DIIENS,.218,DION),$P($G(^DPT(DA,.21)),U,8))
     18 S X(9)=$G(@DIEZTMP@("V",2,DIIENS,.2125,DION),$P($G(^DPT(DA,.21)),U,10))
     19 S X(10)=$G(@DIEZTMP@("V",2,DIIENS,.2207,DION),$P($G(^DPT(DA,.22)),U,7))
     20 S X=$G(X(1))
     21 Q
     222 N X,X1,X2 S DIXR=604 D X2(U) K X2 M X2=X D X2("F") K X1 M X1=X
     23 D
     24 . D ECON^DGDDDTTM
     25 K X M X=X2 D
     26 . D ECON^DGDDDTTM
     27 Q
     28X2(DION) K X
     29 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.331,DION),$P($G(^DPT(DA,.33)),U,1))
     30 S X(2)=$G(@DIEZTMP@("V",2,DIIENS,.332,DION),$P($G(^DPT(DA,.33)),U,2))
     31 S X(3)=$G(@DIEZTMP@("V",2,DIIENS,.333,DION),$P($G(^DPT(DA,.33)),U,3))
     32 S X(4)=$G(@DIEZTMP@("V",2,DIIENS,.334,DION),$P($G(^DPT(DA,.33)),U,4))
     33 S X(5)=$G(@DIEZTMP@("V",2,DIIENS,.335,DION),$P($G(^DPT(DA,.33)),U,5))
     34 S X(6)=$G(@DIEZTMP@("V",2,DIIENS,.336,DION),$P($G(^DPT(DA,.33)),U,6))
     35 S X(7)=$G(@DIEZTMP@("V",2,DIIENS,.337,DION),$P($G(^DPT(DA,.33)),U,7))
     36 S X(8)=$G(@DIEZTMP@("V",2,DIIENS,.338,DION),$P($G(^DPT(DA,.33)),U,8))
     37 S X(9)=$G(@DIEZTMP@("V",2,DIIENS,.3305,DION),$P($G(^DPT(DA,.33)),U,10))
     38 S X(10)=$G(@DIEZTMP@("V",2,DIIENS,.2201,DION),$P($G(^DPT(DA,.22)),U,1))
     39 S X=$G(X(1))
     40 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX27.m

    r613 r623  
    1 DGRPTX27 ; ;12/13/08
    2  S X=DE(17),DIC=DIE
    3  X ^DD(2,.36215,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,2.4)
    4  S X=DE(17),DIC=DIE
    5  S DFN=DA D EN^DGMTCOR K DGMTCOR
    6  S X=DE(17),DIC=DIE
    7  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,2.4)
    8  S X=DE(17),DIC=DIE
    9  D AUTOUPD^DGENA2(DA)
     1DGRPTX27 ; ;12/08/05
     2 D DE G BEGIN
     3DE S DIE="^DPT(D0,""E"",",DIC=DIE,DP=2.0361,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^DPT(D0,"E",DA,""))=""
     4 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=%
     5 K %Z Q
     6 ;
     7W W !?DL+DL-2,DLB_": "
     8 Q
     9O D W W Y W:$X>45 !?9
     10 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     11 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     12TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     13 Q
     14A K DQ(DQ) S DQ=DQ+1
     15B G @DQ
     16RE G PR:$D(DE(DQ)) D W,TR
     17N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     18RD G QS:X?."?" I X["^" D D G ^DIE17
     19 I X="@" D D G Z^DIE2
     20 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     21T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     22 K DDER G X
     23P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     24 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     25 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     26V D @("X"_DQ) K YS
     27Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     28X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     29 S X="?BAD"
     30QS S DZ=X D D,QQ^DIEQ G B
     31D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     32Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     33PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     34R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     35 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     36 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     37RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     38I I DV'["I",DV'["#" G RD
     39 D E^DIE0 G RD:$D(X),PR
     40 Q
     41SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     42 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     43 D ^DIR I 'DDER S %=Y(0),X=Y
     44 Q
     45SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     46 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     47 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     48 Q
     49NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     50KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     51BEGIN S DNM="DGRPTX27",DQ=1+D G B
     521 S DW="0;1",DV="M*P8'X#",DU="",DLB="ELIGIBILITY",DIFLD=.01
     53 S DE(DW)="C1^DGRPTX27"
     54 S DU="DIC(8,"
     55 G RE:'D S DQ=2 G 2
     56C1 G C1S:$D(DE(1))[0 K DB
     57 S X=DE(1),DIC=DIE
     58 K ^DPT(DA(1),"E","B",$E(X,1,30),DA)
     59 S X=DE(1),DIC=DIE
     60 K ^DPT("AEL",DA(1),+X)
     61 S X=DE(1),DIC=DIE
     62 D E32^VADPT62
     63 S X=DE(1),DIC=DIE
     64 X "S DFN=DA(1) D EN^DGMTR K DGREQF"
     65 S X=DE(1),DIC=DIE
     66 D AUTOUPD^DGENA2(DA(1))
     67C1S S X="" G:DG(DQ)=X C1F1 K DB
     68 S X=DG(DQ),DIC=DIE
     69 S ^DPT(DA(1),"E","B",$E(X,1,30),DA)=""
     70 S X=DG(DQ),DIC=DIE
     71 S ^DPT("AEL",DA(1),+X)=""
     72 S X=DG(DQ),DIC=DIE
     73 D E31^VADPT62
     74 S X=DG(DQ),DIC=DIE
     75 X "S DFN=DA(1) D EN^DGMTR K DGREQF"
     76 S X=DG(DQ),DIC=DIE
     77 D AUTOUPD^DGENA2(DA(1))
     78C1F1 Q
     79X1 S DIC("S")="I '$P(^(0),U,7),$S($P(^(0),U,8):1,'$D(^DPT(D0,.36)):0,1:Y=+^(.36)),$$ELGCHK^DGRPTU(D0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X I $D(X) S DINUM=X
     80 Q
     81 ;
     822 G 1^DIE17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX28.m

    r613 r623  
    1 DGRPTX28 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  X ^DD(2,.36215,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,1.4)
    4  S X=DG(DQ),DIC=DIE
    5  S DFN=DA D EN^DGMTCOR K DGMTCOR
    6  S X=DG(DQ),DIC=DIE
    7  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,1.4)
    8  S X=DG(DQ),DIC=DIE
    9  D AUTOUPD^DGENA2(DA)
     1DGRPTX28 ; ;12/08/05
     2 S X=DE(8),DIC=DIE
     3 K ^DPT("APOS",$E(X,1,30),DA)
     4 S X=DE(8),DIC=DIE
     5 ;
     6 S X=DE(8),DIC=DIE
     7 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
     8 S X=DE(8),DIIX=2_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX29.m

    r613 r623  
    1 DGRPTX29 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,3) S:%]"" DE(4)=%
    5  I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,1) S:%]"" DE(2)=%
    6  I $D(^(.362)) S %Z=^(.362) S %=$P(%Z,U,14) S:%]"" DE(1)=%
    7  K %Z Q
    8  ;
    9 W W !?DL+DL-2,DLB_": "
    10  Q
    11 O D W W Y W:$X>45 !?9
    12  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    13  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    14 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    15  Q
    16 A K DQ(DQ) S DQ=DQ+1
    17 B G @DQ
    18 RE G PR:$D(DE(DQ)) D W,TR
    19 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    20 RD G QS:X?."?" I X["^" D D G ^DIE17
    21  I X="@" D D G Z^DIE2
    22  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    23 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    24  K DDER G X
    25 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    26  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    27  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    28 V D @("X"_DQ) K YS
    29 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    30 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    31  S X="?BAD"
    32 QS S DZ=X D D,QQ^DIEQ G B
    33 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    34 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    35 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    36 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    37  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    38  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    39 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    40 I I DV'["I",DV'["#" G RD
    41  D E^DIE0 G RD:$D(X),PR
    42  Q
    43 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    44  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    45  D ^DIR I 'DDER S %=Y(0),X=Y
    46  Q
    47 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    48  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    49  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    50  Q
    51 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    52 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    53 BEGIN S DNM="DGRPTX29",DQ=1
    54 1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".362;14",DV="SX",DU="",DLB="RECEIVING A VA PENSION?",DIFLD=.36235
    55  S DE(DW)="C1^DGRPTX29"
    56  S DU="Y:YES;N:NO;U:UNKNOWN;"
    57  G RE
    58 C1 G C1S:$D(DE(1))[0 K DB
    59  S X=DE(1),DIC=DIE
    60  X ^DD(2,.36235,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,2.4)
    61  S X=DE(1),DIC=DIE
    62  S DFN=DA D EN^DGMTCOR K DGMTCOR
    63  S X=DE(1),DIC=DIE
    64  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,2.4)
    65  S X=DE(1),DIC=DIE
    66  D AUTOUPD^DGENA2(DA)
    67 C1S S X="" G:DG(DQ)=X C1F1 K DB
    68  S X=DG(DQ),DIC=DIE
    69  X ^DD(2,.36235,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,1.4)
    70  S X=DG(DQ),DIC=DIE
    71  S DFN=DA D EN^DGMTCOR K DGMTCOR
    72  S X=DG(DQ),DIC=DIE
    73  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,1.4)
    74  S X=DG(DQ),DIC=DIE
    75  D AUTOUPD^DGENA2(DA)
    76 C1F1 Q
    77 X1 S DFN=DA D MV^DGLOCK
    78  Q
    79  ;
    80 2 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".36;1",DV="*P8'Xa",DU="",DLB="PRIMARY ELIGIBILITY CODE",DIFLD=.361
    81  S DE(DW)="C2^DGRPTX29"
    82  S DU="DIC(8,"
    83  G RE
    84 C2 G C2S:$D(DE(2))[0 K DB
    85  S X=DE(2),DIC=DIE
    86  ;
    87  S X=DE(2),DIC=DIE
    88  K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,2.2) I DIV(1)>0 S DIK(0)=DA,DIK="^DPT(DIV(0),""E"",",DA(1)=DIV(0),DA=DIV(1) D ^DIK S DA=DIK(0) K DIK
    89  S X=DE(2),DIC=DIE
    90  X "I $S('$D(^DIC(8,+X,0)):0,$P(^(0),""^"",1)[""DOM"":0,'$D(^DPT(DA,.36)):1,'$D(^DIC(8,+^(.36),0)):1,$P(^(0),""^"",1)'[""DOM"":1,1:0) S DGXRF=.361 D ^DGDDC Q"
    91  S X=DE(2),DIC=DIE
    92  K ^DPT("AEL",DA,+X)
    93  S X=DE(2),DIC=DIE
    94  D AUTOUPD^DGENA2(DA)
    95  S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
    96 C2S S X="" G:DG(DQ)=X C2F1 K DB
    97  S X=DG(DQ),DIC=DIE
    98  X "S DFN=DA D EN^DGMTR K DGREQF"
    99  S X=DG(DQ),DIC=DIE
    100  K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,89.4) S Y(102)=$S($D(^DPT(D0,"E",D1,0)):^(0),1:"") S X=$S('$D(^DIC(8,+$P(Y(102),U,1),0)):"",1:$P(^(0),U,1)) S D0=I(0,0) S D1=I(1,0) S DIU=X K Y S X=DIV S X=DIV,X=X X ^DD(2,.361,1,2,1.4)
    101  S X=DG(DQ),DIC=DIE
    102  ;
    103  S X=DG(DQ),DIC=DIE
    104  S ^DPT("AEL",DA,+X)=""
    105  S X=DG(DQ),DIC=DIE
    106  D AUTOUPD^DGENA2(DA)
    107  I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    108 C2F1 Q
    109 X2 S DFN=DA D EV^DGLOCK I $D(X) D ECD^DGLOCK1
    110  Q
    111  ;
    112 3 D:$D(DG)>9 F^DIE17,DE S DQ=3,D=0 K DE(1) ;361
    113  S DIFLD=361,DGO="^DGRPTX30",DC="3^2.0361IP^E^",DV="2.0361M*P8'X",DW="0;1",DOW="ELIGIBILITY",DLB="Select "_DOW S:D DC=DC_D
    114  S DU="DIC(8,"
    115  G RE:D I $D(DSC(2.0361))#2,$P(DSC(2.0361),"I $D(^UTILITY(",1)="" X DSC(2.0361) S D=$O(^(0)) S:D="" D=-1 G M3
    116  S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
    117 M3 I D>0 S DC=DC_D I $D(^DPT(DA,"E",+D,0)) S DE(3)=$P(^(0),U,1)
    118  G RE
    119 R3 D DE
    120  S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),1:1) G 3+1
    121  ;
    122 4 S DW=".32;3",DV="*P21'Xa",DU="",DLB="PERIOD OF SERVICE",DIFLD=.323
    123  S DE(DW)="C4^DGRPTX29"
    124  S DU="DIC(21,"
    125  G RE
    126 C4 G C4S:$D(DE(4))[0 K DB
    127  S X=DE(4),DIC=DIE
    128  K ^DPT("APOS",$E(X,1,30),DA)
    129  S X=DE(4),DIC=DIE
    130  ;
    131  S X=DE(4),DIC=DIE
    132  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
    133  S X=DE(4),DIC=DIE
    134  D EVENT^IVMPLOG(DA)
    135  S X=DE(4),DIIX=2_U_DIFLD D AUDIT^DIET
    136 C4S S X="" G:DG(DQ)=X C4F1 K DB
     1DGRPTX29 ; ;12/08/05
    1372 S X=DG(DQ),DIC=DIE
    1383 S ^DPT("APOS",$E(X,1,30),DA)=""
     
    1416 S X=DG(DQ),DIC=DIE
    1427 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
    143  S X=DG(DQ),DIC=DIE
    144  D EVENT^IVMPLOG(DA)
    145  I $D(DE(4))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    146 C4F1 Q
    147 X4 S DFN=DA D POS^DGLOCK1
    148  Q
    149  ;
    150 5 S DQ=6 ;@98
    151 6 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    152 X6 S DGFIN=""
    153  Q
    154 7 G 0^DIE17
     8 I $D(DE(8))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX3.m

    r613 r623  
    1 DGRPTX3 ; ;12/13/08
    2  S X=DE(11),DIC=DIE
     1DGRPTX3 ; ;04/21/06
     2 S X=DG(DQ),DIC=DIE
     3 ;
     4 S X=DG(DQ),DIC=DIE
    35 S A1B2TAG="PAT" D ^A1B2XFR
    4  S X=DE(11),DIC=DIE
     6 S X=DG(DQ),DIC=DIE
    57 D EVENT^IVMPLOG(DA)
    6  S X=DE(11),DIC=DIE
     8 S X=DG(DQ),DIC=DIE
    79 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    8  S X=DE(11),DIC=DIE
     10 S X=DG(DQ),DIC=DIE
    911 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    10  S X=DE(11),DIC=DIE
    11  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".113;" D AVAFC^VAFCDD01(DA)
    12  S X=DE(11),DIC=DIE
     12 S X=DG(DQ),DIC=DIE
     13 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".112;" D AVAFC^VAFCDD01(DA)
     14 S X=DG(DQ),DIC=DIE
    1315 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    14  S X=DE(11),DIIX=2_U_DIFLD D AUDIT^DIET
     16 I $D(DE(9))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX30.m

    r613 r623  
    1 DGRPTX30 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(D0,""E"",",DIC=DIE,DP=2.0361,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^DPT(D0,"E",DA,""))=""
    4  I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=%
    5  K %Z Q
    6  ;
    7 W W !?DL+DL-2,DLB_": "
     1DGRPTX30 ; ;12/08/05
     2 ;;
     31 N X,X1,X2 S DIXR=602 D X1(U) K X2 M X2=X D X1("F") K X1 M X1=X
     4 D
     5 . D PNOK^DGDDDTTM
     6 K X M X=X2 D
     7 . D PNOK^DGDDDTTM
    88 Q
    9 O D W W Y W:$X>45 !?9
    10  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    11  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    12 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     9X1(DION) K X
     10 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.211,DION),$P($G(^DPT(DA,.21)),U,1))
     11 S X(2)=$G(@DIEZTMP@("V",2,DIIENS,.212,DION),$P($G(^DPT(DA,.21)),U,2))
     12 S X(3)=$G(@DIEZTMP@("V",2,DIIENS,.213,DION),$P($G(^DPT(DA,.21)),U,3))
     13 S X(4)=$G(@DIEZTMP@("V",2,DIIENS,.214,DION),$P($G(^DPT(DA,.21)),U,4))
     14 S X(5)=$G(@DIEZTMP@("V",2,DIIENS,.215,DION),$P($G(^DPT(DA,.21)),U,5))
     15 S X(6)=$G(@DIEZTMP@("V",2,DIIENS,.216,DION),$P($G(^DPT(DA,.21)),U,6))
     16 S X(7)=$G(@DIEZTMP@("V",2,DIIENS,.217,DION),$P($G(^DPT(DA,.21)),U,7))
     17 S X(8)=$G(@DIEZTMP@("V",2,DIIENS,.218,DION),$P($G(^DPT(DA,.21)),U,8))
     18 S X(9)=$G(@DIEZTMP@("V",2,DIIENS,.2125,DION),$P($G(^DPT(DA,.21)),U,10))
     19 S X(10)=$G(@DIEZTMP@("V",2,DIIENS,.2207,DION),$P($G(^DPT(DA,.22)),U,7))
     20 S X=$G(X(1))
    1321 Q
    14 A K DQ(DQ) S DQ=DQ+1
    15 B G @DQ
    16 RE G PR:$D(DE(DQ)) D W,TR
    17 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    18 RD G QS:X?."?" I X["^" D D G ^DIE17
    19  I X="@" D D G Z^DIE2
    20  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    21 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    22  K DDER G X
    23 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    24  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    25  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    26 V D @("X"_DQ) K YS
    27 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    28 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    29  S X="?BAD"
    30 QS S DZ=X D D,QQ^DIEQ G B
    31 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    32 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    33 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    34 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    35  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    36  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    37 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    38 I I DV'["I",DV'["#" G RD
    39  D E^DIE0 G RD:$D(X),PR
    40  Q
    41 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    42  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    43  D ^DIR I 'DDER S %=Y(0),X=Y
    44  Q
    45 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    46  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    47  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    48  Q
    49 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    50 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    51 BEGIN S DNM="DGRPTX30",DQ=1+D G B
    52 1 S DW="0;1",DV="M*P8'X#",DU="",DLB="ELIGIBILITY",DIFLD=.01
    53  S DE(DW)="C1^DGRPTX30"
    54  S DU="DIC(8,"
    55  G RE:'D S DQ=2 G 2
    56 C1 G C1S:$D(DE(1))[0 K DB
    57  S X=DE(1),DIC=DIE
    58  K ^DPT(DA(1),"E","B",$E(X,1,30),DA)
    59  S X=DE(1),DIC=DIE
    60  K ^DPT("AEL",DA(1),+X)
    61  S X=DE(1),DIC=DIE
    62  D E32^VADPT62
    63  S X=DE(1),DIC=DIE
    64  X "S DFN=DA(1) D EN^DGMTR K DGREQF"
    65  S X=DE(1),DIC=DIE
    66  D AUTOUPD^DGENA2(DA(1))
    67 C1S S X="" G:DG(DQ)=X C1F1 K DB
    68  S X=DG(DQ),DIC=DIE
    69  S ^DPT(DA(1),"E","B",$E(X,1,30),DA)=""
    70  S X=DG(DQ),DIC=DIE
    71  S ^DPT("AEL",DA(1),+X)=""
    72  S X=DG(DQ),DIC=DIE
    73  D E31^VADPT62
    74  S X=DG(DQ),DIC=DIE
    75  X "S DFN=DA(1) D EN^DGMTR K DGREQF"
    76  S X=DG(DQ),DIC=DIE
    77  D AUTOUPD^DGENA2(DA(1))
    78 C1F1 Q
    79 X1 S DIC("S")="I '$P(^(0),U,7),$S($P(^(0),U,8):1,'$D(^DPT(D0,.36)):0,1:Y=+^(.36)),$$ELGCHK^DGRPTU(D0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X I $D(X) S DINUM=X
    80  Q
    81  ;
    82 2 G 1^DIE17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX4.m

    r613 r623  
    1 DGRPTX4 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
     1DGRPTX4 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,3) S:%]"" DE(1)=% S %=$P(%Z,U,4) S:%]"" DE(5)=% S %=$P(%Z,U,5) S:%]"" DE(7)=% S %=$P(%Z,U,12) S:%]"" DE(4)=%
     5 K %Z Q
     6 ;
     7W W !?DL+DL-2,DLB_": "
     8 Q
     9O D W W Y W:$X>45 !?9
     10 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     11 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     12TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     13 Q
     14A K DQ(DQ) S DQ=DQ+1
     15B G @DQ
     16RE G PR:$D(DE(DQ)) D W,TR
     17N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     18RD G QS:X?."?" I X["^" D D G ^DIE17
     19 I X="@" D D G Z^DIE2
     20 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     21T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     22 K DDER G X
     23P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     24 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     25 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     26V D @("X"_DQ) K YS
     27Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     28X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     29 S X="?BAD"
     30QS S DZ=X D D,QQ^DIEQ G B
     31D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     32Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     33PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     34R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     35 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     36 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     37RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     38I I DV'["I",DV'["#" G RD
     39 D E^DIE0 G RD:$D(X),PR
     40 Q
     41SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     42 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     43 D ^DIR I 'DDER S %=Y(0),X=Y
     44 Q
     45SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     46 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     47 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     48 Q
     49NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     50KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     51BEGIN S DNM="DGRPTX4",DQ=1
     521 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".11;3",DV="Fa",DU="",DLB="STREET ADDRESS [LINE 3]",DIFLD=.113
     53 S DE(DW)="C1^DGRPTX4",DE(DW,"INDEX")=1
     54 G RE
     55C1 G C1S:$D(DE(1))[0 K DB
     56 S X=DE(1),DIC=DIE
    357 S A1B2TAG="PAT" D ^A1B2XFR
    4  S X=DG(DQ),DIC=DIE
    5  D EVENT^IVMPLOG(DA)
    6  S X=DG(DQ),DIC=DIE
    7  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    8  S X=DG(DQ),DIC=DIE
    9  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    10  S X=DG(DQ),DIC=DIE
     58 S X=DE(1),DIC=DIE
     59 D EVENT^IVMPLOG(DA)
     60 S X=DE(1),DIC=DIE
     61 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     62 S X=DE(1),DIC=DIE
     63 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     64 S X=DE(1),DIC=DIE
    1165 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".113;" D AVAFC^VAFCDD01(DA)
    12  S X=DG(DQ),DIC=DIE
    13  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    14  I $D(DE(11))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     66 S X=DE(1),DIC=DIE
     67 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     68 S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
     69C1S S X="" G:DG(DQ)=X C1F1 K DB
     70 S X=DG(DQ),DIC=DIE
     71 S A1B2TAG="PAT" D ^A1B2XFR
     72 S X=DG(DQ),DIC=DIE
     73 D EVENT^IVMPLOG(DA)
     74 S X=DG(DQ),DIC=DIE
     75 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     76 S X=DG(DQ),DIC=DIE
     77 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     78 S X=DG(DQ),DIC=DIE
     79 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".113;" D AVAFC^VAFCDD01(DA)
     80 S X=DG(DQ),DIC=DIE
     81 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     82 I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     83C1F1 N X,X1,X2 S DIXR=233 D C1X1(U) K X2 M X2=X D C1X1("O") K X1 M X1=X
     84 D
     85 . D FC^DGFCPROT(.DA,2,.113,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     86 K X M X=X2 D
     87 . D FC^DGFCPROT(.DA,2,.113,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     88 G C1F2
     89C1X1(DION) K X
     90 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.113,DION),$P($G(^DPT(DA,.11)),U,3))
     91 S X=$G(X(1))
     92 Q
     93C1F2 Q
     94X1 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X
     95 I $D(X),X'?.ANP K X
     96 Q
     97 ;
     982 S DQ=3 ;@1112
     993 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     100X3 S EASZIPLK=1
     101 Q
     1024 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".11;12",DV="FXOa",DU="",DLB="ZIP+4",DIFLD=.1112
     103 S DQ(4,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
     104 S DE(DW)="C4^DGRPTX4",DE(DW,"INDEX")=1
     105 G RE
     106C4 G C4S:$D(DE(4))[0 K DB
     107 S X=DE(4),DIC=DIE
     108 D KILL^DGREGDD1(DA,.116,.11,6,$E(X,1,5))
     109 S X=DE(4),DIC=DIE
     110 D EVENT^IVMPLOG(DA)
     111 S X=DE(4),DIC=DIE
     112 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     113 S X=DE(4),DIC=DIE
     114 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     115 S X=DE(4),DIC=DIE
     116 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".1112;" D AVAFC^VAFCDD01(DA)
     117 S X=DE(4),DIC=DIE
     118 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     119 S X=DE(4),DIIX=2_U_DIFLD D AUDIT^DIET
     120C4S S X="" G:DG(DQ)=X C4F1 K DB
     121 S X=DG(DQ),DIC=DIE
     122 D SET^DGREGDD1(DA,.116,.11,6,$E(X,1,5))
     123 S X=DG(DQ),DIC=DIE
     124 D EVENT^IVMPLOG(DA)
     125 S X=DG(DQ),DIC=DIE
     126 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     127 S X=DG(DQ),DIC=DIE
     128 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     129 S X=DG(DQ),DIC=DIE
     130 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".1112;" D AVAFC^VAFCDD01(DA)
     131 S X=DG(DQ),DIC=DIE
     132 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     133 I $D(DE(4))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     134C4F1 N X,X1,X2 S DIXR=185 D C4X1(U) K X2 M X2=X D C4X1("O") K X1 M X1=X
     135 D
     136 . N DIEXARR M DIEXARR=X S DIEZCOND=1
     137 . I X1(1)'=X2(1)
     138 . S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
     139 . K EASDO2
     140 G C4F2
     141C4X1(DION) K X
     142 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.1112,DION),$P($G(^DPT(DA,.11)),U,12))
     143 S:('$G(EASDO2)&($D(EASZIPLK))) X=$$ZIP^DGREGDD1(DA,X(1))
     144 S:$D(X)#2 X(2)=X
     145 S X=$G(X(1))
     146 Q
     147C4F2 S DIXR=231 D C4X2(U) K X2 M X2=X D C4X2("O") K X1 M X1=X
     148 D
     149 . D FC^DGFCPROT(.DA,2,.1112,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     150 K X M X=X2 D
     151 . D FC^DGFCPROT(.DA,2,.1112,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     152 G C4F3
     153C4X2(DION) K X
     154 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.1112,DION),$P($G(^DPT(DA,.11)),U,12))
     155 S X=$G(X(1))
     156 Q
     157C4F3 Q
     158X4 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>20!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
     159 I $D(X),X'?.ANP K X
     160 Q
     161 ;
     1625 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".11;4",DV="Fa",DU="",DLB="CITY",DIFLD=.114
     163 S DE(DW)="C5^DGRPTX4",DE(DW,"INDEX")=1
     164 G RE
     165C5 G C5S:$D(DE(5))[0 K DB
     166 D ^DGRPTX5
     167C5S S X="" G:DG(DQ)=X C5F1 K DB
     168 D ^DGRPTX6
     169C5F1 N X,X1,X2 S DIXR=234 D C5X1(U) K X2 M X2=X D C5X1("O") K X1 M X1=X
     170 D
     171 . D FC^DGFCPROT(.DA,2,.114,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     172 K X M X=X2 D
     173 . D FC^DGFCPROT(.DA,2,.114,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     174 G C5F2
     175C5X1(DION) K X
     176 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.114,DION),$P($G(^DPT(DA,.11)),U,4))
     177 S X=$G(X(1))
     178 Q
     179C5F2 Q
     180X5 K:$L(X)>15!($L(X)<2) X
     181 I $D(X),X'?.ANP K X
     182 Q
     183 ;
     1846 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     185X6 S:'$$KEY^DGREGDD1(DUZ,DA) Y=.131
     186 Q
     1877 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".11;5",DV="P5'a",DU="",DLB="STATE",DIFLD=.115
     188 S DE(DW)="C7^DGRPTX4",DE(DW,"INDEX")=1
     189 S DU="DIC(5,"
     190 G RE
     191C7 G C7S:$D(DE(7))[0 K DB
     192 D ^DGRPTX7
     193C7S S X="" G:DG(DQ)=X C7F1 K DB
     194 D ^DGRPTX8
     195C7F1 N X,X1,X2 S DIXR=235 D C7X1(U) K X2 M X2=X D C7X1("O") K X1 M X1=X
     196 D
     197 . D FC^DGFCPROT(.DA,2,.115,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     198 K X M X=X2 D
     199 . D FC^DGFCPROT(.DA,2,.115,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
     200 G C7F2
     201C7X1(DION) K X
     202 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.115,DION),$P($G(^DPT(DA,.11)),U,5))
     203 S X=$G(X(1))
     204 Q
     205C7F2 Q
     206X7 Q
     2078 D:$D(DG)>9 F^DIE17 G ^DGRPTX9
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX5.m

    r613 r623  
    1 DGRPTX5 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,5) S:%]"" DE(9)=%
    5  I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,4) S:%]"" DE(2)=% S %=$P(%Z,U,5) S:%]"" DE(4)=% S %=$P(%Z,U,7) S:%]"" DE(5)=% S %=$P(%Z,U,12) S:%]"" DE(1)=% S %=$P(%Z,U,16) S:%]"" DE(8)=%
    6  I $D(^(.13)) S %Z=^(.13) S %=$P(%Z,U,1) S:%]"" DE(6)=% S %=$P(%Z,U,2) S:%]"" DE(7)=%
    7  I $D(^(.21)) S %Z=^(.21) S %=$P(%Z,U,1) S:%]"" DE(10)=%
    8  K %Z Q
    9  ;
    10 W W !?DL+DL-2,DLB_": "
    11  Q
    12 O D W W Y W:$X>45 !?9
    13  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    14  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    15 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    16  Q
    17 A K DQ(DQ) S DQ=DQ+1
    18 B G @DQ
    19 RE G PR:$D(DE(DQ)) D W,TR
    20 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    21 RD G QS:X?."?" I X["^" D D G ^DIE17
    22  I X="@" D D G Z^DIE2
    23  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    24 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    25  K DDER G X
    26 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    27  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    28  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    29 V D @("X"_DQ) K YS
    30 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    31 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    32  S X="?BAD"
    33 QS S DZ=X D D,QQ^DIEQ G B
    34 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    35 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    36 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    37 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    38  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    39  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    40 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    41 I I DV'["I",DV'["#" G RD
    42  D E^DIE0 G RD:$D(X),PR
    43  Q
    44 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    45  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    46  D ^DIR I 'DDER S %=Y(0),X=Y
    47  Q
    48 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    49  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    50  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    51  Q
    52 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    53 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    54 BEGIN S DNM="DGRPTX5",DQ=1
    55 1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".11;12",DV="FXOa",DU="",DLB="ZIP+4",DIFLD=.1112
    56  S DQ(1,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
    57  S DE(DW)="C1^DGRPTX5",DE(DW,"INDEX")=1
    58  G RE
    59 C1 G C1S:$D(DE(1))[0 K DB
    60  S X=DE(1),DIC=DIE
    61  D KILL^DGREGDD1(DA,.116,.11,6,$E(X,1,5))
    62  S X=DE(1),DIC=DIE
    63  D EVENT^IVMPLOG(DA)
    64  S X=DE(1),DIC=DIE
    65  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    66  S X=DE(1),DIC=DIE
    67  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    68  S X=DE(1),DIC=DIE
    69  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".1112;" D AVAFC^VAFCDD01(DA)
    70  S X=DE(1),DIC=DIE
    71  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    72  S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
    73 C1S S X="" G:DG(DQ)=X C1F1 K DB
    74  S X=DG(DQ),DIC=DIE
    75  D SET^DGREGDD1(DA,.116,.11,6,$E(X,1,5))
    76  S X=DG(DQ),DIC=DIE
    77  D EVENT^IVMPLOG(DA)
    78  S X=DG(DQ),DIC=DIE
    79  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    80  S X=DG(DQ),DIC=DIE
    81  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    82  S X=DG(DQ),DIC=DIE
    83  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".1112;" D AVAFC^VAFCDD01(DA)
    84  S X=DG(DQ),DIC=DIE
    85  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    86  I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    87 C1F1 N X,X1,X2 S DIXR=185 D C1X1(U) K X2 M X2=X D C1X1("O") K X1 M X1=X
    88  D
    89  . N DIEXARR M DIEXARR=X S DIEZCOND=1
    90  . I X1(1)'=X2(1)
    91  . S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
    92  . K EASDO2
    93  G C1F2
    94 C1X1(DION) K X
    95  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.1112,DION),$P($G(^DPT(DA,.11)),U,12))
    96  S:('$G(EASDO2)&($D(EASZIPLK))) X=$$ZIP^DGREGDD1(DA,X(1))
    97  S:$D(X)#2 X(2)=X
    98  S X=$G(X(1))
    99  Q
    100 C1F2 S DIXR=231 D C1X2(U) K X2 M X2=X D C1X2("O") K X1 M X1=X
    101  D
    102  . D FC^DGFCPROT(.DA,2,.1112,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    103  K X M X=X2 D
    104  . D FC^DGFCPROT(.DA,2,.1112,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    105  G C1F3
    106 C1X2(DION) K X
    107  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.1112,DION),$P($G(^DPT(DA,.11)),U,12))
    108  S X=$G(X(1))
    109  Q
    110 C1F3 Q
    111 X1 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>20!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
    112  I $D(X),X'?.ANP K X
    113  Q
    114  ;
    115 2 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".11;4",DV="Fa",DU="",DLB="CITY",DIFLD=.114
    116  S DE(DW)="C2^DGRPTX5",DE(DW,"INDEX")=1
    117  G RE
    118 C2 G C2S:$D(DE(2))[0 K DB
    119  S X=DE(2),DIC=DIE
    120  S A1B2TAG="PAT" D ^A1B2XFR
    121  S X=DE(2),DIC=DIE
    122  D EVENT^IVMPLOG(DA)
    123  S X=DE(2),DIC=DIE
    124  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    125  S X=DE(2),DIC=DIE
    126  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    127  S X=DE(2),DIC=DIE
    128  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".114;" D AVAFC^VAFCDD01(DA)
    129  S X=DE(2),DIC=DIE
    130  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    131  S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
    132 C2S S X="" G:DG(DQ)=X C2F1 K DB
    133  S X=DG(DQ),DIC=DIE
    134  S A1B2TAG="PAT" D ^A1B2XFR
    135  S X=DG(DQ),DIC=DIE
    136  D EVENT^IVMPLOG(DA)
    137  S X=DG(DQ),DIC=DIE
    138  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    139  S X=DG(DQ),DIC=DIE
    140  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    141  S X=DG(DQ),DIC=DIE
    142  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".114;" D AVAFC^VAFCDD01(DA)
    143  S X=DG(DQ),DIC=DIE
    144  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    145  I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    146 C2F1 N X,X1,X2 S DIXR=234 D C2X1(U) K X2 M X2=X D C2X1("O") K X1 M X1=X
    147  D
    148  . D FC^DGFCPROT(.DA,2,.114,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    149  K X M X=X2 D
    150  . D FC^DGFCPROT(.DA,2,.114,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    151  G C2F2
    152 C2X1(DION) K X
    153  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.114,DION),$P($G(^DPT(DA,.11)),U,4))
    154  S X=$G(X(1))
    155  Q
    156 C2F2 Q
    157 X2 K:$L(X)>15!($L(X)<2) X
    158  I $D(X),X'?.ANP K X
    159  Q
    160  ;
    161 3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    162 X3 S:'$$KEY^DGREGDD1(DUZ,DA) Y=.131
    163  Q
    164 4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".11;5",DV="P5'a",DU="",DLB="STATE",DIFLD=.115
    165  S DE(DW)="C4^DGRPTX5",DE(DW,"INDEX")=1
    166  S DU="DIC(5,"
    167  G RE
    168 C4 G C4S:$D(DE(4))[0 K DB
    169  S X=DE(4),DIC=DIE
    170  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:""),Y=$P(Y(1),U,7) X:$D(^DD(2,.117,2)) ^(2) S X=Y S DIU=X K Y S X=DIV S X="" X ^DD(2,.115,1,1,2.4)
    171  S X=DE(4),DIC=DIE
    172  S A1B2TAG="PAT" D ^A1B2XFR
    173  S X=DE(4),DIC=DIE
    174  D EVENT^IVMPLOG(DA)
    175  S X=DE(4),DIC=DIE
    176  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    177  S X=DE(4),DIC=DIE
    178  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    179  S X=DE(4),DIC=DIE
    180  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".115;" D AVAFC^VAFCDD01(DA)
    181  S X=DE(4),DIC=DIE
    182  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    183  S X=DE(4),DIIX=2_U_DIFLD D AUDIT^DIET
    184 C4S S X="" G:DG(DQ)=X C4F1 K DB
    185  S X=DG(DQ),DIC=DIE
    186  ;
    187  S X=DG(DQ),DIC=DIE
    188  S A1B2TAG="PAT" D ^A1B2XFR
    189  S X=DG(DQ),DIC=DIE
    190  D EVENT^IVMPLOG(DA)
    191  S X=DG(DQ),DIC=DIE
    192  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
    193  S X=DG(DQ),DIC=DIE
    194  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    195  S X=DG(DQ),DIC=DIE
    196  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".115;" D AVAFC^VAFCDD01(DA)
    197  S X=DG(DQ),DIC=DIE
    198  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    199  I $D(DE(4))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    200 C4F1 N X,X1,X2 S DIXR=235 D C4X1(U) K X2 M X2=X D C4X1("O") K X1 M X1=X
    201  D
    202  . D FC^DGFCPROT(.DA,2,.115,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    203  K X M X=X2 D
    204  . D FC^DGFCPROT(.DA,2,.115,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
    205  G C4F2
    206 C4X1(DION) K X
    207  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.115,DION),$P($G(^DPT(DA,.11)),U,5))
    208  S X=$G(X(1))
    209  Q
    210 C4F2 Q
    211 X4 Q
    212 5 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".11;7",DV="NJ3,0XOa",DU="",DLB="COUNTY",DIFLD=.117
    213  S DQ(5,2)="S Y(0)=Y Q:Y']""""  S Z0=$S($D(^DPT(D0,.11)):+$P(^(.11),""^"",5),1:"""") Q:'Z0  S Y=$P($S($D(^DIC(5,Z0,1,Y,0)):^(0),1:""""),""^"",3)"
    214  S DE(DW)="C5^DGRPTX5"
    215  G RE
    216 C5 G C5S:$D(DE(5))[0 K DB
     1DGRPTX5 ; ;04/21/06
    2172 S X=DE(5),DIC=DIE
    2183 S A1B2TAG="PAT" D ^A1B2XFR
     
    2205 D EVENT^IVMPLOG(DA)
    2216 S X=DE(5),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     8 S X=DE(5),DIC=DIE
    2229 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    22310 S X=DE(5),DIC=DIE
    224  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
     11 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".114;" D AVAFC^VAFCDD01(DA)
     12 S X=DE(5),DIC=DIE
     13 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    22514 S X=DE(5),DIIX=2_U_DIFLD D AUDIT^DIET
    226 C5S S X="" G:DG(DQ)=X C5F1 K DB
    227  D ^DGRPTX6
    228 C5F1 Q
    229 X5 S Z0=$S($D(^DPT(D0,.11)):+$P(^(.11),"^",5),1:0) K:'Z0 X Q:'Z0!'$D(^DIC(5,Z0,1,0))  S DIC="^DIC(5,Z0,1,",DIC(0)="QEM" D ^DIC S X=+Y K:Y'>0 X K Z0,DIC
    230  Q
    231  ;
    232 6 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".13;1",DV="Fa",DU="",DLB="PHONE NUMBER [RESIDENCE]",DIFLD=.131
    233  S DE(DW)="C6^DGRPTX5"
    234  G RE
    235 C6 G C6S:$D(DE(6))[0 K DB
    236  D ^DGRPTX7
    237 C6S S X="" G:DG(DQ)=X C6F1 K DB
    238  D ^DGRPTX8
    239 C6F1 Q
    240 X6 K:$L(X)>20!($L(X)<4) X
    241  I $D(X),X'?.ANP K X
    242  Q
    243  ;
    244 7 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".13;2",DV="Fa",DU="",DLB="PHONE NUMBER [WORK]",DIFLD=.132
    245  S DE(DW)="C7^DGRPTX5"
    246  G RE
    247 C7 G C7S:$D(DE(7))[0 K DB
    248  D ^DGRPTX9
    249 C7S S X="" G:DG(DQ)=X C7F1 K DB
    250  D ^DGRPTX10
    251 C7F1 Q
    252 X7 K:$L(X)>20!($L(X)<4) X
    253  I $D(X),X'?.ANP K X
    254  Q
    255  ;
    256 8 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW=".11;16",DV="S",DU="",DLB="BAD ADDRESS INDICATOR",DIFLD=.121
    257  S DE(DW)="C8^DGRPTX5"
    258  S DU="1:UNDELIVERABLE;2:HOMELESS;3:OTHER;"
    259  G RE
    260 C8 G C8S:$D(DE(8))[0 K DB
    261  D ^DGRPTX11
    262 C8S S X="" G:DG(DQ)=X C8F1 K DB
    263  D ^DGRPTX12
    264 C8F1 Q
    265 X8 Q
    266 9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW="0;5",DV="RP11'a",DU="",DLB="MARITAL STATUS",DIFLD=.05
    267  S DE(DW)="C9^DGRPTX5"
    268  S DU="DIC(11,"
    269  G RE
    270 C9 G C9S:$D(DE(9))[0 K DB
    271  D ^DGRPTX13
    272 C9S S X="" G:DG(DQ)=X C9F1 K DB
    273  D ^DGRPTX14
    274 C9F1 Q
    275 X9 Q
    276 10 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".21;1",DV="Fa",DU="",DLB="K-NAME OF PRIMARY NOK",DIFLD=.211
    277  S DE(DW)="C10^DGRPTX5",DE(DW,"INDEX")=1
    278  G RE
    279 C10 G C10S:$D(DE(10))[0 K DB
    280  D ^DGRPTX15
    281 C10S S X="" G:DG(DQ)=X C10F1 K DB
    282  D ^DGRPTX16
    283 C10F1 N X,X1,X2 S DIXR=590 D C10X1(U) K X2 M X2=X D C10X1("O") K X1 M X1=X
    284  I $G(X(1))]"" D
    285  . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1 D DELCOMP^XLFNAME2(2,.DA,.211,1.02) Q
    286  K X M X=X2 I $G(X(1))]"" D
    287  . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1,DG20NAME=X D NARY^XLFNAME7(.DG20NAME),UPDCOMP^XLFNAME2(2,.DA,.211,.DG20NAME,1.02,+$P($G(^DPT(DA,"NAME")),U,2),"CL35") K DG20NAME Q
    288  G C10F2
    289 C10X1(DION) K X
    290  S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.211,DION),$P($G(^DPT(DA,.21)),U,1))
    291  S X=$G(X(1))
    292  Q
    293 C10F2 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
    294  F DIXR=602 S DIEZRXR(2,DIXR)=""
    295  Q
    296 X10 K:$L(X)>35!($L(X)<3) X I $D(X) S DG20NAME=X,(X,DG20NAME)=$$FORMAT^XLFNAME7(.DG20NAME,3,35) K:'$L(X) X,DG20NAME
    297  I $D(X),X'?.ANP K X
    298  Q
    299  ;
    300 11 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    301 X11 S:X="" Y="@30"
    302  Q
    303 12 D:$D(DG)>9 F^DIE17 G ^DGRPTX17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX6.m

    r613 r623  
    1 DGRPTX6 ; ;12/13/08
     1DGRPTX6 ; ;04/21/06
    22 S X=DG(DQ),DIC=DIE
    33 S A1B2TAG="PAT" D ^A1B2XFR
     
    55 D EVENT^IVMPLOG(DA)
    66 S X=DG(DQ),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     8 S X=DG(DQ),DIC=DIE
    79 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    810 S X=DG(DQ),DIC=DIE
    9  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
     11 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".114;" D AVAFC^VAFCDD01(DA)
     12 S X=DG(DQ),DIC=DIE
     13 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    1014 I $D(DE(5))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX7.m

    r613 r623  
    1 DGRPTX7 ; ;12/13/08
    2  S X=DE(6),DIC=DIE
     1DGRPTX7 ; ;04/21/06
     2 S X=DE(7),DIC=DIE
     3 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:""),Y=$P(Y(1),U,7) X:$D(^DD(2,.117,2)) ^(2) S X=Y S DIU=X K Y S X=DIV S X="" X ^DD(2,.115,1,1,2.4)
     4 S X=DE(7),DIC=DIE
     5 S A1B2TAG="PAT" D ^A1B2XFR
     6 S X=DE(7),DIC=DIE
    37 D EVENT^IVMPLOG(DA)
    4  S X=DE(6),DIC=DIE
     8 S X=DE(7),DIC=DIE
     9 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     10 S X=DE(7),DIC=DIE
    511 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    6  S X=DE(6),DIC=DIE
    7  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".131;" D AVAFC^VAFCDD01(DA)
    8  S X=DE(6),DIC=DIE
     12 S X=DE(7),DIC=DIE
     13 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".115;" D AVAFC^VAFCDD01(DA)
     14 S X=DE(7),DIC=DIE
    915 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    10  S X=DE(6),DIC=DIE
    11  X "N % S %=$E($TR(X,""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()-_=+[]{}<>,./?:;'\|""),1,30) K:%'="""" ^DPT(""AZVWVOE"",%,DA)"
    12  S X=DE(6),DIIX=2_U_DIFLD D AUDIT^DIET
     16 S X=DE(7),DIIX=2_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX8.m

    r613 r623  
    1 DGRPTX8 ; ;12/13/08
     1DGRPTX8 ; ;04/21/06
     2 S X=DG(DQ),DIC=DIE
     3 ;
     4 S X=DG(DQ),DIC=DIE
     5 S A1B2TAG="PAT" D ^A1B2XFR
    26 S X=DG(DQ),DIC=DIE
    37 D EVENT^IVMPLOG(DA)
    48 S X=DG(DQ),DIC=DIE
     9 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:"") S X=$P(Y(1),U,13),X=X S DIU=X K Y S X=DIV S X=$$NOW^XLFDT() S DIH=$G(^DPT(DIV(0),.11)),DIV=X S $P(^(.11),U,13)=DIV,DIH=2,DIG=.118 D ^DICR
     10 S X=DG(DQ),DIC=DIE
    511 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    612 S X=DG(DQ),DIC=DIE
    7  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".131;" D AVAFC^VAFCDD01(DA)
     13 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".115;" D AVAFC^VAFCDD01(DA)
    814 S X=DG(DQ),DIC=DIE
    915 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    10  S X=DG(DQ),DIC=DIE
    11  X "N % S %=$E($TR(X,""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()-_=+[]{}<>,./?:;'\|""),1,30) S:%'="""" ^DPT(""AZVWVOE"",%,DA)="""""
    12  I $D(DE(6))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     16 I $D(DE(7))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX9.m

    r613 r623  
    1 DGRPTX9 ; ;12/13/08
    2  S X=DE(7),DIC=DIE
    3  D EVENT^IVMPLOG(DA)
    4  S X=DE(7),DIC=DIE
    5  S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
    6  S X=DE(7),DIC=DIE
     1DGRPTX9 ; ;04/21/06
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,5) S:%]"" DE(5)=%
     5 I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,7) S:%]"" DE(1)=% S %=$P(%Z,U,16) S:%]"" DE(4)=%
     6 I $D(^(.13)) S %Z=^(.13) S %=$P(%Z,U,1) S:%]"" DE(2)=% S %=$P(%Z,U,2) S:%]"" DE(3)=%
     7 I $D(^(.21)) S %Z=^(.21) S %=$P(%Z,U,1) S:%]"" DE(6)=%
     8 K %Z Q
     9 ;
     10W W !?DL+DL-2,DLB_": "
     11 Q
     12O D W W Y W:$X>45 !?9
     13 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     14 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     15TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     16 Q
     17A K DQ(DQ) S DQ=DQ+1
     18B G @DQ
     19RE G PR:$D(DE(DQ)) D W,TR
     20N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     21RD G QS:X?."?" I X["^" D D G ^DIE17
     22 I X="@" D D G Z^DIE2
     23 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     24T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     25 K DDER G X
     26P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     27 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     28 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     29V D @("X"_DQ) K YS
     30Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     31X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     32 S X="?BAD"
     33QS S DZ=X D D,QQ^DIEQ G B
     34D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     35Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     36PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     37R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     38 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     39 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     40RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     41I I DV'["I",DV'["#" G RD
     42 D E^DIE0 G RD:$D(X),PR
     43 Q
     44SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     45 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     46 D ^DIR I 'DDER S %=Y(0),X=Y
     47 Q
     48SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     49 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     50 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     51 Q
     52NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     53KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     54BEGIN S DNM="DGRPTX9",DQ=1
     551 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".11;7",DV="NJ3,0XOa",DU="",DLB="COUNTY",DIFLD=.117
     56 S DQ(1,2)="S Y(0)=Y Q:Y']""""  S Z0=$S($D(^DPT(D0,.11)):+$P(^(.11),""^"",5),1:"""") Q:'Z0  S Y=$P($S($D(^DIC(5,Z0,1,Y,0)):^(0),1:""""),""^"",3)"
     57 S DE(DW)="C1^DGRPTX9"
     58 G RE
     59C1 G C1S:$D(DE(1))[0 K DB
     60 S X=DE(1),DIC=DIE
     61 S A1B2TAG="PAT" D ^A1B2XFR
     62 S X=DE(1),DIC=DIE
     63 D EVENT^IVMPLOG(DA)
     64 S X=DE(1),DIC=DIE
     65 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     66 S X=DE(1),DIC=DIE
     67 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
     68 S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
     69C1S S X="" G:DG(DQ)=X C1F1 K DB
     70 S X=DG(DQ),DIC=DIE
     71 S A1B2TAG="PAT" D ^A1B2XFR
     72 S X=DG(DQ),DIC=DIE
     73 D EVENT^IVMPLOG(DA)
     74 S X=DG(DQ),DIC=DIE
     75 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     76 S X=DG(DQ),DIC=DIE
     77 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
     78 I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     79C1F1 Q
     80X1 S Z0=$S($D(^DPT(D0,.11)):+$P(^(.11),"^",5),1:0) K:'Z0 X Q:'Z0!'$D(^DIC(5,Z0,1,0))  S DIC="^DIC(5,Z0,1,",DIC(0)="QEM" D ^DIC S X=+Y K:Y'>0 X K Z0,DIC
     81 Q
     82 ;
     832 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".13;1",DV="Fa",DU="",DLB="PHONE NUMBER [RESIDENCE]",DIFLD=.131
     84 S DE(DW)="C2^DGRPTX9"
     85 G RE
     86C2 G C2S:$D(DE(2))[0 K DB
     87 S X=DE(2),DIC=DIE
     88 D EVENT^IVMPLOG(DA)
     89 S X=DE(2),DIC=DIE
     90 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     91 S X=DE(2),DIC=DIE
     92 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".131;" D AVAFC^VAFCDD01(DA)
     93 S X=DE(2),DIC=DIE
     94 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     95 S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
     96C2S S X="" G:DG(DQ)=X C2F1 K DB
     97 S X=DG(DQ),DIC=DIE
     98 D EVENT^IVMPLOG(DA)
     99 S X=DG(DQ),DIC=DIE
     100 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     101 S X=DG(DQ),DIC=DIE
     102 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".131;" D AVAFC^VAFCDD01(DA)
     103 S X=DG(DQ),DIC=DIE
     104 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     105 I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     106C2F1 Q
     107X2 K:$L(X)>20!($L(X)<4) X
     108 I $D(X),X'?.ANP K X
     109 Q
     110 ;
     1113 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".13;2",DV="Fa",DU="",DLB="PHONE NUMBER [WORK]",DIFLD=.132
     112 S DE(DW)="C3^DGRPTX9"
     113 G RE
     114C3 G C3S:$D(DE(3))[0 K DB
     115 S X=DE(3),DIC=DIE
     116 D EVENT^IVMPLOG(DA)
     117 S X=DE(3),DIC=DIE
     118 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     119 S X=DE(3),DIC=DIE
    7120 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".132;" D AVAFC^VAFCDD01(DA)
    8  S X=DE(7),DIC=DIE
    9  D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    10  S X=DE(7),DIIX=2_U_DIFLD D AUDIT^DIET
     121 S X=DE(3),DIC=DIE
     122 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     123 S X=DE(3),DIIX=2_U_DIFLD D AUDIT^DIET
     124C3S S X="" G:DG(DQ)=X C3F1 K DB
     125 S X=DG(DQ),DIC=DIE
     126 D EVENT^IVMPLOG(DA)
     127 S X=DG(DQ),DIC=DIE
     128 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
     129 S X=DG(DQ),DIC=DIE
     130 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".132;" D AVAFC^VAFCDD01(DA)
     131 S X=DG(DQ),DIC=DIE
     132 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     133 I $D(DE(3))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     134C3F1 Q
     135X3 K:$L(X)>20!($L(X)<4) X
     136 I $D(X),X'?.ANP K X
     137 Q
     138 ;
     1394 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".11;16",DV="S",DU="",DLB="BAD ADDRESS INDICATOR",DIFLD=.121
     140 S DU="1:UNDELIVERABLE;2:HOMELESS;3:OTHER;"
     141 G RE
     142X4 Q
     1435 S DW="0;5",DV="RP11'a",DU="",DLB="MARITAL STATUS",DIFLD=.05
     144 S DE(DW)="C5^DGRPTX9"
     145 S DU="DIC(11,"
     146 G RE
     147C5 G C5S:$D(DE(5))[0 K DB
     148 S X=DE(5),DIC=DIE
     149 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".05;" D AVAFC^VAFCDD01(DA)
     150 S X=DE(5),DIC=DIE
     151 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     152 S X=DE(5),DIIX=2_U_DIFLD D AUDIT^DIET
     153C5S S X="" G:DG(DQ)=X C5F1 K DB
     154 S X=DG(DQ),DIC=DIE
     155 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".05;" D AVAFC^VAFCDD01(DA)
     156 S X=DG(DQ),DIC=DIE
     157 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     158 I $D(DE(5))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     159C5F1 Q
     160X5 Q
     1616 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".21;1",DV="Fa",DU="",DLB="K-NAME OF PRIMARY NOK",DIFLD=.211
     162 S DE(DW)="C6^DGRPTX9",DE(DW,"INDEX")=1
     163 G RE
     164C6 G C6S:$D(DE(6))[0 K DB
     165 S X=DE(6),DIC=DIE
     166 X "S DGXRF=.211 D ^DGDDC Q"
     167 S X=DE(6),DIC=DIE
     168 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".211;" D AVAFC^VAFCDD01(DA)
     169 S X=DE(6),DIC=DIE
     170 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     171 S X=DE(6),DIIX=2_U_DIFLD D AUDIT^DIET
     172C6S S X="" G:DG(DQ)=X C6F1 K DB
     173 S X=DG(DQ),DIC=DIE
     174 ;
     175 S X=DG(DQ),DIC=DIE
     176 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".211;" D AVAFC^VAFCDD01(DA)
     177 S X=DG(DQ),DIC=DIE
     178 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
     179 I $D(DE(6))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     180C6F1 N X,X1,X2 S DIXR=590 D C6X1(U) K X2 M X2=X D C6X1("O") K X1 M X1=X
     181 I $G(X(1))]"" D
     182 . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1 D DELCOMP^XLFNAME2(2,.DA,.211,1.02) Q
     183 K X M X=X2 I $G(X(1))]"" D
     184 . I '$G(XUNOTRIG) N XUNOTRIG S XUNOTRIG=1,DG20NAME=X D NARY^XLFNAME7(.DG20NAME),UPDCOMP^XLFNAME2(2,.DA,.211,.DG20NAME,1.02,+$P($G(^DPT(DA,"NAME")),U,2),"CL35") K DG20NAME Q
     185 G C6F2
     186C6X1(DION) K X
     187 S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.211,DION),$P($G(^DPT(DA,.21)),U,1))
     188 S X=$G(X(1))
     189 Q
     190C6F2 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
     191 F DIXR=602 S DIEZRXR(2,DIXR)=""
     192 Q
     193X6 K:$L(X)>35!($L(X)<3) X I $D(X) S DG20NAME=X,(X,DG20NAME)=$$FORMAT^XLFNAME7(.DG20NAME,3,35) K:'$L(X) X,DG20NAME
     194 I $D(X),X'?.ANP K X
     195 Q
     196 ;
     1977 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     198X7 S:X="" Y="@30"
     199 Q
     2008 D:$D(DG)>9 F^DIE17 G ^DGRPTX10
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPU.m

    r613 r623  
    1 DGRPU   ;ALB/MRL,TMK - REGISTRATION UTILITY ROUTINE ;12/25/06  18:28
    2         ;;5.3;Registration;**33,114,489,624,672,689,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19 H       ;Screen Header
    20         I DGRPS'=1.1 W @IOF S Z=$P($T(H1+DGRPS),";;",2)_", SCREEN <"_DGRPS_">"_$S($D(DGRPH):" HELP",1:""),X=79-$L(Z)\2 D W
    21         I DGRPS=1.1 W @IOF S Z="ADDITIONAL PATIENT DEMOGRAPHIC DATA, SCREEN <"_DGRPS_">"_$S($D(DGRPH):" HELP",1:""),X=79-$L(Z)\2 D W
    22         S X=$$SSNNM(DFN)
    23         I '$D(DGRPH) W !,X S X=$S($D(DGRPTYPE):$P(DGRPTYPE,"^",1),1:"PATIENT TYPE UNKNOWN"),X1=79-$L(X) W ?X1,X
    24         S X="",$P(X,"=",80)="" W !,X Q
    25         Q
    26         ;
    27 AL(DGLEN)       ;DGLEN= Available length of line
    28 A       ;Format address(es)
    29         I '$D(DGLEN) N DGLEN S DGLEN=29
    30         N DGX
    31         F I=DGA1:1:DGA1+2 I $P(DGRP(DGAD),U,I)]"" S DGA(DGA2)=$P(DGRP(DGAD),U,I),DGA2=DGA2+2
    32         I DGA2=1 S DGA(1)="STREET ADDRESS UNKNOWN",DGA2=DGA2+2
    33         S J=$S('$D(^DIC(5,+$P(DGRP(DGAD),U,DGA1+4),0)):"",('$L($P(^(0),U,2))):$P(^(0),U,1),1:$P(^(0),U,2)),J(1)=$P(DGRP(DGAD),U,DGA1+3),J(2)=$P(DGRP(DGAD),U,DGA1+5),DGA(DGA2)=$S(J(1)]""&(J]""):J(1)_","_J,J(1)]"":J(1),J]"":J,1:"UNK. CITY/STATE")
    34         I ".33^.34^.211^.331^.311^.25^.21"[DGAD D
    35         .F I=1:1:7 I $P(".33^.34^.211^.331^.311^.25^.21",U,I)=DGAD S DGX=$P($G(^DPT(DFN,.22)),U,I)
    36         E  D
    37         .I DGAD=.141 S DGX=$P(DGRP(.141),U,6) Q
    38         .S DGX=$P(DGRP(DGAD),U,DGA1+11)
    39         S:$L(DGX)>5 DGX=$E(DGX,1,5)_"-"_$E(DGX,6,9)
    40         S DGA(DGA2)=$E($P(DGA(DGA2),",",1),1,(DGLEN-($L(DGX)+4)))_$S($L($P(DGA(DGA2),",",2)):",",1:"")_$P(DGA(DGA2),",",2)_" "_DGX
    41         F I=0:0 S I=$O(DGA(I)) Q:'I  S DGA(I)=$E(DGA(I),1,DGLEN)
    42         K DGA1,I,J
    43         Q
    44         ;
    45 W       I IOST="C-QUME",$L(DGVI)'=2 W ?X,Z Q
    46         W ?X,@DGVI,Z,@DGVO
    47         Q
    48         ;
    49 H1      ;
    50         ;;PATIENT DEMOGRAPHIC DATA
    51         ;;PATIENT DATA
    52         ;;EMERGENCY CONTACT DATA
    53         ;;APPLICANT/SPOUSE EMPLOYMENT DATA
    54         ;;INSURANCE DATA
    55         ;;MILITARY SERVICE DATA
    56         ;;ELIGIBILITY STATUS DATA
    57         ;;FAMILY DEMOGRAPHIC DATA
    58         ;;INCOME SCREENING DATA
    59         ;;INELIGIBLE/MISSING DATA
    60         ;;ELIGIBILITY VERIFICATION DATA
    61         ;;ADMISSION INFORMATION
    62         ;;APPLICATION INFORMATION
    63         ;;APPOINTMENT INFORMATION
    64         ;;SPONSOR DEMOGRAPHIC INFORMATION
    65         ;
    66         ;
    67 INCOME(DFN,DGDT)        ; compute income for veteran...if not in 408.21, pass back file 2 data
    68         ; (called by PTF)
    69         ;
    70         ;
    71         ;  Input:  DFN as IEN of PATIENT file
    72         ;          DGDT as date to return income as of
    73         ;
    74         ; Output:  total income (computed function)
    75         ;          (from 408.21 if available...otherwise from file 2)
    76         ;
    77         ;
    78         N DGDEP,DGINC,DGREL,DGTOT,DGX,I S DGTOT=0
    79         D ALL^DGMTU21(DFN,"V",DGDT,"I")
    80         S DGX=$G(^DGMT(408.21,+$G(DGINC("V")),0)) I DGX]"" F I=8:1:17 S DGTOT=DGTOT+$P(DGX,"^",I)
    81         I DGX']"" S DGTOT=$P($G(^DPT(DFN,.362)),U,20)
    82         Q DGTOT
    83         ;
    84         ;
    85 MTCOMP(DFN,DGDT)        ; is current means test OR COPAY complete?
    86         ;
    87         ;  Input:  DFN as IEN of PATIENT file
    88         ;          DGDT as 'as of' date
    89         ;
    90         ; Output:  1 if means test/COPAY for year prior to DT passed is complete
    91         ;          0 otherwise
    92         ;          DGMTYPT 1=MT;2=CP;0=NONE
    93         ;
    94         N COMP,MT,X,YR
    95         S YR=$$LYR^DGMTSCU1(DGDT),MT=$$LST^DGMTCOU1(DFN,DGDT)
    96         S DGMTYPT=+$P(MT,U,5)
    97         S COMP=1
    98         I DGMTYPT=1 D  ;MT
    99         .I $P(MT,"^",4)']""!("^R^N^"[("^"_$P(MT,"^",4)_"^")) S COMP=0
    100         I DGMTYPT=2 D  ;CP
    101         .I $P(MT,"^",4)']""!("^I^L^"[("^"_$P(MT,"^",4)_"^")) S COMP=0
    102         S X=+$P(MT,"^",2) I ($E(X,1,3)-1)*10000<YR S COMP=0
    103         Q COMP
    104         ;
    105 HLP1010 ;* This is called by the Executable Help for Patient field #1010.159
    106         ;   (APPOINTMENT REQUEST ON 1010EZ)
    107         W !!,"    Enter a 'Y' if the veteran applicant has requested an"
    108         W !,"    appointment with a VA doctor or provider and wants to be"
    109         W !,"    seen as soon as one becomes available  Enter a 'N'"
    110         W !,"    if the veteran applicant has not requested an appointment."
    111         W !!,"    This question may ONLY be entered ONCE for the veteran."
    112         W !,"    The answer to this question CANNOT be changed after the"
    113         W !,"    initial entry.",!
    114         Q
    115         ;
    116 HLPCS   ; * This is called by the Executable Help for Income Relation field #.1
    117         Q:X="?"
    118         N DIR,DGRDVAR
    119         W !?8,"Enter in this field a Yes or No to indicate whether the veteran"
    120         W !?8,"contributed any dollar amount to the child's support last calendar"
    121         W !?8,"year.  The contributions do not have to be in regular set amounts."
    122         W !?8,"For example, a veteran who paid a child's school tuition or"
    123         W !?8,"medical bills would be contributing to the child's support.",!
    124         W !,"Enter RETURN to continue:" R DGRDVAR:DTIME W !
    125         Q
    126         ;
    127 HLP1823 ;*This is called by the Executable Help for Patient Relation field #.18
    128         N DIR,DGRDVAR
    129         W !?7,"Enter 'Y' if the child is currently 18 to 23 years old and the child"
    130         W !?7,"attended school last calendar year.  Enter 'N' if the child is currently"
    131         W !?7,"18 to 23 years old but the child did not attend school last calendar"
    132         W !?7,"year.  Enter 'N' if the child is not currently 18 to 23 years old.",!
    133         I $G(DA) W !,"Enter RETURN to continue:" R DGRDVAR:DTIME W !
    134         Q
    135         ;
    136 HLPMLDS ;* This is called by the Executable Help for Patient field #.362
    137         ;   (DISABILITY RET. FROM MILITARY?)
    138         N X,Y,DIR
    139         W !!,"  Enter '0' or 'NO' if the veteran:"
    140         W !,"    -- Is NOT retired from the military OR"
    141         W !,"    -- Is retired from the military due to length of service AND"
    142         W !,"       does NOT have a disability confirmed by the Military Branch"
    143         W !,"       to have been incurred in or aggravated while on active duty."
    144         W !!,"  Enter '1' or 'YES, RECEIVING MILITARY RETIREMENT' if the veteran:"
    145         W !,"    -- Is confirmed by the Military Branch to have been discharged"
    146         W !,"       or released due to a disability incurred in or aggravated"
    147         W !,"       while on active duty AND"
    148         W !,"       -- Has NOT filed a claim for VA compensation benefits OR"
    149         W !,"       -- Has been rated by the VA to be NSC OR"
    150         W !,"       -- Has been rated by the VA to have noncompensable 0%"
    151         W !,"          SC conditions."
    152         S DIR(0)="E" D ^DIR Q:+Y<1
    153         W !!,"  Enter '2' or 'YES, RECEIVING MILITARY RETIREMENT IN LIEU OF VA"
    154         W !,"                COMPENSATION' if the veteran:"
    155         W !,"       -- Is confirmed by the Military Branch to have been discharged"
    156         W !,"          or released due to a disability incurred in or aggravated"
    157         W !,"          while on active duty AND"
    158         W !,"       -- Is receiving military disability retirement pay AND"
    159         W !,"       -- Has been rated by VA to have compensable SC conditions"
    160         W !,"          but is NOT receiving compensation from the VA"
    161         W !!,"          Once eligibility has been verified, this field will no longer"
    162         W !,"          be editable to any user who does not hold the designated security"
    163         W !,"          key."
    164         Q
    165 HLP3602 ;help text for field .3602, Rec'ing Disability in Lieu of VA Comp
    166         W !,"     Enter 'Y' if this veteran applicant is receiving disability"
    167         W !,"     retirement pay from the Military instead of VA compensation."
    168         W !,"     Enter 'N' if this veteran applicant is not receiving disability"
    169         W !,"     retirement pay from the Military instead of VA compensation."
    170         W !,"     Once eligibility has been verified by HEC this field will no longer "
    171         W !,"     be editable by VistA users. Send updates and/or requests to HEC."
    172         Q
    173 HLP3603 ;help text for field .3603, Discharge Due to LOD Disability
    174         W !,"     Enter 'Y' if this veteran applicant was discharged from the"
    175         W !,"     military for a disability incurred or aggravated in the line "
    176         W !,"     of duty.  Enter 'N' if this veteran applicant was not discharged"
    177         W !,"     from the military for a disability incurred or aggravated in the"
    178         W !,"     line of duty. Once eligibility has been verified by HEC this field"
    179         W !,"     will no longer be editable by VistA users. Send updates and/or requests"
    180         W !,"     to HEC."
    181         Q
    182 SSNNM(DFN)      ; SSN and name on first line of screen
    183         ;
    184         ; ** start of VOE change: DAOU/JLG 2/1/2005,VA/CJS,WV/TOAD 5/9/2006 **
    185         ;
    186         ; Change code so it will display HRN if SSN is null
    187         ;
    188         ; before:
    189         ;
    190         ; N X,SSN
    191         ; S X=$S($D(^DPT(+DFN,0)):^(0),1:""),SSN=$P(X,"^",9),SSN=$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,10)
    192         ;
    193         ; after:
    194         ;
    195         ; Social Security Number field (.09) in Patient file (2)
    196         N X,SSN,HRN
    197         S X=$S($D(^DPT(+DFN,0)):^(0),1:""),SSN=$P(X,"^",9)
    198         I SSN S SSN=$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,10)
    199         ;
    200 ID      S SSN=$$ID^DGLBPID(DFN) ;**GFT/VW
    201         ; for IHS or EHR, replace SSN with HRN
    202         I $G(DUZ("AG"))'="V" D
    203         . Q:SSN]""
    204         . S HRN=$$HRN^AUPNPAT3(+DFN,DUZ(2))
    205         . I HRN S SSN="HRN-"_HRN
    206         ;
    207         ; ** end of VOE change **
    208         ;
    209         S X=$P(X,U)_"; "_SSN
    210         Q X
    211         ;
     1DGRPU ;ALB/MRL,TMK - REGISTRATION UTILITY ROUTINE ;12/25/06  18:28
     2 ;;5.3;Registration;**33,114,489,624,672,689,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19H ;Screen Header
     20 I DGRPS'=1.1 W @IOF S Z=$P($T(H1+DGRPS),";;",2)_", SCREEN <"_DGRPS_">"_$S($D(DGRPH):" HELP",1:""),X=79-$L(Z)\2 D W
     21 I DGRPS=1.1 W @IOF S Z="ADDITIONAL PATIENT DEMOGRAPHIC DATA, SCREEN <"_DGRPS_">"_$S($D(DGRPH):" HELP",1:""),X=79-$L(Z)\2 D W
     22 S X=$$SSNNM(DFN)
     23 I '$D(DGRPH) W !,X S X=$S($D(DGRPTYPE):$P(DGRPTYPE,"^",1),1:"PATIENT TYPE UNKNOWN"),X1=79-$L(X) W ?X1,X
     24 S X="",$P(X,"=",80)="" W !,X Q
     25 Q
     26 ;
     27AL(DGLEN) ;DGLEN= Available length of line
     28A ;Format address(es)
     29 I '$D(DGLEN) N DGLEN S DGLEN=29
     30 N DGX
     31 F I=DGA1:1:DGA1+2 I $P(DGRP(DGAD),U,I)]"" S DGA(DGA2)=$P(DGRP(DGAD),U,I),DGA2=DGA2+2
     32 I DGA2=1 S DGA(1)="STREET ADDRESS UNKNOWN",DGA2=DGA2+2
     33 S J=$S('$D(^DIC(5,+$P(DGRP(DGAD),U,DGA1+4),0)):"",('$L($P(^(0),U,2))):$P(^(0),U,1),1:$P(^(0),U,2)),J(1)=$P(DGRP(DGAD),U,DGA1+3),J(2)=$P(DGRP(DGAD),U,DGA1+5),DGA(DGA2)=$S(J(1)]""&(J]""):J(1)_","_J,J(1)]"":J(1),J]"":J,1:"UNK. CITY/STATE")
     34 I ".33^.34^.211^.331^.311^.25^.21"[DGAD D
     35 .F I=1:1:7 I $P(".33^.34^.211^.331^.311^.25^.21",U,I)=DGAD S DGX=$P($G(^DPT(DFN,.22)),U,I)
     36 E  D
     37 .I DGAD=.141 S DGX=$P(DGRP(.141),U,6) Q
     38 .S DGX=$P(DGRP(DGAD),U,DGA1+11)
     39 S:$L(DGX)>5 DGX=$E(DGX,1,5)_"-"_$E(DGX,6,9)
     40 S DGA(DGA2)=$E($P(DGA(DGA2),",",1),1,(DGLEN-($L(DGX)+4)))_$S($L($P(DGA(DGA2),",",2)):",",1:"")_$P(DGA(DGA2),",",2)_" "_DGX
     41 F I=0:0 S I=$O(DGA(I)) Q:'I  S DGA(I)=$E(DGA(I),1,DGLEN)
     42 K DGA1,I,J
     43 Q
     44 ;
     45W I IOST="C-QUME",$L(DGVI)'=2 W ?X,Z Q
     46 W ?X,@DGVI,Z,@DGVO
     47 Q
     48 ;
     49H1 ;
     50 ;;PATIENT DEMOGRAPHIC DATA
     51 ;;PATIENT DATA
     52 ;;EMERGENCY CONTACT DATA
     53 ;;APPLICANT/SPOUSE EMPLOYMENT DATA
     54 ;;INSURANCE DATA
     55 ;;MILITARY SERVICE DATA
     56 ;;ELIGIBILITY STATUS DATA
     57 ;;FAMILY DEMOGRAPHIC DATA
     58 ;;INCOME SCREENING DATA
     59 ;;INELIGIBLE/MISSING DATA
     60 ;;ELIGIBILITY VERIFICATION DATA
     61 ;;ADMISSION INFORMATION
     62 ;;APPLICATION INFORMATION
     63 ;;APPOINTMENT INFORMATION
     64 ;;SPONSOR DEMOGRAPHIC INFORMATION
     65 ;
     66 ;
     67INCOME(DFN,DGDT) ; compute income for veteran...if not in 408.21, pass back file 2 data
     68 ; (called by PTF)
     69 ;
     70 ;
     71 ;  Input:  DFN as IEN of PATIENT file
     72 ;          DGDT as date to return income as of
     73 ;
     74 ; Output:  total income (computed function)
     75 ;          (from 408.21 if available...otherwise from file 2)
     76 ;
     77 ;
     78 N DGDEP,DGINC,DGREL,DGTOT,DGX,I S DGTOT=0
     79 D ALL^DGMTU21(DFN,"V",DGDT,"I")
     80 S DGX=$G(^DGMT(408.21,+$G(DGINC("V")),0)) I DGX]"" F I=8:1:17 S DGTOT=DGTOT+$P(DGX,"^",I)
     81 I DGX']"" S DGTOT=$P($G(^DPT(DFN,.362)),U,20)
     82 Q DGTOT
     83 ;
     84 ;
     85MTCOMP(DFN,DGDT) ; is current means test OR COPAY complete?
     86 ;
     87 ;  Input:  DFN as IEN of PATIENT file
     88 ;          DGDT as 'as of' date
     89 ;
     90 ; Output:  1 if means test/COPAY for year prior to DT passed is complete
     91 ;          0 otherwise
     92 ;          DGMTYPT 1=MT;2=CP;0=NONE
     93 ;
     94 N COMP,MT,X,YR
     95 S YR=$$LYR^DGMTSCU1(DGDT),MT=$$LST^DGMTCOU1(DFN,DGDT)
     96 S DGMTYPT=+$P(MT,U,5)
     97 S COMP=1
     98 I DGMTYPT=1 D  ;MT
     99 .I $P(MT,"^",4)']""!("^R^N^"[("^"_$P(MT,"^",4)_"^")) S COMP=0
     100 I DGMTYPT=2 D  ;CP
     101 .I $P(MT,"^",4)']""!("^I^L^"[("^"_$P(MT,"^",4)_"^")) S COMP=0
     102 S X=+$P(MT,"^",2) I ($E(X,1,3)-1)*10000<YR S COMP=0
     103 Q COMP
     104 ;
     105HLP1010 ;* This is called by the Executable Help for Patient field #1010.159
     106 ;   (APPOINTMENT REQUEST ON 1010EZ)
     107 W !!,"    Enter a 'Y' if the veteran applicant has requested an"
     108 W !,"    appointment with a VA doctor or provider and wants to be"
     109 W !,"    seen as soon as one becomes available  Enter a 'N'"
     110 W !,"    if the veteran applicant has not requested an appointment."
     111 W !!,"    This question may ONLY be entered ONCE for the veteran."
     112 W !,"    The answer to this question CANNOT be changed after the"
     113 W !,"    initial entry.",!
     114 Q
     115 ;
     116HLPCS ; * This is called by the Executable Help for Income Relation field #.1
     117 Q:X="?"
     118 N DIR,DGRDVAR
     119 W !?8,"Enter in this field a Yes or No to indicate whether the veteran"
     120 W !?8,"contributed any dollar amount to the child's support last calendar"
     121 W !?8,"year.  The contributions do not have to be in regular set amounts."
     122 W !?8,"For example, a veteran who paid a child's school tuition or"
     123 W !?8,"medical bills would be contributing to the child's support.",!
     124 W !,"Enter RETURN to continue:" R DGRDVAR:DTIME W !
     125 Q
     126 ;
     127HLP1823 ;*This is called by the Executable Help for Patient Relation field #.18
     128 N DIR,DGRDVAR
     129 W !?7,"Enter 'Y' if the child is currently 18 to 23 years old and the child"
     130 W !?7,"attended school last calendar year.  Enter 'N' if the child is currently"
     131 W !?7,"18 to 23 years old but the child did not attend school last calendar"
     132 W !?7,"year.  Enter 'N' if the child is not currently 18 to 23 years old.",!
     133 I $G(DA) W !,"Enter RETURN to continue:" R DGRDVAR:DTIME W !
     134 Q
     135 ;
     136HLPMLDS ;* This is called by the Executable Help for Patient field #.362
     137 ;   (DISABILITY RET. FROM MILITARY?)
     138 N X,Y,DIR
     139 W !!,"  Enter '0' or 'NO' if the veteran:"
     140 W !,"    -- Is NOT retired from the military OR"
     141 W !,"    -- Is retired from the military due to length of service AND"
     142 W !,"       does NOT have a disability confirmed by the Military Branch"
     143 W !,"       to have been incurred in or aggravated while on active duty."
     144 W !!,"  Enter '1' or 'YES, RECEIVING MILITARY RETIREMENT' if the veteran:"
     145 W !,"    -- Is confirmed by the Military Branch to have been discharged"
     146 W !,"       or released due to a disability incurred in or aggravated"
     147 W !,"       while on active duty AND"
     148 W !,"       -- Has NOT filed a claim for VA compensation benefits OR"
     149 W !,"       -- Has been rated by the VA to be NSC OR"
     150 W !,"       -- Has been rated by the VA to have noncompensable 0%"
     151 W !,"          SC conditions."
     152 S DIR(0)="E" D ^DIR Q:+Y<1
     153 W !!,"  Enter '2' or 'YES, RECEIVING MILITARY RETIREMENT IN LIEU OF VA"
     154 W !,"                COMPENSATION' if the veteran:"
     155 W !,"       -- Is confirmed by the Military Branch to have been discharged"
     156 W !,"          or released due to a disability incurred in or aggravated"
     157 W !,"          while on active duty AND"
     158 W !,"       -- Is receiving military disability retirement pay AND"
     159 W !,"       -- Has been rated by VA to have compensable SC conditions"
     160 W !,"          but is NOT receiving compensation from the VA"
     161 W !!,"          Once eligibility has been verified, this field will no longer"
     162 W !,"          be editable to any user who does not hold the designated security"
     163 W !,"          key."
     164 Q
     165HLP3602 ;help text for field .3602, Rec'ing Disability in Lieu of VA Comp
     166 W !,"     Enter 'Y' if this veteran applicant is receiving disability"
     167 W !,"     retirement pay from the Military instead of VA compensation."
     168 W !,"     Enter 'N' if this veteran applicant is not receiving disability"
     169 W !,"     retirement pay from the Military instead of VA compensation."
     170 W !,"     Once eligibility has been verified by HEC this field will no longer "
     171 W !,"     be editable by VistA users. Send updates and/or requests to HEC."
     172 Q
     173HLP3603 ;help text for field .3603, Discharge Due to LOD Disability
     174 W !,"     Enter 'Y' if this veteran applicant was discharged from the"
     175 W !,"     military for a disability incurred or aggravated in the line "
     176 W !,"     of duty.  Enter 'N' if this veteran applicant was not discharged"
     177 W !,"     from the military for a disability incurred or aggravated in the"
     178 W !,"     line of duty. Once eligibility has been verified by HEC this field"
     179 W !,"     will no longer be editable by VistA users. Send updates and/or requests"
     180 W !,"     to HEC."
     181 Q
     182SSNNM(DFN) ; SSN and name on first line of screen
     183 ;
     184 ; ** start of VOE change: DAOU/JLG 2/1/2005,VA/CJS,WV/TOAD 5/9/2006 **
     185 ;
     186 ; Change code so it will display HRN if SSN is null
     187 ;
     188 ; before:
     189 ;
     190 ; N X,SSN
     191 ; S X=$S($D(^DPT(+DFN,0)):^(0),1:""),SSN=$P(X,"^",9),SSN=$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,10)
     192 ;
     193 ; after:
     194 ;
     195 ; Social Security Number field (.09) in Patient file (2)
     196 N X,SSN,HRN
     197 S X=$S($D(^DPT(+DFN,0)):^(0),1:""),SSN=$P(X,"^",9)
     198 I SSN S SSN=$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,10)
     199 ;
     200ID S SSN=$$ID^DGLBPID(DFN) ;**GFT/VW
     201 ; for IHS or EHR, replace SSN with HRN
     202 I $G(DUZ("AG"))'="V" D
     203 . Q:SSN]""
     204 . S HRN=$$HRN^AUPNPAT3(+DFN,DUZ(2))
     205 . I HRN S SSN="HRN-"_HRN
     206 ;
     207 ; ** end of VOE change **
     208 ;
     209 S X=$P(X,U)_"; "_SSN
     210 Q X
     211 ;
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPV.m

    r613 r623  
    1 DGRPV   ;ALB/MRL,RTK,PJR,BRM,TMK,AMA - REGISTRATION DEFINE VARIABLES ON ENTRY ; 8/11/05 12:56pm
    2         ;;5.3;Registration;**109,114,247,190,327,365,343,397,415,489,546,545,451,624,677,672,689,716,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19         ;
    20         ;
    21         ;set up variables for registration screen processing
    22         ;
    23         ;DGRPVV   :string of 15 ones and zeros each character corresponding to
    24         ;          a particular screen (0 means allow edit, 1 means don't)
    25         ;
    26         ;DGRPVV(n):where n=screen number.  String of x ones and zeros where
    27         ;          x is the number of elements on screen n (0=edit, 1=don't)
    28         ;
    29         ;DGVI     :Turn on high intensity
    30         ;DGVO     :Turn off high intensity
    31         ;
    32 EN      D DT^DICRW I '$D(DVBGUI) D HOME^%ZIS
    33         S (DGVI,DGVO)="""""" I $S('$D(IOST(0)):1,'$D(^DG(43,1,0)):1,'$P(^DG(43,1,0),"^",36):1,$D(^DG(43,1,"TERM",IOST(0))):1,1:0) G M ;goto M if not high intensity
    34         I $D(^%ZIS(2,IOST(0),7)) S I=^(7),X=$S($P(I,"^",3)]"":3,1:2) I $L($P(I,"^",1)),$L($P(I,"^",X)) S DGVI=$P(I,"^",1),DGVO=$P(I,"^",X)
    35 M       I $L(DGVI_DGVO)>4 S X=132 X ^%ZOSF("RM")
    36         S DGRPW=1,DGRPCM=0,DGRPU="UNANSWERED",DGRPNA="NOT APPLICABLE",DGRPV=$S($D(DGRPV):DGRPV,1:1)
    37 SC7     S X=$S('$D(^DPT(DFN,"TYPE")):0,1:+^("TYPE")) S:'$D(DGELVER) DGELVER=0
    38         S DGRPTYPE=$S($D(^DG(391,+X,0)):^(0),1:""),(DGRPSC,DGRPSCE,DGRPSCE1)="" S:'$D(DGELVER) DGELVER=0
    39         I DGRPTYPE'="" S DGRPSC=$G(^DG(391,+X,"S")),DGRPSCE=$G(^("E")),DGRPSCE1=$G(^("E10"))
    40         ;
    41         S DGPH=$P($G(^DPT(DFN,.53)),U)  ;Purple Heart Indicator
    42         I $G(DGPRFLG)=1 D
    43         . S DGRPVV="000001111111111"
    44         E  D
    45         . S DGRPVV="000000000000000"
    46         S X="5^3^5^2^3^8^4^2^10^2^4^5^5^2^1"
    47         ;
    48         ; ** VOE change 1 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
    49         ;
    50         ; new line: if agency code is not VA, new section added to screen 3
    51         I $G(DUZ("AG"))'="V" S $P(X,"^",3)="6"
    52         ;
    53         ; ** end of VOE change 1 **
    54         ;
    55         F I=1:1:15 S J=+$P(X,"^",I),DGRPVV(I)=$S((I<12)!(I=15):$E("00000000000000000",1,J),1:$E("11111111111111111",1,J))
    56         S DGRPVV(1.1)="00"
    57         S DGRPVV(2)="00010"
    58         I $G(DGPH)]"" S $E(DGRPVV(6),8)=1
    59         ;
    60         F I=3,6,8,9,10,11 S J=+$P(DGRPSC,"^",I) I 'J S DGRPVV=$E(DGRPVV,0,I-1)_1_$E(DGRPVV,I+1,99)
    61         ;
    62         ;-- if patient type is TRICARE then turn off screens 2,4
    63         ;
    64         ;-- modified 08/20/2003 for NOIS Calls MAC-0400-61574 & AMA-0700-71769
    65         ;-- commented the line to allow screens 2 & 4 to display for Tricare
    66         ;I DGRPTYPE["TRICARE" F I=2,4 S J=+$P(DGRPSC,"^",I) I 'J S DGRPVV=$E(DGRPVV,0,I-1)_1_$E(DGRPVV,I+1,99)
    67         ;
    68         ; ** VOE change 2 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
    69         ;
    70         ; add lines: if agency code is not VA, change last screen to 14,
    71         ; and clear flag for screen 15 (it is VA-specific)
    72         I $G(DUZ("AG"))'="V" D
    73         . S DGRPLAST=14
    74         . F I=15 S DGRPVV=$E(DGRPVV,0,I-1)_$S(I=15:"",1:1)_$E(DGRPVV,I+1,99)
    75         ;
    76         ; ** end of VOE change 2 **
    77         ;
    78         F I=31:0 S I=$O(^DD(391,I)) Q:I=""!(I>99)  I $D(^(I,0)),($E(^(0),1)'="*"),'+$P(DGRPSCE,"^",I) S X1=$E(I),X2=$E(I,2) I +X1 S DGRPVV(X1)=$E(DGRPVV(X1),0,X2-1)_1_$E(DGRPVV(X1),X2+1,99)
    79         I $G(^DPT(DFN,.35)),(^(.35)<+($E(DT,1,3)_"0000")) S DGRPVV=$E(DGRPVV,0,7)_11_$E(DGRPVV,10,99)
    80         K DIRUT,DUOUT,DTOUT
    81         ;
    82         ;Fields are numbered screen_item and put in that piece position.
    83         ;Because FM does not allow more than 100 pieces on a node, it was
    84         ;necessary to start a new node E10 for fields on screens 10 or higher.
    85         ;In these instances, the piece position will be screen_item-100 so,
    86         ;for example, screen 11, item 2 would be field 112, but piece 12.
    87         ;Items on screens <10 will be found on node E.
    88         ;
    89         F I=100:0 S I=$O(^DD(391,I)) Q:I=""!(I>150)  I $D(^(I,0)),($E(^(0),1)'="*"),'+$P(DGRPSCE1,"^",I-100) S X1=$E(I,1,2),X2=$E(I,3) I +X1 S DGRPVV(X1)=$E(DGRPVV(X1),0,X2-1)_1_$E(DGRPVV(X1),X2+1,99)
    90         ;
    91         I $S('($D(DUZ)#2):0,'$D(^XUSEC("DG ELIGIBILITY",DUZ)):0,1:1) G ELVER ;if user holds eligibility key, skip
    92         F I=.3,.32,.361 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
    93         S DGRPVV(10)=11 I $P(DGRP(.361),"^",1)="V" S DGRPVV(7)=111,DGRPVV(1)=1_$E(DGRPVV(1),2,99) ;if elig verified, can't edit elig data, name, ssn, or dob
    94         ;
    95         ; ** VOE change 3 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
    96         ;
    97         ; add line: if agency code is not VA, only edit one section of screen 7
    98         ; The rest is veteran specific.
    99         I $G(DUZ("AG"))'="V" S DGRPVV(7)="1101"
    100         ;
    101         ; ** end of VOE change 3 **
    102         ;
    103         I $P(DGRP(.3),"^",6)]"" S DGRPVV(8)=11 ;if monetary ben. verified, can't edit income screening data
    104         I $P(DGRP(.32),"^",2)]"" S DGRPVV(6)=111111111 ;if service data verified, can't edit service screen
    105         ;
    106 ELVER   ;set up variables for eligibility verification
    107         ;if elig ver option, only edit screens 1, 2, and 7 (and 6, 8, 9, 10,
    108         ;   and 11 if they're turned on).
    109         ;
    110         S DGRP(.361)=$G(^DPT(DFN,.361))
    111         I $P(DGRP(.361),U,3)="H" S DGRPVV(10)=10
    112         I $P($G(DGRP(.361)),U)="V",($P(DGRP(.361),U,3)="H") S DGRPVV(6)=$E(DGRPVV(6),1,5)_1_$E(DGRPVV(6),7,99),DGRPVV(11)=1000
    113         S:'DGELVER DGRPLAST=$S($G(DGPRFLG)=1:5,1:15)
    114         ;
    115         ; ** VOE change 4 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
    116         ;
    117         ; add line: if agency code is not VA, and last screen is set to 15, set
    118         ; it to 14 (it is VA-specific)
    119         I $G(DUZ("AG"))'="V",DGRPLAST=15 S DGRPLAST=14
    120         ;
    121         ; ** end of VOE change 4 **
    122         ;
    123         I DGELVER S DGRPVV="00111"_$E(DGRPVV,6,11)_"1111" F I=1:1:11 S J=$E(DGRPVV,I) I 'J S DGRPLAST=I
    124 Q       K DGRPSC,DGRPSCE
    125         Q
    126         ;
    127 WW      ;Write number on screens for display and/or edit (Z=number)
    128         W:DGRPW ! S Z=$S(DGRPCM:Z,DGRPV:"<"_Z_">",$E(DGRPVV(DGRPS),Z):"<"_Z_">",1:"["_Z_"]")
    129         I DGRPCM!($E(Z)="[") W @DGVI,Z,@DGVO
    130         I 'DGRPCM&($E(Z)'="[") W Z
    131         Q
    132         ;
    133 WW1     ;spacing for screen display (Z=item to print)
    134         F Z2=1:1:(Z1-$L(Z)) S Z=Z_" "
    135         W Z K Z2
    136         Q
    137         ;
    138 WW2     ; Write number on screen for fields always selectable
    139         W:DGRPW ! S Z="["_Z_"]"
    140         I DGRPCM!($E(Z)="[") W @DGVI,Z,@DGVO
    141         Q
     1DGRPV ;ALB/MRL,RTK,PJR,BRM,TMK,AMA - REGISTRATION DEFINE VARIABLES ON ENTRY ; 8/11/05 12:56pm
     2 ;;5.3;Registration;**109,114,247,190,327,365,343,397,415,489,546,545,451,624,677,672,689,716,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     19 ;
     20 ;
     21 ;set up variables for registration screen processing
     22 ;
     23 ;DGRPVV   :string of 15 ones and zeros each character corresponding to
     24 ;          a particular screen (0 means allow edit, 1 means don't)
     25 ;
     26 ;DGRPVV(n):where n=screen number.  String of x ones and zeros where
     27 ;          x is the number of elements on screen n (0=edit, 1=don't)
     28 ;
     29 ;DGVI     :Turn on high intensity
     30 ;DGVO     :Turn off high intensity
     31 ;
     32EN D DT^DICRW I '$D(DVBGUI) D HOME^%ZIS
     33 S (DGVI,DGVO)="""""" I $S('$D(IOST(0)):1,'$D(^DG(43,1,0)):1,'$P(^DG(43,1,0),"^",36):1,$D(^DG(43,1,"TERM",IOST(0))):1,1:0) G M ;goto M if not high intensity
     34 I $D(^%ZIS(2,IOST(0),7)) S I=^(7),X=$S($P(I,"^",3)]"":3,1:2) I $L($P(I,"^",1)),$L($P(I,"^",X)) S DGVI=$P(I,"^",1),DGVO=$P(I,"^",X)
     35M I $L(DGVI_DGVO)>4 S X=132 X ^%ZOSF("RM")
     36 S DGRPW=1,DGRPCM=0,DGRPU="UNANSWERED",DGRPNA="NOT APPLICABLE",DGRPV=$S($D(DGRPV):DGRPV,1:1)
     37SC7 S X=$S('$D(^DPT(DFN,"TYPE")):0,1:+^("TYPE")) S:'$D(DGELVER) DGELVER=0
     38 S DGRPTYPE=$S($D(^DG(391,+X,0)):^(0),1:""),(DGRPSC,DGRPSCE,DGRPSCE1)="" S:'$D(DGELVER) DGELVER=0
     39 I DGRPTYPE'="" S DGRPSC=$G(^DG(391,+X,"S")),DGRPSCE=$G(^("E")),DGRPSCE1=$G(^("E10"))
     40 ;
     41 S DGPH=$P($G(^DPT(DFN,.53)),U)  ;Purple Heart Indicator
     42 I $G(DGPRFLG)=1 D
     43 . S DGRPVV="000001111111111"
     44 E  D
     45 . S DGRPVV="000000000000000"
     46 S X="5^3^5^2^3^8^4^2^10^2^4^5^5^2^1"
     47 ;
     48 ; ** VOE change 1 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
     49 ;
     50 ; new line: if agency code is not VA, new section added to screen 3
     51 I $G(DUZ("AG"))'="V" S $P(X,"^",3)="6"
     52 ;
     53 ; ** end of VOE change 1 **
     54 ;
     55 F I=1:1:15 S J=+$P(X,"^",I),DGRPVV(I)=$S((I<12)!(I=15):$E("00000000000000000",1,J),1:$E("11111111111111111",1,J))
     56 S DGRPVV(1.1)="00"
     57 S DGRPVV(2)="00010"
     58 I $G(DGPH)]"" S $E(DGRPVV(6),8)=1
     59 ;
     60 F I=3,6,8,9,10,11 S J=+$P(DGRPSC,"^",I) I 'J S DGRPVV=$E(DGRPVV,0,I-1)_1_$E(DGRPVV,I+1,99)
     61 ;
     62 ;-- if patient type is TRICARE then turn off screens 2,4
     63 ;
     64 ;-- modified 08/20/2003 for NOIS Calls MAC-0400-61574 & AMA-0700-71769
     65 ;-- commented the line to allow screens 2 & 4 to display for Tricare
     66 ;I DGRPTYPE["TRICARE" F I=2,4 S J=+$P(DGRPSC,"^",I) I 'J S DGRPVV=$E(DGRPVV,0,I-1)_1_$E(DGRPVV,I+1,99)
     67 ;
     68 ; ** VOE change 2 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
     69 ;
     70 ; add lines: if agency code is not VA, change last screen to 14,
     71 ; and clear flag for screen 15 (it is VA-specific)
     72 I $G(DUZ("AG"))'="V" D
     73 . S DGRPLAST=14
     74 . F I=15 S DGRPVV=$E(DGRPVV,0,I-1)_$S(I=15:"",1:1)_$E(DGRPVV,I+1,99)
     75 ;
     76 ; ** end of VOE change 2 **
     77 ;
     78 F I=31:0 S I=$O(^DD(391,I)) Q:I=""!(I>99)  I $D(^(I,0)),($E(^(0),1)'="*"),'+$P(DGRPSCE,"^",I) S X1=$E(I),X2=$E(I,2) I +X1 S DGRPVV(X1)=$E(DGRPVV(X1),0,X2-1)_1_$E(DGRPVV(X1),X2+1,99)
     79 I $G(^DPT(DFN,.35)),(^(.35)<+($E(DT,1,3)_"0000")) S DGRPVV=$E(DGRPVV,0,7)_11_$E(DGRPVV,10,99)
     80 K DIRUT,DUOUT,DTOUT
     81 ;
     82 ;Fields are numbered screen_item and put in that piece position.
     83 ;Because FM does not allow more than 100 pieces on a node, it was
     84 ;necessary to start a new node E10 for fields on screens 10 or higher.
     85 ;In these instances, the piece position will be screen_item-100 so,
     86 ;for example, screen 11, item 2 would be field 112, but piece 12.
     87 ;Items on screens <10 will be found on node E.
     88 ;
     89 F I=100:0 S I=$O(^DD(391,I)) Q:I=""!(I>150)  I $D(^(I,0)),($E(^(0),1)'="*"),'+$P(DGRPSCE1,"^",I-100) S X1=$E(I,1,2),X2=$E(I,3) I +X1 S DGRPVV(X1)=$E(DGRPVV(X1),0,X2-1)_1_$E(DGRPVV(X1),X2+1,99)
     90 ;
     91 I $S('($D(DUZ)#2):0,'$D(^XUSEC("DG ELIGIBILITY",DUZ)):0,1:1) G ELVER ;if user holds eligibility key, skip
     92 F I=.3,.32,.361 S DGRP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
     93 S DGRPVV(10)=11 I $P(DGRP(.361),"^",1)="V" S DGRPVV(7)=111,DGRPVV(1)=1_$E(DGRPVV(1),2,99) ;if elig verified, can't edit elig data, name, ssn, or dob
     94 ;
     95 ; ** VOE change 3 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
     96 ;
     97 ; add line: if agency code is not VA, only edit one section of screen 7
     98 ; The rest is veteran specific.
     99 I $G(DUZ("AG"))'="V" S DGRPVV(7)="1101"
     100 ;
     101 ; ** end of VOE change 3 **
     102 ;
     103 I $P(DGRP(.3),"^",6)]"" S DGRPVV(8)=11 ;if monetary ben. verified, can't edit income screening data
     104 I $P(DGRP(.32),"^",2)]"" S DGRPVV(6)=111111111 ;if service data verified, can't edit service screen
     105 ;
     106ELVER ;set up variables for eligibility verification
     107 ;if elig ver option, only edit screens 1, 2, and 7 (and 6, 8, 9, 10,
     108 ;   and 11 if they're turned on).
     109 ;
     110 S DGRP(.361)=$G(^DPT(DFN,.361))
     111 I $P(DGRP(.361),U,3)="H" S DGRPVV(10)=10
     112 I $P($G(DGRP(.361)),U)="V",($P(DGRP(.361),U,3)="H") S DGRPVV(6)=$E(DGRPVV(6),1,5)_1_$E(DGRPVV(6),7,99),DGRPVV(11)=1000
     113 S:'DGELVER DGRPLAST=$S($G(DGPRFLG)=1:5,1:15)
     114 ;
     115 ; ** VOE change 4 of 4: DAOU/WCJ 2/7/2005,VA/CJS,WV/TOAD 5/9/2006 **
     116 ;
     117 ; add line: if agency code is not VA, and last screen is set to 15, set
     118 ; it to 14 (it is VA-specific)
     119 I $G(DUZ("AG"))'="V",DGRPLAST=15 S DGRPLAST=14
     120 ;
     121 ; ** end of VOE change 4 **
     122 ;
     123 I DGELVER S DGRPVV="00111"_$E(DGRPVV,6,11)_"1111" F I=1:1:11 S J=$E(DGRPVV,I) I 'J S DGRPLAST=I
     124Q K DGRPSC,DGRPSCE
     125 Q
     126 ;
     127WW ;Write number on screens for display and/or edit (Z=number)
     128 W:DGRPW ! S Z=$S(DGRPCM:Z,DGRPV:"<"_Z_">",$E(DGRPVV(DGRPS),Z):"<"_Z_">",1:"["_Z_"]")
     129 I DGRPCM!($E(Z)="[") W @DGVI,Z,@DGVO
     130 I 'DGRPCM&($E(Z)'="[") W Z
     131 Q
     132 ;
     133WW1 ;spacing for screen display (Z=item to print)
     134 F Z2=1:1:(Z1-$L(Z)) S Z=Z_" "
     135 W Z K Z2
     136 Q
     137 ;
     138WW2 ; Write number on screen for fields always selectable
     139 W:DGRPW ! S Z="["_Z_"]"
     140 I DGRPCM!($E(Z)="[") W @DGVI,Z,@DGVO
     141 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX7.m

    r613 r623  
    1 DGRPX7 ; GENERATED FROM 'DG LOAD EDIT SCREEN 7' INPUT TEMPLATE(#420), FILE 2;12/13/08
     1DGRPX7 ; GENERATED FROM 'DG LOAD EDIT SCREEN 7' INPUT TEMPLATE(#420), FILE 2;12/27/07
    22 D DE G BEGIN
    33DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.29)) S %Z=^(.29) S %=$P(%Z,U,1) S:%]"" DE(14)=% S %=$P(%Z,U,2) S:%]"" DE(13)=% S %=$P(%Z,U,12) S:%]"" DE(11)=%
    54 I $D(^(.3)) S %Z=^(.3) S %=$P(%Z,U,1) S:%]"" DE(5)=% S %=$P(%Z,U,2) S:%]"" DE(7)=% S %=$P(%Z,U,4) S:%]"" DE(8)=% S %=$P(%Z,U,5) S:%]"" DE(9)=% S %=$P(%Z,U,12) S:%]"" DE(10)=%
    6  I $D(^(.31)) S %Z=^(.31) S %=$P(%Z,U,3) S:%]"" DE(15)=% S %=$P(%Z,U,4) S:%]"" DE(16)=%
    75 I $D(^("TYPE")) S %Z=^("TYPE") S %=$P(%Z,U,1) S:%]"" DE(2)=%
    86 I $D(^("VET")) S %Z=^("VET") S %=$P(%Z,U,1) S:%]"" DE(4)=%
     
    6058X1 S:DGDR'["701" Y="@702"
    6159 Q
    62 2 S DW="TYPE;1",DV="P391'a",DU="",DLB="TYPE",DIFLD=391
     602 S DW="TYPE;1",DV="RP391'a",DU="",DLB="TYPE",DIFLD=391
    6361 S DE(DW)="C2^DGRPX7",DE(DW,"INDEX")=1
    6462 S DU="DG(391,"
     
    8785X3 D SC7^DGRPV
    8886 Q
    89 4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW="VET;1",DV="SXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
     874 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW="VET;1",DV="RSXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
    9088 S DE(DW)="C4^DGRPX7"
    9189 S DU="Y:YES;N:NO;"
     
    123121 Q
    124122 ;
    125 5 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".3;1",DV="SXa",DU="",DLB="SERVICE CONNECTED?",DIFLD=.301
     1235 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".3;1",DV="RSXa",DU="",DLB="SERVICE CONNECTED?",DIFLD=.301
    126124 S DE(DW)="C5^DGRPX7"
    127125 S DU="Y:YES;N:NO;"
     
    206204 G RE
    207205C9 G C9S:$D(DE(9))[0 K DB
    208  S X=DE(9),DIC=DIE
    209  D AUTOUPD^DGENA2(DA)
    210  S X=DE(9),DIC=DIE
    211  S DFN=DA D EN^DGMTCOR K DGMTCOR
     206 D ^DGRPX71
    212207C9S S X="" G:DG(DQ)=X C9F1 K DB
    213  S X=DG(DQ),DIC=DIE
    214  D AUTOUPD^DGENA2(DA)
    215  S X=DG(DQ),DIC=DIE
    216  S DFN=DA D EN^DGMTCOR K DGMTCOR
     208 D ^DGRPX72
    217209C9F1 Q
    218210X9 Q
     
    222214 Q
    223215 ;
    224 11 S DW=".29;12",DV="S",DU="",DLB="RATED INCOMPETENT?",DIFLD=.293
    225  S DE(DW)="C11^DGRPX7"
    226  S DU="0:NO;1:YES;"
    227  G RE
    228 C11 G C11S:$D(DE(11))[0 K DB
    229  S X=DE(11),DIC=DIE
    230  D EVENT^IVMPLOG(DA)
    231 C11S S X="" G:DG(DQ)=X C11F1 K DB
    232  S X=DG(DQ),DIC=DIE
    233  D EVENT^IVMPLOG(DA)
    234 C11F1 Q
    235 X11 Q
    236 12 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=12 D X12 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    237 X12 S:'X Y=.313
    238  Q
    239 13 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".29;2",DV="D",DU="",DLB="DATE RULED INCOMPETENT (CIVIL)",DIFLD=.292
    240  G RE
    241 X13 S %DT="E" D ^%DT S X=Y K:Y<1 X
    242  Q
    243  ;
    244 14 S DW=".29;1",DV="D",DU="",DLB="DATE RULED INCOMPETENT (VA)",DIFLD=.291
    245  G RE
    246 X14 S %DT="E" D ^%DT S X=Y K:Y<1 X
    247  Q
    248  ;
    249 15 S DW=".31;3",DV="FXOa",DU="",DLB="CLAIM NUMBER",DIFLD=.313
    250  S DQ(15,2)="S Y(0)=Y S Y=$E(Y,1,10)"
    251  S DE(DW)="C15^DGRPX7"
    252  G RE
    253 C15 G C15S:$D(DE(15))[0 K DB
    254  S X=DE(15),DIC=DIE
    255  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".313;" D AVAFC^VAFCDD01(DA)
    256  S X=DE(15),DIC=DIE
    257  D EVENT^IVMPLOG(DA)
    258  S X=DE(15),DIIX=2_U_DIFLD D AUDIT^DIET
    259 C15S S X="" G:DG(DQ)=X C15F1 K DB
    260  D ^DGRPX71
    261 C15F1 Q
    262 X15 S DFN=DA D EV^DGLOCK I $D(X) S L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E "  ",L S:X?1"SS".E X=L K:$L(X)>9 X Q:'$D(X)  I X'=L K:$L(X)>8!($L(X)<7)!'(X?.N) X
    263  I $D(X),X'?.ANP K X
    264  Q
    265  ;
    266 16 D:$D(DG)>9 F^DIE17,DE S DQ=16,DW=".31;4",DV="*P4'X",DU="",DLB="CLAIM FOLDER LOCATION",DIFLD=.314
    267  S DE(DW)="C16^DGRPX7"
    268  S DU="DIC(4,"
    269  G RE
    270 C16 G C16S:$D(DE(16))[0 K DB
    271  D ^DGRPX72
    272 C16S S X="" G:DG(DQ)=X C16F1 K DB
    273  D ^DGRPX73
    274 C16F1 Q
    275 X16 S DIC("S")="I $$CFLTF^DGREGDD(Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
    276  Q
    277  ;
    278 17 S DQ=18 ;@702
    279 18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    280 X18 S:DGDR'["702" Y="@703"
    281  Q
    282 19 D:$D(DG)>9 F^DIE17 G ^DGRPX74
     21611 D:$D(DG)>9 F^DIE17 G ^DGRPX73
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX71.m

    r613 r623  
    1 DGRPX71 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".313;" D AVAFC^VAFCDD01(DA)
    4  S X=DG(DQ),DIC=DIE
    5  D EVENT^IVMPLOG(DA)
    6  I $D(DE(15))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     1DGRPX71 ; ;12/27/07
     2 S X=DE(9),DIC=DIE
     3 D AUTOUPD^DGENA2(DA)
     4 S X=DE(9),DIC=DIE
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX72.m

    r613 r623  
    1 DGRPX72 ; ;12/13/08
    2  S X=DE(16),DIC=DIE
    3  D KILL^DGREGDD(DA)
     1DGRPX72 ; ;12/27/07
     2 S X=DG(DQ),DIC=DIE
     3 D AUTOUPD^DGENA2(DA)
     4 S X=DG(DQ),DIC=DIE
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX73.m

    r613 r623  
    1 DGRPX73 ; ;12/13/08
     1DGRPX73 ; ;12/27/07
     2 D DE G BEGIN
     3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     4 I $D(^(.29)) S %Z=^(.29) S %=$P(%Z,U,1) S:%]"" DE(4)=% S %=$P(%Z,U,2) S:%]"" DE(3)=% S %=$P(%Z,U,12) S:%]"" DE(1)=%
     5 I $D(^(.3)) S %Z=^(.3) S %=$P(%Z,U,11) S:%]"" DE(12)=%
     6 I $D(^(.31)) S %Z=^(.31) S %=$P(%Z,U,3) S:%]"" DE(5)=% S %=$P(%Z,U,4) S:%]"" DE(6)=%
     7 I $D(^(.362)) S %Z=^(.362) S %=$P(%Z,U,12) S:%]"" DE(9)=% S %=$P(%Z,U,13) S:%]"" DE(10)=% S %=$P(%Z,U,14) S:%]"" DE(11)=% S %=$P(%Z,U,20) S:%]"" DE(14)=%
     8 K %Z Q
     9 ;
     10W W !?DL+DL-2,DLB_": "
     11 Q
     12O D W W Y W:$X>45 !?9
     13 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
     14 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
     15TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
     16 Q
     17A K DQ(DQ) S DQ=DQ+1
     18B G @DQ
     19RE G PR:$D(DE(DQ)) D W,TR
     20N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
     21RD G QS:X?."?" I X["^" D D G ^DIE17
     22 I X="@" D D G Z^DIE2
     23 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
     24T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
     25 K DDER G X
     26P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
     27 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
     28 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
     29V D @("X"_DQ) K YS
     30Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
     31X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
     32 S X="?BAD"
     33QS S DZ=X D D,QQ^DIEQ G B
     34D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
     35Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
     36PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
     37R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
     38 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
     39 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
     40RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
     41I I DV'["I",DV'["#" G RD
     42 D E^DIE0 G RD:$D(X),PR
     43 Q
     44SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
     45 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
     46 D ^DIR I 'DDER S %=Y(0),X=Y
     47 Q
     48SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
     49 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
     50 E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
     51 Q
     52NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
     53KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
     54BEGIN S DNM="DGRPX73",DQ=1
     551 S DW=".29;12",DV="S",DU="",DLB="RATED INCOMPETENT?",DIFLD=.293
     56 S DE(DW)="C1^DGRPX73"
     57 S DU="0:NO;1:YES;"
     58 G RE
     59C1 G C1S:$D(DE(1))[0 K DB
     60 S X=DE(1),DIC=DIE
     61 D EVENT^IVMPLOG(DA)
     62C1S S X="" G:DG(DQ)=X C1F1 K DB
     63 S X=DG(DQ),DIC=DIE
     64 D EVENT^IVMPLOG(DA)
     65C1F1 Q
     66X1 Q
     672 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     68X2 S:'X Y=.313
     69 Q
     703 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".29;2",DV="D",DU="",DLB="DATE RULED INCOMPETENT (CIVIL)",DIFLD=.292
     71 G RE
     72X3 S %DT="E" D ^%DT S X=Y K:Y<1 X
     73 Q
     74 ;
     754 S DW=".29;1",DV="D",DU="",DLB="DATE RULED INCOMPETENT (VA)",DIFLD=.291
     76 G RE
     77X4 S %DT="E" D ^%DT S X=Y K:Y<1 X
     78 Q
     79 ;
     805 S DW=".31;3",DV="FXOa",DU="",DLB="CLAIM NUMBER",DIFLD=.313
     81 S DQ(5,2)="S Y(0)=Y S Y=$E(Y,1,10)"
     82 S DE(DW)="C5^DGRPX73"
     83 G RE
     84C5 G C5S:$D(DE(5))[0 K DB
     85 S X=DE(5),DIC=DIE
     86 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".313;" D AVAFC^VAFCDD01(DA)
     87 S X=DE(5),DIC=DIE
     88 D EVENT^IVMPLOG(DA)
     89 S X=DE(5),DIIX=2_U_DIFLD D AUDIT^DIET
     90C5S S X="" G:DG(DQ)=X C5F1 K DB
     91 S X=DG(DQ),DIC=DIE
     92 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".313;" D AVAFC^VAFCDD01(DA)
     93 S X=DG(DQ),DIC=DIE
     94 D EVENT^IVMPLOG(DA)
     95 I $D(DE(5))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     96C5F1 Q
     97X5 S DFN=DA D EV^DGLOCK I $D(X) S L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E "  ",L S:X?1"SS".E X=L K:$L(X)>9 X Q:'$D(X)  I X'=L K:$L(X)>8!($L(X)<7)!'(X?.N) X
     98 I $D(X),X'?.ANP K X
     99 Q
     100 ;
     1016 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".31;4",DV="*P4'X",DU="",DLB="CLAIM FOLDER LOCATION",DIFLD=.314
     102 S DE(DW)="C6^DGRPX73"
     103 S DU="DIC(4,"
     104 G RE
     105C6 G C6S:$D(DE(6))[0 K DB
     106 S X=DE(6),DIC=DIE
     107 D KILL^DGREGDD(DA)
     108C6S S X="" G:DG(DQ)=X C6F1 K DB
    2109 S X=DG(DQ),DIC=DIE
    3110 D SET^DGREGDD(DA,X)
     111C6F1 Q
     112X6 S DIC("S")="I $$CFLTF^DGREGDD(Y)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
     113 Q
     114 ;
     1157 S DQ=8 ;@702
     1168 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     117X8 S:DGDR'["702" Y="@703"
     118 Q
     1199 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".362;12",DV="SX",DU="",DLB="RECEIVING A&A BENEFITS?",DIFLD=.36205
     120 S DE(DW)="C9^DGRPX73"
     121 S DU="Y:YES;N:NO;U:UNKNOWN;"
     122 G RE
     123C9 G C9S:$D(DE(9))[0 K DB
     124 S X=DE(9),DIC=DIE
     125 X ^DD(2,.36205,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,2.4)
     126 S X=DE(9),DIC=DIE
     127 S DFN=DA D EN^DGMTCOR K DGMTCOR
     128 S X=DE(9),DIC=DIE
     129 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,2.4)
     130 S X=DE(9),DIC=DIE
     131 D AUTOUPD^DGENA2(DA)
     132C9S S X="" G:DG(DQ)=X C9F1 K DB
     133 S X=DG(DQ),DIC=DIE
     134 X ^DD(2,.36205,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,1.4)
     135 S X=DG(DQ),DIC=DIE
     136 S DFN=DA D EN^DGMTCOR K DGMTCOR
     137 S X=DG(DQ),DIC=DIE
     138 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,1.4)
     139 S X=DG(DQ),DIC=DIE
     140 D AUTOUPD^DGENA2(DA)
     141C9F1 Q
     142X9 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
     143 Q
     144 ;
     14510 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".362;13",DV="SX",DU="",DLB="RECEIVING HOUSEBOUND BENEFITS?",DIFLD=.36215
     146 S DE(DW)="C10^DGRPX73"
     147 S DU="Y:YES;N:NO;U:UNKNOWN;"
     148 G RE
     149C10 G C10S:$D(DE(10))[0 K DB
     150 S X=DE(10),DIC=DIE
     151 X ^DD(2,.36215,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,2.4)
     152 S X=DE(10),DIC=DIE
     153 S DFN=DA D EN^DGMTCOR K DGMTCOR
     154 S X=DE(10),DIC=DIE
     155 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,2.4)
     156 S X=DE(10),DIC=DIE
     157 D AUTOUPD^DGENA2(DA)
     158C10S S X="" G:DG(DQ)=X C10F1 K DB
     159 S X=DG(DQ),DIC=DIE
     160 X ^DD(2,.36215,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,1.4)
     161 S X=DG(DQ),DIC=DIE
     162 S DFN=DA D EN^DGMTCOR K DGMTCOR
     163 S X=DG(DQ),DIC=DIE
     164 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,1.4)
     165 S X=DG(DQ),DIC=DIE
     166 D AUTOUPD^DGENA2(DA)
     167C10F1 Q
     168X10 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
     169 Q
     170 ;
     17111 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".362;14",DV="SX",DU="",DLB="RECEIVING A VA PENSION?",DIFLD=.36235
     172 S DE(DW)="C11^DGRPX73"
     173 S DU="Y:YES;N:NO;U:UNKNOWN;"
     174 G RE
     175C11 G C11S:$D(DE(11))[0 K DB
     176 D ^DGRPX74
     177C11S S X="" G:DG(DQ)=X C11F1 K DB
     178 D ^DGRPX75
     179C11F1 Q
     180X11 S DFN=DA D MV^DGLOCK
     181 Q
     182 ;
     18312 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".3;11",DV="SX",DU="",DLB="RECEIVING VA DISABILITY?",DIFLD=.3025
     184 S DE(DW)="C12^DGRPX73"
     185 S DU="Y:YES;N:NO;U:UNKNOWN;"
     186 G RE
     187C12 G C12S:$D(DE(12))[0 K DB
     188 D ^DGRPX76
     189C12S S X="" G:DG(DQ)=X C12F1 K DB
     190 D ^DGRPX77
     191C12F1 Q
     192X12 S DFN=DA D MV^DGLOCK I $D(X),X="Y" D EC^DGLOCK1
     193 Q
     194 ;
     19513 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
     196X13 S:(X'="Y")&($P($G(^DPT(DA,.362)),U,12,14)'["Y") Y=.36265
     197 Q
     19814 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".362;20",DV="NJ8,2X",DU="",DLB="TOTAL ANNUAL VA CHECK AMOUNT",DIFLD=.36295
     199 S DE(DW)="C14^DGRPX73"
     200 G RE
     201C14 G C14S:$D(DE(14))[0 K DB
     202 D ^DGRPX78
     203C14S S X="" G:DG(DQ)=X C14F1 K DB
     204 D ^DGRPX79
     205C14F1 Q
     206X14 D DOL^DGLOCK2 K:+X'=X&(X'?.N1"."2N)!(X>99999)!(X<0) X I $D(X) S DFN=DA D MV^DGLOCK I $D(X),('$$TOTCHK^DGLOCK2(DFN)) D TOTCKMSG^DGLOCK2 K X
     207 Q
     208 ;
     20915 D:$D(DG)>9 F^DIE17 G ^DGRPX710
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX74.m

    r613 r623  
    1 DGRPX74 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.3)) S %Z=^(.3) S %=$P(%Z,U,9) S:%]"" DE(14)=% S %=$P(%Z,U,11) S:%]"" DE(4)=%
    5  I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,1) S:%]"" DE(12)=%
    6  I $D(^(.362)) S %Z=^(.362) S %=$P(%Z,U,6) S:%]"" DE(9)=% S %=$P(%Z,U,12) S:%]"" DE(1)=% S %=$P(%Z,U,13) S:%]"" DE(2)=% S %=$P(%Z,U,14) S:%]"" DE(3)=% S %=$P(%Z,U,17) S:%]"" DE(7)=% S %=$P(%Z,U,20) S:%]"" DE(6)=%
    7  K %Z Q
    8  ;
    9 W W !?DL+DL-2,DLB_": "
    10  Q
    11 O D W W Y W:$X>45 !?9
    12  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    13  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    14 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    15  Q
    16 A K DQ(DQ) S DQ=DQ+1
    17 B G @DQ
    18 RE G PR:$D(DE(DQ)) D W,TR
    19 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    20 RD G QS:X?."?" I X["^" D D G ^DIE17
    21  I X="@" D D G Z^DIE2
    22  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    23 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    24  K DDER G X
    25 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    26  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    27  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    28 V D @("X"_DQ) K YS
    29 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    30 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    31  S X="?BAD"
    32 QS S DZ=X D D,QQ^DIEQ G B
    33 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    34 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    35 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    36 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    37  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    38  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    39 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    40 I I DV'["I",DV'["#" G RD
    41  D E^DIE0 G RD:$D(X),PR
    42  Q
    43 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    44  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    45  D ^DIR I 'DDER S %=Y(0),X=Y
    46  Q
    47 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    48  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    49  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    50  Q
    51 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    52 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    53 BEGIN S DNM="DGRPX74",DQ=1
    54 1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".362;12",DV="SX",DU="",DLB="RECEIVING A&A BENEFITS?",DIFLD=.36205
    55  S DE(DW)="C1^DGRPX74"
    56  S DU="Y:YES;N:NO;U:UNKNOWN;"
    57  G RE
    58 C1 G C1S:$D(DE(1))[0 K DB
    59  S X=DE(1),DIC=DIE
    60  X ^DD(2,.36205,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,2.4)
    61  S X=DE(1),DIC=DIE
     1DGRPX74 ; ;12/27/07
     2 S X=DE(11),DIC=DIE
     3 X ^DD(2,.36235,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,2.4)
     4 S X=DE(11),DIC=DIE
    625 S DFN=DA D EN^DGMTCOR K DGMTCOR
    63  S X=DE(1),DIC=DIE
    64  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,2.4)
    65  S X=DE(1),DIC=DIE
     6 S X=DE(11),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,2.4)
     8 S X=DE(11),DIC=DIE
    669 D AUTOUPD^DGENA2(DA)
    67 C1S S X="" G:DG(DQ)=X C1F1 K DB
    68  S X=DG(DQ),DIC=DIE
    69  X ^DD(2,.36205,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,1,1.4)
    70  S X=DG(DQ),DIC=DIE
    71  S DFN=DA D EN^DGMTCOR K DGMTCOR
    72  S X=DG(DQ),DIC=DIE
    73  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36205,1,3,1.4)
    74  S X=DG(DQ),DIC=DIE
    75  D AUTOUPD^DGENA2(DA)
    76 C1F1 Q
    77 X1 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
    78  Q
    79  ;
    80 2 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".362;13",DV="SX",DU="",DLB="RECEIVING HOUSEBOUND BENEFITS?",DIFLD=.36215
    81  S DE(DW)="C2^DGRPX74"
    82  S DU="Y:YES;N:NO;U:UNKNOWN;"
    83  G RE
    84 C2 G C2S:$D(DE(2))[0 K DB
    85  S X=DE(2),DIC=DIE
    86  X ^DD(2,.36215,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,2.4)
    87  S X=DE(2),DIC=DIE
    88  S DFN=DA D EN^DGMTCOR K DGMTCOR
    89  S X=DE(2),DIC=DIE
    90  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,2.4)
    91  S X=DE(2),DIC=DIE
    92  D AUTOUPD^DGENA2(DA)
    93 C2S S X="" G:DG(DQ)=X C2F1 K DB
    94  S X=DG(DQ),DIC=DIE
    95  X ^DD(2,.36215,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,1,1.4)
    96  S X=DG(DQ),DIC=DIE
    97  S DFN=DA D EN^DGMTCOR K DGMTCOR
    98  S X=DG(DQ),DIC=DIE
    99  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36215,1,3,1.4)
    100  S X=DG(DQ),DIC=DIE
    101  D AUTOUPD^DGENA2(DA)
    102 C2F1 Q
    103 X2 S DFN=DA D MV^DGLOCK I $D(X) S DFN=DA D EV^DGLOCK
    104  Q
    105  ;
    106 3 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".362;14",DV="SX",DU="",DLB="RECEIVING A VA PENSION?",DIFLD=.36235
    107  S DE(DW)="C3^DGRPX74"
    108  S DU="Y:YES;N:NO;U:UNKNOWN;"
    109  G RE
    110 C3 G C3S:$D(DE(3))[0 K DB
    111  S X=DE(3),DIC=DIE
    112  X ^DD(2,.36235,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,2.4)
    113  S X=DE(3),DIC=DIE
    114  S DFN=DA D EN^DGMTCOR K DGMTCOR
    115  S X=DE(3),DIC=DIE
    116  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,2.4)
    117  S X=DE(3),DIC=DIE
    118  D AUTOUPD^DGENA2(DA)
    119 C3S S X="" G:DG(DQ)=X C3F1 K DB
    120  S X=DG(DQ),DIC=DIE
    121  X ^DD(2,.36235,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,1.4)
    122  S X=DG(DQ),DIC=DIE
    123  S DFN=DA D EN^DGMTCOR K DGMTCOR
    124  S X=DG(DQ),DIC=DIE
    125  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,1.4)
    126  S X=DG(DQ),DIC=DIE
    127  D AUTOUPD^DGENA2(DA)
    128 C3F1 Q
    129 X3 S DFN=DA D MV^DGLOCK
    130  Q
    131  ;
    132 4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".3;11",DV="SX",DU="",DLB="RECEIVING VA DISABILITY?",DIFLD=.3025
    133  S DE(DW)="C4^DGRPX74"
    134  S DU="Y:YES;N:NO;U:UNKNOWN;"
    135  G RE
    136 C4 G C4S:$D(DE(4))[0 K DB
    137  S X=DE(4),DIC=DIE
    138  X ^DD(2,.3025,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,1,2.4)
    139  S X=DE(4),DIC=DIE
    140  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,2,2.4)
    141  S X=DE(4),DIC=DIE
    142  D EVENT^IVMPLOG(DA)
    143 C4S S X="" G:DG(DQ)=X C4F1 K DB
    144  S X=DG(DQ),DIC=DIE
    145  X ^DD(2,.3025,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,1,1.4)
    146  S X=DG(DQ),DIC=DIE
    147  K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,2,1.4)
    148  S X=DG(DQ),DIC=DIE
    149  D EVENT^IVMPLOG(DA)
    150 C4F1 Q
    151 X4 S DFN=DA D MV^DGLOCK I $D(X),X="Y" D EC^DGLOCK1
    152  Q
    153  ;
    154 5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    155 X5 S:(X'="Y")&($P($G(^DPT(DA,.362)),U,12,14)'["Y") Y=.36265
    156  Q
    157 6 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".362;20",DV="NJ8,2X",DU="",DLB="TOTAL ANNUAL VA CHECK AMOUNT",DIFLD=.36295
    158  S DE(DW)="C6^DGRPX74"
    159  G RE
    160 C6 G C6S:$D(DE(6))[0 K DB
    161  S X=DE(6),DIC=DIE
    162  X "S DFN=DA D EN^DGMTR K DGREQF"
    163  S X=DE(6),DIC=DIE
    164  D AUTOUPD^DGENA2(DA)
    165 C6S S X="" G:DG(DQ)=X C6F1 K DB
    166  S X=DG(DQ),DIC=DIE
    167  X "S DFN=DA D EN^DGMTR K DGREQF"
    168  S X=DG(DQ),DIC=DIE
    169  D AUTOUPD^DGENA2(DA)
    170 C6F1 Q
    171 X6 D DOL^DGLOCK2 K:+X'=X&(X'?.N1"."2N)!(X>99999)!(X<0) X I $D(X) S DFN=DA D MV^DGLOCK I $D(X),('$$TOTCHK^DGLOCK2(DFN)) D TOTCKMSG^DGLOCK2 K X
    172  Q
    173  ;
    174 7 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".362;17",DV="SX",DU="",DLB="GI INSURANCE POLICY?",DIFLD=.36265
    175  S DE(DW)="C7^DGRPX74"
    176  S DU="Y:YES;N:NO;U:UNKNOWN;"
    177  G RE
    178 C7 G C7S:$D(DE(7))[0 K DB
    179  S X=DE(7),DIC=DIE
    180  X ^DD(2,.36265,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X="" X ^DD(2,.36265,1,1,2.4)
    181 C7S S X="" G:DG(DQ)=X C7F1 K DB
    182  S X=DG(DQ),DIC=DIE
    183  X ^DD(2,.36265,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X="" X ^DD(2,.36265,1,1,1.4)
    184 C7F1 Q
    185 X7 S DFN=DA D MV^DGLOCK Q
    186  Q
    187  ;
    188 8 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    189 X8 S:X'="Y" Y="@703"
    190  Q
    191 9 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".362;6",DV="NJ8,2X",DU="",DLB="AMOUNT OF GI INSURANCE",DIFLD=.3626
    192  G RE
    193 X9 D DOL^DGLOCK2 K:+X'=X&(X'?.N1"."2N)!(X>999999)!(X<1) X I $D(X) S DFN=DA D MV^DGLOCK I $D(X),$D(^DPT(DA,.362)),$P(^(.362),U,17)'="Y" W !?4,*7,"Applicant doesn't have GI Insurance." K X
    194  Q
    195  ;
    196 10 S DQ=11 ;@703
    197 11 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    198 X11 S:DGDR'["703" Y="@704"
    199  Q
    200 12 S DW=".36;1",DV="*P8'Xa",DU="",DLB="PRIMARY ELIGIBILITY CODE",DIFLD=.361
    201  S DE(DW)="C12^DGRPX74"
    202  S DU="DIC(8,"
    203  G RE
    204 C12 G C12S:$D(DE(12))[0 K DB
    205  D ^DGRPX75
    206 C12S S X="" G:DG(DQ)=X C12F1 K DB
    207  D ^DGRPX76
    208 C12F1 Q
    209 X12 S DFN=DA D EV^DGLOCK I $D(X) D ECD^DGLOCK1
    210  Q
    211  ;
    212 13 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    213 X13 D AAC1^DGLOCK2 S:DGAAC(1)']"" Y=361
    214  Q
    215 14 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".3;9",DV="*P35'X",DU="",DLB="AGENCY/ALLIED COUNTRY",DIFLD=.309
    216  S DU="DIC(35,"
    217  G RE
    218 X14 S DFN=DA D AAC^DGLOCK2
    219  Q
    220  ;
    221 15 D:$D(DG)>9 F^DIE17 G ^DGRPX77
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX75.m

    r613 r623  
    1 DGRPX75 ; ;12/13/08
    2  S X=DE(12),DIC=DIE
    3  ;
    4  S X=DE(12),DIC=DIE
    5  K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,2.2) I DIV(1)>0 S DIK(0)=DA,DIK="^DPT(DIV(0),""E"",",DA(1)=DIV(0),DA=DIV(1) D ^DIK S DA=DIK(0) K DIK
    6  S X=DE(12),DIC=DIE
    7  X "I $S('$D(^DIC(8,+X,0)):0,$P(^(0),""^"",1)[""DOM"":0,'$D(^DPT(DA,.36)):1,'$D(^DIC(8,+^(.36),0)):1,$P(^(0),""^"",1)'[""DOM"":1,1:0) S DGXRF=.361 D ^DGDDC Q"
    8  S X=DE(12),DIC=DIE
    9  K ^DPT("AEL",DA,+X)
    10  S X=DE(12),DIC=DIE
     1DGRPX75 ; ;12/27/07
     2 S X=DG(DQ),DIC=DIE
     3 X ^DD(2,.36235,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,1,1.4)
     4 S X=DG(DQ),DIC=DIE
     5 S DFN=DA D EN^DGMTCOR K DGMTCOR
     6 S X=DG(DQ),DIC=DIE
     7 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.36235,1,3,1.4)
     8 S X=DG(DQ),DIC=DIE
    119 D AUTOUPD^DGENA2(DA)
    12  S X=DE(12),DIIX=2_U_DIFLD D AUDIT^DIET
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX76.m

    r613 r623  
    1 DGRPX76 ; ;12/13/08
    2  S X=DG(DQ),DIC=DIE
    3  X "S DFN=DA D EN^DGMTR K DGREQF"
    4  S X=DG(DQ),DIC=DIE
    5  K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,89.4) S Y(102)=$S($D(^DPT(D0,"E",D1,0)):^(0),1:"") S X=$S('$D(^DIC(8,+$P(Y(102),U,1),0)):"",1:$P(^(0),U,1)) S D0=I(0,0) S D1=I(1,0) S DIU=X K Y S X=DIV S X=DIV,X=X X ^DD(2,.361,1,2,1.4)
    6  S X=DG(DQ),DIC=DIE
    7  ;
    8  S X=DG(DQ),DIC=DIE
    9  S ^DPT("AEL",DA,+X)=""
    10  S X=DG(DQ),DIC=DIE
    11  D AUTOUPD^DGENA2(DA)
    12  I $D(DE(12))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
     1DGRPX76 ; ;12/27/07
     2 S X=DE(12),DIC=DIE
     3 X ^DD(2,.3025,1,1,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,1,2.4)
     4 S X=DE(12),DIC=DIE
     5 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,2,2.4)
     6 S X=DE(12),DIC=DIE
     7 D EVENT^IVMPLOG(DA)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX77.m

    r613 r623  
    1 DGRPX77 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
    4  I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,3) S:%]"" DE(2)=%
    5  I $D(^("ODS")) S %Z=^("ODS") S %=$P(%Z,U,2) S:%]"" DE(4)=% S %=$P(%Z,U,3) S:%]"" DE(5)=%
    6  K %Z Q
    7  ;
    8 W W !?DL+DL-2,DLB_": "
    9  Q
    10 O D W W Y W:$X>45 !?9
    11  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    12  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    13 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    14  Q
    15 A K DQ(DQ) S DQ=DQ+1
    16 B G @DQ
    17 RE G PR:$D(DE(DQ)) D W,TR
    18 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    19 RD G QS:X?."?" I X["^" D D G ^DIE17
    20  I X="@" D D G Z^DIE2
    21  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    22 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    23  K DDER G X
    24 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    25  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    26  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    27 V D @("X"_DQ) K YS
    28 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    29 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    30  S X="?BAD"
    31 QS S DZ=X D D,QQ^DIEQ G B
    32 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    33 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    34 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    35 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    36  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    37  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    38 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    39 I I DV'["I",DV'["#" G RD
    40  D E^DIE0 G RD:$D(X),PR
    41  Q
    42 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    43  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    44  D ^DIR I 'DDER S %=Y(0),X=Y
    45  Q
    46 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    47  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    48  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    49  Q
    50 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    51 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    52 BEGIN S DNM="DGRPX77",DQ=1
    53 1 S D=0 K DE(1) ;361
    54  S DIFLD=361,DGO="^DGRPX78",DC="3^2.0361IP^E^",DV="2.0361M*P8'X",DW="0;1",DOW="ELIGIBILITY",DLB="Select "_DOW S:D DC=DC_D
    55  S DU="DIC(8,"
    56  G RE:D I $D(DSC(2.0361))#2,$P(DSC(2.0361),"I $D(^UTILITY(",1)="" X DSC(2.0361) S D=$O(^(0)) S:D="" D=-1 G M1
    57  S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
    58 M1 I D>0 S DC=DC_D I $D(^DPT(DA,"E",+D,0)) S DE(1)=$P(^(0),U,1)
    59  G RE
    60 R1 D DE
    61  S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),1:1) G 1+1
    62  ;
    63 2 S DW=".32;3",DV="*P21'Xa",DU="",DLB="PERIOD OF SERVICE",DIFLD=.323
    64  S DE(DW)="C2^DGRPX77"
    65  S DU="DIC(21,"
    66  G RE
    67 C2 G C2S:$D(DE(2))[0 K DB
    68  S X=DE(2),DIC=DIE
    69  K ^DPT("APOS",$E(X,1,30),DA)
    70  S X=DE(2),DIC=DIE
    71  ;
    72  S X=DE(2),DIC=DIE
    73  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
    74  S X=DE(2),DIC=DIE
    75  D EVENT^IVMPLOG(DA)
    76  S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
    77 C2S S X="" G:DG(DQ)=X C2F1 K DB
     1DGRPX77 ; ;12/27/07
    782 S X=DG(DQ),DIC=DIE
    79  S ^DPT("APOS",$E(X,1,30),DA)=""
     3 X ^DD(2,.3025,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,1,1.4)
    804 S X=DG(DQ),DIC=DIE
    81  X ^DD(2,.323,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,"ODS")):^("ODS"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y X ^DD(2,.323,1,2,1.1) X ^DD(2,.323,1,2,1.4)
    82  S X=DG(DQ),DIC=DIE
    83  I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
     5 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X='$$TOTCHK^DGLOCK2(DA) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.362)):^(.362),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X="" X ^DD(2,.3025,1,2,1.4)
    846 S X=DG(DQ),DIC=DIE
    857 D EVENT^IVMPLOG(DA)
    86  I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    87 C2F1 Q
    88 X2 S DFN=DA D POS^DGLOCK1
    89  Q
    90  ;
    91 3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    92 X3 D ^DGYZODS S:'DGODS Y="@704"
    93  Q
    94 4 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW="ODS;2",DV="S",DU="",DLB="RECALLED TO ACTIVE DUTY",DIFLD=11500.02
    95  S DE(DW)="C4^DGRPX77"
    96  S DU="0:NO;1:NATIONAL GUARD;2:RESERVES;"
    97  G RE
    98 C4 G C4S:$D(DE(4))[0 K DB
    99  S X=DE(4),DIC=DIE
    100  S A1B2TAG="PAT" D ^A1B2XFR
    101 C4S S X="" G:DG(DQ)=X C4F1 K DB
    102  S X=DG(DQ),DIC=DIE
    103  S A1B2TAG="PAT" D ^A1B2XFR
    104 C4F1 Q
    105 X4 Q
    106 5 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW="ODS;3",DV="*P25002.1'",DU="",DLB="RANK",DIFLD=11500.03
    107  S DE(DW)="C5^DGRPX77"
    108  S DU="DIC(25002.1,"
    109  G RE
    110 C5 G C5S:$D(DE(5))[0 K DB
    111  S X=DE(5),DIC=DIE
    112  S A1B2TAG="PAT" D ^A1B2XFR
    113 C5S S X="" G:DG(DQ)=X C5F1 K DB
    114  S X=DG(DQ),DIC=DIE
    115  S A1B2TAG="PAT" D ^A1B2XFR
    116 C5F1 Q
    117 X5 S DIC("S")="I '$P(^(0),""^"",4),(""^e^c^""[(""^""_$P(^(0),""^"",2)_""^""))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
    118  Q
    119  ;
    120 6 S DQ=7 ;@704
    121 7 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
    122 X7 S:DGDR'["704" Y="@99"
    123  Q
    124 8 D:$D(DG)>9 F^DIE17,DE S DQ=8,D=0 K DE(1) ;.3731
    125  S DIFLD=.3731,DGO="^DGRPX79",DC="2^2.05A^.373^",DV="2.05MFX",DW="0;1",DOW="SERVICE CONNECTED CONDITIONS",DLB="Select "_DOW S:D DC=DC_D
    126  G RE:D I $D(DSC(2.05))#2,$P(DSC(2.05),"I $D(^UTILITY(",1)="" X DSC(2.05) S D=$O(^(0)) S:D="" D=-1 G M8
    127  S D=$S($D(^DPT(DA,.373,0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
    128 M8 I D>0 S DC=DC_D I $D(^DPT(DA,.373,+D,0)) S DE(8)=$P(^(0),U,1)
    129  G RE
    130 R8 D DE
    131  S D=$S($D(^DPT(DA,.373,0)):$P(^(0),U,3,4),1:1) G 8+1
    132  ;
    133 9 S DQ=10 ;@99
    134 10 G 0^DIE17
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX78.m

    r613 r623  
    1 DGRPX78 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(D0,""E"",",DIC=DIE,DP=2.0361,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^DPT(D0,"E",DA,""))=""
    4  I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=%
    5  K %Z Q
    6  ;
    7 W W !?DL+DL-2,DLB_": "
    8  Q
    9 O D W W Y W:$X>45 !?9
    10  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    11  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    12 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    13  Q
    14 A K DQ(DQ) S DQ=DQ+1
    15 B G @DQ
    16 RE G PR:$D(DE(DQ)) D W,TR
    17 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    18 RD G QS:X?."?" I X["^" D D G ^DIE17
    19  I X="@" D D G Z^DIE2
    20  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    21 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    22  K DDER G X
    23 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    24  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    25  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    26 V D @("X"_DQ) K YS
    27 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    28 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    29  S X="?BAD"
    30 QS S DZ=X D D,QQ^DIEQ G B
    31 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    32 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    33 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    34 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    35  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    36  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    37 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    38 I I DV'["I",DV'["#" G RD
    39  D E^DIE0 G RD:$D(X),PR
    40  Q
    41 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    42  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    43  D ^DIR I 'DDER S %=Y(0),X=Y
    44  Q
    45 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    46  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    47  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    48  Q
    49 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    50 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    51 BEGIN S DNM="DGRPX78",DQ=1+D G B
    52 1 S DW="0;1",DV="M*P8'X#",DU="",DLB="ELIGIBILITY",DIFLD=.01
    53  S DE(DW)="C1^DGRPX78"
    54  S DU="DIC(8,"
    55  G RE:'D S DQ=2 G 2
    56 C1 G C1S:$D(DE(1))[0 K DB
    57  S X=DE(1),DIC=DIE
    58  K ^DPT(DA(1),"E","B",$E(X,1,30),DA)
    59  S X=DE(1),DIC=DIE
    60  K ^DPT("AEL",DA(1),+X)
    61  S X=DE(1),DIC=DIE
    62  D E32^VADPT62
    63  S X=DE(1),DIC=DIE
    64  X "S DFN=DA(1) D EN^DGMTR K DGREQF"
    65  S X=DE(1),DIC=DIE
    66  D AUTOUPD^DGENA2(DA(1))
    67 C1S S X="" G:DG(DQ)=X C1F1 K DB
    68  S X=DG(DQ),DIC=DIE
    69  S ^DPT(DA(1),"E","B",$E(X,1,30),DA)=""
    70  S X=DG(DQ),DIC=DIE
    71  S ^DPT("AEL",DA(1),+X)=""
    72  S X=DG(DQ),DIC=DIE
    73  D E31^VADPT62
    74  S X=DG(DQ),DIC=DIE
    75  X "S DFN=DA(1) D EN^DGMTR K DGREQF"
    76  S X=DG(DQ),DIC=DIE
    77  D AUTOUPD^DGENA2(DA(1))
    78 C1F1 Q
    79 X1 S DIC("S")="I '$P(^(0),U,7),$S($P(^(0),U,8):1,'$D(^DPT(D0,.36)):0,1:Y=+^(.36)),$$ELGCHK^DGRPTU(D0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X I $D(X) S DINUM=X
    80  Q
    81  ;
    82 2 G 1^DIE17
     1DGRPX78 ; ;12/27/07
     2 S X=DE(14),DIC=DIE
     3 X "S DFN=DA D EN^DGMTR K DGREQF"
     4 S X=DE(14),DIC=DIE
     5 D AUTOUPD^DGENA2(DA)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPX79.m

    r613 r623  
    1 DGRPX79 ; ;12/13/08
    2  D DE G BEGIN
    3 DE S DIE="^DPT(D0,.373,",DIC=DIE,DP=2.05,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^DPT(D0,.373,DA,""))=""
    4  I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=% S %=$P(%Z,U,2) S:%]"" DE(2)=%
    5  K %Z Q
    6  ;
    7 W W !?DL+DL-2,DLB_": "
    8  Q
    9 O D W W Y W:$X>45 !?9
    10  I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
    11  W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W "  (No Editing)" Q
    12 TR R X:DTIME E  S (DTOUT,X)=U W $C(7)
    13  Q
    14 A K DQ(DQ) S DQ=DQ+1
    15 B G @DQ
    16 RE G PR:$D(DE(DQ)) D W,TR
    17 N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
    18 RD G QS:X?."?" I X["^" D D G ^DIE17
    19  I X="@" D D G Z^DIE2
    20  I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W "  "_X
    21 T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I  W:'$D(DB(DQ)) "  "_% G V
    22  K DDER G X
    23 P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
    24  G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
    25  I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
    26 V D @("X"_DQ) K YS
    27 Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
    28 X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
    29  S X="?BAD"
    30 QS S DZ=X D D,QQ^DIEQ G B
    31 D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
    32 Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
    33 PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
    34 R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
    35  I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
    36  X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
    37 RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
    38 I I DV'["I",DV'["#" G RD
    39  D E^DIE0 G RD:$D(X),PR
    40  Q
    41 SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
    42  I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
    43  D ^DIR I 'DDER S %=Y(0),X=Y
    44  Q
    45 SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
    46  I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
    47  E  K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
    48  Q
    49 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
    50 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
    51 BEGIN S DNM="DGRPX79",DQ=1+D G B
    52 1 S DW="0;1",DV="MFX",DU="",DLB="SERVICE CONNECTED CONDITIONS",DIFLD=.01
    53  G RE:'D S DQ=2 G 2
    54 X1 K:$L(X)>30!($L(X)<1) X
    55  I $D(X),X'?.ANP K X
    56  Q
    57  ;
    58 2 S DW="0;2",DV="NJ3,0X",DU="",DLB="PERCENTAGE",DIFLD=.02
    59  G RE
    60 X2 K:+X'=X!(X>100)!(X<0)!(X?.E1"."1N.N) X
    61  Q
    62  ;
    63 3 G 1^DIE17
     1DGRPX79 ; ;12/27/07
     2 S X=DG(DQ),DIC=DIE
     3 X "S DFN=DA D EN^DGMTR K DGREQF"
     4 S X=DG(DQ),DIC=DIE
     5 D AUTOUPD^DGENA2(DA)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPXR.m

    r613 r623  
    1 DGRPXR ; GENERATED FROM 'DGRP COLLATERAL REGISTER' INPUT TEMPLATE(#422), FILE 2;12/13/08
     1DGRPXR ; GENERATED FROM 'DGRP COLLATERAL REGISTER' INPUT TEMPLATE(#422), FILE 2;12/10/01
    22 D DE G BEGIN
    33DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
     
    5555 M DIEZAR=^DIE(422,"AR") S DICRREC="TRIG^DIE17"
    5656 S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=422,U="^"
    57 1 S DW="VET;1",DV="SXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
     571 S DW="VET;1",DV="RSXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
    5858 S DE(DW)="C1^DGRPXR"
    5959 S DU="Y:YES;N:NO;"
     
    6666 S DFN=DA D EN^DGMTCOR K DGMTCOR
    6767 S X=DE(1),DIC=DIE
    68  S DFN=DA D EN^DGRP7CC
    69  S X=DE(1),DIC=DIE
    7068 ;
    7169 S X=DE(1),DIC=DIE
     
    7674 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    7775 S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
    78 C1S S X="" G:DG(DQ)=X C1F1 K DB
     76C1S S X="" Q:DG(DQ)=X K DB
    7977 S X=DG(DQ),DIC=DIE
    8078 S DFN=DA D EN^DGMTCOR K DGMTCOR
    81  S X=DG(DQ),DIC=DIE
    82  S DFN=DA D EN^DGRP7CC
    8379 S X=DG(DQ),DIC=DIE
    8480 X ^DD(2,1901,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X=DIV S X="N" X ^DD(2,1901,1,3,1.4)
     
    9086 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
    9187 I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    92 C1F1 Q
     88 Q
    9389X1 I $D(X) S:'$D(DPTX) DFN=DA D:'$D(^XUSEC("DG ELIGIBILITY",DUZ)) VAGE^DGLOCK:X="Y" I $D(X) D:$D(DFN) EV^DGLOCK
    9490 Q
     
    113109 D AUTOUPD^DGENA2(DA)
    114110 S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
    115 C2S S X="" G:DG(DQ)=X C2F1 K DB
     111C2S S X="" Q:DG(DQ)=X K DB
    116112 S X=DG(DQ),DIC=DIE
    117113 X "S DFN=DA D EN^DGMTR K DGREQF"
     
    125121 D AUTOUPD^DGENA2(DA)
    126122 I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    127 C2F1 Q
     123 Q
    128124X2 Q
    1291253 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".32;3",DV="*P21'Xa",DU="",DLB="PERIOD OF SERVICE",DIFLD=.323
     
    141137 S X=DE(3),DIC=DIE
    142138 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
    143  S X=DE(3),DIC=DIE
    144  D EVENT^IVMPLOG(DA)
    145139 S X=DE(3),DIIX=2_U_DIFLD D AUDIT^DIET
    146 C3S S X="" G:DG(DQ)=X C3F1 K DB
     140C3S S X="" Q:DG(DQ)=X K DB
    147141 S X=DG(DQ),DIC=DIE
    148142 S ^DPT("APOS",$E(X,1,30),DA)=""
     
    151145 S X=DG(DQ),DIC=DIE
    152146 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
    153  S X=DG(DQ),DIC=DIE
    154  D EVENT^IVMPLOG(DA)
    155147 I $D(DE(3))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
    156 C3F1 Q
     148 Q
    157149X3 S DFN=DA D POS^DGLOCK1
    158150 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRUGA01.m

    r613 r623  
    1 DGRUGA01        ;ALB/GRR - HL7 ADT A01 MESSAGE BUILDER ; 11/27/07 1:43pm
    2         ;;5.3;Registration;**190,303,762**;Aug 13, 1993;Build 3
    3         ;
    4         ;This routine will build a ADT A01 (Admit) HL7 message for an inpatient.
    5         ;
    6 EN(DFN,DGMIEN,DGARRAY)  ;Entry point of routine
    7         ;DFN - Patient Internal Entry Number
    8         ;DGMIEN - Patient Movement Internal Entry Number
    9         ;DGARRAY - Name of output array by reference where built message will be contained.
    10         ;
    11         ;The HL7 variables must be initialized before calling this routine!
    12         ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
    13         ;
    14         N DGPV1,DGHOLD,DGCNT,DGMDT,DGCDT,DGOADT,DGZEL,DGICD,DGICDCNT,DGIN,DGIN1,DGRB,DGW,DGINCNT S DGCNT=0
    15         Q:DGARRAY=""  ;Required output variable name was not passed
    16         K @DGARRAY ;Kill output array to insure erroneous data does not exist
    17         Q:DGMIEN=""
    18         S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
    19         D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
    20         S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
    21         S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A01","05",DGMDT) ;Create Event segment and store in output array
    22         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    23         S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
    24         S DGHOLD=$$EN^VAFHLNK1(DFN,DGMIEN,",2,3,4,5,") ;Create the NK1 segment using the segment sequence numbers passed, and store in output array
    25         I DGHOLD]"" S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGHOLD
    26         S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
    27         S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,",$G(DGMIEN),"","") ;Create the PV1 segment based on sequence numbers passed, and store in output array
    28         S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;Check if integrated site and get original admit date
    29         ;Check if doing data seed of RAI/MDS machine
    30         I $G(DGSEED)=1 D
    31         .N VAIP,DGPCPNM,DGPCPPTR,DGWPTR,DGRBPTR,DGWTRAN,DGRBTRAN
    32         .D IN5^VADPT
    33         .;Put current Primary Care Physician into PV1 segment
    34         .S DGPCPPTR=+$G(VAIP(7))
    35         .S DGPCPNM=$$HLNAME^HLFNC($P($G(VAIP(7)),"^",2))
    36         .S:DGPCPNM="" DGPCPNM=HL("Q")
    37         .S $P(DGPV1,HL("FS"),8)=DGPCPPTR_$E(HL("ECH"))_DGPCPNM
    38         .K ATTDOC S ATTDOC=$$ATTDOC^DGRUUTL(.ATTDOC) S $P(DGPV1,HL("FS"),18)=ATTDOC K ATTDOC ; P-762
    39         .;Get current ward & room/bed
    40         .S DGW=$$GET1^DIQ(2,DFN,.1,"I")
    41         .S DGRB=$$GET1^DIQ(2,DFN,.101,"I")
    42         .;Convert ward & room/bed to pointers
    43         .S DGWPTR=$$FIND1^DIC(42,,"XQ",DGW)
    44         .S DGRBPTR=$$FIND1^DIC(405.4,,"XQ",DGRB)
    45         .;Translate ward & room/bed
    46         .S DGWTRAN=$$WARDTRAN^DGRUUTL1(DGWPTR,DGW)
    47         .S DGRBTRAN=$$RBTRAN^DGRUUTL1(DGRBPTR,DGRB)
    48         .;Put translated ward & room/bed into PV1 segment
    49         .S $P(DGPV1,HL("FS"),4)=DGWTRAN_$E(HL("ECH"))_$P(DGRBTRAN,"-")_$E(HL("ECH"))_$P(DGRBTRAN,"-",2)
    50         I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT) S $P(@DGARRAY@(1),HL("FS"),7)=$$HLDATE^HLFNC(DGOADT)
    51         S DGPV1=$$DOCID^DGRUUTL(DGPV1)
    52         K ATTDOC S ATTDOC=$$ATTDOC^DGRUUTL(.ATTDOC) S $P(DGPV1,HL("FS"),18)=ATTDOC K ATTDOC ; P-762
    53         ;TRANSLATE WARD AND ROOM-BED NAMES IF NEEDED (ALREADY DONE IF SEEDING)
    54         S:'$G(DGSEED) DGPV1=$$LOCTRAN^DGRUUTL1(DGPV1)
    55         S @DGARRAY@(DGCNT)=DGPV1
    56         S DGCNT=DGCNT+1 ;Increment node counter to store next segment
    57         S @DGARRAY@(DGCNT)=$$EN^VAFHLPV2(DFN,DGMIEN,",3,") ;Create PV2 segment
    58         D IN^VAFHLDG1(DFN,DGMIEN,",2,3,5,","DGICD",DGMDT) ;Create the DG1 segment(s) and store in a temporary array
    59         I $O(DGICD(0))>0 D  ;DG1 segment were built
    60         .S DGICDCNT=0 F  S DGICDCNT=$O(DGICD(DGICDCNT)) Q:DGICDCNT=""  S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGICD(DGICDCNT,0) ;Loop through temporary array and store DG1 segment(s) in output array
    61         S DGIN1=$$IN1^DGRUUTL1(DFN)
    62         S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGIN1
    63         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    64         S @DGARRAY@(DGCNT)=$$EN^VAFHLIN2(DFN,DGMIEN,",2,3,6,8,") ;Create and store IN2 segment in output array
    65         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    66         S DGZEL=$$EN^VAFHLZEL(DFN,",1,8,",1) ;Create ZEL segment (only primary eligibility - param 3 = 1)
    67         I $P(DGZEL,HL("FS"),9)'=0&($P(DGZEL,HL("FS"),9)'=1) S $P(DGZEL,HL("FS"),9)=1 ;stuff patient as veteran
    68         S @DGARRAY@(DGCNT)=DGZEL
    69         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    70         S @DGARRAY@(DGCNT)=$$EN^VAFHLZEM(DFN,",1,5,",1,1) ;Create ZEM segment for Patient (param 3 = 1)
    71         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    72         S @DGARRAY@(DGCNT)=$$EN^VAFHLZEN(DFN,",1,9,",1,"",HL("FS")) ;Create ZEN segment and add to message array
    73         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    74         S @DGARRAY@(DGCNT)=$$EN^VAFHLZMH(DFN,DGMIEN,",4,") ;Create the ZMH segment and store in the output array
    75         Q
     1DGRUGA01 ;ALB/GRR - HL7 ADT A01 MESSAGE BUILDER ;06/08/99
     2 ;;5.3;Registration;**190,303**;Aug 13, 1993
     3 ;
     4 ;This routine will build a ADT A01 (Admit) HL7 message for an inpatient.
     5 ;
     6EN(DFN,DGMIEN,DGARRAY) ;Entry point of routine
     7 ;DFN - Patient Internal Entry Number
     8 ;DGMIEN - Patient Movement Internal Entry Number
     9 ;DGARRAY - Name of output array by reference where built message will be contained.
     10 ;
     11 ;The HL7 variables must be initialized before calling this routine!
     12 ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
     13 ;
     14 N DGPV1,DGHOLD,DGCNT,DGMDT,DGCDT,DGOADT,DGZEL,DGICD,DGICDCNT,DGIN,DGIN1,DGRB,DGW,DGINCNT S DGCNT=0
     15 Q:DGARRAY=""  ;Required output variable name was not passed
     16 K @DGARRAY ;Kill output array to insure erroneous data does not exist
     17 Q:DGMIEN=""
     18 S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
     19 D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
     20 S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
     21 S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A01","05",DGMDT) ;Create Event segment and store in output array
     22 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     23 S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
     24 S DGHOLD=$$EN^VAFHLNK1(DFN,DGMIEN,",2,3,4,5,") ;Create the NK1 segment using the segment sequence numbers passed, and store in output array
     25 I DGHOLD]"" S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGHOLD
     26 S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
     27 S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,",$G(DGMIEN),"","") ;Create the PV1 segment based on sequence numbers passed, and store in output array
     28 S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;Check if integrated site and get original admit date
     29 ;Check if doing data seed of RAI/MDS machine
     30 I $G(DGSEED)=1 D
     31 .N VAIP,DGPCPNM,DGPCPPTR,DGWPTR,DGRBPTR,DGWTRAN,DGRBTRAN
     32 .D IN5^VADPT
     33 .;Put current Primary Care Physician into PV1 segment
     34 .S DGPCPPTR=+$G(VAIP(7))
     35 .S DGPCPNM=$$HLNAME^HLFNC($P($G(VAIP(7)),"^",2))
     36 .S:DGPCPNM="" DGPCPNM=HL("Q")
     37 .S $P(DGPV1,HL("FS"),8)=DGPCPPTR_$E(HL("ECH"))_DGPCPNM
     38 .;Get current ward & room/bed
     39 .S DGW=$$GET1^DIQ(2,DFN,.1,"I")
     40 .S DGRB=$$GET1^DIQ(2,DFN,.101,"I")
     41 .;Convert ward & room/bed to pointers
     42 .S DGWPTR=$$FIND1^DIC(42,,"XQ",DGW)
     43 .S DGRBPTR=$$FIND1^DIC(405.4,,"XQ",DGRB)
     44 .;Translate ward & room/bed
     45 .S DGWTRAN=$$WARDTRAN^DGRUUTL1(DGWPTR,DGW)
     46 .S DGRBTRAN=$$RBTRAN^DGRUUTL1(DGRBPTR,DGRB)
     47 .;Put translated ward & room/bed into PV1 segment
     48 .S $P(DGPV1,HL("FS"),4)=DGWTRAN_$E(HL("ECH"))_$P(DGRBTRAN,"-")_$E(HL("ECH"))_$P(DGRBTRAN,"-",2)
     49 I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT) S $P(@DGARRAY@(1),HL("FS"),7)=$$HLDATE^HLFNC(DGOADT)
     50 S DGPV1=$$DOCID^DGRUUTL(DGPV1)
     51 ;TRANSLATE WARD AND ROOM-BED NAMES IF NEEDED (ALREADY DONE IF SEEDING)
     52 S:'$G(DGSEED) DGPV1=$$LOCTRAN^DGRUUTL1(DGPV1)
     53 S @DGARRAY@(DGCNT)=DGPV1
     54 S DGCNT=DGCNT+1 ;Increment node counter to store next segment
     55 S @DGARRAY@(DGCNT)=$$EN^VAFHLPV2(DFN,DGMIEN,",3,") ;Create PV2 segment
     56 D IN^VAFHLDG1(DFN,DGMIEN,",2,3,5,","DGICD",DGMDT) ;Create the DG1 segment(s) and store in a temporary array
     57 I $O(DGICD(0))>0 D  ;DG1 segment were built
     58 .S DGICDCNT=0 F  S DGICDCNT=$O(DGICD(DGICDCNT)) Q:DGICDCNT=""  S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGICD(DGICDCNT,0) ;Loop through temporary array and store DG1 segment(s) in output array
     59 S DGIN1=$$IN1^DGRUUTL1(DFN)
     60 S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGIN1
     61 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     62 S @DGARRAY@(DGCNT)=$$EN^VAFHLIN2(DFN,DGMIEN,",2,3,6,8,") ;Create and store IN2 segment in output array
     63 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     64 S DGZEL=$$EN^VAFHLZEL(DFN,",1,8,",1) ;Create ZEL segment (only primary eligibility - param 3 = 1)
     65 I $P(DGZEL,HL("FS"),9)'=0&($P(DGZEL,HL("FS"),9)'=1) S $P(DGZEL,HL("FS"),9)=1 ;stuff patient as veteran
     66 S @DGARRAY@(DGCNT)=DGZEL
     67 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     68 S @DGARRAY@(DGCNT)=$$EN^VAFHLZEM(DFN,",1,5,",1,1) ;Create ZEM segment for Patient (param 3 = 1)
     69 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     70 S @DGARRAY@(DGCNT)=$$EN^VAFHLZEN(DFN,",1,9,",1,"",HL("FS")) ;Create ZEN segment and add to message array
     71 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     72 S @DGARRAY@(DGCNT)=$$EN^VAFHLZMH(DFN,DGMIEN,",4,") ;Create the ZMH segment and store in the output array
     73 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRUGA08.m

    r613 r623  
    1 DGRUGA08        ;ALB/GRR - HL7 ADT A08 MESSAGE BUILDER ; 10/11/07 9:24am
    2         ;;5.3;Registration;**190,312,328,721,762**;Aug 13, 1993;Build 3
    3         ;
    4         ;This routine will build a ADT A08 (Patient Update) HL7 message for an inpatient.
    5         ;
    6 EN(DFN,DGMIEN,DGARRAY,DGDC,DGSSNC)      ;Entry point of routine
    7         ;DFN - Patient Internal Entry Number
    8         ;DGMIEN - Patient Movement Internal Entry Number
    9         ;DGARRAY - Name of output array by reference where built message will be contained.
    10         ;DGDC - date type~prior date (date type is A, T, or D) (Required for date change only) [Optional]
    11         ;DGSSNC - Prior SSN (Required for SSN Change only) [Optional]
    12         ;
    13         ;The HL7 variables must be initialized before calling this routine!
    14         ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
    15         ;
    16         N DGPV1,DGHOLD,DGCNT,DGMDT,DGCDT,DGOADT,DGIN1,DGLMT,DGZEL,DGICD,DGICDCNT,DGIN,DGINCNT S DGCNT=0
    17         Q:DGARRAY=""  ;Required output variable name was not passed
    18         K @DGARRAY ;Kill output array to insure erroneous data does not exist
    19         I DGMIEN="" N VAIP D NOW^%DTC S VAIP("D")=% D IN5^VADPT S DGMIEN=$G(VAIP(1)) K VAIP Q:DGMIEN=""  ;changed p-328
    20         D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
    21         S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
    22         S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
    23         S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A08","05",DGMDT) ;Create Event segment and store in output array
    24         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    25         S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
    26         S DGHOLD=$$EN^VAFHLNK1(DFN,DGMIEN,",2,3,4,5,") ;Create the NK1 segment using the segment sequence numbers passed, and store in output array
    27         I DGHOLD]"" S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGHOLD
    28         S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
    29         S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,45,",DGMIEN,"","") ;Create the PV1 segment based on sequence numbers passed
    30         S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;check if integrated site get original admit date/time
    31         I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT)
    32         S DGPV1=$$DOCID^DGRUUTL(DGPV1)
    33         I $G(DGLMT)=1,$E($G(DGDC))="D" S $P(DGPV1,HL("FS"),4)=$P(DGPV1,HL("FS"),7) ;This is a change to a prior HL7, move prior location to current
    34         N VAIP D IN5^VADPT S $P(DGPV1,HL("FS"),11)=$$GET1^DIQ(45.7,+VAIP(8),1,"I") K VAIP ; p-721
    35         K ATTDOC S ATTDOC=$$ATTDOC^DGRUUTL(.ATTDOC) S $P(DGPV1,HL("FS"),18)=ATTDOC K ATTDOC ; P-762
    36         S @DGARRAY@(DGCNT)=$$LOCTRAN^DGRUUTL1(DGPV1)
    37         S DGCNT=DGCNT+1 ;Increment node counter to store next segment
    38         S @DGARRAY@(DGCNT)=$$EN^VAFHLPV2(DFN,DGMIEN,",3,") ;Create PV2 segment
    39         D IN^VAFHLDG1(DFN,DGMIEN,",2,3,5,","DGICD") ;Create the DG1 segment(s) and store in a temporary array
    40         I $O(DGICD(0))>0 D  ;DG1 segment were built
    41         .S DGICDCNT=0 F  S DGICDCNT=$O(DGICD(DGICDCNT)) Q:DGICDCNT=""  S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGICD(DGICDCNT,0) ;Loop through temporary array and store DG1 segment(s) in output array
    42         S DGIN1=$$IN1^DGRUUTL1(DFN)
    43         S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGIN1
    44         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    45         S @DGARRAY@(DGCNT)=$$EN^VAFHLIN2(DFN,DGMIEN,",2,3,6,8,") ;Create and store IN2 segment in output array
    46         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    47         S DGZEL=$$EN^VAFHLZEL(DFN,",1,8,",1) ;Create ZEL segment (only primary eligibility - param 3 = 1)
    48         I $P(DGZEL,HL("FS"),9)'=0&($P(DGZEL,HL("FS"),9)'=1) S $P(DGZEL,HL("FS"),9)=1 ;stuff patient as veteran
    49         S @DGARRAY@(DGCNT)=DGZEL
    50         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    51         S @DGARRAY@(DGCNT)=$$EN^VAFHLZEM(DFN,",1,5,",1,1) ;Create ZEM segment for Patient (param 3 = 1)
    52         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    53         S @DGARRAY@(DGCNT)=$$EN^VAFHLZEN(DFN,",1,9,",1,"",HL("FS")) ;Create ZEN segment and add to message array
    54         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    55         S @DGARRAY@(DGCNT)=$$EN^VAFHLZMH(DFN,DGMIEN,",4,") ;Create the ZMH segment and store in the output array
    56         S DGDC=$G(DGDC),DGSSNC=$G(DGSSNC)
    57         I DGDC]""!(DGSSNC]"") D  ;date or ssn change
    58         .I DGDC]""&'("ADT"[$E(DGDC)) Q
    59         .S DGCNT=DGCNT+1
    60         .S @DGARRAY@(DGCNT)=$$EN^DGRUGZDC(DFN,DGDC,DGSSNC,DGMDT)
    61         Q
     1DGRUGA08 ;ALB/GRR - HL7 ADT A08 MESSAGE BUILDER ; 21 Sep 2006  8:24 AM
     2 ;;5.3;Registration;**190,312,328,721**;Aug 13, 1993;Build 3
     3 ;
     4 ;This routine will build a ADT A08 (Patient Update) HL7 message for an inpatient.
     5 ;
     6EN(DFN,DGMIEN,DGARRAY,DGDC,DGSSNC) ;Entry point of routine
     7 ;DFN - Patient Internal Entry Number
     8 ;DGMIEN - Patient Movement Internal Entry Number
     9 ;DGARRAY - Name of output array by reference where built message will be contained.
     10 ;DGDC - date type~prior date (date type is A, T, or D) (Required for date change only) [Optional]
     11 ;DGSSNC - Prior SSN (Required for SSN Change only) [Optional]
     12 ;
     13 ;The HL7 variables must be initialized before calling this routine!
     14 ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
     15 ;
     16 N DGPV1,DGHOLD,DGCNT,DGMDT,DGCDT,DGOADT,DGIN1,DGLMT,DGZEL,DGICD,DGICDCNT,DGIN,DGINCNT S DGCNT=0
     17 Q:DGARRAY=""  ;Required output variable name was not passed
     18 K @DGARRAY ;Kill output array to insure erronuous data does not exist
     19 I DGMIEN="" N VAIP D NOW^%DTC S VAIP("D")=% D IN5^VADPT S DGMIEN=$G(VAIP(1)) K VAIP Q:DGMIEN=""  ;changed p-328
     20 D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
     21 S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
     22 S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
     23 S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A08","05",DGMDT) ;Create Event segment and store in output array
     24 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     25 S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
     26 S DGHOLD=$$EN^VAFHLNK1(DFN,DGMIEN,",2,3,4,5,") ;Create the NK1 segment using the segment sequence numbers passed, and store in output array
     27 I DGHOLD]"" S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGHOLD
     28 S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
     29 S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,45,",DGMIEN,"","") ;Create the PV1 segment based on sequence numbers passed
     30 S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;check if integrated site get original admit date/time
     31 I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT)
     32 S DGPV1=$$DOCID^DGRUUTL(DGPV1)
     33 I $G(DGLMT)=1,$E($G(DGDC))="D" S $P(DGPV1,HL("FS"),4)=$P(DGPV1,HL("FS"),7) ;This is a change to a prior HL7, move prior location to current
     34 N VAIP D IN5^VADPT S $P(DGPV1,HL("FS"),11)=$$GET1^DIQ(45.7,+VAIP(8),1,"I") K VAIP ; p-721
     35 S @DGARRAY@(DGCNT)=$$LOCTRAN^DGRUUTL1(DGPV1)
     36 S DGCNT=DGCNT+1 ;Increment node counter to store next segment
     37 S @DGARRAY@(DGCNT)=$$EN^VAFHLPV2(DFN,DGMIEN,",3,") ;Create PV2 segment
     38 D IN^VAFHLDG1(DFN,DGMIEN,",2,3,5,","DGICD") ;Create the DG1 segment(s) and store in a temporary array
     39 I $O(DGICD(0))>0 D  ;DG1 segment were built
     40 .S DGICDCNT=0 F  S DGICDCNT=$O(DGICD(DGICDCNT)) Q:DGICDCNT=""  S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGICD(DGICDCNT,0) ;Loop through temporary array and store DG1 segment(s) in output array
     41 S DGIN1=$$IN1^DGRUUTL1(DFN)
     42 S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGIN1
     43 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     44 S @DGARRAY@(DGCNT)=$$EN^VAFHLIN2(DFN,DGMIEN,",2,3,6,8,") ;Create and store IN2 segment in output array
     45 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     46 S DGZEL=$$EN^VAFHLZEL(DFN,",1,8,",1) ;Create ZEL segment (only primary eligibility - param 3 = 1)
     47 I $P(DGZEL,HL("FS"),9)'=0&($P(DGZEL,HL("FS"),9)'=1) S $P(DGZEL,HL("FS"),9)=1 ;stuff patient as veteran
     48 S @DGARRAY@(DGCNT)=DGZEL
     49 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     50 S @DGARRAY@(DGCNT)=$$EN^VAFHLZEM(DFN,",1,5,",1,1) ;Create ZEM segment for Patient (param 3 = 1)
     51 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     52 S @DGARRAY@(DGCNT)=$$EN^VAFHLZEN(DFN,",1,9,",1,"",HL("FS")) ;Create ZEN segment and add to message array
     53 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     54 S @DGARRAY@(DGCNT)=$$EN^VAFHLZMH(DFN,DGMIEN,",4,") ;Create the ZMH segment and store in the output array
     55 S DGDC=$G(DGDC),DGSSNC=$G(DGSSNC)
     56 I DGDC]""!(DGSSNC]"") D  ;date or ssn change
     57 .I DGDC]""&'("ADT"[$E(DGDC)) Q
     58 .S DGCNT=DGCNT+1
     59 .S @DGARRAY@(DGCNT)=$$EN^DGRUGZDC(DFN,DGDC,DGSSNC,DGMDT)
     60 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRUGA22.m

    r613 r623  
    1 DGRUGA22        ;ALB/GRR - HL7 ADT A22 MESSAGE BUILDER ; 11/7/07 3:45pm
    2         ;;5.3;Registration;**190,762**;Aug 13, 1993;Build 3
    3         ;
    4         ;This routine will build a ADT A22 (From Leave of Absence) HL7 message for an inpatient.
    5         ;
    6 EN(DFN,DGMIEN,DGARRAY)  ;Entry point of routine
    7         ;DFN - Patient Internal Entry Number
    8         ;DGMIEN - Patient Movement Internal Entry Number
    9         ;DGARRAY - Name of output array by reference where built message will be contained.
    10         ;
    11         ;The HL7 variables must be initialized before calling this routine!
    12         ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
    13         ;
    14         N DGPV1,DGCNT,DGMDT,DGCDT,DGOADT,DGICD,DGICDCNT,DGIN,DGINCNT S DGCNT=0
    15         Q:DGARRAY=""  ;Required output variable name was not passed
    16         K @DGARRAY ;Kill output array to insure erroneous data does not exist
    17         Q:DGMIEN=""
    18         S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
    19         D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
    20         S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
    21         S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A22","05",DGMDT) ;Create Event segment and store in output array
    22         S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
    23         S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
    24         S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I") ;Retrieve Movement Date/Time
    25         S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
    26         S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,",$G(DGMIEN),"","") ;Create the PV1 segment based on sequence numbers passed
    27         S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;check if integrated site get original admit date/time
    28         I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT)
    29         S DGPV1=$$DOCID^DGRUUTL(DGPV1)
    30         N VAIP,DGW,DGRM D IN5^VADPT S DGW=$P(VAIP(5),"^",2),DGRM=$P(VAIP(6),"^",2),$P(DGPV1,HL("FS"),4)=DGW_$E(HLECH)_DGRM K VAIP ; P-762
    31         S @DGARRAY@(DGCNT)=$$LOCTRAN^DGRUUTL1(DGPV1) ;Translate Ward and Room-Bed name, store into array
    32         S DGMTYP=$$GET1^DIQ(405,DGMIEN,.18,"I") ;Get Movement Type
    33         I DGMTYP=14!(DGMTYP=41) S $P(@DGARRAY@(DGCNT),HL("FS"),41)="H" ;If From ASIH flag bed status field as 'H'
    34         Q
     1DGRUGA22 ;ALB/GRR - HL7 ADT A22 MESSAGE BUILDER ;8/5/99  15:36
     2 ;;5.3;Registration;**190**;Aug 13, 1993
     3 ;
     4 ;This routine will build a ADT A22 (From Leave of Absence) HL7 message for an inpatient.
     5 ;
     6EN(DFN,DGMIEN,DGARRAY) ;Entry point of routine
     7 ;DFN - Patient Internal Entry Number
     8 ;DGMIEN - Patient Movement Internal Entry Number
     9 ;DGARRAY - Name of output array by reference where built message will be contained.
     10 ;
     11 ;The HL7 variables must be initialized before calling this routine!
     12 ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
     13 ;
     14 N DGPV1,DGCNT,DGMDT,DGCDT,DGOADT,DGICD,DGICDCNT,DGIN,DGINCNT S DGCNT=0
     15 Q:DGARRAY=""  ;Required output variable name was not passed
     16 K @DGARRAY ;Kill output array to insure erronuous data does not exist
     17 Q:DGMIEN=""
     18 S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
     19 D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
     20 S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
     21 S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A22","05",DGMDT) ;Create Event segment and store in output array
     22 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
     23 S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
     24 S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I") ;Retrieve Movement Date/Time
     25 S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
     26 S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,",$G(DGMIEN),"","") ;Create the PV1 segment based on sequence numbers passed
     27 S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;check if integrated site get original admit date/time
     28 I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT)
     29 S DGPV1=$$DOCID^DGRUUTL(DGPV1)
     30 S @DGARRAY@(DGCNT)=$$LOCTRAN^DGRUUTL1(DGPV1) ;Translate Ward and Room-Bed name, store into array
     31 S DGMTYP=$$GET1^DIQ(405,DGMIEN,.18,"I") ;Get Movement Type
     32 I DGMTYP=14!(DGMTYP=41) S $P(@DGARRAY@(DGCNT),HL("FS"),41)="H" ;If From ASIH flag bed status field as 'H'
     33 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRUGBJ.m

    r613 r623  
    1 DGRUGBJ ; ALB/SCK - RAI/MDS COTS ADT Background job ; 11/7/07 3:49pm
    2         ;;5.3;Registration;**190,312,357,762**;Aug 13, 1993;Build 3
    3         ;
    4 EN      ; Main Entry point for patient demographic update to COTS system
    5         ;
    6         L +^XTMP("ADT/HL7 MDS COTS UPDATE"):3 E  Q
    7         ;
    8         ; Check for HL7 send parameter
    9         Q:'$P($$SEND^VAFHUTL(),"^",2)
    10         ;
    11         ; Look for patient demographic changes monitored by the COTS system
    12         N PVTPTR,DGNODE,DFN,DGDATE,DGARRAY,DGUSR,DGRSLT
    13         ;
    14         S DGARRAY="^TMP(""DGRAI"",""EVNTINFO"","_$J_")"
    15         K @DGARRAY
    16         ;
    17         ; Begin looking for entries needing transmission with a type of "COTS UPDATE", Code 6.
    18         S PVTPTR=0
    19         F  S PVTPTR=+$O(^VAT(391.71,"AXMIT",6,PVTPTR)) Q:('PVTPTR)  D
    20         . ; If no entry for xref (out of sync) delete the xref and quit
    21         . I ('$D(^VAT(391.71,PVTPTR))) K ^VAT(391.71,"AXMIT",6,PVTPTR) Q
    22         . ; Get event date and pointer to patient for entry
    23         . S DGNODE=$G(^VAT(391.71,PVTPTR,0))
    24         . S DFN=+$P(DGNODE,"^",3)
    25         . S EVNTDT=+DGNODE
    26         . ; Check for patient, if not valid, then mark as transmitted and quit
    27         . I ('$D(^DPT(DFN,0))) D XMITFLAG^VAFCDD01(PVTPTR,"",1) Q
    28         . N VAIN D INP^VADPT ; p-762
    29         . I '$$CHKWARD^DGRUUTL(+VAIN(4)) D XMITFLAG^VAFCDD01(PVTPTR,"",1) K VAIN Q  ; P-762
    30         . K @DGARRAY
    31         . S @DGARRAY@("PIVOT")=PVTPTR
    32         . S @DGARRAY@("REASON",1)=""
    33         . I (+$G(^DPT(DFN,.35))) S @DGARRAY@("REASON",1)=99
    34         . ;
    35         . S @DGARRAY@("USER")=$$GET1^DIQ(200,+$P(DGNODE,"^",9),.01)
    36         . ;
    37         . S @DGARRAY@("EVENT-NUM")=$P(DGNODE,"^",2)
    38         . S @DGARRAY@("VAR-PTR")=$P(DGNODE,"^",5)
    39         . ;
    40         . S DGRSLT=$$BLDA08(DFN,EVNTDT,DGARRAY)
    41         . I (DGRSLT<0) D ERRBUL(DGARRAY,DGRSLT) ;deleted Q p-357
    42         . ;
    43         . ; Mark entry in pivot file as transmitted
    44         . D XMITFLAG^VAFCDD01(PVTPTR,"",1)
    45         ;
    46         L -^XTMP("ADT/HL7 MDS COTS UPDATE")
    47         Q
    48         ;
    49 BLDA08(DFN,EVNTDT,EVNTINFO,DGDC,DGOSSN) ;
    50         ;
    51         N RESULT,DGTMP,GLOREF
    52         ;
    53         S DFN=+$G(DFN)
    54         I ('$D(^DPT(DFN,0))) S RESULT="-1^Could not find entry in PATIENT file" G BLDQ
    55         ;
    56         S DGDC=$G(DGDC)
    57         S DGOSSN=$G(DGOSSN)
    58         S EVNTDT=$G(EVNTDT)
    59         S:('EVNTDT) EVNTDT=$$NOW^XLFDT
    60         ;
    61         S GLOREF="^TMP(""HLS"","_$J_")"
    62         K @GLOREF
    63         ;
    64         S @EVNTINFO@("DFN")=DFN
    65         S @EVNTINFO@("EVENT")="A08"
    66         S @EVNTINFO@("DATE")=EVNTDT
    67         ;
    68         N HLEID,HL,HLFS,HLECH,HLQ,NDX
    69         ;
    70         K HL
    71         D INIT^HLFNC2("DGRU-PATIENT-A08-SERVER",.HL)
    72         ;
    73         I ($O(HL(""))']"") S RESULT="-1^Server Protocol not found" G BLDQ
    74         ;
    75         ; Build segment array
    76         D EN^DGRUGA08(DFN,"","DGTMP",DGDC,DGOSSN)
    77         I '$O(DGTMP(0)) S RESULT="-1^Unable to build segment list to transmit" G BLDQ
    78         ;Check segment list for errors
    79         S NDX=0
    80         F  S NDX=$O(DGTMP(NDX)) Q:'NDX  D  G:(+$G(RESULT)<0) BLDQ
    81         . I +DGTMP(NDX)<0 S RESULT="-1^An error occurred in one of the segments"
    82         ;
    83         M @GLOREF=DGTMP
    84         S RESULT=$$SENDMSG(GLOREF)
    85         I +$P(RESULT,"^",2)>0 S RESULT="-1^"_$P(RESULT,"^",2,3)
    86 BLDQ    Q $G(RESULT)
    87         ;
    88 SENDMSG(GLOREF) ; Transmit the HL7 message
    89         N HLA,HLRST
    90         M HLA("HLS")=@GLOREF
    91         I $D(HLA("HLS")) D
    92         . D GENERATE^HLMA("DGRU-PATIENT-A08-SERVER","LM",1,.HLRST,"")
    93         K HLA,HERR
    94         Q (HLRST)
    95         ;
    96 ERRBUL(EVNTINFO,RESULT) ; Generate bulletin if an error occurred while building the HL7 message.
    97         ;
    98         N XMY,XMDUZ,XMDT,XMZ,XMB,XMCHAN,XMSUB
    99         ;
    100         S XMCHAN=1
    101         S XMSUB="RAI/MDS HL7 BUILD ERROR"
    102         S (XMDUZ,XMDUZ)="RAI/MDS APPLICATION"
    103         ;
    104         S XMB="DGRU RAI ERROR"
    105         S XMB(1)=$$GET1^DIQ(2,@EVNTINFO@("DFN"),.01)
    106         S XMB(2)=@EVNTINFO@("EVENT")
    107         S XMB(3)=">>> "_$P(RESULT,"^",2)
    108         S XMB(4)=@EVNTINFO@("USER")
    109         S XMB(5)=$$FMTE^XLFDT(@EVNTINFO@("DATE"))
    110         S XMDT=DT
    111         D ^XMB
    112         Q
     1DGRUGBJ ; ALB/SCK - RAI/MDS COTS ADT Background job ; 8-10-99
     2 ;;5.3;Registration;**190,312,357**;Aug 13, 1993
     3 ;
     4EN ; Main Entry point for patient demographic update to COTS system
     5 ;
     6 L +^XTMP("ADT/HL7 MDS COTS UPDATE"):3 E  Q
     7 ;
     8 ; Check for HL7 send parameter
     9 Q:'$P($$SEND^VAFHUTL(),"^",2)
     10 ;
     11 ; Look for patient demographic changes monitored by the COTS system
     12 N PVTPTR,DGNODE,DFN,DGDATE,DGARRAY,DGUSR,DGRSLT
     13 ;
     14 S DGARRAY="^TMP(""DGRAI"",""EVNTINFO"","_$J_")"
     15 K @DGARRAY
     16 ;
     17 ; Begin looking for entries needing transmission with a type of "COTS UPDATE", Code 6.
     18 S PVTPTR=0
     19 F  S PVTPTR=+$O(^VAT(391.71,"AXMIT",6,PVTPTR)) Q:('PVTPTR)  D
     20 . ; If no entry for xref (out of sync) delete the xref and quit
     21 . I ('$D(^VAT(391.71,PVTPTR))) K ^VAT(391.71,"AXMIT",6,PVTPTR) Q
     22 . ; Get event date and pointer to patient for entry
     23 . S DGNODE=$G(^VAT(391.71,PVTPTR,0))
     24 . S DFN=+$P(DGNODE,"^",3)
     25 . S EVNTDT=+DGNODE
     26 . ; Check for patient, if not valid, then mark as transmitted and quit
     27 . I ('$D(^DPT(DFN,0))) D XMITFLAG^VAFCDD01(PVTPTR,"",1) Q
     28 . ;
     29 . K @DGARRAY
     30 . S @DGARRAY@("PIVOT")=PVTPTR
     31 . S @DGARRAY@("REASON",1)=""
     32 . I (+$G(^DPT(DFN,.35))) S @DGARRAY@("REASON",1)=99
     33 . ;
     34 . S @DGARRAY@("USER")=$$GET1^DIQ(200,+$P(DGNODE,"^",9),.01)
     35 . ;
     36 . S @DGARRAY@("EVENT-NUM")=$P(DGNODE,"^",2)
     37 . S @DGARRAY@("VAR-PTR")=$P(DGNODE,"^",5)
     38 . ;
     39 . S DGRSLT=$$BLDA08(DFN,EVNTDT,DGARRAY)
     40 . I (DGRSLT<0) D ERRBUL(DGARRAY,DGRSLT) ;deleted Q p-357
     41 . ;
     42 . ; Mark entry in pivot file as transmitted
     43 . D XMITFLAG^VAFCDD01(PVTPTR,"",1)
     44 ;
     45 L -^XTMP("ADT/HL7 MDS COTS UPDATE")
     46 Q
     47 ;
     48BLDA08(DFN,EVNTDT,EVNTINFO,DGDC,DGOSSN) ;
     49 ;
     50 N RESULT,DGTMP,GLOREF
     51 ;
     52 S DFN=+$G(DFN)
     53 I ('$D(^DPT(DFN,0))) S RESULT="-1^Could not find entry in PATIENT file" G BLDQ
     54 ;
     55 S DGDC=$G(DGDC)
     56 S DGOSSN=$G(DGOSSN)
     57 S EVNTDT=$G(EVNTDT)
     58 S:('EVNTDT) EVNTDT=$$NOW^XLFDT
     59 ;
     60 S GLOREF="^TMP(""HLS"","_$J_")"
     61 K @GLOREF
     62 ;
     63 S @EVNTINFO@("DFN")=DFN
     64 S @EVNTINFO@("EVENT")="A08"
     65 S @EVNTINFO@("DATE")=EVNTDT
     66 ;
     67 N HLEID,HL,HLFS,HLECH,HLQ,NDX
     68 ;
     69 K HL
     70 D INIT^HLFNC2("DGRU-PATIENT-A08-SERVER",.HL)
     71 ;
     72 I ($O(HL(""))']"") S RESULT="-1^Server Protocol not found" G BLDQ
     73 ;
     74 ; Build segment array
     75 D EN^DGRUGA08(DFN,"","DGTMP",DGDC,DGOSSN)
     76 I '$O(DGTMP(0)) S RESULT="-1^Unable to build segment list to transmit" G BLDQ
     77 ;Check segment list for errors
     78 S NDX=0
     79 F  S NDX=$O(DGTMP(NDX)) Q:'NDX  D  G:(+$G(RESULT)<0) BLDQ
     80 . I +DGTMP(NDX)<0 S RESULT="-1^An error occurred in one of the segments"
     81 ;
     82 M @GLOREF=DGTMP
     83 S RESULT=$$SENDMSG(GLOREF)
     84 I +$P(RESULT,"^",2)>0 S RESULT="-1^"_$P(RESULT,"^",2,3)
     85BLDQ Q $G(RESULT)
     86 ;
     87SENDMSG(GLOREF) ; Transmit the HL7 message
     88 N HLA,HLRST
     89 M HLA("HLS")=@GLOREF
     90 I $D(HLA("HLS")) D
     91 . D GENERATE^HLMA("DGRU-PATIENT-A08-SERVER","LM",1,.HLRST,"")
     92 K HLA,HERR
     93 Q (HLRST)
     94 ;
     95ERRBUL(EVNTINFO,RESULT) ; Generate bulliten if an error occurred while building the HL7 message.
     96 ;
     97 N XMY,XMDUZ,XMDT,XMZ,XMB,XMCHAN,XMSUB
     98 ;
     99 S XMCHAN=1
     100 S XMSUB="RAI/MDS HL7 BUILD ERROR"
     101 S (XMDUZ,XMDUZ)="RAI/MDS APPLICATION"
     102 ;
     103 S XMB="DGRU RAI ERROR"
     104 S XMB(1)=$$GET1^DIQ(2,@EVNTINFO@("DFN"),.01)
     105 S XMB(2)=@EVNTINFO@("EVENT")
     106 S XMB(3)=">>> "_$P(RESULT,"^",2)
     107 S XMB(4)=@EVNTINFO@("USER")
     108 S XMB(5)=$$FMTE^XLFDT(@EVNTINFO@("DATE"))
     109 S XMDT=DT
     110 D ^XMB
     111 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRUUTL.m

    r613 r623  
    1 DGRUUTL ;ALB/GRR - RAI/MDS UTILITY ROUTINE ; 10/11/07 8:42am
    2         ;;5.3;Registration;**190,444,762**;Aug 13, 1993;Build 3
    3 HLNAME(DGNAME)  ;Piece apart name into LAST NAME_"^"_FIRST NAME_"^"_MIDDLE NAME_"^"_SUFFIX
    4         ;Input DGNAME - Either Last Name, First or First, Middle and Last Name (i.e. SMITH,JOHN R   or  JOHN R SMITH)
    5         S (DGFN,DGMN,DGLN,DGSUF,P1,P2,P3,P4)=""
    6         I DGNAME'["," S P=$L(DGNAME," ") F Z=1:1:P S @("P"_Z)=$P(DGNAME," ",Z)
    7         I DGNAME["," D
    8         .S P1=$P(DGNAME,","),P2=$P(DGNAME,",",2),DGN=P2_" "_P1
    9         .S P=$L(DGN," ") F Z=1:1:P S @("P"_Z)=$P(DGN," ",Z)
    10         S DGSUF=$$SUF(@("P"_P))
    11         I DGSUF'="" S P=P-1
    12         I P=4 S DGFN=P1,DGMN=P2,DGLN=P3_" "_P4 G NAMQ
    13         I P=3 D  G NAMQ
    14         .I $L($P(P2,"."))=1 S DGFN=P1,DGMN=P2,DGLN=P3 Q
    15         .I $L($P(P2,"."))=2 S DGFN=P1,DGLN=P2_" "_P3 Q
    16         .S DGFN=P1,DGMN=P2,DGLN=P3
    17         S DGFN=P1,DGLN=P2
    18 NAMQ    Q DGLN_"^"_DGFN_"^"_DGMN_"^"_DGSUF
    19         ;
    20 SUF(X)  ;COMPARES PASSED DATA TO LIST OF SUFFIX'S AND RETURNS A FOUND SUFFIX OR NULL
    21         I "^JR.^SR.^II.^III.^IV.^V.^VI.^VII.^VIII.^VIIII.^IX.^X."'[X Q ""
    22         Q X
    23         ;
    24 CHKWARD(X)      ;RETURNS 1 IF RAI/MDS WARD AND 0 IF NOT
    25         ;;Input X - Internal Entry Number of Ward in Ward file (#42)
    26         ;
    27         Q $S(+X>0:+($$GET1^DIQ(42,X,.035,"I")),1:0)
    28         ;
    29 MEDICARE(DFN)   ;Will retrieve the patient's Medicare Number and return it or return null
    30         ;Input - DFN patient's IEN
    31         N DGSUB ;modified p-444
    32         Q:DFN']"" ""  ;p-444
    33         S DGSUB=$$HICN^IBCNSU1(DFN) ;p-444
    34         Q:DGSUB<0 ""  ;no medicare number  p-444
    35         Q DGSUB
    36         ;
    37 MEDICAID(DFN)   ;Will retrieve the patient's Medicaid Number and return it or a null
    38         ;Input - DFN patient's IEN
    39         ;
    40         ;  Returns the medicaid information from the patient file
    41         ; P-762 return Medicaid number or 'N'
    42         N A S A=$$GET1^DIQ(2,DFN,.383)
    43         S:A="" A="N"
    44         Q A
    45         ;
    46 GETAMOV(DFN)    ;GET LAST ADMISSION MOVEMENT FOR A PATIENT
    47         ;
    48         N I,J S (I,J)=""
    49         S I=$O(^DGPM("ATID1",DFN,I)) Q:I="" ""
    50         S J=$O(^DGPM("ATID1",DFN,I,J)) ;ien of admission movement
    51         Q J
    52         ;
    53 RELATE(X)       ;CONVERT FREE TEXT RELATIONSHIP TO RELATIONSHIP FILE ENTRY NUMBER AND NAME
    54         N DIC,Y
    55         S X=$$UPPER^HLFNC(X)
    56         S X=$S(X="WIFE":"SPOUSE",X="HUSBAND":"SPOUSE",1:X)
    57         S DIC="^DG(408.11,",DIC(0)="X" D ^DIC
    58         S:Y<0 Y="99^OTHER" ;DEFAULT IF NOT FOUND IN FILE
    59         Q Y
    60         ;
    61 ENC(DGRSEG,DGRMNMT,DGRFLN,DGRFLNM,DGROLDN,DGRNDATA,DGRSIED,DGCIEN)      ;CREATE AND SEND MASTER FILE UPDATE HL7 MESSAGE
    62         ;INPUT:
    63         ;     DGRSEG  -  File Number
    64         ;     DGRMNMT -  Message Type (ie INSURANCE)
    65         ;     DGRFLN  -  Vista File Number (ie 36)
    66         ;     DGRFLNM -  Vista File Name (ie INSURANCE COMPANY)
    67         ;     DGROLDN -  Old Name value
    68         ;     DGRNDATA - New value (ie BLUE CROSS NH/VT)
    69         ;     DGRSIED -  Server Protocol IEN
    70         ;     DGRUHLP -  Priority of Message (ie I = Immediate)
    71         ;
    72         Q:DGRSEG=""!(DGRMNMT="")!(DGRFLN="")!(DGRFLNM="")!(DGRNDATA="")!(DGRSIED="")  ;Quit if all parameters not passed
    73         D EN^DGRUGMFU(DGRSEG,DGRMNMT,DGRFLN,DGRFLNM,DGROLDN,DGRNDATA,DGCIEN) ;Call routine which formats the Master File Update
    74         I $D(^TMP($J,"DGRUGMFU",1)) D  ;If a Master File Update was created, do the following
    75         .M HLA("HLS")=^TMP($J,"DGRUGMFU") ;Move global array maintaining HL7 message to local array
    76         .D GENERATE^HLMA("DGRU-RAI-MFU-SERVER","LM",1,.DGRUET,"") ;Call API to generate the HL7 message
    77         Q
    78 SENDMFU()       ;Function to determine if master file updates should be sent
    79         Q $P($G(^DG(43,1,"HL7")),"^",4)=1
    80         ;
    81 DOCID(X)        ;Insure provider ID not greater than 6 digits
    82         Q:$E(X,1,3)'="PV1" -1
    83         N DGDOC,DGNIEN,IEN
    84         S DGDOC=$P(X,HL("FS"),8),IEN=$P(DGDOC,$E(HL("ECH")))
    85         I $L(IEN)<7 G EXITDOC
    86         S DGNIEN=$E(IEN,$L(IEN)-5,$L(IEN)),$P(DGDOC,$E(HL("ECH")))=DGNIEN
    87         S $P(X,HL("FS"),8)=DGDOC
    88 EXITDOC Q X
    89         ;
    90 ATTDOC(X)       ;get attending physician - p-762
    91         N ATTPTR,ATTNAME,VAIP D IN5^VADPT S ATTPTR=$P(VAIP(18),"^",1),ATTNAME=$P(VAIP(18),"^",2) K VAIP
    92         I $L(ATTPTR)>6 S ATTPTR=$E(ATTPTR,$L(ATTPTR)-5,$L(ATTPTR))
    93         I $G(ATTNAME) S ATTNAME=$$HLNAME(ATTNAME)
    94         Q ATTPTR_$E(HL("ECH"))_ATTNAME
     1DGRUUTL ;ALB/GRR - RAI/MDS UTILITY ROUTINE
     2 ;;5.3;Registration;**190,444**;Aug 13, 1993
     3HLNAME(DGNAME) ;Piece apart name into LAST NAME_"^"_FIRST NAME_"^"_MIDDLE NAME_"^"_SUFFIX
     4 ;Input DGNAME - Either Last Name, First or First, Middle and Last Name (i.e. SMITH,JOHN R   or  JOHN R SMITH)
     5 S (DGFN,DGMN,DGLN,DGSUF,P1,P2,P3,P4)=""
     6 I DGNAME'["," S P=$L(DGNAME," ") F Z=1:1:P S @("P"_Z)=$P(DGNAME," ",Z)
     7 I DGNAME["," D
     8 .S P1=$P(DGNAME,","),P2=$P(DGNAME,",",2),DGN=P2_" "_P1
     9 .S P=$L(DGN," ") F Z=1:1:P S @("P"_Z)=$P(DGN," ",Z)
     10 S DGSUF=$$SUF(@("P"_P))
     11 I DGSUF'="" S P=P-1
     12 I P=4 S DGFN=P1,DGMN=P2,DGLN=P3_" "_P4 G NAMQ
     13 I P=3 D  G NAMQ
     14 .I $L($P(P2,"."))=1 S DGFN=P1,DGMN=P2,DGLN=P3 Q
     15 .I $L($P(P2,"."))=2 S DGFN=P1,DGLN=P2_" "_P3 Q
     16 .S DGFN=P1,DGMN=P2,DGLN=P3
     17 S DGFN=P1,DGLN=P2
     18NAMQ Q DGLN_"^"_DGFN_"^"_DGMN_"^"_DGSUF
     19 ;
     20SUF(X) ;COMPARES PASSED DATA TO LIST OF SUFFIX'S AND RETURNS A FOUND SUFFIX OR NULL
     21 I "^JR.^SR.^II.^III.^IV.^V.^VI.^VII.^VIII.^VIIII.^IX.^X."'[X Q ""
     22 Q X
     23 ;
     24CHKWARD(X) ;RETURNS 1 IF RAI/MDS WARD AND 0 IF NOT
     25 ;;Input X - Internal Entry Number of Ward in Ward file (#42)
     26 ;
     27 Q $S(+X>0:+($$GET1^DIQ(42,X,.035,"I")),1:0)
     28 ;
     29MEDICARE(DFN) ;Will retrieve the patient's Medicare Number and return it or return null
     30 ;Input - DFN patient's IEN
     31 N DGSUB ;modified p-444
     32 Q:DFN']"" ""  ;p-444
     33 S DGSUB=$$HICN^IBCNSU1(DFN) ;p-444
     34 Q:DGSUB<0 ""  ;no medicare number  p-444
     35 Q DGSUB
     36 ;
     37MEDICAID(DFN) ;Will retrieve the patient's Medicaid Number and return it or a null
     38 ;Input - DFN patient's IEN
     39 ;
     40 ;  Returns the medicaid information from the patient file
     41 Q $$GET1^DIQ(2,DFN,.383)
     42 ;
     43GETAMOV(DFN) ;GET LAST ADMISSION MOVEMENT FOR A PATIENT
     44 ;
     45 N I,J S (I,J)=""
     46 S I=$O(^DGPM("ATID1",DFN,I)) Q:I="" ""
     47 S J=$O(^DGPM("ATID1",DFN,I,J)) ;ien of admission movement
     48 Q J
     49 ;
     50RELATE(X) ;CONVERT FREE TEXT RELATIONSHIP TO RELATIONSHIP FILE ENTRY NUMBER AND NAME
     51 N DIC,Y
     52 S X=$$UPPER^HLFNC(X)
     53 S X=$S(X="WIFE":"SPOUSE",X="HUSBAND":"SPOUSE",1:X)
     54 S DIC="^DG(408.11,",DIC(0)="X" D ^DIC
     55 S:Y<0 Y="99^OTHER" ;DEFAULT IF NOT FOUND IN FILE
     56 Q Y
     57 ;
     58ENC(DGRSEG,DGRMNMT,DGRFLN,DGRFLNM,DGROLDN,DGRNDATA,DGRSIED,DGCIEN) ;CREATE AND SEND MASTER FILE UPDATE HL7 MESSAGE
     59 ;INPUT:
     60 ;     DGRSEG  -  File Number
     61 ;     DGRMNMT -  Message Type (ie INSURANCE)
     62 ;     DGRFLN  -  Vista File Number (ie 36)
     63 ;     DGRFLNM -  Vista File Name (ie INSURANCE COMPANY)
     64 ;     DGROLDN -  Old Name value
     65 ;     DGRNDATA - New value (ie BLUE CROSS NH/VT)
     66 ;     DGRSIED -  Server Protocol IEN
     67 ;     DGRUHLP -  Priority of Message (ie I = Immediate)
     68 ;
     69 Q:DGRSEG=""!(DGRMNMT="")!(DGRFLN="")!(DGRFLNM="")!(DGRNDATA="")!(DGRSIED="")  ;Quit if all parameters not passed
     70 D EN^DGRUGMFU(DGRSEG,DGRMNMT,DGRFLN,DGRFLNM,DGROLDN,DGRNDATA,DGCIEN) ;Call routine which formats the Master File Update
     71 I $D(^TMP($J,"DGRUGMFU",1)) D  ;If a Master File Update was created, do the following
     72 .M HLA("HLS")=^TMP($J,"DGRUGMFU") ;Move global array maintaining HL7 message to local array
     73 .D GENERATE^HLMA("DGRU-RAI-MFU-SERVER","LM",1,.DGRUET,"") ;Call API to generate the HL7 message
     74 Q
     75SENDMFU() ;Function to determine if master file updates should be sent
     76 Q $P($G(^DG(43,1,"HL7")),"^",4)=1
     77 ;
     78DOCID(X) ;Insure provider ID not greater than 6 digits
     79 Q:$E(X,1,3)'="PV1" -1
     80 N DGDOC,DGNIEN,IEN
     81 S DGDOC=$P(X,HL("FS"),8),IEN=$P(DGDOC,$E(HL("ECH")))
     82 I $L(IEN)<7 G EXITDOC
     83 S DGNIEN=$E(IEN,$L(IEN)-5,$L(IEN)),$P(DGDOC,$E(HL("ECH")))=DGNIEN
     84 S $P(X,HL("FS"),8)=DGDOC
     85EXITDOC Q X
     86 ;
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DPTLK.m

    r613 r623  
    1 DPTLK   ;ALB/RMO,RTK - MAS Patient Look-up Main Routine ;1/27/07  13:12
    2         ;;5.3;Registration;**32,72,93,73,136,157,197,232,265,277,223,327,244,513,528,541,576,600,485,633,629,647,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ;
    12         ; mods made for magstripe read 12/96 - JFP
    13         ;
    14         ;Optional input: DPTNOFZY='1' to suppress fuzzy lookups implemented
    15         ;                by patch DG*5.3*244
    16         ;
    17 EN      ; -- Entry point
    18         ;Following line so VOE will use alternate lookup routine, DAOU,VA/CJS,WV/TOAD
    19         I $G(DUZ("AG"))'="V" D ^AUPNLK Q
    20         N DIE,DR
    21         K DPTX,DPTDFN,DPTSAVX I $D(DIC(0)) G QK:DIC(0)["I"!(DIC(0)'["A"&('$D(X)))
    22         I '$D(^DD("VERSION")) W !!?3,"Unable to proceed. Fileman version node ^DD(""VERSION"") is undefined." G QK
    23         I '$D(^DPT(0))!(^DD("VERSION")<17.2) W !!?3,"Unable to proceed. ",$S('$D(^DPT(0)):"0th node of ^DPT missing",^DD("VERSION")<17.2:"Fileman version must be at least 17.2",1:""),"." G QK
    24 EN2     K DO,DUOUT,DTOUT S U="^",DIC="^DPT(",DIC(0)=$S($D(DIC(0)):DIC(0),1:"AELMQ") S:DIC(0)'["A" (DPTX,DPTSAVX)=X
    25         S DPTSZ=1000 I $D(^DD("OS"))#2 S DPTSZ=$S(+$P(^DD("OS",^("OS"),0),U,2):$P(^(0),U,2),1:DPTSZ)
    26         ;
    27 ASKPAT  ; -- Prompt for patient
    28         I DIC(0)["A" D   G QK:'$T!($E(DPTX)["^")!(DPTX="")
    29         .K DTOUT,DUOUT
    30         .W !,$S($D(DIC("A")):DIC("A"),1:"Select PATIENT NAME: ") W:$D(DIC("B")) DIC("B"),"// "
    31         .R X:DTIME
    32         .S DPTX=X S:'$T DTOUT=1 S:$T&(DPTX="")&($D(DIC("B"))) DPTX=DIC("B") S:DPTX["^"&($E(DPTX)'="%") DUOUT=1
    33         ; -- Check for the IATA magnetic stripe input
    34         N MAG,GCHK
    35         S MAG=0
    36         I $E(DPTX)="%"!($E(DPTX)=";"),DPTX["?" S MAG=1,(X,DPTX)=$$IATA(DPTX)
    37         ;
    38 CHKPAT  ; -- Custom Patient Lookup
    39         D DO^DIC1
    40         S DIC("W")=$S($D(DIC("W")):DIC("W"),1:"")
    41         K DPTIFNS,DPTS,DPTSEL
    42         S DPTCNT=0
    43         ; -- Check input for format an length
    44         G CHKDFN:DPTX?1A!(DPTX'?.ANP)!($L(DPTX)>30)
    45         ; -- Check for null response or abort
    46         I DPTX=""!(DPTX["^") G ASKPAT:DIC(0)["A",QK
    47         ; -- Check for question mark
    48         I DPTX["?" D  G ASKPAT:DIC(0)["A",QK
    49         .S D="B"
    50         .S DZ=$S(DPTX?1"?":"",1:"??")
    51         .G CHKPAT1:DZ="??"
    52         .N %
    53         .W !,?1,"Answer with PATIENT NAME, or SOCIAL SECURITY NUMBER, or last 4 digits",!,?4,"of SOCIAL SECURITY NUMBER, or first initial of"
    54         .W " last name with last",!,?4,"4 digits of SOCIAL SECURITY NUMBER"
    55         .W !,?1,"Do you want the entire ",+$P($G(^DPT(0)),"^",4),"-Entry PATIENT List" S %=0 D YN^DICN
    56         .Q:%'=1
    57         .S DZ="??"
    58 CHKPAT1 .S X=DPTX
    59         .D DQ^DICQ
    60         ; -- Check for space bar, return
    61         I DPTX=" " D  G CHKDFN
    62         .S Y=$S('($D(DUZ)#2):-1,$D(^DISV(DUZ,"^DPT(")):^("^DPT("),1:-1)
    63         .D SETDPT^DPTLK1:Y>0
    64         .S DPTDFN=$S($D(DPTS(Y)):Y,1:-1)
    65         ; -- Check for DFN look up
    66         I $E(DPTX)="`" D  G CHKDFN
    67         .S Y=$S($D(^DPT(+$P(DPTX,"`",2),0)):+$P(DPTX,"`",2),1:-1)
    68         .D SETDPT^DPTLK1:Y>0
    69         .S DPTDFN=$S($D(DPTS(Y)):Y,1:-1)
    70         ; -- Puts input in correct format
    71         G CHKDFN:DPTX=""
    72         ; -- Force new entry
    73         I $E(DPTX)="""",$E(DPTX,$L(DPTX))="""" G NOPAT
    74         ; -- Check for index lookups
    75         D ^DPTLK1 G QK:$D(DTOUT)!($D(DUOUT)&(DIC(0)'["A")),ASKPAT:$D(DUOUT),CHKPAT:DPTDFN<0,CHKDFN:DPTDFN>0 I DIC(0)["N",$D(^DPT(DPTX,0)) S Y=X D SETDPT^DPTLK1 S DPTDFN=$S($D(DPTS(Y)):Y,1:-1) G CHKDFN
    76 MAG     ; -- No patient found, check for mag stripe input, create stub
    77         I 'MAG G NOPAT
    78         ; -- Check for ADT option(s) only
    79         N DGOPT
    80         S DGOPT=$P($G(XQY0),"^",2)
    81         I DGOPT'="Load/Edit Patient Data",DGOPT'="Register a Patient" D  G EN2
    82         .W !,"    ...Patient not in database, use ADT options to load patient" D Q1
    83         ; -- Prompt for creation of stub
    84         S DIR(0)="Y",DIR("B")="NO",DIR("A")="Patient not found...Create stub entry: "
    85         S GCHK=$D(^TMP("DGVIC"))
    86         D ^DIR
    87         K DIR
    88         I 'Y D Q1 G EN2
    89         ; -- Parse IATA fields
    90         D FIELDS(IATA)
    91         ; -- Check for Duplicates
    92         D EP2^DPTLK3
    93         I DPTDFN<0 D Q1 G EN2
    94         ; -- Creates Stub entry in patient file
    95         S Y=$$FILE^DPTLK4(DGFLDS)
    96         I $P(Y,"^",3)'=1 W !,"Could not add patient to patient file" D QK1 Q
    97         D QK1
    98         Q
    99         ;
    100 NOPAT   ; -- No patient found, ask to add new
    101         I DIC(0)["L" D ^DPTLK2 S Y=DPTDFN G ASKPAT:DIC(0)["A"&(Y<0)&('$G(DTOUT)),QK1
    102         ;
    103 CHKDFN  ; --
    104         S:'$D(DPTDFN) DPTDFN=-1 I DPTDFN'>0!('$D(DPTS(+DPTDFN))) W:DIC(0)["Q" *7," ??" G ASKPAT:DIC(0)["A",QK
    105         I DIC(0)["E" D  W $S('$D(DPTSEL)&('$D(DIVP)):$P(DPTS(DPTDFN),U,2)_"  "_$P(DPTS(DPTDFN),U)_"  ",$D(^DPT(DPTDFN,0)):"  "_$P(^(0),U)_"  ",1:"") S Y=DPTDFN X:$D(^DPT(DPTDFN,0)) "N DDS X DIC(""W"")"
    106         .I $D(DDS) D CLRMSG^DDS S DX=0,DY=DDSHBX+1 X DDXY
    107         ;
    108         ; check for other patients in "BS5" xref on Patient file
    109         I '$G(DICR),DPTDFN>0,DIC(0)["E",$$BS5^DPTLK5(+DPTDFN) D  G ASKPAT:DIC(0)["A"&(%'=1),QK:DPTDFN<0
    110         .N DPTZERO,DPTLSNME,DPTSSN S DPTZERO=$G(^DPT(+DPTDFN,0)),DPTLSNME=$P($P(DPTZERO,U),","),DPTSSN=$E($P(DPTZERO,U,9),6,9)
    111         .W $C(7),!!,"There is more than one patient whose last name is '",DPTLSNME,"' and"
    112         .W !,"whose social security number ends with '",DPTSSN,"'."
    113         .W !,"Are you sure you wish to continue (Y/N)" S %=0 D YN^DICN
    114         .I %'=1 S DPTDFN=-1
    115         ;
    116         I '$G(DICR),DPTDFN>0 S Y=DPTDFN D ^DGSEC S DPTDFN=Y G ASKPAT:DIC(0)["A"&(DPTDFN<0),QK:DPTDFN<0
    117         S DPTX=DPTX_$P(DPTS(DPTDFN),U,2),DPTDFN=DPTDFN_U_$P(^DPT(DPTDFN,0),U)
    118         ;
    119 Q       ; --
    120         S Y=$S('$D(DPTDFN):-1,'$D(DPTS(+DPTDFN)):-1,1:DPTDFN),X=$S($D(DPTX)&(+Y>0):DPTX,$D(DPTSAVX):DPTSAVX,$D(DPTX):DPTX,1:"")
    121         I Y>0 S:DIC(0)'["F" ^DISV($S($D(DUZ)#2:DUZ,1:0),"^DPT(")=+Y S:DIC(0)["Z" Y(0)=^DPT(+Y,0),Y(0,0)=$P(^(0),U,1)
    122         ;DG*600
    123         ;I DIC(0)["E",$P($G(^DPT(+Y,0)),U,21) W *7,!,"Warning : You have selected a test patient."
    124         I DIC(0)["E",$$TESTPAT^VADPT(+Y) W *7,!,"WARNING : You may have selected a test patient."
    125         I DIC(0)["E",$$BADADR^DGUTL3(+Y) W *7,!,"WARNING : ** This patient has been flagged with a Bad Address Indicator."
    126         I DIC(0)["E",$$VAADV^DPTLK3(+Y) W *7,!,"** Patient is VA ADVANTAGE."
    127         ;DG*485
    128         I $D(^DPT("AXFFP",1,+Y)) D FFP^DPTLK5
    129         ;Display enrollment information
    130         I Y>0,DIC(0)["E" D ENR
    131         ;
    132         ;Call Combat Vet check
    133         I Y>0,DIC(0)["E" D CV
    134         ;
    135         ; check whether to display Means Test Required message
    136         D
    137         .N DPTDIV
    138         .I '$G(DUZ(2)) Q
    139         .I Y>0,DIC(0)["E" S DPTDIV=$$DMT^DPTLK5(+Y,DUZ(2)) I DPTDIV D
    140         ..W $C(7),!!,"MEANS TEST REQUIRED"
    141         ..W !,?3,$P($G(^DG(40.8,DPTDIV,"MT")),U,2)
    142         ..H 2
    143         ;
    144 Q1      ; -- Clean up variables
    145         K D,DIC("W"),DO,DPTCNT,DPTDFN,DPTIFNS,DPTIX,DPTS
    146         K DPTSAVX,DPTSEL,DPTSZ,DPTX
    147         ;
    148         K:$D(IATA) IATA
    149         K:$D(DGFLDS) @DGFLDS,DGFLDS
    150         Q
    151         ;
    152 QK      K:'$D(DPTNOFZK) DPTNOFZY G Q
    153         ;
    154 QK1     K:'$D(DPTNOFZK) DPTNOFZY G Q1
    155         ;
    156 IX      ; --
    157         I $D(D),$D(^DD(2,0,"IX",D)),($E(D)'="A") S DPTIX=D
    158         G DPTLK
    159         ;
    160 IATA(X) ; --
    161         ;This function pulls off ssn from the IATA track
    162         ;
    163         ;Input:  X   -  what was read in
    164         ;Output: SSN -  social security number
    165         ;          Q -  quit
    166         ;
    167         ; Track            Start Sent     End Sent      Field Separator
    168         ; -----            ----------     --------      ---------------
    169         ;  IATA (alphanum)      %             ?          {   (Note: VA used ^)
    170         ;  ABA (numeric)        ;             ?          =   
    171         ;
    172         ;N IATA
    173         S (IATA)=""
    174         I $E(X)'="%" Q X ; no start sentinel
    175         I X'["?" Q "Q"
    176         ; -- Extract data from track
    177         S IATA=$$TRACK(X,"%","?")
    178         ; -- checks for no data
    179         I IATA="" Q "Q"
    180         ; -- Returns SSN
    181         I IATA'="" Q $P(IATA,"^")
    182         Q "Q"
    183         ;
    184 TRACK(X,START,END)      ; find track where start/end are sentinels
    185         ;
    186         Q $P($P($G(X),START,2),END,1)
    187         ;
    188 FIELDS(IATA)    ; -- Sets fields
    189         Q:'$D(IATA)
    190         N CNT,FIELD
    191         S DGFLDS="^TMP(""DGVIC"","_$J_")",CNT=1
    192         K @DGFLDS
    193         F  S FIELD=$P($G(IATA),"^",CNT)  Q:FIELD=""  D
    194         .S @DGFLDS@(CNT)=FIELD
    195         .S CNT=CNT+1
    196         ; -- Define fields for duplicate checker
    197         S DPTX=$G(@DGFLDS@(2)) ;NAME
    198         S DPTIDS(.03)=$G(@DGFLDS@(3)) ;DOB
    199         S DPTIDS(.09)=$G(@DGFLDS@(1)) ;SSN
    200         Q
    201 ENR     ;Display Enrollment information after patient selection
    202         N DGENCAT,DGENDFN,DGENR,DGEGTIEN,DGEGT
    203         I '$$GET^DGENA($$FINDCUR^DGENA(+DPTDFN),.DGENR) Q
    204         S DGENCAT=$$CATEGORY^DGENA4(+DPTDFN)
    205         S DGENCAT=$$EXTERNAL^DILFD(27.15,.02,"",DGENCAT)
    206         W !?1,"Enrollment Priority: ",$S($G(DGENR("PRIORITY")):$$EXT^DGENU("PRIORITY",DGENR("PRIORITY")),1:""),$S($G(DGENR("SUBGRP"))="":"",1:$$EXT^DGENU("SUBGRP",$G(DGENR("SUBGRP"))))
    207         W ?33,"Category: ",DGENCAT
    208         W ?57,"End Date: ",$S($G(DGENR("END")):$$FMTE^XLFDT(DGENR("END"),"5DZ"),1:""),!
    209         ;If patient is NOT ELIGIBLE, display Enrollment Status (Ineligible Project Phase I)
    210         I $G(DGENR("STATUS"))=10!($G(DGENR("STATUS"))=19)!($G(DGENR("STATUS"))=20) D
    211         . W ?1,"Enrollment Status: ",$S($G(DGENR("STATUS")):$$EXT^DGENU("STATUS",DGENR("STATUS")),1:"") ;H 5
    212         ;check for Combat Veteran Eligibility, if elig do not display EGT info
    213         I $$CVEDT^DGCV(+DPTDFN) Q
    214         ;Get Enrollment Group Threshold Priority and Subgroup
    215         S DGEGTIEN=$$FINDCUR^DGENEGT
    216         S DGEGT=$$GET^DGENEGT(DGEGTIEN,.DGEGT)
    217         Q:$G(DGENR("PRIORITY"))=""!($G(DGEGT("PRIORITY"))="")
    218         ;Compare Patient's Enrollment Priority to Enrollment Group Threshold
    219         I '$$ABOVE^DGENEGT1(+DPTDFN,DGENR("PRIORITY"),$G(DGENR("SUBGRP")),DGEGT("PRIORITY"),DGEGT("SUBGRP")) D
    220         .N X,IORVOFF,IORVON
    221         .S X="IORVOFF;IORVON"
    222         .D ENDR^%ZISS
    223         .W !?32 W:$D(IORVON) IORVON  W "*** WARNING ***" W:$D(IORVOFF) IORVOFF
    224         .I DGENR("END")'="" W !?14 W:$D(IORVON) IORVON W "*** PATIENT ENROLLMENT END",$S(DT>+DGENR("END"):"ED",1:"S")," EFFECTIVE ",$$FMTE^XLFDT(DGENR("END"),"5DZ")," ***" W:$D(IORVOFF) IORVOFF Q
    225         .W !?5 W:$D(IORVON) IORVON W "*** PATIENT ENROLLMENT ENDING.  ENROLLMENT END DATE IS NOT KNOWN. ***" W:$D(IORVOFF) IORVOFF
    226         Q
    227 CV      ;check for Combat Vet status
    228         N DGCV
    229         S DGCV=$$CVEDT^DGCV(+DPTDFN)
    230         I $P(DGCV,U)=1 D  Q
    231         . I '$$GET^DGENA($$FINDCUR^DGENA(+DPTDFN),.DGENR) W !
    232         . W ?3,"Combat Vet Status: "_$S($P(DGCV,U,3)=1:"ELIGIBLE",1:"EXPIRED"),?57,"End Date: "_$$FMTE^XLFDT($P(DGCV,U,2),"5DZ")
    233         Q
     1DPTLK ;ALB/RMO,RTK - MAS Patient Look-up Main Routine ;1/27/07  13:12
     2 ;;5.3;Registration;**32,72,93,73,136,157,197,232,265,277,223,327,244,513,528,541,576,600,485,633,629,647,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ;
     12 ; mods made for magstripe read 12/96 - JFP
     13 ;
     14 ;Optional input: DPTNOFZY='1' to suppress fuzzy lookups implemented
     15 ;                by patch DG*5.3*244
     16 ;
     17EN ; -- Entry point
     18 ;Following line so VOE will use alternate lookup routine, DAOU,VA/CJS,WV/TOAD
     19 I $G(DUZ("AG"))'="V" D ^AUPNLK Q
     20 N DIE,DR
     21 K DPTX,DPTDFN,DPTSAVX I $D(DIC(0)) G QK:DIC(0)["I"!(DIC(0)'["A"&('$D(X)))
     22 I '$D(^DD("VERSION")) W !!?3,"Unable to proceed. Fileman version node ^DD(""VERSION"") is undefined." G QK
     23 I '$D(^DPT(0))!(^DD("VERSION")<17.2) W !!?3,"Unable to proceed. ",$S('$D(^DPT(0)):"0th node of ^DPT missing",^DD("VERSION")<17.2:"Fileman version must be at least 17.2",1:""),"." G QK
     24EN2 K DO,DUOUT,DTOUT S U="^",DIC="^DPT(",DIC(0)=$S($D(DIC(0)):DIC(0),1:"AELMQ") S:DIC(0)'["A" (DPTX,DPTSAVX)=X
     25 S DPTSZ=1000 I $D(^DD("OS"))#2 S DPTSZ=$S(+$P(^DD("OS",^("OS"),0),U,2):$P(^(0),U,2),1:DPTSZ)
     26 ;
     27ASKPAT ; -- Prompt for patient
     28 I DIC(0)["A" D   G QK:'$T!($E(DPTX)["^")!(DPTX="")
     29 .K DTOUT,DUOUT
     30 .W !,$S($D(DIC("A")):DIC("A"),1:"Select PATIENT NAME: ") W:$D(DIC("B")) DIC("B"),"// "
     31 .R X:DTIME
     32 .S DPTX=X S:'$T DTOUT=1 S:$T&(DPTX="")&($D(DIC("B"))) DPTX=DIC("B") S:DPTX["^"&($E(DPTX)'="%") DUOUT=1
     33 ; -- Check for the IATA magnetic stripe input
     34 N MAG,GCHK
     35 S MAG=0
     36 I $E(DPTX)="%"!($E(DPTX)=";"),DPTX["?" S MAG=1,(X,DPTX)=$$IATA(DPTX)
     37 ;
     38CHKPAT ; -- Custom Patient Lookup
     39 D DO^DIC1
     40 S DIC("W")=$S($D(DIC("W")):DIC("W"),1:"")
     41 K DPTIFNS,DPTS,DPTSEL
     42 S DPTCNT=0
     43 ; -- Check input for format an length
     44 G CHKDFN:DPTX?1A!(DPTX'?.ANP)!($L(DPTX)>30)
     45 ; -- Check for null response or abort
     46 I DPTX=""!(DPTX["^") G ASKPAT:DIC(0)["A",QK
     47 ; -- Check for question mark
     48 I DPTX["?" D  G ASKPAT:DIC(0)["A",QK
     49 .S D="B"
     50 .S DZ=$S(DPTX?1"?":"",1:"??")
     51 .G CHKPAT1:DZ="??"
     52 .N %
     53 .W !,?1,"Answer with PATIENT NAME, or SOCIAL SECURITY NUMBER, or last 4 digits",!,?4,"of SOCIAL SECURITY NUMBER, or first initial of"
     54 .W " last name with last",!,?4,"4 digits of SOCIAL SECURITY NUMBER"
     55 .W !,?1,"Do you want the entire ",+$P($G(^DPT(0)),"^",4),"-Entry PATIENT List" S %=0 D YN^DICN
     56 .Q:%'=1
     57 .S DZ="??"
     58CHKPAT1 .S X=DPTX
     59 .D DQ^DICQ
     60 ; -- Check for space bar, return
     61 I DPTX=" " D  G CHKDFN
     62 .S Y=$S('($D(DUZ)#2):-1,$D(^DISV(DUZ,"^DPT(")):^("^DPT("),1:-1)
     63 .D SETDPT^DPTLK1:Y>0
     64 .S DPTDFN=$S($D(DPTS(Y)):Y,1:-1)
     65 ; -- Check for DFN look up
     66 I $E(DPTX)="`" D  G CHKDFN
     67 .S Y=$S($D(^DPT(+$P(DPTX,"`",2),0)):+$P(DPTX,"`",2),1:-1)
     68 .D SETDPT^DPTLK1:Y>0
     69 .S DPTDFN=$S($D(DPTS(Y)):Y,1:-1)
     70 ; -- Puts input in correct format
     71 G CHKDFN:DPTX=""
     72 ; -- Force new entry
     73 I $E(DPTX)="""",$E(DPTX,$L(DPTX))="""" G NOPAT
     74 ; -- Check for index lookups
     75 D ^DPTLK1 G QK:$D(DTOUT)!($D(DUOUT)&(DIC(0)'["A")),ASKPAT:$D(DUOUT),CHKPAT:DPTDFN<0,CHKDFN:DPTDFN>0 I DIC(0)["N",$D(^DPT(DPTX,0)) S Y=X D SETDPT^DPTLK1 S DPTDFN=$S($D(DPTS(Y)):Y,1:-1) G CHKDFN
     76MAG ; -- No patient found, check for mag stripe input, create stub
     77 I 'MAG G NOPAT
     78 ; -- Check for ADT option(s) only
     79 N DGOPT
     80 S DGOPT=$P($G(XQY0),"^",2)
     81 I DGOPT'="Load/Edit Patient Data",DGOPT'="Register a Patient" D  G EN2
     82 .W !,"    ...Patient not in database, use ADT options to load patient" D Q1
     83 ; -- Prompt for creation of stub
     84 S DIR(0)="Y",DIR("B")="NO",DIR("A")="Patient not found...Create stub entry: "
     85 S GCHK=$D(^TMP("DGVIC"))
     86 D ^DIR
     87 K DIR
     88 I 'Y D Q1 G EN2
     89 ; -- Parse IATA fields
     90 D FIELDS(IATA)
     91 ; -- Check for Duplicates
     92 D EP2^DPTLK3
     93 I DPTDFN<0 D Q1 G EN2
     94 ; -- Creates Stub entry in patient file
     95 S Y=$$FILE^DPTLK4(DGFLDS)
     96 I $P(Y,"^",3)'=1 W !,"Could not add patient to patient file" D QK1 Q
     97 D QK1
     98 Q
     99 ;
     100NOPAT ; -- No patient found, ask to add new
     101 I DIC(0)["L" D ^DPTLK2 S Y=DPTDFN G ASKPAT:DIC(0)["A"&(Y<0)&('$G(DTOUT)),QK1
     102 ;
     103CHKDFN ; --
     104 S:'$D(DPTDFN) DPTDFN=-1 I DPTDFN'>0!('$D(DPTS(+DPTDFN))) W:DIC(0)["Q" *7," ??" G ASKPAT:DIC(0)["A",QK
     105 I DIC(0)["E" D  W $S('$D(DPTSEL)&('$D(DIVP)):$P(DPTS(DPTDFN),U,2)_"  "_$P(DPTS(DPTDFN),U)_"  ",$D(^DPT(DPTDFN,0)):"  "_$P(^(0),U)_"  ",1:"") S Y=DPTDFN X:$D(^DPT(DPTDFN,0)) "N DDS X DIC(""W"")"
     106 .I $D(DDS) D CLRMSG^DDS S DX=0,DY=DDSHBX+1 X DDXY
     107 ;
     108 ; check for other patients in "BS5" xref on Patient file
     109 I '$G(DICR),DPTDFN>0,DIC(0)["E",$$BS5^DPTLK5(+DPTDFN) D  G ASKPAT:DIC(0)["A"&(%'=1),QK:DPTDFN<0
     110 .N DPTZERO,DPTLSNME,DPTSSN S DPTZERO=$G(^DPT(+DPTDFN,0)),DPTLSNME=$P($P(DPTZERO,U),","),DPTSSN=$E($P(DPTZERO,U,9),6,9)
     111 .W $C(7),!!,"There is more than one patient whose last name is '",DPTLSNME,"' and"
     112 .W !,"whose social security number ends with '",DPTSSN,"'."
     113 .W !,"Are you sure you wish to continue (Y/N)" S %=0 D YN^DICN
     114 .I %'=1 S DPTDFN=-1
     115 ;
     116 I '$G(DICR),DPTDFN>0 S Y=DPTDFN D ^DGSEC S DPTDFN=Y G ASKPAT:DIC(0)["A"&(DPTDFN<0),QK:DPTDFN<0
     117 S DPTX=DPTX_$P(DPTS(DPTDFN),U,2),DPTDFN=DPTDFN_U_$P(^DPT(DPTDFN,0),U)
     118 ;
     119Q ; --
     120 S Y=$S('$D(DPTDFN):-1,'$D(DPTS(+DPTDFN)):-1,1:DPTDFN),X=$S($D(DPTX)&(+Y>0):DPTX,$D(DPTSAVX):DPTSAVX,$D(DPTX):DPTX,1:"")
     121 I Y>0 S:DIC(0)'["F" ^DISV($S($D(DUZ)#2:DUZ,1:0),"^DPT(")=+Y S:DIC(0)["Z" Y(0)=^DPT(+Y,0),Y(0,0)=$P(^(0),U,1)
     122 ;DG*600
     123 ;I DIC(0)["E",$P($G(^DPT(+Y,0)),U,21) W *7,!,"Warning : You have selected a test patient."
     124 I DIC(0)["E",$$TESTPAT^VADPT(+Y) W *7,!,"WARNING : You may have selected a test patient."
     125 I DIC(0)["E",$$BADADR^DGUTL3(+Y) W *7,!,"WARNING : ** This patient has been flagged with a Bad Address Indicator."
     126 I DIC(0)["E",$$VAADV^DPTLK3(+Y) W *7,!,"** Patient is VA ADVANTAGE."
     127 ;DG*485
     128 I $D(^DPT("AXFFP",1,+Y)) D FFP^DPTLK5
     129 ;Display enrollment information
     130 I Y>0,DIC(0)["E" D ENR
     131 ;
     132 ;Call Combat Vet check
     133 I Y>0,DIC(0)["E" D CV
     134 ;
     135 ; check whether to display Means Test Required message
     136 D
     137 .N DPTDIV
     138 .I '$G(DUZ(2)) Q
     139 .I Y>0,DIC(0)["E" S DPTDIV=$$DMT^DPTLK5(+Y,DUZ(2)) I DPTDIV D
     140 ..W $C(7),!!,"MEANS TEST REQUIRED"
     141 ..W !,?3,$P($G(^DG(40.8,DPTDIV,"MT")),U,2)
     142 ..H 2
     143 ;
     144Q1 ; -- Clean up variables
     145 K D,DIC("W"),DO,DPTCNT,DPTDFN,DPTIFNS,DPTIX,DPTS
     146 K DPTSAVX,DPTSEL,DPTSZ,DPTX
     147 ;
     148 K:$D(IATA) IATA
     149 K:$D(DGFLDS) @DGFLDS,DGFLDS
     150 Q
     151 ;
     152QK K:'$D(DPTNOFZK) DPTNOFZY G Q
     153 ;
     154QK1 K:'$D(DPTNOFZK) DPTNOFZY G Q1
     155 ;
     156IX ; --
     157 I $D(D),$D(^DD(2,0,"IX",D)),($E(D)'="A") S DPTIX=D
     158 G DPTLK
     159 ;
     160IATA(X) ; --
     161 ;This function pulls off ssn from the IATA track
     162 ;
     163 ;Input:  X   -  what was read in
     164 ;Output: SSN -  social security number
     165 ;          Q -  quit
     166 ;
     167 ; Track            Start Sent     End Sent      Field Separator
     168 ; -----            ----------     --------      ---------------
     169 ;  IATA (alphanum)      %             ?          {   (Note: VA used ^)
     170 ;  ABA (numeric)        ;             ?          =   
     171 ;
     172 ;N IATA
     173 S (IATA)=""
     174 I $E(X)'="%" Q X ; no start sentinel
     175 I X'["?" Q "Q"
     176 ; -- Extract data from track
     177 S IATA=$$TRACK(X,"%","?")
     178 ; -- checks for no data
     179 I IATA="" Q "Q"
     180 ; -- Returns SSN
     181 I IATA'="" Q $P(IATA,"^")
     182 Q "Q"
     183 ;
     184TRACK(X,START,END) ; find track where start/end are sentinels
     185 ;
     186 Q $P($P($G(X),START,2),END,1)
     187 ;
     188FIELDS(IATA) ; -- Sets fields
     189 Q:'$D(IATA)
     190 N CNT,FIELD
     191 S DGFLDS="^TMP(""DGVIC"","_$J_")",CNT=1
     192 K @DGFLDS
     193 F  S FIELD=$P($G(IATA),"^",CNT)  Q:FIELD=""  D
     194 .S @DGFLDS@(CNT)=FIELD
     195 .S CNT=CNT+1
     196 ; -- Define fields for duplicate checker
     197 S DPTX=$G(@DGFLDS@(2)) ;NAME
     198 S DPTIDS(.03)=$G(@DGFLDS@(3)) ;DOB
     199 S DPTIDS(.09)=$G(@DGFLDS@(1)) ;SSN
     200 Q
     201ENR ;Display Enrollment information after patient selection
     202 N DGENCAT,DGENDFN,DGENR,DGEGTIEN,DGEGT
     203 I '$$GET^DGENA($$FINDCUR^DGENA(+DPTDFN),.DGENR) Q
     204 S DGENCAT=$$CATEGORY^DGENA4(+DPTDFN)
     205 S DGENCAT=$$EXTERNAL^DILFD(27.15,.02,"",DGENCAT)
     206 W !?1,"Enrollment Priority: ",$S($G(DGENR("PRIORITY")):$$EXT^DGENU("PRIORITY",DGENR("PRIORITY")),1:""),$S($G(DGENR("SUBGRP"))="":"",1:$$EXT^DGENU("SUBGRP",$G(DGENR("SUBGRP"))))
     207 W ?33,"Category: ",DGENCAT
     208 W ?57,"End Date: ",$S($G(DGENR("END")):$$FMTE^XLFDT(DGENR("END"),"5DZ"),1:""),!
     209 ;If patient is NOT ELIGIBLE, display Enrollment Status (Ineligible Project Phase I)
     210 I $G(DGENR("STATUS"))=10!($G(DGENR("STATUS"))=19)!($G(DGENR("STATUS"))=20) D
     211 . W ?1,"Enrollment Status: ",$S($G(DGENR("STATUS")):$$EXT^DGENU("STATUS",DGENR("STATUS")),1:"") ;H 5
     212 ;check for Combat Veteran Eligibility, if elig do not display EGT info
     213 I $$CVEDT^DGCV(+DPTDFN) Q
     214 ;Get Enrollment Group Threshold Priority and Subgroup
     215 S DGEGTIEN=$$FINDCUR^DGENEGT
     216 S DGEGT=$$GET^DGENEGT(DGEGTIEN,.DGEGT)
     217 Q:$G(DGENR("PRIORITY"))=""!($G(DGEGT("PRIORITY"))="")
     218 ;Compare Patient's Enrollment Priority to Enrollment Group Threshold
     219 I '$$ABOVE^DGENEGT1(+DPTDFN,DGENR("PRIORITY"),$G(DGENR("SUBGRP")),DGEGT("PRIORITY"),DGEGT("SUBGRP")) D
     220 .N X,IORVOFF,IORVON
     221 .S X="IORVOFF;IORVON"
     222 .D ENDR^%ZISS
     223 .W !?32 W:$D(IORVON) IORVON  W "*** WARNING ***" W:$D(IORVOFF) IORVOFF
     224 .I DGENR("END")'="" W !?14 W:$D(IORVON) IORVON W "*** PATIENT ENROLLMENT END",$S(DT>+DGENR("END"):"ED",1:"S")," EFFECTIVE ",$$FMTE^XLFDT(DGENR("END"),"5DZ")," ***" W:$D(IORVOFF) IORVOFF Q
     225 .W !?5 W:$D(IORVON) IORVON W "*** PATIENT ENROLLMENT ENDING.  ENROLLMENT END DATE IS NOT KNOWN. ***" W:$D(IORVOFF) IORVOFF
     226 Q
     227CV ;check for Combat Vet status
     228 N DGCV
     229 S DGCV=$$CVEDT^DGCV(+DPTDFN)
     230 I $P(DGCV,U)=1 D  Q
     231 . I '$$GET^DGENA($$FINDCUR^DGENA(+DPTDFN),.DGENR) W !
     232 . W ?3,"Combat Vet Status: "_$S($P(DGCV,U,3)=1:"ELIGIBLE",1:"EXPIRED"),?57,"End Date: "_$$FMTE^XLFDT($P(DGCV,U,2),"5DZ")
     233 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VADATE.m

    r613 r623  
    1 VADATE  ;ALB/MLI - GENERIC DATE ROUTINE ; 1 DEC 88 @1000
    2         ;;5.3;Registration,;**749**;Aug 13, 1993;Build 10
    3         ;
    4         I $D(VADAT("F")),$S(VADAT("F")<1:1,VADAT("F")>2:1,1:0) K VADAT("F")
    5         I '$D(VADAT("W")) S VANOW=$$NOW^XLFDT
    6         S VA=$S('$D(VADAT("W")):VANOW,1:VADAT("W")),(VA,VADATE("I"))=$S($D(VADAT("S")):VA,'$D(VADAT("T")):$E(VA,1,12),1:$P(VA,".",1))
    7         S:'$D(VADAT("H")) (VA(1),VA(2),VA(3))=1 I $D(VADAT("H")) F I=1:1:3 S VA(I)=$S(VADAT("H")[I:1,1:0)
    8         S VAM=$S('$E(VA,4,5):"",'VA(2):"",$S('$D(VADAT("F")):1,VADAT("F")=2:1,1:0):$P("JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC","^",+$E(VA,4,5)),1:$E(VA,4,5)),VAY=$S(VA(3):(1700+$E(VA,1,3)),1:""),VAD=$S(VA(1)&$E(VA,6,7):$E(VA,6,7),1:"")
    9         I $P(VA,".",2)]"" S VA=$P(VA,".",2),VAT=$E(VA_"000000",1,2)_":"_$E(VA_"000000",3,4) S:$D(VADAT("S")) VAT=VAT_":"_$E(VA_"000000",5,6)
    10         I '$D(VADAT("F")) S VADATE("E")=VAM_$S(VAM]""&(VAD!VAY):" ",1:"")_$S(VAD:$J(+VAD,2),1:"")_$S(VAD&VAY:",",1:"")_VAY_$S($D(VAT):"@"_VAT,1:"") G QUIT
    11         S VADEL=$S('$D(VADAT("D")):"-",1:VADAT("D")) I VADAT("F")=1 S VADATE("E")=$S('VA(2):"",VAM]"":VAM,1:"00")_$S(VA(1)&VA(2):VADEL,1:"")_$S('VA(1):"",VAD]"":VAD,1:"00")_$S((VA(1)!VA(2))&VA(3):VADEL,1:"")
    12         I VADAT("F")=2 S VADATE("E")=$S('VA(1):"",VAD]"":VAD,1:"00")_$S(VA(1)&VA(2):VADEL,1:"")_$S('VA(2):"",VAM]"":VAM,1:"XXX")_$S((VA(1)!VA(2))&VA(3):VADEL,1:"")
    13         S VADATE("E")=VADATE("E")_$S(VA(3):$E(VAY,3,4),1:"")_$S($D(VAT):"@"_VAT,1:"")
    14 QUIT    I $D(VADAT("J")),VADAT("J")?.N F I=$L(VADATE("E"))+1:1:VADAT("J") S VADATE("E")=" "_VADATE("E")
    15         K %DT,VA,VAD,VADEL,VAM,VAT,VAX,VAY,VANOW Q
    16 KVAR    K VADAT,VADATE Q
     1VADATE ;ALB/MLI - GENERIC DATE ROUTINE ; 1 DEC 88 @1000
     2 ;;5.3;Registration;;Aug 13, 1993
     3 ;
     4 I $D(VADAT("F")),$S(VADAT("F")<1:1,VADAT("F")>2:1,1:0) K VADAT("F")
     5 I '$D(VADAT("W")) D NOW^%DTC
     6 S VA=$S('$D(VADAT("W")):%,1:VADAT("W")),(VA,VADATE("I"))=$S($D(VADAT("S")):VA,'$D(VADAT("T")):$E(VA,1,12),1:$P(VA,".",1))
     7 S:'$D(VADAT("H")) (VA(1),VA(2),VA(3))=1 I $D(VADAT("H")) F I=1:1:3 S VA(I)=$S(VADAT("H")[I:1,1:0)
     8 S VAM=$S('$E(VA,4,5):"",'VA(2):"",$S('$D(VADAT("F")):1,VADAT("F")=2:1,1:0):$P("JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC","^",+$E(VA,4,5)),1:$E(VA,4,5)),VAY=$S(VA(3):(1700+$E(VA,1,3)),1:""),VAD=$S(VA(1)&$E(VA,6,7):$E(VA,6,7),1:"")
     9 I $P(VA,".",2)]"" S VA=$P(VA,".",2),VAT=$E(VA_"000000",1,2)_":"_$E(VA_"000000",3,4) S:$D(VADAT("S")) VAT=VAT_":"_$E(VA_"000000",5,6)
     10 I '$D(VADAT("F")) S VADATE("E")=VAM_$S(VAM]""&(VAD!VAY):" ",1:"")_$S(VAD:$J(+VAD,2),1:"")_$S(VAD&VAY:",",1:"")_VAY_$S($D(VAT):"@"_VAT,1:"") G QUIT
     11 S VADEL=$S('$D(VADAT("D")):"-",1:VADAT("D")) I VADAT("F")=1 S VADATE("E")=$S('VA(2):"",VAM]"":VAM,1:"00")_$S(VA(1)&VA(2):VADEL,1:"")_$S('VA(1):"",VAD]"":VAD,1:"00")_$S((VA(1)!VA(2))&VA(3):VADEL,1:"")
     12 I VADAT("F")=2 S VADATE("E")=$S('VA(1):"",VAD]"":VAD,1:"00")_$S(VA(1)&VA(2):VADEL,1:"")_$S('VA(2):"",VAM]"":VAM,1:"XXX")_$S((VA(1)!VA(2))&VA(3):VADEL,1:"")
     13 S VADATE("E")=VADATE("E")_$S(VA(3):$E(VAY,3,4),1:"")_$S($D(VAT):"@"_VAT,1:"")
     14QUIT I $D(VADAT("J")),VADAT("J")?.N F I=$L(VADATE("E"))+1:1:VADAT("J") S VADATE("E")=" "_VADATE("E")
     15 K %DT,VA,VAD,VADEL,VAM,VAT,VAX,VAY Q
     16KVAR K VADAT,VADATE Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VADPT1.m

    r613 r623  
    1 VADPT1  ;ALB/MRL/MJK - PATIENT VARIABLES ;1/27/07  15:00
    2         ;;5.3;Registration;**415,489,516,614,634**;Aug 13, 1993;Build 30
    3         ; Modified from FOIA VISTA,
    4         ; Copyright (C) 2007 WorldVistA
    5         ;
    6         ; This program is free software; you can redistribute it and/or modify
    7         ; it under the terms of the GNU General Public License as published by
    8         ; the Free Software Foundation; either version 2 of the License, or
    9         ; (at your option) any later version.
    10         ;
    11         ; This program is distributed in the hope that it will be useful,
    12         ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    13         ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14         ; GNU General Public License for more details.
    15         ;
    16         ; You should have received a copy of the GNU General Public License
    17         ; along with this program; if not, write to the Free Software
    18         ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    19 1       ;Demographic [DEM]
    20         N W,Z,NODE
    21         ;
    22         ; -- name [1 - NM]
    23         S VAX=^DPT(DFN,0),@VAV@($P(VAS,"^",1))=$P(VAX,"^")
    24         ;
    25         ; -- ssn [2 - SS]
    26         S Z=$P(VAX,"^",9) S:Z]"" @VAV@($P(VAS,"^",2))=Z_$S(Z]"":"^"_$E(Z,1,3)_"-"_$E(Z,4,5)_"-"_$E(Z,6,10),1:"")
    27         ;
    28         ; -- date of birth [2 - DB]
    29         S Z=$P(VAX,"^",3),Y=Z I Y]"" X ^DD("DD") S @VAV@($P(VAS,"^",3))=Z_"^"_Y
    30         ;
    31         ; -- age [4 - AG]
    32         S W=$S('$D(^DPT(DFN,.35)):"",'^(.35):"",1:+^(.35)) S Y=$S('W:DT,1:W) S:Z]"" @VAV@($P(VAS,"^",4))=$E(Y,1,3)-$E(Z,1,3)-($E(Y,4,7)<$E(Z,4,7))
    33         ;
    34         ; Added for VOE to support pediatrics
    35         ;
    36         I @VAV@($P(VAS,"^",4))<2 D  ;IHS/ANMC/CLS 01/20/2005
    37         .N X,X1,X2,X3
    38         .S X1=$S('$G(^DPT(DFN,.35)):DT,1:+^(.35))
    39         .S X2=$P(VAX,"^",3) Q:'X1!('X2)
    40         .D ^%DTC S X3=X\365.25,X=$S(X3>2:X3,X<31:X_" DYS",1:X\30_" MOS")
    41         .S @VAV@($P(VAS,"^",4))=X Q
    42         ;
    43         ; End VOE addition
    44         ;
    45         ;
    46         ; -- expired date [6 - EX]
    47         S (Y,Z)=W X:Y]"" ^DD("DD") S:Z]"" @VAV@($P(VAS,"^",6))=Z_"^"_Y
    48         ;
    49         ; -- sex [5 - SX]
    50         S Z=$P(VAX,"^",2) S:Z]"" @VAV@($P(VAS,"^",5))=Z_"^"_$S(Z="M":"MALE",Z="F":"FEMALE",1:"") K Z
    51         ;
    52         ; -- remarks [7 - RE]
    53         S @VAV@($P(VAS,"^",7))=$P(VAX,"^",10)
    54         ;
    55         ; -- historic race [8 - RA]
    56         S Z=$P(VAX,"^",6),@VAV@($P(VAS,"^",8))=Z_$S($D(^DIC(10,+Z,0)):"^"_$P(^(0),"^"),1:"")
    57         ;
    58         ; -- religion [9 - RP]
    59         S Z=$P(VAX,"^",8),@VAV@($P(VAS,"^",9))=Z_$S($D(^DIC(13,+Z,0)):"^"_$P(^(0),"^"),1:"")
    60         ;
    61         ; -- marital status [10 - MS]
    62         S Z=$P(VAX,"^",5),@VAV@($P(VAS,"^",10))=Z_$S($D(^DIC(11,+Z,0)):"^"_$P(^(0),"^"),1:"")
    63         ;
    64         ; -- ethnicity [11 - ET]
    65         S X=0 F Y=1:1 S X=+$O(^DPT(DFN,.06,X)) Q:'X  D
    66         .S NODE=$G(^DPT(DFN,.06,X,0)),Z=$P(NODE,"^",1) I Z D
    67         ..S @VAV@($P(VAS,"^",11),Y)=Z_"^"_$P($G(^DIC(10.2,Z,0)),"^",1)
    68         ..; -- collection method
    69         ..S Z=$P(NODE,"^",2) I Z D
    70         ...S @VAV@($P(VAS,"^",11),Y,1)=Z_"^"_$P($G(^DIC(10.3,Z,0)),"^",1)
    71         S @VAV@($P(VAS,"^",11))=Y-1
    72         ;
    73         ; -- race [12 - RC]
    74         S X=0 F Y=1:1 S X=+$O(^DPT(DFN,.02,X)) Q:'X  D
    75         .S NODE=$G(^DPT(DFN,.02,X,0)),Z=$P(NODE,"^",1) I Z D
    76         ..S @VAV@($P(VAS,"^",12),Y)=Z_"^"_$P($G(^DIC(10,Z,0)),"^",1)
    77         ..; -- collection method
    78         ..S Z=$P(NODE,"^",2) I Z D
    79         ...S @VAV@($P(VAS,"^",12),Y,1)=Z_"^"_$P($G(^DIC(10.3,Z,0)),"^",1)
    80         S @VAV@($P(VAS,"^",12))=Y-1
    81         Q
    82         ;
    83         ; Added for VOE to support pediatrics
    84         ;
    85 PAGE    ; -- IHS printable age  ;IHS/ITSC/CLS 01/14/2005
    86         N X,X1,X2,Y,AUX
    87         S X1=$S('$D(^DPT(DFN,.35)):DT,1:+^(.35))
    88         S X2=$P(VAX,"^",3) D:X2 ^%DTC:X1 S AUX=X\365.25,X=$S(AUX>2:AUX_" YRS",X<31:X_" DYS",1:X\30_" MOS")
    89         S @VAV@($P(VAS,"^",4))=X Q
    90         ;
    91         ; End addition for VOE & IHS
    92         ;
    93 2       ;Other Patient Variables [OPD]
    94         N W,Z
    95         S VAX=^DPT(DFN,0)
    96         ;
    97         ; -- city of birth [1 - BC]
    98         S @VAV@($P(VAS,"^",1))=$P(VAX,"^",11)
    99         ;
    100         ; -- state of birth [2 - BS]
    101         S Z=$P(VAX,"^",12),@VAV@($P(VAS,"^",2))=Z_$S($D(^DIC(5,+Z,0)):"^"_$P(^(0),"^",1),1:"")
    102         ;
    103         ; -- occupation [6 - OC]
    104         S @VAV@($P(VAS,"^",6))=$P(VAX,"^",7)
    105         ;
    106         ; -- names
    107         S VAX=$S($D(^DPT(DFN,.24)):^(.24),1:"")
    108         S @VAV@($P(VAS,"^",3))=$P(VAX,"^",1) ; father's        [3 - FN]
    109         S @VAV@($P(VAS,"^",4))=$P(VAX,"^",2) ; mother's        [4 - MN]
    110         S @VAV@($P(VAS,"^",5))=$P(VAX,"^",3) ; mother's maiden [5 - MM]
    111         ;
    112         ; -- employment status [7 - ES]
    113         S VAX=$S($D(^DPT(DFN,.311)):^(.311),1:""),W="EMPLOYED FULL TIME^EMPLOYED PART TIME^NOT EMPLOYED^SELF EMPLOYED^RETIRED^ACTIVE MILITARY DUTY^UNKNOWN"
    114         S Z=$P(VAX,"^",15),@VAV@($P(VAS,"^",7))=Z_$S(Z:"^"_$P(W,"^",Z),1:"")
    115         Q
    116         ;
    117 3       ;Address [ADD]
    118         S VABEG=$S($D(VATEST("ADD",9)):VATEST("ADD",9),1:DT),VAEND=$S($D(VATEST("ADD",10)):VATEST("ADD",10),1:DT)
    119         I $S($D(VAPA("P")):1,'$D(^DPT(DFN,.121)):1,$P(^(.121),"^",9)'="Y":1,'$P(^(.121),"^",7):1,$P(^(.121),"^",7)>VABEG:1,'$P(^(.121),"^",8):0,1:$P(^(.121),"^",8)<VAEND) S VAX=$S($D(^DPT(DFN,.11)):^(.11),1:""),VAX(1)=0
    120         E  S VAX=$S($D(^DPT(DFN,.121)):^(.121),1:""),VAX(1)=1
    121         F I=1:1:6 S VAZ=$P(VAX,"^",I),@VAV@($P(VAS,"^",I))=VAZ I I=5,$D(^DIC(5,+VAZ,0)) S VAZ=$P(^(0),"^"),@VAV@($P(VAS,"^",5))=@VAV@($P(VAS,"^",5))_"^"_VAZ
    122         S VAZ=$S('VAX(1):$P(VAX,"^",7),1:$P(VAX,"^",11)) S:$D(^DIC(5,+$P(VAX,"^",5),1,+VAZ,0)) VAZ=VAZ_"^"_$P(^(0),"^",1) S @VAV@($P(VAS,"^",7))=VAZ
    123         S VAZIP4=$P(VAX,U,12)
    124         S @VAV@($P(VAS,U,11))=VAZIP4_$S('$G(VAZIP4):"",($L(VAZIP4)=5):U_VAZIP4,1:U_$E(VAZIP4,1,5)_"-"_$E(VAZIP4,6,9))
    125         ;DG*5.3*516
    126         I $D(^DPT(DFN,.13)) S @VAV@($P(VAS,"^",8))=$P(^(.13),"^",1)
    127         I 'VAX(1) G CA
    128         S @VAV@($P(VAS,"^",8))=$P(VAX,"^",10)
    129         F I=7,8 S VAZ=$P(VAX,"^",I),Y=VAZ X:Y]"" ^DD("DD") S @VAV@($P(VAS,"^",I+2))=VAZ_"^"_Y
    130 CA      ;Confidential Address
    131         I '$D(^DPT(DFN,.141)) G Q3
    132         N VACAT,VAACT,VAACTDT,VATYP,VATYPNAM,VACAN
    133         S VAX=$S($D(^DPT(DFN,.141)):^(.141),1:"")
    134         S VAACTDT=$S($D(VAPA("CD")):VAPA("CD"),1:DT)
    135         F I=1:1:6 S VAZ=$P(VAX,"^",I),@VAV@($P(VAS,"^",I+12))=VAZ D
    136         .I I=5,$D(^DIC(5,+VAZ,0)) S VAZ=$P(^(0),"^"),@VAV@($P(VAS,"^",I+12))=@VAV@($P(VAS,"^",I+12))_"^"_VAZ Q
    137         .I I=6,($G(VAZ)]"") S @VAV@($P(VAS,"^",I+12))=@VAV@($P(VAS,"^",I+12))_"^"_$S(($L(VAZ)=5):VAZ,1:$E(VAZ,1,5)_"-"_$E(VAZ,6,9))
    138         S VAZ=$P(VAX,"^",11) S:$D(^DIC(5,+$P(VAX,"^",5),1,+VAZ,0)) VAZ=VAZ_"^"_$P(^(0),"^",1) S @VAV@($P(VAS,"^",19))=VAZ
    139         F I=7,8 S VAZ=$P(VAX,"^",I),Y=VAZ X:Y]"" ^DD("DD") S @VAV@($P(VAS,"^",I+13))=VAZ_"^"_Y
    140         S VABEG=$P(VAX,"^",7),VAEND=$P(VAX,"^",8)
    141         S @VAV@($P(VAS,"^",12))=1
    142         I 'VABEG!(VABEG>VAACTDT)!(VAEND&(VAEND<VAACTDT)) S @VAV@($P(VAS,"^",12))=0
    143         I $D(^DPT(DFN,.14)) D
    144         .S VACAN="" F  S VACAN=$O(^DPT(DFN,.14,VACAN)) Q:VACAN=""  D
    145         ..Q:'$D(^DPT(DFN,.14,VACAN,0))
    146         ..S VATYP=$P(^DPT(DFN,.14,VACAN,0),"^",1),VAACT=$P(^DPT(DFN,.14,VACAN,0),"^",2)
    147         ..S VACAT=$$GET1^DID(2.141,.01,"","POINTER","","DGERR")
    148         ..S VATYPNAM="" F I=1:1 S VATYPNAM=$P(VACAT,";",I) Q:VATYPNAM=""  D
    149         ...I +VATYPNAM[VATYP S VATYPNAM=$P(VATYPNAM,":",2),@VAV@($P(VAS,"^",22),VATYP)=VATYP_"^"_VATYPNAM_"^"_VAACT
    150 Q3      K VABEG,VAEND,VAZIP4 Q
    151         ;
    152 4       ;Other Address [OAD]
    153         N VAZIP4
    154         I $S('$D(VAOA("A")):1,VAOA("A")<1:1,VAOA("A")>6:1,1:0) S VAX=.21,VAOA("A")=7
    155         E  S VAX="."_$P("33^34^211^331^311^25","^",+VAOA("A"))
    156         S VAX(1)=VAX,VAX=$S($D(^DPT(DFN,VAX(1))):^(VAX(1)),1:"") I VAX(1)=.25 S VAX=$P(VAX,"^",1)_"^^"_$P(VAX,"^",2,99)
    157         S VAX(2)=0 F I=3,4,5,6,7,8 S VAX(2)=VAX(2)+1,@VAV@($P(VAS,"^",VAX(2)))=$P(VAX,"^",I)
    158         S @VAV@($P(VAS,"^",7))="",@VAV@($P(VAS,"^",8))=$P(VAX,"^",9),VAX(2)=8
    159         F I=1,2 S VAX(2)=VAX(2)+1,@VAV@($P(VAS,"^",VAX(2)))=$P(VAX,"^",I)
    160         I "^.311^.25"[("^"_VAX(1)_"^") S @VAV@($P(VAS,"^",10))=""
    161         S VAZ=@VAV@($P(VAS,"^",5)) I VAZ,$D(^DIC(5,+VAZ,0)) S VAZ(1)=$P(^(0),"^",1),@VAV@($P(VAS,"^",5))=VAZ_"^"_VAZ(1)
    162         S VAZIP4=$P($G(^DPT(DFN,.22)),U,VAOA("A"))
    163         S @VAV@($P(VAS,U,11))=VAZIP4_$S('$G(VAZIP4):"",($L(VAZIP4)=5):U_VAZIP4,1:U_$E(VAZIP4,1,5)_"-"_$E(VAZIP4,6,9))
    164         Q
     1VADPT1 ;ALB/MRL/MJK - PATIENT VARIABLES ;1/27/07  15:00
     2 ;;5.3;Registration;**415,489,516,614,634**;Aug 13, 1993;Build 28
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
     191 ;Demographic [DEM]
     20 N W,Z,NODE
     21 ;
     22 ; -- name [1 - NM]
     23 S VAX=^DPT(DFN,0),@VAV@($P(VAS,"^",1))=$P(VAX,"^")
     24 ;
     25 ; -- ssn [2 - SS]
     26 S Z=$P(VAX,"^",9) S:Z]"" @VAV@($P(VAS,"^",2))=Z_$S(Z]"":"^"_$E(Z,1,3)_"-"_$E(Z,4,5)_"-"_$E(Z,6,10),1:"")
     27 ;
     28 ; -- date of birth [2 - DB]
     29 S Z=$P(VAX,"^",3),Y=Z I Y]"" X ^DD("DD") S @VAV@($P(VAS,"^",3))=Z_"^"_Y
     30 ;
     31 ; -- age [4 - AG]
     32 S W=$S('$D(^DPT(DFN,.35)):"",'^(.35):"",1:+^(.35)) S Y=$S('W:DT,1:W) S:Z]"" @VAV@($P(VAS,"^",4))=$E(Y,1,3)-$E(Z,1,3)-($E(Y,4,7)<$E(Z,4,7))
     33 ;
     34 ; Added for VOE to support pediatrics
     35 ;
     36 I @VAV@($P(VAS,"^",4))<2 D  ;IHS/ANMC/CLS 01/20/2005
     37 .N X,X1,X2,X3
     38 .S X1=$S('$G(^DPT(DFN,.35)):DT,1:+^(.35))
     39 .S X2=$P(VAX,"^",3) Q:'X1!('X2)
     40 .D ^%DTC S X3=X\365.25,X=$S(X3>2:X3,X<31:X_" DYS",1:X\30_" MOS")
     41 .S @VAV@($P(VAS,"^",4))=X Q
     42 ;
     43 ; End VOE addition
     44 ;
     45 ;
     46 ; -- expired date [6 - EX]
     47 S (Y,Z)=W X:Y]"" ^DD("DD") S:Z]"" @VAV@($P(VAS,"^",6))=Z_"^"_Y
     48 ;
     49 ; -- sex [5 - SX]
     50 S Z=$P(VAX,"^",2) S:Z]"" @VAV@($P(VAS,"^",5))=Z_"^"_$S(Z="M":"MALE",Z="F":"FEMALE",1:"") K Z
     51 ;
     52 ; -- remarks [7 - RE]
     53 S @VAV@($P(VAS,"^",7))=$P(VAX,"^",10)
     54 ;
     55 ; -- historic race [8 - RA]
     56 S Z=$P(VAX,"^",6),@VAV@($P(VAS,"^",8))=Z_$S($D(^DIC(10,+Z,0)):"^"_$P(^(0),"^"),1:"")
     57 ;
     58 ; -- religion [9 - RP]
     59 S Z=$P(VAX,"^",8),@VAV@($P(VAS,"^",9))=Z_$S($D(^DIC(13,+Z,0)):"^"_$P(^(0),"^"),1:"")
     60 ;
     61 ; -- marital status [10 - MS]
     62 S Z=$P(VAX,"^",5),@VAV@($P(VAS,"^",10))=Z_$S($D(^DIC(11,+Z,0)):"^"_$P(^(0),"^"),1:"")
     63 ;
     64 ; -- ethnicity [11 - ET]
     65 S X=0 F Y=1:1 S X=+$O(^DPT(DFN,.06,X)) Q:'X  D
     66 .S NODE=$G(^DPT(DFN,.06,X,0)),Z=$P(NODE,"^",1) I Z D
     67 ..S @VAV@($P(VAS,"^",11),Y)=Z_"^"_$P($G(^DIC(10.2,Z,0)),"^",1)
     68 ..; -- collection method
     69 ..S Z=$P(NODE,"^",2) I Z D
     70 ...S @VAV@($P(VAS,"^",11),Y,1)=Z_"^"_$P($G(^DIC(10.3,Z,0)),"^",1)
     71 S @VAV@($P(VAS,"^",11))=Y-1
     72 ;
     73 ; -- race [12 - RC]
     74 S X=0 F Y=1:1 S X=+$O(^DPT(DFN,.02,X)) Q:'X  D
     75 .S NODE=$G(^DPT(DFN,.02,X,0)),Z=$P(NODE,"^",1) I Z D
     76 ..S @VAV@($P(VAS,"^",12),Y)=Z_"^"_$P($G(^DIC(10,Z,0)),"^",1)
     77 ..; -- collection method
     78 ..S Z=$P(NODE,"^",2) I Z D
     79 ...S @VAV@($P(VAS,"^",12),Y,1)=Z_"^"_$P($G(^DIC(10.3,Z,0)),"^",1)
     80 S @VAV@($P(VAS,"^",12))=Y-1
     81 Q
     82 ;
     83 ; Added for VOE to support pediatrics
     84 ;
     85PAGE ; -- IHS printable age  ;IHS/ITSC/CLS 01/14/2005
     86 N X,X1,X2,Y,AUX
     87 S X1=$S('$D(^DPT(DFN,.35)):DT,1:+^(.35))
     88 S X2=$P(VAX,"^",3) D:X2 ^%DTC:X1 S AUX=X\365.25,X=$S(AUX>2:AUX_" YRS",X<31:X_" DYS",1:X\30_" MOS")
     89 S @VAV@($P(VAS,"^",4))=X Q
     90 ;
     91 ; End addition for VOE & IHS
     92 ;
     932 ;Other Patient Variables [OPD]
     94 N W,Z
     95 S VAX=^DPT(DFN,0)
     96 ;
     97 ; -- city of birth [1 - BC]
     98 S @VAV@($P(VAS,"^",1))=$P(VAX,"^",11)
     99 ;
     100 ; -- state of birth [2 - BS]
     101 S Z=$P(VAX,"^",12),@VAV@($P(VAS,"^",2))=Z_$S($D(^DIC(5,+Z,0)):"^"_$P(^(0),"^",1),1:"")
     102 ;
     103 ; -- occupation [6 - OC]
     104 S @VAV@($P(VAS,"^",6))=$P(VAX,"^",7)
     105 ;
     106 ; -- names
     107 S VAX=$S($D(^DPT(DFN,.24)):^(.24),1:"")
     108 S @VAV@($P(VAS,"^",3))=$P(VAX,"^",1) ; father's        [3 - FN]
     109 S @VAV@($P(VAS,"^",4))=$P(VAX,"^",2) ; mother's        [4 - MN]
     110 S @VAV@($P(VAS,"^",5))=$P(VAX,"^",3) ; mother's maiden [5 - MM]
     111 ;
     112 ; -- employment status [7 - ES]
     113 S VAX=$S($D(^DPT(DFN,.311)):^(.311),1:""),W="EMPLOYED FULL TIME^EMPLOYED PART TIME^NOT EMPLOYED^SELF EMPLOYED^RETIRED^ACTIVE MILITARY DUTY^UNKNOWN"
     114 S Z=$P(VAX,"^",15),@VAV@($P(VAS,"^",7))=Z_$S(Z:"^"_$P(W,"^",Z),1:"")
     115 Q
     116 ;
     1173 ;Address [ADD]
     118 S VABEG=$S($D(VATEST("ADD",9)):VATEST("ADD",9),1:DT),VAEND=$S($D(VATEST("ADD",10)):VATEST("ADD",10),1:DT)
     119 I $S($D(VAPA("P")):1,'$D(^DPT(DFN,.121)):1,$P(^(.121),"^",9)'="Y":1,'$P(^(.121),"^",7):1,$P(^(.121),"^",7)>VABEG:1,'$P(^(.121),"^",8):0,1:$P(^(.121),"^",8)<VAEND) S VAX=$S($D(^DPT(DFN,.11)):^(.11),1:""),VAX(1)=0
     120 E  S VAX=$S($D(^DPT(DFN,.121)):^(.121),1:""),VAX(1)=1
     121 F I=1:1:6 S VAZ=$P(VAX,"^",I),@VAV@($P(VAS,"^",I))=VAZ I I=5,$D(^DIC(5,+VAZ,0)) S VAZ=$P(^(0),"^"),@VAV@($P(VAS,"^",5))=@VAV@($P(VAS,"^",5))_"^"_VAZ
     122 S VAZ=$S('VAX(1):$P(VAX,"^",7),1:$P(VAX,"^",11)) S:$D(^DIC(5,+$P(VAX,"^",5),1,+VAZ,0)) VAZ=VAZ_"^"_$P(^(0),"^",1) S @VAV@($P(VAS,"^",7))=VAZ
     123 S VAZIP4=$P(VAX,U,12)
     124 S @VAV@($P(VAS,U,11))=VAZIP4_$S('$G(VAZIP4):"",($L(VAZIP4)=5):U_VAZIP4,1:U_$E(VAZIP4,1,5)_"-"_$E(VAZIP4,6,9))
     125 ;DG*5.3*516
     126 I $D(^DPT(DFN,.13)) S @VAV@($P(VAS,"^",8))=$P(^(.13),"^",1)
     127 I 'VAX(1) G CA
     128 S @VAV@($P(VAS,"^",8))=$P(VAX,"^",10)
     129 F I=7,8 S VAZ=$P(VAX,"^",I),Y=VAZ X:Y]"" ^DD("DD") S @VAV@($P(VAS,"^",I+2))=VAZ_"^"_Y
     130CA ;Confidential Address
     131 I '$D(^DPT(DFN,.141)) G Q3
     132 N VACAT,VAACT,VAACTDT,VATYP,VATYPNAM,VACAN
     133 S VAX=$S($D(^DPT(DFN,.141)):^(.141),1:"")
     134 S VAACTDT=$S($D(VAPA("CD")):VAPA("CD"),1:DT)
     135 F I=1:1:6 S VAZ=$P(VAX,"^",I),@VAV@($P(VAS,"^",I+12))=VAZ D
     136 .I I=5,$D(^DIC(5,+VAZ,0)) S VAZ=$P(^(0),"^"),@VAV@($P(VAS,"^",I+12))=@VAV@($P(VAS,"^",I+12))_"^"_VAZ Q
     137 .I I=6,($G(VAZ)]"") S @VAV@($P(VAS,"^",I+12))=@VAV@($P(VAS,"^",I+12))_"^"_$S(($L(VAZ)=5):VAZ,1:$E(VAZ,1,5)_"-"_$E(VAZ,6,9))
     138 S VAZ=$P(VAX,"^",11) S:$D(^DIC(5,+$P(VAX,"^",5),1,+VAZ,0)) VAZ=VAZ_"^"_$P(^(0),"^",1) S @VAV@($P(VAS,"^",19))=VAZ
     139 F I=7,8 S VAZ=$P(VAX,"^",I),Y=VAZ X:Y]"" ^DD("DD") S @VAV@($P(VAS,"^",I+13))=VAZ_"^"_Y
     140 S VABEG=$P(VAX,"^",7),VAEND=$P(VAX,"^",8)
     141 S @VAV@($P(VAS,"^",12))=1
     142 I 'VABEG!(VABEG>VAACTDT)!(VAEND&(VAEND<VAACTDT)) S @VAV@($P(VAS,"^",12))=0
     143 I $D(^DPT(DFN,.14)) D
     144 .S VACAN="" F  S VACAN=$O(^DPT(DFN,.14,VACAN)) Q:VACAN=""  D
     145 ..Q:'$D(^DPT(DFN,.14,VACAN,0))
     146 ..S VATYP=$P(^DPT(DFN,.14,VACAN,0),"^",1),VAACT=$P(^DPT(DFN,.14,VACAN,0),"^",2)
     147 ..S VACAT=$$GET1^DID(2.141,.01,"","POINTER","","DGERR")
     148 ..S VATYPNAM="" F I=1:1 S VATYPNAM=$P(VACAT,";",I) Q:VATYPNAM=""  D
     149 ...I +VATYPNAM[VATYP S VATYPNAM=$P(VATYPNAM,":",2),@VAV@($P(VAS,"^",22),VATYP)=VATYP_"^"_VATYPNAM_"^"_VAACT
     150Q3 K VABEG,VAEND,VAZIP4 Q
     151 ;
     1524 ;Other Address [OAD]
     153 N VAZIP4
     154 I $S('$D(VAOA("A")):1,VAOA("A")<1:1,VAOA("A")>6:1,1:0) S VAX=.21,VAOA("A")=7
     155 E  S VAX="."_$P("33^34^211^331^311^25","^",+VAOA("A"))
     156 S VAX(1)=VAX,VAX=$S($D(^DPT(DFN,VAX(1))):^(VAX(1)),1:"") I VAX(1)=.25 S VAX=$P(VAX,"^",1)_"^^"_$P(VAX,"^",2,99)
     157 S VAX(2)=0 F I=3,4,5,6,7,8 S VAX(2)=VAX(2)+1,@VAV@($P(VAS,"^",VAX(2)))=$P(VAX,"^",I)
     158 S @VAV@($P(VAS,"^",7))="",@VAV@($P(VAS,"^",8))=$P(VAX,"^",9),VAX(2)=8
     159 F I=1,2 S VAX(2)=VAX(2)+1,@VAV@($P(VAS,"^",VAX(2)))=$P(VAX,"^",I)
     160 I "^.311^.25"[("^"_VAX(1)_"^") S @VAV@($P(VAS,"^",10))=""
     161 S VAZ=@VAV@($P(VAS,"^",5)) I VAZ,$D(^DIC(5,+VAZ,0)) S VAZ(1)=$P(^(0),"^",1),@VAV@($P(VAS,"^",5))=VAZ_"^"_VAZ(1)
     162 S VAZIP4=$P($G(^DPT(DFN,.22)),U,VAOA("A"))
     163 S @VAV@($P(VAS,U,11))=VAZIP4_$S('$G(VAZIP4):"",($L(VAZIP4)=5):U_VAZIP4,1:U_$E(VAZIP4,1,5)_"-"_$E(VAZIP4,6,9))
     164 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VADPT2.m

    r613 r623  
    1 VADPT2  ;ALB/MJK - ESTABLISH PATIENT VARIABLES ; 3/23/88  9:13 PM ; [10/20/95 4:02pm]
    2         ;;5.3;Registration;**69,749**;Aug 13, 1993;Build 10
    3 5       ; -- INP call
    4         S (VAWD,VATS,VADX,VAPP,VAAP,VARM)="" S VANOW=$$NOW^XLFDT K VAMV,VAMV0
    5         I '$D(VAINDT) N VAINDT S VAINDT=VANOW
    6         S VATD=9999999.999999-VAINDT
    7         F VAID=VATD:0 S VAID=$O(^DGPM("APID",DFN,VAID)) Q:'VAID  S VAMV=$O(^(VAID,0)) D CHK I $D(VAMV) K:"^3^4^5^"[("^"_VAMT_"^") VAMV,VAMV0 Q
    8         ;
    9         G:'$D(VAMV0) DONE
    10         S (VAPRT,VAPRC,VACN)=1 D GET^VADPT30
    11         S VAMV0=^DGPM(VAMV,0),VAMVT=$P(VAMV0,"^",4),VACA=$P(VAMV0,"^",14),VACA0=$S($D(^DGPM(+VACA,0)):^(0),1:"")
    12         ;
    13         ; set: adm ifn(1) ; doctor(2) ; tr spec(3) ; ward(4) ; room(5) ; attending (11)
    14         S @VAV@($P(VAS,"^",1))=VACA,@VAV@($P(VAS,"^",2))=VAPP,@VAV@($P(VAS,"^",3))=VATS,@VAV@($P(VAS,"^",4))=VAWD,@VAV@($P(VAS,"^",5))=$P(VARM,"^",2),@VAV@($P(VAS,"^",11))=VAAP
    15         ;
    16         ; set bed/no bed  mvt type(6)
    17         D IB S @VAV@($P(VAS,"^",6))=VAZ
    18         ;
    19         ; set adm date(7)
    20         S Y=+VACA0 X:Y ^DD("DD") S @VAV@($P(VAS,"^",7))=+VACA0_"^"_Y
    21         ;
    22         ; set: adm type(8) ; adm dx(9) ; ptf ifn(10)
    23         S @VAV@($P(VAS,"^",8))=$P(VACA0,"^",4)_"^"_$S($D(^DG(405.1,+$P(VACA0,"^",4),0)):$P(^(0),"^"),1:""),@VAV@($P(VAS,"^",9))=$P(VACA0,"^",10),@VAV@($P(VAS,"^",10))=$P(VACA0,"^",16)
    24         ;
    25 DONE    K VAID,VANOW,VACA,VACA0,VAMV,VAMV0,VATD,VAMT,VAMVT D KVAR^VADPT30 Q
    26         ;
    27 IB      ;In-Bed status
    28         ; input:  VAINDT = internal date of requested info
    29         ;         VAMV   = starting IFN
    30         ;         VAMV0  = 0th of VAMV
    31         ;
    32         ; output: VAZ    = <O:not in bed OR 1: in bed>^fac. mvt name
    33         ;         VAZ(2) = abs ret date
    34         ;
    35         S VAZ=0,VAZ(2)=""
    36         S VAXI=+$O(^DGPM("APMV",DFN,+$P(VAMV0,"^",14),9999999.999999-VAINDT)),VAXI=+$O(^(VAXI,0))
    37         I 'VAXI,$D(VAIP("L")),$P(VAMV0,"^",2)=4 S VAXI=VAMV ; only used via IN5
    38         G IBQ:'VAXI
    39         S VAX0=$S($D(^DGPM(VAXI,0)):^(0),1:"")
    40         G IBQ:VAX0']"",IBQ:"^3^5^"[("^"_$P(VAX0,"^",2)_"^")
    41         S VAXI=$S($D(^DG(405.1,+$P(VAX0,"^",4),0)):$P(^(0),"^"),1:"")
    42         ; -- check in-bed status flag
    43         S VAZ=$S('$D(^DG(405.2,+$P(VAX0,"^",18),"E")):1,1:'^("E"))_"^"_VAXI,VAZ(2)=$P(VAX0,"^",13)
    44 IBQ     K VAXI,VAX0 Q
    45         ;
    46 CHK     ; -- check if mvt exists and if 'while asih' type d/c
    47         ;    if VAMV returned undefined then continue $Oing
    48         ;
    49         I $D(^DGPM(+VAMV,0)) S VAMV0=^(0),VAMT=$P(VAMV0,"^",2)
    50         I '$D(VAMV0) K VAMV G CHKQ
    51         I "^42^47^"[("^"_$P(VAMV0,"^",18)_"^"),$P(VAMV0,"^",22)'=2,$O(^DGPM("APMV",DFN,+$P(VAMV0,"^",14),VAID)),$O(^($O(^(VAID)),0)),$D(^DGPM($O(^(0)),0)),"^13^44^"[("^"_$P(^(0),"^",18)_"^") K VAMV,VAMV0
    52         ; info: 47 mvt can not have seq #; will always be null
    53 CHKQ    Q
    54         ;
    55 ADM     ; -- send back adm ifn for dfn on vaindt or now
    56         S VADT=$S($D(VAINDT):VAINDT,1:"") I 'VADT  S VADT=$$NOW^XLFDT
    57         S VAID=9999999.999999-VADT,VADMVT=""
    58         F  S VAID=$O(^DGPM("ATID1",DFN,VAID)) Q:'VAID  S VAMV=+$O(^DGPM("ATID1",DFN,VAID,0)) I $D(^DGPM(VAMV,0)) S VAMV0=^(0),VAMV1=$S($D(^DGPM(+$P(VAMV0,"^",17),0)):^(0),1:9999999.999999) D  Q:VADMVT!($P(VAMV0,U,18)'=40)
    59         .I VAMV0'>VADT,VAMV1>VADT S VADMVT=VAMV
    60         K VAID,VADT,VAMV,VAMV0,VAMV1
     1VADPT2 ;ALB/MJK - ESTABLISH PATIENT VARIABLES ; 3/23/88  9:13 PM ; [10/20/95 4:02pm]
     2 ;;5.3;Registration;**69**;Aug 13, 1993
     35 ; -- INP call
     4 S (VAWD,VATS,VADX,VAPP,VAAP,VARM)="" D NOW^%DTC S VANOW=% K VAMV,VAMV0
     5 I '$D(VAINDT) N VAINDT S VAINDT=VANOW
     6 S VATD=9999999.999999-VAINDT
     7 F VAID=VATD:0 S VAID=$O(^DGPM("APID",DFN,VAID)) Q:'VAID  S VAMV=$O(^(VAID,0)) D CHK I $D(VAMV) K:"^3^4^5^"[("^"_VAMT_"^") VAMV,VAMV0 Q
     8 ;
     9 G:'$D(VAMV0) DONE
     10 S (VAPRT,VAPRC,VACN)=1 D GET^VADPT30
     11 S VAMV0=^DGPM(VAMV,0),VAMVT=$P(VAMV0,"^",4),VACA=$P(VAMV0,"^",14),VACA0=$S($D(^DGPM(+VACA,0)):^(0),1:"")
     12 ;
     13 ; set: adm ifn(1) ; doctor(2) ; tr spec(3) ; ward(4) ; room(5) ; attending (11)
     14 S @VAV@($P(VAS,"^",1))=VACA,@VAV@($P(VAS,"^",2))=VAPP,@VAV@($P(VAS,"^",3))=VATS,@VAV@($P(VAS,"^",4))=VAWD,@VAV@($P(VAS,"^",5))=$P(VARM,"^",2),@VAV@($P(VAS,"^",11))=VAAP
     15 ;
     16 ; set bed/no bed  mvt type(6)
     17 D IB S @VAV@($P(VAS,"^",6))=VAZ
     18 ;
     19 ; set adm date(7)
     20 S Y=+VACA0 X:Y ^DD("DD") S @VAV@($P(VAS,"^",7))=+VACA0_"^"_Y
     21 ;
     22 ; set: adm type(8) ; adm dx(9) ; ptf ifn(10)
     23 S @VAV@($P(VAS,"^",8))=$P(VACA0,"^",4)_"^"_$S($D(^DG(405.1,+$P(VACA0,"^",4),0)):$P(^(0),"^"),1:""),@VAV@($P(VAS,"^",9))=$P(VACA0,"^",10),@VAV@($P(VAS,"^",10))=$P(VACA0,"^",16)
     24 ;
     25DONE K VAID,VANOW,VACA,VACA0,VAMV,VAMV0,VATD,VAMT,VAMVT D KVAR^VADPT30 Q
     26 ;
     27IB ;In-Bed status
     28 ; input:  VAINDT = internal date of requested info
     29 ;         VAMV   = starting IFN
     30 ;         VAMV0  = 0th of VAMV
     31 ;
     32 ; output: VAZ    = <O:not in bed OR 1: in bed>^fac. mvt name
     33 ;         VAZ(2) = abs ret date
     34 ;
     35 S VAZ=0,VAZ(2)=""
     36 S VAXI=+$O(^DGPM("APMV",DFN,+$P(VAMV0,"^",14),9999999.999999-VAINDT)),VAXI=+$O(^(VAXI,0))
     37 I 'VAXI,$D(VAIP("L")),$P(VAMV0,"^",2)=4 S VAXI=VAMV ; only used via IN5
     38 G IBQ:'VAXI
     39 S VAX0=$S($D(^DGPM(VAXI,0)):^(0),1:"")
     40 G IBQ:VAX0']"",IBQ:"^3^5^"[("^"_$P(VAX0,"^",2)_"^")
     41 S VAXI=$S($D(^DG(405.1,+$P(VAX0,"^",4),0)):$P(^(0),"^"),1:"")
     42 ; -- check in-bed status flag
     43 S VAZ=$S('$D(^DG(405.2,+$P(VAX0,"^",18),"E")):1,1:'^("E"))_"^"_VAXI,VAZ(2)=$P(VAX0,"^",13)
     44IBQ K VAXI,VAX0 Q
     45 ;
     46CHK ; -- check if mvt exists and if 'while asih' type d/c
     47 ;    if VAMV returned undefined then continue $Oing
     48 ;
     49 I $D(^DGPM(+VAMV,0)) S VAMV0=^(0),VAMT=$P(VAMV0,"^",2)
     50 I '$D(VAMV0) K VAMV G CHKQ
     51 I "^42^47^"[("^"_$P(VAMV0,"^",18)_"^"),$P(VAMV0,"^",22)'=2,$O(^DGPM("APMV",DFN,+$P(VAMV0,"^",14),VAID)),$O(^($O(^(VAID)),0)),$D(^DGPM($O(^(0)),0)),"^13^44^"[("^"_$P(^(0),"^",18)_"^") K VAMV,VAMV0
     52 ; info: 47 mvt can not have seq #; will always be null
     53CHKQ Q
     54 ;
     55ADM ; -- send back adm ifn for dfn on vaindt or now
     56 S VADT=$S($D(VAINDT):VAINDT,1:"") I 'VADT D NOW^%DTC S VADT=%
     57 S VAID=9999999.999999-VADT,VADMVT=""
     58 F  S VAID=$O(^DGPM("ATID1",DFN,VAID)) Q:'VAID  S VAMV=+$O(^DGPM("ATID1",DFN,VAID,0)) I $D(^DGPM(VAMV,0)) S VAMV0=^(0),VAMV1=$S($D(^DGPM(+$P(VAMV0,"^",17),0)):^(0),1:9999999.999999) D  Q:VADMVT!($P(VAMV0,U,18)'=40)
     59 .I VAMV0'>VADT,VAMV1>VADT S VADMVT=VAMV
     60 K VAID,VADT,VAMV,VAMV0,VAMV1
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VADPT3.m

    r613 r623  
    1 VADPT3  ;ALB/MRL - PATIENT VARIABLES [IN5]; 12 DEC 1988 ; 7/22/03 5:00pm
    2         ;;5.3;Registration;**532,749**;Aug 13, 1993;Build 10
    3         ;Inpatient variables [Version 5.0 and above]
    4 6       ;
    5         S (NOW,VAX("DAT"))=$$NOW^XLFDT,NOWI=9999999.999999-NOW
    6         ;
    7         I $D(VAIP("E")),$D(^DGPM(+VAIP("E"),0)) S VAX("DT")=+^(0),E=+VAIP("E") G GO ;Specific Entry
    8         ;
    9         I $D(VAIP("D")),"^l^L^"[("^"_$E(VAIP("D"))_"^") D LAST G GO:E,Q
    10         ;
    11         S VAX=$S($D(VAIP("D")):VAIP("D"),$D(VAINDT):VAINDT,1:0)
    12         I VAX S:VAX?7N!(VAX?7N1".".N) VAX("DT")=VAX I '$D(VAX("DT")) G Q ;Invalid Entry
    13         ;
    14         S:'$D(VAX("DT")) VAX("DT")=NOW
    15         I VAX("DT")=VAX("DAT") S E=$S($D(^DPT(DFN,.102)):+^(.102),1:0),E=$S($D(^DGPM(E,0)):E,1:0) G GO:E D LODGER G GO:E D ASIHOF G GO:E,Q ;Current IP
    16         ;
    17         ;Find Past Movement
    18         S VAX=+$O(^DGPM("APID",DFN,9999999.999999-VAX("DT"))) I 'VAX D LODGER G GO:E,Q
    19         S VAX=+$O(^DGPM("APID",DFN,VAX,0)) I '$D(^DGPM(VAX,0)) D LODGER G GO:E,Q
    20         S VAZ=^DGPM(VAX,0) D OK G GO:E D LODGER G GO:E,Q
    21         ;
    22 GO      S:'$D(VAX("DT")) VAX("DT")=NOW D ^VADPT31 ; setting of VAX("DT") can be removed??
    23         ;
    24 Q       K NOW,NOWI,VAX,VAZ,VAZ2,E,VACC,VAQ,VANN,VASET,^UTILITY("VADPTZ",$J,DFN) D KVAR^VADPT30 Q
    25         ;
    26 OK      N VAADT,VADDT,VAQUIT
    27         S E=0,VAZ2="^"_(+$P(VAZ,"^",18))_"^"
    28         I "^13^41^46^"[VAZ2 D OK1 Q:'VAX  G OK
    29         I "^42^"[VAZ2 D 42 I 'Y D OK1 Q:'VAX  G OK
    30         I "^47^"[VAZ2 D 47 I 'Y D OK1 Q:'VAX  G OK
    31         I $D(VAX("DT")),$P(VAZ,"^",2)=3,VAZ'>VAX("DT") Q
    32         ;DG*5.3*532
    33         ;Check for out-of-order disch. recs caused by same day adm./disch.
    34         ;where disch. date < adm. date because disch. date had no time
    35         I +VAZ<2890000,$D(VAX("DT")),$P(VAZ,"^",2)'=3 S VAQUIT=0 D  Q:VAQUIT
    36         .S VAADT=$P(VAZ,"^",14) Q:'VAADT
    37         .S VADDT=$P($G(^DGPM(VAADT,0)),"^",17) Q:'VADDT
    38         .S VADDT=$P($G(^DGPM(VADDT,0)),"^",14) I $P(VADDT,".",2)="",VADDT=$P(VAADT,"."),VAZ'>VAX("DT") S VAQUIT=1
    39         S E=+VAX Q
    40         ;
    41 OK1     S VAX=+$O(^DGPM("APID",DFN,9999999.9999999-(VAZ+($P(VAZ,"^",22)/10000000)))),VAX=+$O(^(VAX,0))
    42         I VAX,$D(^DGPM(VAX,0)) S VAZ=^(0)
    43         Q
    44         ;
    45 LAST    ; returns last movement for patient
    46         ; called by bed control and pt inquiry
    47         S VAX=+$O(^DGPM("APID",DFN,NOWI)),E=0
    48         I $D(VAIP("L")) D LLDCHK G LASTQ:E
    49         S VAX=+$O(^DGPM("APID",DFN,VAX,0)) I $D(^DGPM(VAX,0)) S VAZ=^(0) D OK
    50 LASTQ   S VAX("DT")=NOW
    51         Q
    52         ;
    53 LODGER  ;
    54         S E=0 G LODGERQ:'$D(VAIP("L"))
    55         I VAX("DT")=VAX("DAT") S VAX=$S($D(^DPT(DFN,.107)):^(.107),1:"") G LODGERQ:VAX']"" S E=$S($D(^DPT("LD",VAX,DFN)):+^(DFN),1:0) G LODGERQ
    56         ;
    57         S VAX=$O(^DGPM("ATID4",DFN,9999999.999999-VAX("DT"))) S:VAX E=+$O(^DGPM("ATID4",DFN,VAX,0))
    58         I E S E=$S($D(^DGPM(E,0)):E,1:0) I E,$D(^DGPM(+$P(^(0),"^",17),0)),^(0)'>VAX("DT") S E=0
    59 LODGERQ Q
    60         ;
    61 LLDCHK  ; -- last lodger mvt checking ; build array of inverse dates and chk
    62         N IDT S IDT(VAX)=0
    63         S IDT=+$O(^DGPM("ATID4",DFN,NOWI)) S:IDT IDT(IDT)=+$O(^(IDT,0))
    64         S IDT=+$O(^DGPM("ATID5",DFN,NOWI)) S:IDT IDT(IDT)=+$O(^(IDT,0))
    65         S IDT=+$O(IDT(0)) I IDT S E=IDT(IDT),E=$S($D(^DGPM(E,0)):E,1:0)
    66         Q
    67         ;
    68 CHK     ;
    69         G VAR^VADPT30
    70         ;
    71 ASIHOF  ; -- is last mvt asih oth fac
    72         S E=0,VAX=$S('$O(^DGPM("APID",DFN,NOWI)):"",1:$O(^DGPM("APID",DFN,$O(^(NOWI)),0)))
    73         I VAX,$D(^DGPM(VAX,0)),"^43^45^"[("^"_$P(^(0),"^",18)_"^") S E=VAX
    74         Q
    75         ;
    76 42      ; -- check to see if this mvt can be used; for 'while asih' d/c category
    77         ;   If Y returned high then mvt is good
    78         ;
    79         I VAZ'<VAX("DAT") S Y=0 G Q42 ; not a real d/c yet
    80         I $P(VAZ,"^",22)=2 S Y=0 G Q42 ; nhcu d/c assoicated w/asih d/c (seq #2)
    81         D SCAN
    82 Q42     Q
    83         ;
    84 SCAN    ; -- determine is d/c while in other fac(Y=1 returned if so.)
    85         ;
    86         N VAID,VACA,M S Y=0,VAID=9999999.999999-VAZ,VACA=+$P(VAZ,"^",14)
    87         F VAID=VAID:0 S VAID=$O(^DGPM("APMV",DFN,VACA,VAID)) Q:'VAID  I $D(^DGPM(+$O(^(VAID,0)),0)) S M=$P(^(0),"^",18) I "^13^44^43^45^"[("^"_M_"^") S Y=$S(M=43!(M=45):1,1:0) Q
    88         Q
    89         ;
    90 47      ; -- check to see if d/c from nhcu while asih in other fac
    91         ;   If y returned high then mvt is good.
    92         D SCAN Q
    93         ;
    94         ; 13 = to asih (vah)     (xfr)|44 = resume asih in parent facility (xfr)
    95         ; 41 = from asih         (d/c)|45 = change asih location(other fac)(xfr)
    96         ; 42 = while asih        (d/c)|46 = continues asih (other fac)     (d/c)
    97         ; 43 = to asih(other fac)(xfr)|47 = discharge from nhcu while asih (d/c)
     1VADPT3 ;ALB/MRL - PATIENT VARIABLES [IN5]; 12 DEC 1988 ; 7/22/03 5:00pm
     2 ;;5.3;Registration;**532**;Aug 13, 1993
     3 ;Inpatient variables [Version 5.0 and above]
     46 ;
     5 D NOW^%DTC S (NOW,VAX("DAT"))=%,NOWI=9999999.999999-%
     6 ;
     7 I $D(VAIP("E")),$D(^DGPM(+VAIP("E"),0)) S VAX("DT")=+^(0),E=+VAIP("E") G GO ;Specific Entry
     8 ;
     9 I $D(VAIP("D")),"^l^L^"[("^"_$E(VAIP("D"))_"^") D LAST G GO:E,Q
     10 ;
     11 S VAX=$S($D(VAIP("D")):VAIP("D"),$D(VAINDT):VAINDT,1:0)
     12 I VAX S:VAX?7N!(VAX?7N1".".N) VAX("DT")=VAX I '$D(VAX("DT")) G Q ;Invalid Entry
     13 ;
     14 S:'$D(VAX("DT")) VAX("DT")=NOW
     15 I VAX("DT")=VAX("DAT") S E=$S($D(^DPT(DFN,.102)):+^(.102),1:0),E=$S($D(^DGPM(E,0)):E,1:0) G GO:E D LODGER G GO:E D ASIHOF G GO:E,Q ;Current IP
     16 ;
     17 ;Find Past Movement
     18 S VAX=+$O(^DGPM("APID",DFN,9999999.999999-VAX("DT"))) I 'VAX D LODGER G GO:E,Q
     19 S VAX=+$O(^DGPM("APID",DFN,VAX,0)) I '$D(^DGPM(VAX,0)) D LODGER G GO:E,Q
     20 S VAZ=^DGPM(VAX,0) D OK G GO:E D LODGER G GO:E,Q
     21 ;
     22GO S:'$D(VAX("DT")) VAX("DT")=NOW D ^VADPT31 ; setting of VAX("DT") can be removed??
     23 ;
     24Q K NOW,NOWI,VAX,VAZ,VAZ2,E,VACC,VAQ,VANN,VASET,^UTILITY("VADPTZ",$J,DFN) D KVAR^VADPT30 Q
     25 ;
     26OK N VAADT,VADDT,VAQUIT
     27 S E=0,VAZ2="^"_(+$P(VAZ,"^",18))_"^"
     28 I "^13^41^46^"[VAZ2 D OK1 Q:'VAX  G OK
     29 I "^42^"[VAZ2 D 42 I 'Y D OK1 Q:'VAX  G OK
     30 I "^47^"[VAZ2 D 47 I 'Y D OK1 Q:'VAX  G OK
     31 I $D(VAX("DT")),$P(VAZ,"^",2)=3,VAZ'>VAX("DT") Q
     32 ;DG*5.3*532
     33 ;Check for out-of-order disch. recs caused by same day adm./disch.
     34 ;where disch. date < adm. date because disch. date had no time
     35 I +VAZ<2890000,$D(VAX("DT")),$P(VAZ,"^",2)'=3 S VAQUIT=0 D  Q:VAQUIT
     36 .S VAADT=$P(VAZ,"^",14) Q:'VAADT
     37 .S VADDT=$P($G(^DGPM(VAADT,0)),"^",17) Q:'VADDT
     38 .S VADDT=$P($G(^DGPM(VADDT,0)),"^",14) I $P(VADDT,".",2)="",VADDT=$P(VAADT,"."),VAZ'>VAX("DT") S VAQUIT=1
     39 S E=+VAX Q
     40 ;
     41OK1 S VAX=+$O(^DGPM("APID",DFN,9999999.9999999-(VAZ+($P(VAZ,"^",22)/10000000)))),VAX=+$O(^(VAX,0))
     42 I VAX,$D(^DGPM(VAX,0)) S VAZ=^(0)
     43 Q
     44 ;
     45LAST ; returns last movement for patient
     46 ; called by bed control and pt inquiry
     47 S VAX=+$O(^DGPM("APID",DFN,NOWI)),E=0
     48 I $D(VAIP("L")) D LLDCHK G LASTQ:E
     49 S VAX=+$O(^DGPM("APID",DFN,VAX,0)) I $D(^DGPM(VAX,0)) S VAZ=^(0) D OK
     50LASTQ S VAX("DT")=NOW
     51 Q
     52 ;
     53LODGER ;
     54 S E=0 G LODGERQ:'$D(VAIP("L"))
     55 I VAX("DT")=VAX("DAT") S VAX=$S($D(^DPT(DFN,.107)):^(.107),1:"") G LODGERQ:VAX']"" S E=$S($D(^DPT("LD",VAX,DFN)):+^(DFN),1:0) G LODGERQ
     56 ;
     57 S VAX=$O(^DGPM("ATID4",DFN,9999999.999999-VAX("DT"))) S:VAX E=+$O(^DGPM("ATID4",DFN,VAX,0))
     58 I E S E=$S($D(^DGPM(E,0)):E,1:0) I E,$D(^DGPM(+$P(^(0),"^",17),0)),^(0)'>VAX("DT") S E=0
     59LODGERQ Q
     60 ;
     61LLDCHK ; -- last lodger mvt checking ; build array of inverse dates and chk
     62 N IDT S IDT(VAX)=0
     63 S IDT=+$O(^DGPM("ATID4",DFN,NOWI)) S:IDT IDT(IDT)=+$O(^(IDT,0))
     64 S IDT=+$O(^DGPM("ATID5",DFN,NOWI)) S:IDT IDT(IDT)=+$O(^(IDT,0))
     65 S IDT=+$O(IDT(0)) I IDT S E=IDT(IDT),E=$S($D(^DGPM(E,0)):E,1:0)
     66 Q
     67 ;
     68CHK ;
     69 G VAR^VADPT30
     70 ;
     71ASIHOF ; -- is last mvt asih oth fac
     72 S E=0,VAX=$S('$O(^DGPM("APID",DFN,NOWI)):"",1:$O(^DGPM("APID",DFN,$O(^(NOWI)),0)))
     73 I VAX,$D(^DGPM(VAX,0)),"^43^45^"[("^"_$P(^(0),"^",18)_"^") S E=VAX
     74 Q
     75 ;
     7642 ; -- check to see if this mvt can be used; for 'while asih' d/c category
     77 ;   If Y returned high then mvt is good
     78 ;
     79 I VAZ'<VAX("DAT") S Y=0 G Q42 ; not a real d/c yet
     80 I $P(VAZ,"^",22)=2 S Y=0 G Q42 ; nhcu d/c assoicated w/asih d/c (seq #2)
     81 D SCAN
     82Q42 Q
     83 ;
     84SCAN ; -- determine is d/c while in other fac(Y=1 returned if so.)
     85 ;
     86 N VAID,VACA,M S Y=0,VAID=9999999.999999-VAZ,VACA=+$P(VAZ,"^",14)
     87 F VAID=VAID:0 S VAID=$O(^DGPM("APMV",DFN,VACA,VAID)) Q:'VAID  I $D(^DGPM(+$O(^(VAID,0)),0)) S M=$P(^(0),"^",18) I "^13^44^43^45^"[("^"_M_"^") S Y=$S(M=43!(M=45):1,1:0) Q
     88 Q
     89 ;
     9047 ; -- check to see if d/c from nhcu while asih in other fac
     91 ;   If y returned high then mvt is good.
     92 D SCAN Q
     93 ;
     94 ; 13 = to asih (vah)     (xfr)|44 = resume asih in parent facility (xfr)
     95 ; 41 = from asih         (d/c)|45 = change asih location(other fac)(xfr)
     96 ; 42 = while asih        (d/c)|46 = continues asih (other fac)     (d/c)
     97 ; 43 = to asih(other fac)(xfr)|47 = discharge from nhcu while asih (d/c)
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VADPT5.m

    r613 r623  
    1 VADPT5  ;ALB/MRL/MJK - PATIENT VARIABLES [REG]; 14 DEC 1988 ; 8/6/04 7:42am
    2         ;;5.3;Registration;**54,63,242,584,749**;Aug 13, 1993;Build 10
    3 10      ;Registration/Disposition [REG]
    4         N VARPSV
    5         S VARPSV("C")=$S('$G(VARP("C")):999999999,1:+VARP("C"))
    6         S VARPSV("F")=9999999-$S($G(VARP("F"))?7N.E:VARP("F"),1:0)
    7         S VARPSV("T")=$S($G(VARP("T"))?7N.E:VARP("T"),1:7777777) I '$P(VARPSV("T"),".",2) S $P(VARPSV("T"),".",2)=999999
    8         S VARPSV("T")=9999999-VARPSV("T")
    9         S VAX=VARPSV("T"),VAX(1)=0
    10         I '$D(^DPT(DFN,"DIS")) Q
    11         F I=0:0 S VAX=$O(^DPT(DFN,"DIS",VAX)) Q:VAX=""!(VAX>VARPSV("F"))!(VAX(1)+1>VARPSV("C"))  S VAX(2)=$G(^DPT(DFN,"DIS",VAX,0)),VAX(1)=VAX(1)+1 D 101:+VAX(2)>0
    12         Q
    13 101     S (VAX("I"),VAX("E"))="",VAX(3)=0 F I=1,2,3,4,5,6,7,9 S VAX(3)=VAX(3)+1,$P(VAX("I"),"^",VAX(3))=$P(VAX(2),"^",I) D 102
    14         S @VAV@(VAX(1),"I")=VAX("I"),@VAV@(VAX(1),"E")=VAX("E") Q
    15 102     I "^1^6^"[("^"_VAX(3)_"^") S Y=$P(VAX("I"),"^",VAX(3)) I Y]"" X ^DD("DD") S $P(VAX("E"),"^",VAX(3))=Y Q
    16         S X(1)=$S($D(^DD(2.101,$S(I<9:(I-1),1:I),0)):$P(^(0),"^",3),1:"") I "^2^3^"[("^"_VAX(3)_"^"),$P(VAX("I"),"^",VAX(3))]"",X(1)]"" S $P(VAX("E"),"^",VAX(3))=$P($P(X(1),$P(VAX("I"),"^",VAX(3))_":",2),";",1) Q
    17         I "^4^5^7^8^"[("^"_VAX(3)_"^"),$P(VAX("I"),"^",VAX(3))]"",X(1)]"" S X(1)="^"_X(1)_$P(VAX("I"),"^",VAX(3))_",0)" I $D(@(X(1))) S $P(VAX("E"),"^",VAX(3))=$P(^(0),"^",1)
    18         Q
    19         ;
    20 11      ;Clinic Enrollments [SDE]
    21         S (VAX,VAX(1))=0 F I=0:0 S VAX=$O(^DPT(DFN,"DE",VAX)) Q:VAX'>0  S VAZ=$S($D(^DPT(DFN,"DE",VAX,0)):^(0),1:"") I +VAZ,$P(VAZ,"^",2)'="I" S VAX(3)=0 D 111
    22         Q
    23 111     S VAX(4)=0 F I1=0:0 S VAX(4)=$O(^DPT(DFN,"DE",VAX,1,VAX(4))) Q:VAX(4)'>0!(VAX(3))  S VAZ(1)=$S($D(^DPT(DFN,"DE",VAX,1,VAX(4),0)):^(0),1:"") I +VAZ(1),$P(VAZ(1),"^",3)']"" S VAX(3)=VAZ(1)
    24         Q:'VAX(3)  S (VAX("I"),VAX("E"))="",Y=+VAX(3),$P(VAX("I"),"^",2)=Y X ^DD("DD") S $P(VAX("E"),"^",2)=Y
    25         S $P(VAX("I"),"^",3)=$P(VAX(3),"^",2) I $P(VAX("I"),"^",3)]"" S $P(VAX("E"),"^",3)=$S($P(VAX("I"),"^",3)="O":"OPT",$P(VAX("I"),"^",3)="A":"AC",1:"")
    26         S $P(VAX("I"),"^",1)=+VAZ,$P(VAX("E"),"^",1)=$S($D(^SC(+VAZ,0)):$P(^(0),"^",1),1:""),VAX(1)=VAX(1)+1,@VAV@(VAX(1),"I")=VAX("I"),@VAV@(VAX(1),"E")=VAX("E") Q
    27         ;
    28 12      ;Appointments [SDA]
    29         N VASDSV,SDCNT,SDARRAY,VANOW
    30         S VANOW=$$NOW^XLFDT
    31         S VASDSV("F")=$S($G(VASD("F"))?7N.E:VASD("F"),1:VANOW)
    32         S VASDSV("T")=$S(+$G(VASD("T")):+VASD("T"),1:9999999) I '$P(VASDSV("T"),".",2) S $P(VASDSV("T"),".",2)=999999
    33         S VASDSV("W")=$S('$G(VASD("W")):12,1:VASD("W"))
    34         S VAZ(2)=$S($D(VASD("N")):VASD("N"),1:9999)
    35         ;Set STATUS Codes (VistA;RSA)
    36         S VAZ=";R^I;I^N;NS^NA;NSR^C;CC^CA;CCR^PC;CP^PCA;CPR^NT;NT^",VAZ(1)=""
    37         ;Extract User Required STATUS Codes in RSA format
    38         F I=1:1 S I1=+$E(VASDSV("W"),I) Q:'I1  D
    39         .S VAZ(1)=VAZ(1)_$P($P(VAZ,"^",I1),";",2)_";"
    40         ;Create parameter list for the extrinsic call to the Appointment API
    41         ;Note: Appointment API can only accept a maximum of 3 fields
    42         ;               to filter on.
    43         ; 1 : "FROM;TO" Appointment Date Range to Search
    44         ; 2 : Clinic IEN or Array of Clinic IENs if defined (Pass the Root)
    45         ; 3 : Requested STATUS Codes (Passed if VASD("C") is not defined.)
    46         ; 4 : Patient IEN
    47         S SDARRAY="",SDARRAY(1)=VASDSV("F")_";"_VASDSV("T")
    48         I $O(VASD("C",0))>0 S SDARRAY(2)="VASD(""C"","
    49         E  S SDARRAY(3)=VAZ(1)
    50         S SDARRAY(4)=DFN
    51         ;Set Fields for API to Return
    52         ;  1 : Appointment Date/Time
    53         ;  2 : Clinic
    54         ;  3 : Appointment Status
    55         ; 10 : Appointment Type
    56         S SDARRAY("FLDS")="1;2;3;10"
    57         ;Remove Clinic IEN from Global Reference
    58         S SDARRAY("SORT")="P"
    59         ;Call Appointment API (Pass Array by reference)
    60         S SDCNT=$$SDAPI^SDAMA301(.SDARRAY)
    61         S VAX="",VAX(1)=0
    62         ;If error returned, determine error and set VAERR appropriately
    63         ; 1 : For any error other than 101
    64         ; 2 : If error is 101 : Database is unavailable 
    65         I SDCNT<0 S VAX=$O(^TMP($J,"SDAMA301",VAX)) S VAERR=$S(VAX=101:2,1:1) K ^TMP($J,"SDAMA301") Q
    66         D 122:SDCNT>0
    67         Q
    68 121     S VAX(5)=1 I VASDSV("W")'[1,$P(VAZ,"^",2)']"" S VAX(5)=0 Q
    69         I VASDSV("C"),'$D(VASD("C",+VAZ)) S VAX(5)=0 Q
    70         S (VAX("I"),VAX("E"))="",VAX(2)=1,$P(VAX("I"),"^",1)=+VAX F I1=1,2,16 S VAX(2)=VAX(2)+1,$P(VAX("I"),"^",VAX(2))=$P(VAZ,"^",I1)
    71         Q
    72 122     ;Build Internal/External Output Globals
    73         ;
    74         N SDCIEN,SDDTM,SDNODE
    75         S (SDCIEN,SDDTM)=""
    76         ;Redefine VAZ (STATUS Codes(RSA;VistA))
    77         S VAZ="R;^I;I^NS;N^NSR;NA^CC;C^CCR;CA^CP;PC^CPR;PCA^NT;NT^"
    78         S SDDTM=""
    79         ;Loop through appointments and convert for output
    80         F  S SDDTM=$O(^TMP($J,"SDAMA301",DFN,SDDTM)) Q:'SDDTM  D
    81         .;Get Appointment Information and clear VAX("I") & VAX("E")
    82         .S SDNODE=^(SDDTM),(VAX("I"),VAX("E"))=""
    83         .;If Clinics were passed to appointment API,
    84         .;     Filter on Appointment Status Codes
    85         .I $O(VASD("C",0))>0,(VAZ(1)'[($P($P(SDNODE,"^",3),";")_";")) Q
    86         .;Extract and format Appointment Date/Time
    87         .S Y=$P(SDNODE,"^",1)
    88         .S $P(VAX("I"),"^",1)=Y
    89         .X ^DD("DD") S $P(VAX("E"),"^",1)=Y
    90         .;Extract and format Clinic Information
    91         .S $P(VAX("I"),"^",2)=$P($P(SDNODE,"^",2),";",1)
    92         .S $P(VAX("E"),"^",2)=$P($P(SDNODE,"^",2),";",2)
    93         .;Extract and format Appointment Type
    94         .S $P(VAX("I"),"^",4)=$P($P(SDNODE,"^",10),";",1)
    95         .S $P(VAX("E"),"^",4)=$P($P(SDNODE,"^",10),";",2)
    96         .;Extract and format Appointment Status
    97         .S Y=$P($P(VAZ,$P($P(SDNODE,"^",3),";")_";",2),"^"),$P(VAX("I"),"^",3)=Y
    98         .I Y]"" S X=$S($D(^DD(2.98,3,0)):$P(^(0),"^",3),1:""),$P(VAX("E"),"^",3)=$P($P(X,Y_":",2),";",1)
    99         .S VAX(1)=VAX(1)+1
    100         .;Store information in global
    101         .S @VAV@(VAX(1),"I")=VAX("I"),@VAV@(VAX(1),"E")=VAX("E")
    102         K ^TMP($J,"SDAMA301")
    103         Q
     1VADPT5 ;ALB/MRL/MJK - PATIENT VARIABLES [REG]; 14 DEC 1988 ; 8/6/04 7:42am
     2 ;;5.3;Registration;**54,63,242,584**;Aug 13, 1993
     310 ;Registration/Disposition [REG]
     4 N VARPSV
     5 S VARPSV("C")=$S('$G(VARP("C")):999999999,1:+VARP("C"))
     6 S VARPSV("F")=9999999-$S($G(VARP("F"))?7N.E:VARP("F"),1:0)
     7 S VARPSV("T")=$S($G(VARP("T"))?7N.E:VARP("T"),1:7777777) I '$P(VARPSV("T"),".",2) S $P(VARPSV("T"),".",2)=999999
     8 S VARPSV("T")=9999999-VARPSV("T")
     9 S VAX=VARPSV("T"),VAX(1)=0
     10 I '$D(^DPT(DFN,"DIS")) Q
     11 F I=0:0 S VAX=$O(^DPT(DFN,"DIS",VAX)) Q:VAX=""!(VAX>VARPSV("F"))!(VAX(1)+1>VARPSV("C"))  S VAX(2)=$G(^DPT(DFN,"DIS",VAX,0)),VAX(1)=VAX(1)+1 D 101:+VAX(2)>0
     12 Q
     13101 S (VAX("I"),VAX("E"))="",VAX(3)=0 F I=1,2,3,4,5,6,7,9 S VAX(3)=VAX(3)+1,$P(VAX("I"),"^",VAX(3))=$P(VAX(2),"^",I) D 102
     14 S @VAV@(VAX(1),"I")=VAX("I"),@VAV@(VAX(1),"E")=VAX("E") Q
     15102 I "^1^6^"[("^"_VAX(3)_"^") S Y=$P(VAX("I"),"^",VAX(3)) I Y]"" X ^DD("DD") S $P(VAX("E"),"^",VAX(3))=Y Q
     16 S X(1)=$S($D(^DD(2.101,$S(I<9:(I-1),1:I),0)):$P(^(0),"^",3),1:"") I "^2^3^"[("^"_VAX(3)_"^"),$P(VAX("I"),"^",VAX(3))]"",X(1)]"" S $P(VAX("E"),"^",VAX(3))=$P($P(X(1),$P(VAX("I"),"^",VAX(3))_":",2),";",1) Q
     17 I "^4^5^7^8^"[("^"_VAX(3)_"^"),$P(VAX("I"),"^",VAX(3))]"",X(1)]"" S X(1)="^"_X(1)_$P(VAX("I"),"^",VAX(3))_",0)" I $D(@(X(1))) S $P(VAX("E"),"^",VAX(3))=$P(^(0),"^",1)
     18 Q
     19 ;
     2011 ;Clinic Enrollments [SDE]
     21 S (VAX,VAX(1))=0 F I=0:0 S VAX=$O(^DPT(DFN,"DE",VAX)) Q:VAX'>0  S VAZ=$S($D(^DPT(DFN,"DE",VAX,0)):^(0),1:"") I +VAZ,$P(VAZ,"^",2)'="I" S VAX(3)=0 D 111
     22 Q
     23111 S VAX(4)=0 F I1=0:0 S VAX(4)=$O(^DPT(DFN,"DE",VAX,1,VAX(4))) Q:VAX(4)'>0!(VAX(3))  S VAZ(1)=$S($D(^DPT(DFN,"DE",VAX,1,VAX(4),0)):^(0),1:"") I +VAZ(1),$P(VAZ(1),"^",3)']"" S VAX(3)=VAZ(1)
     24 Q:'VAX(3)  S (VAX("I"),VAX("E"))="",Y=+VAX(3),$P(VAX("I"),"^",2)=Y X ^DD("DD") S $P(VAX("E"),"^",2)=Y
     25 S $P(VAX("I"),"^",3)=$P(VAX(3),"^",2) I $P(VAX("I"),"^",3)]"" S $P(VAX("E"),"^",3)=$S($P(VAX("I"),"^",3)="O":"OPT",$P(VAX("I"),"^",3)="A":"AC",1:"")
     26 S $P(VAX("I"),"^",1)=+VAZ,$P(VAX("E"),"^",1)=$S($D(^SC(+VAZ,0)):$P(^(0),"^",1),1:""),VAX(1)=VAX(1)+1,@VAV@(VAX(1),"I")=VAX("I"),@VAV@(VAX(1),"E")=VAX("E") Q
     27 ;
     2812 ;Appointments [SDA]
     29 N VASDSV,SDCNT,SDARRAY
     30 D NOW^%DTC
     31 S VASDSV("F")=$S($G(VASD("F"))?7N.E:VASD("F"),1:%)
     32 S VASDSV("T")=$S(+$G(VASD("T")):+VASD("T"),1:9999999) I '$P(VASDSV("T"),".",2) S $P(VASDSV("T"),".",2)=999999
     33 S VASDSV("W")=$S('$G(VASD("W")):12,1:VASD("W"))
     34 S VAZ(2)=$S($D(VASD("N")):VASD("N"),1:9999)
     35 ;Set STATUS Codes (VistA;RSA)
     36 S VAZ=";R^I;I^N;NS^NA;NSR^C;CC^CA;CCR^PC;CP^PCA;CPR^NT;NT^",VAZ(1)=""
     37 ;Extract User Required STATUS Codes in RSA format
     38 F I=1:1 S I1=+$E(VASDSV("W"),I) Q:'I1  D
     39 .S VAZ(1)=VAZ(1)_$P($P(VAZ,"^",I1),";",2)_";"
     40 ;Create parameter list for the extrinsic call to the Appointment API
     41 ;Note: Appointment API can only accept a maximum of 3 fields
     42 ;               to filter on.
     43 ; 1 : "FROM;TO" Appointment Date Range to Search
     44 ; 2 : Clinic IEN or Array of Clinic IENs if defined (Pass the Root)
     45 ; 3 : Requested STATUS Codes (Passed if VASD("C") is not defined.)
     46 ; 4 : Patient IEN
     47 S SDARRAY="",SDARRAY(1)=VASDSV("F")_";"_VASDSV("T")
     48 I $O(VASD("C",0))>0 S SDARRAY(2)="VASD(""C"","
     49 E  S SDARRAY(3)=VAZ(1)
     50 S SDARRAY(4)=DFN
     51 ;Set Fields for API to Return
     52 ;  1 : Appointment Date/Time
     53 ;  2 : Clinic
     54 ;  3 : Appointment Status
     55 ; 10 : Appointment Type
     56 S SDARRAY("FLDS")="1;2;3;10"
     57 ;Remove Clinic IEN from Global Reference
     58 S SDARRAY("SORT")="P"
     59 ;Call Appointment API (Pass Array by reference)
     60 S SDCNT=$$SDAPI^SDAMA301(.SDARRAY)
     61 S VAX="",VAX(1)=0
     62 ;If error returned, determine error and set VAERR appropriately
     63 ; 1 : For any error other than 101
     64 ; 2 : If error is 101 : Database is unavailable 
     65 I SDCNT<0 S VAX=$O(^TMP($J,"SDAMA301",VAX)) S VAERR=$S(VAX=101:2,1:1) K ^TMP($J,"SDAMA301") Q
     66 D 122:SDCNT>0
     67 Q
     68121 S VAX(5)=1 I VASDSV("W")'[1,$P(VAZ,"^",2)']"" S VAX(5)=0 Q
     69 I VASDSV("C"),'$D(VASD("C",+VAZ)) S VAX(5)=0 Q
     70 S (VAX("I"),VAX("E"))="",VAX(2)=1,$P(VAX("I"),"^",1)=+VAX F I1=1,2,16 S VAX(2)=VAX(2)+1,$P(VAX("I"),"^",VAX(2))=$P(VAZ,"^",I1)
     71 Q
     72122 ;Build Internal/External Output Globals
     73 ;
     74 N SDCIEN,SDDTM,SDNODE
     75 S (SDCIEN,SDDTM)=""
     76 ;Redefine VAZ (STATUS Codes(RSA;VistA))
     77 S VAZ="R;^I;I^NS;N^NSR;NA^CC;C^CCR;CA^CP;PC^CPR;PCA^NT;NT^"
     78 S SDDTM=""
     79 ;Loop through appointments and convert for output
     80 F  S SDDTM=$O(^TMP($J,"SDAMA301",DFN,SDDTM)) Q:'SDDTM  D
     81 .;Get Appointment Information and clear VAX("I") & VAX("E")
     82 .S SDNODE=^(SDDTM),(VAX("I"),VAX("E"))=""
     83 .;If Clinics were passed to appointment API,
     84 .;     Filter on Appointment Status Codes
     85 .I $O(VASD("C",0))>0,(VAZ(1)'[($P($P(SDNODE,"^",3),";")_";")) Q
     86 .;Extract and format Appointment Date/Time
     87 .S Y=$P(SDNODE,"^",1)
     88 .S $P(VAX("I"),"^",1)=Y
     89 .X ^DD("DD") S $P(VAX("E"),"^",1)=Y
     90 .;Extract and format Clinic Information
     91 .S $P(VAX("I"),"^",2)=$P($P(SDNODE,"^",2),";",1)
     92 .S $P(VAX("E"),"^",2)=$P($P(SDNODE,"^",2),";",2)
     93 .;Extract and format Appointment Type
     94 .S $P(VAX("I"),"^",4)=$P($P(SDNODE,"^",10),";",1)
     95 .S $P(VAX("E"),"^",4)=$P($P(SDNODE,"^",10),";",2)
     96 .;Extract and format Appointment Status
     97 .S Y=$P($P(VAZ,$P($P(SDNODE,"^",3),";")_";",2),"^"),$P(VAX("I"),"^",3)=Y
     98 .I Y]"" S X=$S($D(^DD(2.98,3,0)):$P(^(0),"^",3),1:""),$P(VAX("E"),"^",3)=$P($P(X,Y_":",2),";",1)
     99 .S VAX(1)=VAX(1)+1
     100 .;Store information in global
     101 .S @VAV@(VAX(1),"I")=VAX("I"),@VAV@(VAX(1),"E")=VAX("E")
     102 K ^TMP($J,"SDAMA301")
     103 Q
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VADPT61.m

    r613 r623  
    1 VADPT61 ;ALB/MJK - Patient ID Utilities (cont.); 12 AUG 89 @1200
    2         ;;5.3;Registration,;**749**;Aug 13, 1993;Build 10
    3         ;
    4 1       ;;ID Format Enter/Edit
    5         W ! S DIC="^DIC(8.2,",DIC(0)="AELMQ" D ^DIC K DIC G Q1:+Y<1
    6         S DA=+Y,DIE="^DIC(8.2,",DR="[DG ID FORMAT ENTER/EDIT]" D ^DIE G 1
    7 Q1      K DIE,DR,DA,Y Q
    8         ;
    9 2       ;;Eligibility Code Enter/Edit
    10         W ! S DIC="^DIC(8,",DIC(0)="AELMQ",DIC("DR")=8 D ^DIC K DIC G Q2:+Y<1
    11         S DA=+Y,DIE="^DIC(8,",DR="[DG ELIG ENTER/EDIT]" D ^DIE G 2
    12 Q2      K DIE,DR,DA,Y
    13         Q
    14         ;
    15 ASK     ;
    16         Q:$S('$D(^DIC(8.2,+$P(^DIC(8,VAELG,0),U,10),0)):1,1:'$P(^(0),U,2))
    17         W !!,*7,"User Input Needed for '",$P(^DIC(8,VAELG,0),U),"' id:"
    18         S DIE="^DPT("_DFN_",""E"",",DR=.03,DA(1)=DFN,DA=VAELG D ^DIE
    19         W !!?5,"...",$P(^DIC(8,VAELG,0),U)
    20         K DIE,DR,DA,Y
    21         Q
    22         ;
    23 WARN    ; -- interaction warning
    24         I $P(X,U,2) W !!?5,*7,"WARNING: User interaction usually is required for this format."
    25         Q
    26         ;
    27 BEG     ;
    28         S VASTART=$$NOW^XLFDT
    29         Q
    30         ;
    31 END     ;
    32         S VAEND=$$NOW^XLFDT,L=0
    33         K XMY
    34         S XMSUB=$P($T(OPTS+VAOPT),";",4),XMDUZ=.5,XMTEXT="VATEXT(",XMY(DUZ)=""
    35         I VAOPT=3 S XMSUB=XMSUB_" (Format: "_$S($D(^DIC(8.2,VAFMT,0)):$P(^(0),U),1:"UNKNOWN")_")"
    36         I VAOPT=5 S XMSUB=XMSUB_" (Eligibility: "_$S($D(^DIC(8,VAELG,0)):$P(^(0),U),1:"UNKNOWN")_")"
    37         S L=L+1 S VATEXT(L,0)=" "
    38         S Y=VASTART,L=L+1 X ^DD("DD") S VATEXT(L,0)="  Job started   at "_Y
    39         S Y=VAEND,L=L+1 X ^DD("DD") S VATEXT(L,0)="  Job completed at "_Y
    40         D ^XMD
    41         K VAOPT,VASTART,VAEND,L,VATEXT,XMY,XMSUB,XMDUZ,XMTEXT,Y,% Q
    42         ;
    43 TASK    ;
    44         W !!?5,"The resetting of ID formats can take many hours."
    45         W !?5,"It is suggested that it be run at off-peak hours,"
    46         W !?5,"perferably over a weekend.",!
    47         K ZTSK S X=$T(OPTS+VAOPT),VARS=$P(X,";",5)
    48         F I=1:1 S Y=$P(VARS,"^",I) Q:Y=""  S ZTSAVE(Y)=""
    49         S ZTSAVE("VAOPT")="",ZTRTN="QUE"_VAOPT_"^VADPT60",ZTDESC=$P(X,";",4),ZTIO="" D ^%ZTLOAD
    50         I $D(ZTSK) W !!,"Job has been queued. (Task #",ZTSK,")",!,"A MailMan message will be sent to you when the job has completed."
    51 TASKQ   K ZTIO,ZTRTN,ZTDESC,ZTSAVE,VARS,Y,X,ZTSK Q
    52         ;
    53 OPTS    ; -- queue task list ;;opt#;description;vars to save
    54         ;;1;none
    55         ;;2;none
    56         ;;3;Reset ID Format;VAFMT
    57         ;;4;Reset Primary Eligibilty ID Format
    58         ;;5;Reset Specific Eligibilty ID Format;VAELG
    59         ;;6;none
    60         ;;7;Reset All ID Formats for all Patients
     1VADPT61 ;ALB/MJK - Patient ID Utilities (cont.); 12 AUG 89 @1200
     2 ;;5.3;Registration;;Aug 13, 1993
     3 ;
     41 ;;ID Format Enter/Edit
     5 W ! S DIC="^DIC(8.2,",DIC(0)="AELMQ" D ^DIC K DIC G Q1:+Y<1
     6 S DA=+Y,DIE="^DIC(8.2,",DR="[DG ID FORMAT ENTER/EDIT]" D ^DIE G 1
     7Q1 K DIE,DR,DA,Y Q
     8 ;
     92 ;;Eligibility Code Enter/Edit
     10 W ! S DIC="^DIC(8,",DIC(0)="AELMQ",DIC("DR")=8 D ^DIC K DIC G Q2:+Y<1
     11 S DA=+Y,DIE="^DIC(8,",DR="[DG ELIG ENTER/EDIT]" D ^DIE G 2
     12Q2 K DIE,DR,DA,Y
     13 Q
     14 ;
     15ASK ;
     16 Q:$S('$D(^DIC(8.2,+$P(^DIC(8,VAELG,0),U,10),0)):1,1:'$P(^(0),U,2))
     17 W !!,*7,"User Input Needed for '",$P(^DIC(8,VAELG,0),U),"' id:"
     18 S DIE="^DPT("_DFN_",""E"",",DR=.03,DA(1)=DFN,DA=VAELG D ^DIE
     19 W !!?5,"...",$P(^DIC(8,VAELG,0),U)
     20 K DIE,DR,DA,Y
     21 Q
     22 ;
     23WARN ; -- interaction warning
     24 I $P(X,U,2) W !!?5,*7,"WARNING: User interaction usually is required for this format."
     25 Q
     26 ;
     27BEG ;
     28 D NOW^%DTC S VASTART=%
     29 Q
     30 ;
     31END ;
     32 D NOW^%DTC S VAEND=%,L=0
     33 K XMY
     34 S XMSUB=$P($T(OPTS+VAOPT),";",4),XMDUZ=.5,XMTEXT="VATEXT(",XMY(DUZ)=""
     35 I VAOPT=3 S XMSUB=XMSUB_" (Format: "_$S($D(^DIC(8.2,VAFMT,0)):$P(^(0),U),1:"UNKNOWN")_")"
     36 I VAOPT=5 S XMSUB=XMSUB_" (Eligibility: "_$S($D(^DIC(8,VAELG,0)):$P(^(0),U),1:"UNKNOWN")_")"
     37 S L=L+1 S VATEXT(L,0)=" "
     38 S Y=VASTART,L=L+1 X ^DD("DD") S VATEXT(L,0)="  Job started   at "_Y
     39 S Y=VAEND,L=L+1 X ^DD("DD") S VATEXT(L,0)="  Job completed at "_Y
     40 D ^XMD
     41 K VAOPT,VASTART,VAEND,L,VATEXT,XMY,XMSUB,XMDUZ,XMTEXT,Y,% Q
     42 ;
     43TASK ;
     44 W !!?5,"The resetting of ID formats can take many hours."
     45 W !?5,"It is suggested that it be run at off-peak hours,"
     46 W !?5,"perferably over a weekend.",!
     47 K ZTSK S X=$T(OPTS+VAOPT),VARS=$P(X,";",5)
     48 F I=1:1 S Y=$P(VARS,"^",I) Q:Y=""  S ZTSAVE(Y)=""
     49 S ZTSAVE("VAOPT")="",ZTRTN="QUE"_VAOPT_"^VADPT60",ZTDESC=$P(X,";",4),ZTIO="" D ^%ZTLOAD
     50 I $D(ZTSK) W !!,"Job has been queued. (Task #",ZTSK,")",!,"A MailMan message will be sent to you when the job has completed."
     51TASKQ K ZTIO,ZTRTN,ZTDESC,ZTSAVE,VARS,Y,X,ZTSK Q
     52 ;
     53OPTS ; -- queue task list ;;opt#;description;vars to save
     54 ;;1;none
     55 ;;2;none
     56 ;;3;Reset ID Format;VAFMT
     57 ;;4;Reset Primary Eligibilty ID Format
     58 ;;5;Reset Specific Eligibilty ID Format;VAELG
     59 ;;6;none
     60 ;;7;Reset All ID Formats for all Patients
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCPID.m

    r613 r623  
    1 VAFCPID ;ALB/MLI,PKE-Create generic PID segment ; 21 Nov 2002  3:13 PM
    2         ;;5.3;Registration;**91,149,190,415,508,749**;Aug 13, 1993;Build 10
    3         ;
    4         ; This routine returns the HL7 defined PID segment with its
    5         ; mappings to DHCP PATIENT file fields.
    6         ;
    7 EN(DFN,VAFSTR,VAFNUM)   ; returns PID segment
    8         ;  Input - DFN as internal entry number of the PATIENT file
    9         ;          VAFSTR as string of fields requested separated by commas
    10         ;          VAFNUM as sequential number for SET ID (default=1)
    11         ;
    12         ;      ****Also assumes all HL7 variables returned from****
    13         ;          INIT^HLTRANS are defined
    14         ;
    15         ; Output - String containing the desired components of the PID segment
    16         ;          VAFPID(n) - if the string is longer than 245, the remaining
    17         ;                      characters will be returned in VAFPID(n) where
    18         ;                      n is a sequential number beginning with 1
    19         ;
    20         ; WARNING: This routine makes external calls to VADPT.  Non-namespaced
    21         ;          variables may be altered.
    22         ;
    23         N I,VAFY,VA,VADM,X,X1,Y,OUTPUT,DGNAME,DGMMN,VAPA ; calls VADPT...have to NEW
    24         S VAFSTR=$G(VAFSTR) ; if not defined, just return required fields
    25         S DFN=$G(DFN)
    26         I DFN']"" G QUIT
    27         ;Get demographics and permanent address
    28         S VAPA("P")="" D 4^VADPT
    29         S VAFSTR=","_VAFSTR_","
    30         K VAFY
    31         ;Set ID (#1)
    32         I VAFSTR[",1," S VAFY(1)=$S($G(VAFNUM):VAFNUM,1:1)
    33         ;External ID (#2 - always included)
    34         S X=$$GETICN^MPIF001(DFN) S:(+X=-1) X="" S VAFY(2)=$S(X]"":X,1:HLQ)
    35         ;Patient ID (#3 - req)
    36         S VAFY(3)=$$M10^HLFNC(DFN)
    37         ;Alternate ID (#4)
    38         I VAFSTR[",4," S X=$G(VA("BID")),VAFY(4)=$S(X]"":X,1:HLQ)
    39         ;Name (#5 - req)
    40         S DGNAME("FILE")=2,DGNAME("IENS")=DFN,DGNAME("FIELD")=.01
    41         S X=$$HLNAME^XLFNAME(.DGNAME,"",$E(HLECH)),VAFY(5)=$S(X]"":X,1:HLQ)
    42         ;Mother's maiden name (#6)
    43         I VAFSTR[",6," D
    44         .S DGMMN("FILE")=2,DGMMN("IENS")=DFN,DGMMN("FIELD")=.2403
    45         .S X=$$HLNAME^XLFNAME(.DGMMN,"",$E(HLECH)),VAFY(6)=$S(X]"":X,1:HLQ)
    46         ;Date of birth (#7)
    47         I VAFSTR[",7," S VAFY(7)=$$HLDATE^HLFNC(+VADM(3))
    48         ;Sex (#8)
    49         I VAFSTR[",8," S X=$P(VADM(5),"^",1),VAFY(8)=$S("^M^F^"[("^"_X_"^"):X,1:"U")
    50         ;Race (#10)
    51         I VAFSTR[10 D
    52         .N HOW
    53         .S Y=$F(VAFSTR,"10")
    54         .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
    55         .D SEQ10^VAFHLPI1(HOW,HLQ)
    56         ;Address (#11)
    57         I VAFSTR[11 D
    58         .N HOW
    59         .S Y=$F(VAFSTR,"11")
    60         .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
    61         .D SEQ11^VAFHLPI2(HOW,HLQ)
    62         ;County (#12)
    63         I VAFSTR[12 S X1=$P($G(^DIC(5,+$G(VAPA(5)),1,+$G(VAPA(7)),0)),"^",3),VAFY(12)=$S(X1]"":X1,1:HLQ)
    64         S X=$G(^DPT(DFN,.13))
    65         ;Home phone (#13)
    66         I VAFSTR[13 S X1=$$HLPHONE^HLFNC($P(X,"^",1)),VAFY(13)=$S(X1]"":X1,1:HLQ)
    67         ;Business phone (#14)
    68         I VAFSTR[14 S X1=$$HLPHONE^HLFNC($P(X,"^",2)),VAFY(14)=$S(X1]"":X1,1:HLQ)
    69         ;Marital status (#16)
    70         I VAFSTR[16 S X=$P($G(^DIC(11,+VADM(10),0)),"^",3),VAFY(16)=$S(X="M":"M",X="N":"S",X="S":"A",X]"":X,1:HLQ)
    71         ;Religious preference (#17) (if blank send 29 (UNKNOWN))
    72         I VAFSTR[17 S X=$P($G(^DIC(13,+VADM(9),0)),"^",4),VAFY(17)=$S(X]"":X,1:29)
    73         ;SSN (#19)
    74         I VAFSTR[19 S X=$P(VADM(2),"^",1),VAFY(19)=$S(X]"":X,1:HLQ)
    75         ;Ethnicity (#22)
    76         I VAFSTR[22 D
    77         .N HOW
    78         .S Y=$F(VAFSTR,"22")
    79         .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
    80         .D SEQ22^VAFHLPI1(HOW,HLQ)
    81         ;Birth place (#23)
    82         I VAFSTR[23 D
    83         .N DGBC,DGBS
    84         .S DGBC=$$GET1^DIQ(2,DFN,.092,"I")
    85         .S DGBS=$$GET1^DIQ(2,DFN,.093,"E")
    86         .S VAFY(23)=DGBC_" "_DGBS
    87         ;Date of death (#29) & Death indicator (#30) (always included if dead)
    88         S X=+VADM(6) I X D
    89         .S VAFY(29)=$$HLDATE^HLFNC(X)
    90         .S VAFY(30)="Y"
    91         ;
    92 QUIT    D KVA^VADPT
    93         D MAKEIT^VAFHLU("PID",.VAFY,.OUTPUT,.VAFPID)
    94         Q OUTPUT
    95         ;
    96 ADDR(VAFADDR,VAFCOUNT)  ;Return HL7 address
    97         ; Input  - VAFADDR as address in format:
    98         ;            line1^line2^line3^city^state^zip+4
    99         ;          VAFCOUNT as internal value of county (optional)
    100         ; Output - HL7 v2.3 formatted Address_HLFS_County Code
    101         ;
    102         ;      ****Also assumes all HL7 variables returned from****
    103         ;          INIT^HLTRANS are defined
    104         ;
    105         N X,Y,Z S X=$E(HLECH)
    106         ;Street address (line 1)
    107         S $P(Y,X,1)=$P(VAFADDR,"^",1)
    108         ;Other designation (line 2)
    109         S $P(Y,X,2)=$P(VAFADDR,"^",2)
    110         ;City
    111         S $P(Y,X,3)=$P(VAFADDR,"^",4)
    112         ;State
    113         S $P(Y,X,4)=$P($G(^DIC(5,+$P(VAFADDR,"^",5),0)),"^",2)
    114         ;Zip
    115         S $P(Y,X,5)=$P(VAFADDR,"^",6)
    116         ;Other geographic designation (line 3)
    117         S $P(Y,X,8)=$P(VAFADDR,"^",3)
    118         ;County
    119         S $P(Y,X,9)=$P($G(^DIC(5,+$P(VAFADDR,"^",5),1,+$G(VAFCOUNT),0)),"^",3)
    120         F Z=1,2,3,4,5,8,9 I $P(Y,X,Z)="" S $P(Y,X,Z)=HLQ
    121         I $G(VAFCOUNT) D
    122         .S $P(Y,HLFS,2)=$P(Y,X,9)
    123         Q Y
     1VAFCPID ;ALB/MLI,PKE-Create generic PID segment ; 21 Nov 2002  3:13 PM
     2 ;;5.3;Registration;**91,149,190,415,508**;Aug 13, 1993
     3 ;
     4 ; This routine returns the HL7 defined PID segment with its
     5 ; mappings to DHCP PATIENT file fields.
     6 ;
     7EN(DFN,VAFSTR,VAFNUM) ; returns PID segment
     8 ;  Input - DFN as internal entry number of the PATIENT file
     9 ;          VAFSTR as string of fields requested separated by commas
     10 ;          VAFNUM as sequential number for SET ID (default=1)
     11 ;
     12 ;      ****Also assumes all HL7 variables returned from****
     13 ;          INIT^HLTRANS are defined
     14 ;
     15 ; Output - String containing the desired components of the PID segment
     16 ;          VAFPID(n) - if the string is longer than 245, the remaining
     17 ;                      characters will be returned in VAFPID(n) where
     18 ;                      n is a sequential number beginning with 1
     19 ;
     20 ; WARNING: This routine makes external calls to VADPT.  Non-namespaced
     21 ;          variables may be altered.
     22 ;
     23 N I,VAFY,VA,VADM,X,X1,Y,OUTPUT,DGNAME,VAPA ; calls VADPT...have to NEW
     24 S VAFSTR=$G(VAFSTR) ; if not defined, just return required fields
     25 S DFN=$G(DFN)
     26 I DFN']"" G QUIT
     27 ;Get demographics and permanent address
     28 S VAPA("P")="" D 4^VADPT
     29 S VAFSTR=","_VAFSTR_","
     30 K VAFY
     31 ;Set ID (#1)
     32 I VAFSTR[",1," S VAFY(1)=$S($G(VAFNUM):VAFNUM,1:1)
     33 ;External ID (#2 - always included)
     34 S X=$$GETICN^MPIF001(DFN) S:(+X=-1) X="" S VAFY(2)=$S(X]"":X,1:HLQ)
     35 ;Patient ID (#3 - req)
     36 S VAFY(3)=$$M10^HLFNC(DFN)
     37 ;Alternate ID (#4)
     38 I VAFSTR[",4," S X=$G(VA("BID")),VAFY(4)=$S(X]"":X,1:HLQ)
     39 ;Name (#5 - req)
     40 S DGNAME("FILE")=2,DGNAME("IENS")=DFN,DGNAME("FIELD")=.01
     41 S X=$$HLNAME^XLFNAME(.DGNAME,"",$E(HLECH)),VAFY(5)=$S(X]"":X,1:HLQ)
     42 ;Mother's maiden name (#6)
     43 I VAFSTR[",6," S X=$P($G(^DPT(DFN,.24)),"^",3),VAFY(6)=$S(X]"":X,1:HLQ)
     44 ;Date of birth (#7)
     45 I VAFSTR[",7," S VAFY(7)=$$HLDATE^HLFNC(+VADM(3))
     46 ;Sex (#8)
     47 I VAFSTR[",8," S X=$P(VADM(5),"^",1),VAFY(8)=$S("^M^F^"[("^"_X_"^"):X,1:"U")
     48 ;Race (#10)
     49 I VAFSTR[10 D
     50 .N HOW
     51 .S Y=$F(VAFSTR,"10")
     52 .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
     53 .D SEQ10^VAFHLPI1(HOW,HLQ)
     54 ;Address (#11)
     55 I VAFSTR[11 D
     56 .N HOW
     57 .S Y=$F(VAFSTR,"11")
     58 .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
     59 .D SEQ11^VAFHLPI2(HOW,HLQ)
     60 ;County (#12)
     61 I VAFSTR[12 S X1=$P($G(^DIC(5,+$G(VAPA(5)),1,+$G(VAPA(7)),0)),"^",3),VAFY(12)=$S(X1]"":X1,1:HLQ)
     62 S X=$G(^DPT(DFN,.13))
     63 ;Home phone (#13)
     64 I VAFSTR[13 S X1=$$HLPHONE^HLFNC($P(X,"^",1)),VAFY(13)=$S(X1]"":X1,1:HLQ)
     65 ;Business phone (#14)
     66 I VAFSTR[14 S X1=$$HLPHONE^HLFNC($P(X,"^",2)),VAFY(14)=$S(X1]"":X1,1:HLQ)
     67 ;Marital status (#16)
     68 I VAFSTR[16 S X=$P($G(^DIC(11,+VADM(10),0)),"^",3),VAFY(16)=$S(X="M":"M",X="N":"S",X="S":"A",X]"":X,1:HLQ)
     69 ;Religious preference (#17) (if blank send 29 (UNKNOWN))
     70 I VAFSTR[17 S X=$P($G(^DIC(13,+VADM(9),0)),"^",4),VAFY(17)=$S(X]"":X,1:29)
     71 ;SSN (#19)
     72 I VAFSTR[19 S X=$P(VADM(2),"^",1),VAFY(19)=$S(X]"":X,1:HLQ)
     73 ;Ethnicity (#22)
     74 I VAFSTR[22 D
     75 .N HOW
     76 .S Y=$F(VAFSTR,"22")
     77 .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
     78 .D SEQ22^VAFHLPI1(HOW,HLQ)
     79 ;Birth place (#23)
     80 I VAFSTR[23 D
     81 .N DGBC,DGBS
     82 .S DGBC=$$GET1^DIQ(2,DFN,.092,"I")
     83 .S DGBS=$$GET1^DIQ(2,DFN,.093,"E")
     84 .S VAFY(23)=DGBC_" "_DGBS
     85 ;Date of death (#29) & Death indicator (#30) (always included if dead)
     86 S X=+VADM(6) I X D
     87 .S VAFY(29)=$$HLDATE^HLFNC(X)
     88 .S VAFY(30)="Y"
     89 ;
     90QUIT D KVA^VADPT
     91 D MAKEIT^VAFHLU("PID",.VAFY,.OUTPUT,.VAFPID)
     92 Q OUTPUT
     93 ;
     94ADDR(VAFADDR,VAFCOUNT) ;Return HL7 address
     95 ; Input  - VAFADDR as address in format:
     96 ;            line1^line2^line3^city^state^zip+4
     97 ;          VAFCOUNT as internal value of county (optional)
     98 ; Output - HL7 v2.3 formatted Address_HLFS_County Code
     99 ;
     100 ;      ****Also assumes all HL7 variables returned from****
     101 ;          INIT^HLTRANS are defined
     102 ;
     103 N X,Y,Z S X=$E(HLECH)
     104 ;Street address (line 1)
     105 S $P(Y,X,1)=$P(VAFADDR,"^",1)
     106 ;Other designation (line 2)
     107 S $P(Y,X,2)=$P(VAFADDR,"^",2)
     108 ;City
     109 S $P(Y,X,3)=$P(VAFADDR,"^",4)
     110 ;State
     111 S $P(Y,X,4)=$P($G(^DIC(5,+$P(VAFADDR,"^",5),0)),"^",2)
     112 ;Zip
     113 S $P(Y,X,5)=$P(VAFADDR,"^",6)
     114 ;Other geographic designation (line 3)
     115 S $P(Y,X,8)=$P(VAFADDR,"^",3)
     116 ;County
     117 S $P(Y,X,9)=$P($G(^DIC(5,+$P(VAFADDR,"^",5),1,+$G(VAFCOUNT),0)),"^",3)
     118 F Z=1,2,3,4,5,8,9 I $P(Y,X,Z)="" S $P(Y,X,Z)=HLQ
     119 I $G(VAFCOUNT) D
     120 .S $P(Y,HLFS,2)=$P(Y,X,9)
     121 Q Y
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCTF.m

    r613 r623  
    1 VAFCTF  ;BIR/DLR-Utility for capturing patient's Date Last Treated and Event Reason ;9/9/2002
    2         ;;5.3;Registration;**428,713,766**;Aug 13, 1993;Build 3
    3         Q  ; quit if called from the top
    4         ;
    5         ;Reference to ^SCE("ADFN" supported by IA# 2953
    6         ;Reference to EXC^RGHLLOG supported by IA# 2796
    7         ;Reference to $$ICNLC^MPIF001 supported by IA #3072
    8         ;
    9 EN1(VAFCDFN,VAFCSUP)    ; determine the LAST TREATMENT DATE for a single
    10         ; patient
    11         ; input: VAFCDFN - the dfn of the patient
    12         ;        VAFCSUP - if 1, suppress add entries to the ADT HL7 PIVOT
    13         ;                (#391.71) file for TF messaging - VAFCTFMF (optional)
    14         ; output: VAFCDATE - patient's DATE LAST TREATED
    15         ;         VAFCENVR - event reason
    16         ;
    17         N ERR,VAFCSITE,VAFCLAST,VAFCSITE,VAFCADMD,VAFCENDT,VAFCDATE,VAFCENVR,VAFCTYPE
    18         S U="^"
    19         S:'$D(VAFCSITE) VAFCSITE=$$KSP^XUPARAM("INST") ;defines the local facility
    20         S (VAFCLAST,VAFCADMD)=$$ADMDIS(VAFCDFN) ; dt_"^"_event type or ""
    21         S VAFCADMD=$S(VAFCADMD]"":$P(VAFCADMD,"^"),1:"") ; event dt or null
    22         S:$P(VAFCLAST,"^",2)=3!(VAFCLAST="") VAFCENDT=$$ENCDT(VAFCDFN,VAFCADMD)
    23         ; patient has been discharged or has never been admitted.  Has this
    24         ; individual been checked out of a clinic?
    25         I $D(VAFCENDT)#2,($P(VAFCLAST,U)) S VAFCLAST=$S(+VAFCENDT>+VAFCLAST:VAFCENDT,1:VAFCLAST)
    26         I $D(VAFCENDT)#2,('$P(VAFCLAST,U)) S VAFCLAST=VAFCENDT
    27         S VAFCTYPE=$P(VAFCLAST,"^",2),VAFCDATE=+VAFCLAST
    28         ; input variables to FILE^VAFCTFU
    29         ; VAFCDFN - patient ien ; VAFCSITE - treating facility
    30         ; VAFCDATE - date last treated ; VAFCENVR - event reason
    31         ;
    32         I +VAFCDATE'>0 S VAFCDATE="",VAFCENVR=""
    33         I +VAFCDATE>0 S VAFCENVR=$S(VAFCTYPE=1:"A1",VAFCTYPE=3:"A2",1:"A3") ;A1=adm;A2=dis;A3=CO
    34         N STA,ICN S ICN=$$ICNLC^MPIF001(VAFCDFN),STA=$P($$SITE^VASITE,"^",3)
    35         D FILE^VAFCTFU(VAFCDFN,VAFCSITE_U_VAFCDATE_U_VAFCENVR,$G(VAFCSUP),1,.ERR) I $D(ERR(STA)) D EXC^RGHLLOG(212,ERR(STA),VAFCDFN)
    36         ;
    37         Q
    38 ADMDIS(DFN)     ; find the patient's last admission and discharge dates if
    39         ; they exist.
    40         ; Input: DFN - ien of the patient (file 2)
    41         ;Output: a valid discharge/admission date/time concatenated with
    42         ;        the event type (1=admission, 3=discharge) -or- null
    43         N %,VAERR,VAIP S VAIP("D")="LAST" D IN5^VADPT
    44         I '+$G(VAIP(17,1)),('+$G(VAIP(13,1))) Q ""
    45         ; no discharge date, no admission date, return null
    46         I '+$G(VAIP(17,1)) Q $P($G(VAIP(13,1)),U)_"^1"
    47         ; no discharge date, return admission date
    48         I '+$G(VAIP(13,1)) Q $P($G(VAIP(17,1)),U)_"^3"
    49         ; no admission date, return discharge date
    50         I +$G(VAIP(17,1))>(+$G(VAIP(13,1))) Q +$G(VAIP(17,1))_"^3"
    51         ; return discharge date
    52         Q +$G(VAIP(13,1))_"^1" ; return admission date
    53         ;
    54 ENCDT(DFN,INPDT)        ; find the last patient check out date/time.  'ADFN'
    55         ; cross-reference accessed through DBIA: 2953
    56         ; Input: DFN  - ien of the patient (file 2)
    57         ;        INPDT - date (if any) returned from the inpatient admission/
    58         ;               discharge subroutine     
    59         ;Output: a valid discharge/admission date/time concatenated with
    60         ;        the event type (5=check out) -or- null
    61         Q:'DFN "" ; we need dfn defined
    62         N VAFCDATA,VAFCPURG,VAFCX,VAFCX1,VAFCX2,VAFCX3
    63         S VAFCX=9999999.9999999,VAFCX2=0,VAFCX3=""
    64         F  S VAFCX=$O(^SCE("ADFN",DFN,VAFCX),-1) Q:'VAFCX!(INPDT>VAFCX)  D  Q:VAFCX2
    65         . S VAFCX1=0 F  S VAFCX1=$O(^SCE("ADFN",DFN,VAFCX,VAFCX1)) Q:'VAFCX1  D  Q:VAFCX2
    66         .. D GETGEN^SDOE(VAFCX1,"VAFCDATA")
    67         .. D PARSE^SDOE(.VAFCDATA,"EXTERNAL","VAFCPARS")
    68         .. I $G(VAFCPARS(.12))="CHECKED OUT" S VAFCX2=1,VAFCX3=VAFCX
    69         .. K VAFCDATA,VAFCPARS
    70         .. Q
    71         . Q
    72         K VAFCDATA,VAFCPURG,VAFCX,VAFCX1,VAFCX2
    73         ;DG*5.3*766
    74         I $E(VAFCX3,9,10)>23 S VAFCX3=$E(VAFCX3,1,8)_"23"_$E(VAFCX3,11,14)
    75         I $E(VAFCX3,11)>5 S VAFCX3=$E(VAFCX3,1,10)_"59"_$E(VAFCX3,13,14)
    76         ;DG*5.3*713
    77         I $E(VAFCX3,13)>5 S VAFCX3=$E(VAFCX3,1,12)_"59"
    78         Q VAFCX3_"^5" ; X is either null or the date/time of the check out
    79         ;
     1VAFCTF ;BIR/DLR-Utility for capturing patient's Date Last Treated and Event Reason ;9/9/2002
     2 ;;5.3;Registration;**428,713**;Aug 13, 1993
     3 Q  ; quit if called from the top
     4 ;
     5 ;Reference to ^SCE("ADFN" supported by IA# 2953
     6 ;Reference to EXC^RGHLLOG supported by IA# 2796
     7 ;Reference to $$ICNLC^MPIF001 supported by IA #3072
     8 ;
     9EN1(VAFCDFN,VAFCSUP) ; determine the LAST TREATMENT DATE for a single
     10 ; patient
     11 ; input: VAFCDFN - the dfn of the patient
     12 ;        VAFCSUP - if 1, suppress add entries to the ADT HL7 PIVOT
     13 ;                (#391.71) file for TF messaging - VAFCTFMF (optional)
     14 ; output: VAFCDATE - patient's DATE LAST TREATED
     15 ;         VAFCENVR - event reason
     16 ;
     17 N ERR,VAFCSITE,VAFCLAST,VAFCSITE,VAFCADMD,VAFCENDT,VAFCDATE,VAFCENVR,VAFCTYPE
     18 S U="^"
     19 S:'$D(VAFCSITE) VAFCSITE=$$KSP^XUPARAM("INST") ;defines the local facility
     20 S (VAFCLAST,VAFCADMD)=$$ADMDIS(VAFCDFN) ; dt_"^"_event type or ""
     21 S VAFCADMD=$S(VAFCADMD]"":$P(VAFCADMD,"^"),1:"") ; event dt or null
     22 S:$P(VAFCLAST,"^",2)=3!(VAFCLAST="") VAFCENDT=$$ENCDT(VAFCDFN,VAFCADMD)
     23 ; patient has been discharged or has never been admitted.  Has this
     24 ; individual been checked out of a clinic?
     25 I $D(VAFCENDT)#2,($P(VAFCLAST,U)) S VAFCLAST=$S(+VAFCENDT>+VAFCLAST:VAFCENDT,1:VAFCLAST)
     26 I $D(VAFCENDT)#2,('$P(VAFCLAST,U)) S VAFCLAST=VAFCENDT
     27 S VAFCTYPE=$P(VAFCLAST,"^",2),VAFCDATE=+VAFCLAST
     28 ; input variables to FILE^VAFCTFU
     29 ; VAFCDFN - patient ien ; VAFCSITE - treating facility
     30 ; VAFCDATE - date last treated ; VAFCENVR - event reason
     31 ;
     32 I +VAFCDATE'>0 S VAFCDATE="",VAFCENVR=""
     33 I +VAFCDATE>0 S VAFCENVR=$S(VAFCTYPE=1:"A1",VAFCTYPE=3:"A2",1:"A3") ;A1=adm;A2=dis;A3=CO
     34 N STA,ICN S ICN=$$ICNLC^MPIF001(VAFCDFN),STA=$P($$SITE^VASITE,"^",3)
     35 D FILE^VAFCTFU(VAFCDFN,VAFCSITE_U_VAFCDATE_U_VAFCENVR,$G(VAFCSUP),1,.ERR) I $D(ERR(STA)) D EXC^RGHLLOG(212,ERR(STA),VAFCDFN)
     36 ;
     37 Q
     38ADMDIS(DFN) ; find the patient's last admission and discharge dates if
     39 ; they exist.
     40 ; Input: DFN - ien of the patient (file 2)
     41 ;Output: a valid discharge/admission date/time concatenated with
     42 ;        the event type (1=admission, 3=discharge) -or- null
     43 N %,VAERR,VAIP S VAIP("D")="LAST" D IN5^VADPT
     44 I '+$G(VAIP(17,1)),('+$G(VAIP(13,1))) Q ""
     45 ; no discharge date, no admission date, return null
     46 I '+$G(VAIP(17,1)) Q $P($G(VAIP(13,1)),U)_"^1"
     47 ; no discharge date, return admission date
     48 I '+$G(VAIP(13,1)) Q $P($G(VAIP(17,1)),U)_"^3"
     49 ; no admission date, return discharge date
     50 I +$G(VAIP(17,1))>(+$G(VAIP(13,1))) Q +$G(VAIP(17,1))_"^3"
     51 ; return discharge date
     52 Q +$G(VAIP(13,1))_"^1" ; return admission date
     53 ;
     54ENCDT(DFN,INPDT) ; find the last patient check out date/time.  'ADFN'
     55 ; cross-reference accessed through DBIA: 2953
     56 ; Input: DFN  - ien of the patient (file 2)
     57 ;        INPDT - date (if any) returned from the inpatient admission/
     58 ;               discharge subroutine     
     59 ;Output: a valid discharge/admission date/time concatenated with
     60 ;        the event type (5=check out) -or- null
     61 Q:'DFN "" ; we need dfn defined
     62 N VAFCDATA,VAFCPURG,VAFCX,VAFCX1,VAFCX2,VAFCX3
     63 S VAFCX=9999999.9999999,VAFCX2=0,VAFCX3=""
     64 F  S VAFCX=$O(^SCE("ADFN",DFN,VAFCX),-1) Q:'VAFCX!(INPDT>VAFCX)  D  Q:VAFCX2
     65 . S VAFCX1=0 F  S VAFCX1=$O(^SCE("ADFN",DFN,VAFCX,VAFCX1)) Q:'VAFCX1  D  Q:VAFCX2
     66 .. D GETGEN^SDOE(VAFCX1,"VAFCDATA")
     67 .. D PARSE^SDOE(.VAFCDATA,"EXTERNAL","VAFCPARS")
     68 .. I $G(VAFCPARS(.12))="CHECKED OUT" S VAFCX2=1,VAFCX3=VAFCX
     69 .. K VAFCDATA,VAFCPARS
     70 .. Q
     71 . Q
     72 K VAFCDATA,VAFCPURG,VAFCX,VAFCX1,VAFCX2
     73 I $E(VAFCX3,13)>5 S VAFCX3=$E(VAFCX3,1,12)_"59"
     74 Q VAFCX3_"^5" ; X is either null or the date/time of the check out
     75 ;
  • WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFHLPID.m

    r613 r623  
    1 VAFHLPID        ;ALB/MLI/ESD - Create generic PID segment ; 21 Nov 2002  3:13 PM
    2         ;;5.3;Registration;**68,94,415,508,749**;Aug 13, 1993;Build 10
    3         ;
    4         ; This routine returns the HL7 defined PID segment with its
    5         ; mappings to DHCP PATIENT file fields.
    6         ;
    7 EN(DFN,VAFSTR,VAFNUM,PTID)      ; returns PID segment
    8         ;  Input - DFN as internal entry number of the PATIENT file
    9         ;          VAFSTR as string of fields requested separated by commas
    10         ;          VAFNUM as sequential number for SET ID (default=1)
    11         ;          PTID is flag denoting which Patient ID (seq 3) to use
    12         ;              0 - Use DFN formatted as data type CK (default)
    13         ;              1 - Use ICN
    14         ;              2 - Use DFN formatted as data type CX
    15         ;              3 - Use SSN (with dashes)
    16         ;
    17         ;      ****Also assumes all HL7 variables returned from****
    18         ;          INIT^HLTRANS are defined
    19         ;
    20         ; Output - String containing the desired components of the PID segment
    21         ;          VAFPID(n) - if the string is longer than 245, the remaining
    22         ;                      characters will be returned in VAFPID(n) where
    23         ;                      n is a sequential number beginning with 1
    24         ;
    25         ; WARNING: This routine makes external calls to VADPT.  Non-namespaced
    26         ;          variables may be altered.
    27         ;
    28         N I,VAFY,VA,VADM,X,X1,Y,OUTPUT,DGNAME,DGMMN,VAPA ; calls VADPT...have to NEW
    29         S VAFSTR=$G(VAFSTR) ; if not defined, just return required fields
    30         S DFN=$G(DFN)
    31         I DFN']"" G QUIT
    32         ;Get demographics and permanent address
    33         S VAPA("P")="" D 4^VADPT
    34         S VAFSTR=","_VAFSTR_","
    35         K VAFY
    36         ;Set ID (#1)
    37         I VAFSTR[",1," S VAFY(1)=$S($G(VAFNUM):VAFNUM,1:1)
    38         ;External ID (#2)
    39         I VAFSTR[",2," S X=$G(VA("PID")),VAFY(2)=$S(X]"":$$M10^HLFNC(X),1:HLQ)
    40         ;Patient ID (#3 - req)
    41         S PTID=+$G(PTID)
    42         I 'PTID S VAFY(3)=$$M10^HLFNC(DFN)
    43         I PTID D
    44         .S X=$S(PTID=1:"NI",PTID=2:"PI",PTID=3:"SS")
    45         .S VAFY(3)=$$SEQ3^VAFHLPI1(DFN,X,HLECH,HLQ)
    46         ;Alternate ID (#4)
    47         I VAFSTR[",4," S X=$G(VA("BID")),VAFY(4)=$S(X]"":X,1:HLQ)
    48         ;Name (#5 - req)
    49         S DGNAME("FILE")=2,DGNAME("IENS")=DFN,DGNAME("FIELD")=.01
    50         S X=$$HLNAME^XLFNAME(.DGNAME,"",$E(HLECH)),VAFY(5)=$S(X]"":X,1:HLQ)
    51         ;Mother's maiden name (#6)
    52         I VAFSTR[",6," D
    53         .S DGMMN("FILE")=2,DGMMN("IENS")=DFN,DGMMN("FIELD")=.2403
    54         .S X=$$HLNAME^XLFNAME(.DGMMN,"",$E(HLECH)),VAFY(6)=$S(X]"":X,1:HLQ)
    55         ;Date of birth (#7)
    56         I VAFSTR[",7," S VAFY(7)=$$HLDATE^HLFNC(+VADM(3))
    57         ;Sex (#8)
    58         I VAFSTR[",8," S X=$P(VADM(5),"^",1),VAFY(8)=$S("^M^F^"[("^"_X_"^"):X,1:"U")
    59         ;Race (#10)
    60         I VAFSTR[10 D
    61         .N HOW
    62         .S Y=$F(VAFSTR,"10")
    63         .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
    64         .D SEQ10^VAFHLPI1(HOW,HLQ)
    65         ;Address (#11)
    66         I VAFSTR[11 D
    67         .N HOW
    68         .S Y=$F(VAFSTR,"11")
    69         .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
    70         .D SEQ11^VAFHLPI2(HOW,HLQ)
    71         ;County (#12)
    72         I VAFSTR[12 S X1=$P($G(^DIC(5,+$G(VAPA(5)),1,+$G(VAPA(7)),0)),"^",3),VAFY(12)=$S(X1]"":X1,1:HLQ)
    73         S X=$G(^DPT(DFN,.13))
    74         ;Home phone (#13)
    75         I VAFSTR[13 S X1=$$HLPHONE^HLFNC($P(X,"^",1)),VAFY(13)=$S(X1]"":X1,1:HLQ)
    76         ;Business phone (#14)
    77         I VAFSTR[14 S X1=$$HLPHONE^HLFNC($P(X,"^",2)),VAFY(14)=$S(X1]"":X1,1:HLQ)
    78         ;Marital status (#16)
    79         I VAFSTR[16 S X=$P($G(^DIC(11,+VADM(10),0)),"^",3),VAFY(16)=$S(X="N":"S",X="U":"",X="":HLQ,1:X)
    80         ;Religious preference (#17) (if blank send 29 (UNKNOWN))
    81         I VAFSTR[17 S X=$P($G(^DIC(13,+VADM(9),0)),"^",4),VAFY(17)=$S(X]"":X,1:29)
    82         ;SSN (#19)
    83         I VAFSTR[19 S X=$P(VADM(2),"^",1),VAFY(19)=$S(X]"":X,1:HLQ)
    84         ;Ethnicity (#22)
    85         I VAFSTR[22 D
    86         .N HOW
    87         .S Y=$F(VAFSTR,"22")
    88         .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
    89         .D SEQ22^VAFHLPI1(HOW,HLQ)
    90         ;
    91 QUIT    D KVA^VADPT
    92         D MAKEIT^VAFHLU("PID",.VAFY,.OUTPUT,.VAFPID)
    93         Q OUTPUT
     1VAFHLPID ;ALB/MLI/ESD - Create generic PID segment ; 21 Nov 2002  3:13 PM
     2 ;;5.3;Registration;**68,94,415,508**;Aug 13, 1993
     3 ;
     4 ; This routine returns the HL7 defined PID segment with its
     5 ; mappings to DHCP PATIENT file fields.
     6 ;
     7EN(DFN,VAFSTR,VAFNUM,PTID) ; returns PID segment
     8 ;  Input - DFN as internal entry number of the PATIENT file
     9 ;          VAFSTR as string of fields requested separated by commas
     10 ;          VAFNUM as sequential number for SET ID (default=1)
     11 ;          PTID is flag denoting which Patient ID (seq 3) to use
     12 ;              0 - Use DFN formatted as data type CK (default)
     13 ;              1 - Use ICN
     14 ;              2 - Use DFN formatted as data type CX
     15 ;              3 - Use SSN (with dashes)
     16 ;
     17 ;      ****Also assumes all HL7 variables returned from****
     18 ;          INIT^HLTRANS are defined
     19 ;
     20 ; Output - String containing the desired components of the PID segment
     21 ;          VAFPID(n) - if the string is longer than 245, the remaining
     22 ;                      characters will be returned in VAFPID(n) where
     23 ;                      n is a sequential number beginning with 1
     24 ;
     25 ; WARNING: This routine makes external calls to VADPT.  Non-namespaced
     26 ;          variables may be altered.
     27 ;
     28 N I,VAFY,VA,VADM,X,X1,Y,OUTPUT,DGNAME,VAPA ; calls VADPT...have to NEW
     29 S VAFSTR=$G(VAFSTR) ; if not defined, just return required fields
     30 S DFN=$G(DFN)
     31 I DFN']"" G QUIT
     32 ;Get demographics and permanent address
     33 S VAPA("P")="" D 4^VADPT
     34 S VAFSTR=","_VAFSTR_","
     35 K VAFY
     36 ;Set ID (#1)
     37 I VAFSTR[",1," S VAFY(1)=$S($G(VAFNUM):VAFNUM,1:1)
     38 ;External ID (#2)
     39 I VAFSTR[",2," S X=$G(VA("PID")),VAFY(2)=$S(X]"":$$M10^HLFNC(X),1:HLQ)
     40 ;Patient ID (#3 - req)
     41 S PTID=+$G(PTID)
     42 I 'PTID S VAFY(3)=$$M10^HLFNC(DFN)
     43 I PTID D
     44 .S X=$S(PTID=1:"NI",PTID=2:"PI",PTID=3:"SS")
     45 .S VAFY(3)=$$SEQ3^VAFHLPI1(DFN,X,HLECH,HLQ)
     46 ;Alternate ID (#4)
     47 I VAFSTR[",4," S X=$G(VA("BID")),VAFY(4)=$S(X]"":X,1:HLQ)
     48 ;Name (#5 - req)
     49 S DGNAME("FILE")=2,DGNAME("IENS")=DFN,DGNAME("FIELD")=.01
     50 S X=$$HLNAME^XLFNAME(.DGNAME,"",$E(HLECH)),VAFY(5)=$S(X]"":X,1:HLQ)
     51 ;Mother's maiden name (#6)
     52 I VAFSTR[",6," S X=$P($G(^DPT(DFN,.24)),"^",3),VAFY(6)=$S(X]"":X,1:HLQ)
     53 ;Date of birth (#7)
     54 I VAFSTR[",7," S VAFY(7)=$$HLDATE^HLFNC(+VADM(3))
     55 ;Sex (#8)
     56 I VAFSTR[",8," S X=$P(VADM(5),"^",1),VAFY(8)=$S("^M^F^"[("^"_X_"^"):X,1:"U")
     57 ;Race (#10)
     58 I VAFSTR[10 D
     59 .N HOW
     60 .S Y=$F(VAFSTR,"10")
     61 .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
     62 .D SEQ10^VAFHLPI1(HOW,HLQ)
     63 ;Address (#11)
     64 I VAFSTR[11 D
     65 .N HOW
     66 .S Y=$F(VAFSTR,"11")
     67 .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
     68 .D SEQ11^VAFHLPI2(HOW,HLQ)
     69 ;County (#12)
     70 I VAFSTR[12 S X1=$P($G(^DIC(5,+$G(VAPA(5)),1,+$G(VAPA(7)),0)),"^",3),VAFY(12)=$S(X1]"":X1,1:HLQ)
     71 S X=$G(^DPT(DFN,.13))
     72 ;Home phone (#13)
     73 I VAFSTR[13 S X1=$$HLPHONE^HLFNC($P(X,"^",1)),VAFY(13)=$S(X1]"":X1,1:HLQ)
     74 ;Business phone (#14)
     75 I VAFSTR[14 S X1=$$HLPHONE^HLFNC($P(X,"^",2)),VAFY(14)=$S(X1]"":X1,1:HLQ)
     76 ;Marital status (#16)
     77 I VAFSTR[16 S X=$P($G(^DIC(11,+VADM(10),0)),"^",3),VAFY(16)=$S(X="N":"S",X="U":"",X="":HLQ,1:X)
     78 ;Religious preference (#17) (if blank send 29 (UNKNOWN))
     79 I VAFSTR[17 S X=$P($G(^DIC(13,+VADM(9),0)),"^",4),VAFY(17)=$S(X]"":X,1:29)
     80 ;SSN (#19)
     81 I VAFSTR[19 S X=$P(VADM(2),"^",1),VAFY(19)=$S(X]"":X,1:HLQ)
     82 ;Ethnicity (#22)
     83 I VAFSTR[22 D
     84 .N HOW
     85 .S Y=$F(VAFSTR,"22")
     86 .S HOW=$P($E(VAFSTR,Y,$F(VAFSTR,",",Y)),",",1)
     87 .D SEQ22^VAFHLPI1(HOW,HLQ)
     88 ;
     89QUIT D KVA^VADPT
     90 D MAKEIT^VAFHLU("PID",.VAFY,.OUTPUT,.VAFPID)
     91 Q OUTPUT
Note: See TracChangeset for help on using the changeset viewer.