source: WorldVistAEHR/trunk/r/AUTOMATED_MED_INFO_EXCHANGE-DVBA-DVBC/DVBCUTL2.m@ 767

Last change on this file since 767 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1DVBCUTL2 ;ALB/GTS-557/THM-DVBCUTIL, CONTINUED ; 3/4/91 12:54 PM
2 ;;2.7;AMIE;;Apr 10, 1995
3 ;
4KILL K %ZIS,BY,COLUMN,DVBCDT(0),EXAM,EXAMNM,HIST,FF,LABEL,LEVEL,LOC,MA,MB,NFINAL,NODE,OLDEXAM,OUT,PDATE,PDTA,PIECE,REAS,STAT1,TYPE,X1,X2,XDR,XST,JIJ,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,ZW,JJY,VX,ADIV,ADIVNUM,DVBCDD,EDAYS,HEAD,HEAD2,ULINE,IO("Q")
5 K EXHD,XMTEXT,ZTDTH,OUT,CANC,DOTS,L,MG,REASON,SEND,XEXAM,XMDUZ,XMSUB,XMY,%X,%Y,JFLD,JX,JDR,DTREL,DTREQ,DTRQCMP,DTSCHEDC,DTTRANS,EDATE,ER,EXDATE,EXSTAT,RQSTAT,SBULL,TOT,XDT,XMDISPI,XMKK,XMLOC,XMLOCK,XMQF,XMR,XMT,XMTYP,XMZ,%H,K,NODATA,PNAM
6 K ANS,BDATE,PROCDT,QQ,RDATE,REQSTR,SADIV,OLDY,RQDT,RQDT2,PGM,SDATE,SDATE1,SDATE2,EDATE,EDATE1,EDATE2,CMPDIV,BY1,DAYS,FAX,PRTDIV,XMMG,ADEQ,EXMNM,PRTDATE,RUNDATE,RPTSITE,FEXAM,XSTAT,JZ,ZPR,REQDA,DVBCDT,FDT,RN,XIX,DVBCZ,EXDT,AGE
7 K COMP,DTOUT,DTSCH,DTSCH2,LNE,PG,PHYS,EXDA,DVBCDIV,%W,PRTNM,DIVNM,AW,AX,AY,BDATE1,CANDT,COL,DVBCJ,DVBCSEQ,DVBCSITE,ELTYP,EXPTR,EXSTAT,HD3,HEAD3,JJZ,JK,LVL,LX,NAME,OLDDA1,ORVP,PG,PRBY,RELBY,SEQNUM,TOTAL,TXT,TYP,DVBCXJI,PNM,PREF,NARR
8 G KILL^DVBCUTL3
9 ;
10DDIS1 ;display rated disabilities
11 W ?2,DX,?37,$J(PCT,3,0)," %",?50,$S(SC=1:"Yes",1:"No"),?58,DXCOD,!
12 Q
13 ;
14DDIS I '$D(^DPT(DFN,.372)) W !!,"No rated disabilities on file",!! Q
15 W !?2,"Rated Disability",?37,"Percent",?50,"SC ?",?58,"Dx Code",! W ?2 F LINE=1:1:63 W "-"
16 W !! F I=0:0 S I=$O(^DPT(DFN,.372,I)) Q:I="" S DXNUM=$P(^DPT(DFN,.372,I,0),U,1),PCT=$P(^(0),U,2),SC=$P(^(0),U,3),DX=$S($D(^DIC(31,DXNUM)):$P(^(DXNUM,0),U,1),1:"Unknown"),DXCOD=$S($D(^DIC(31,DXNUM)):$P(^(DXNUM,0),U,3),1:"Unknown") D DDIS1
17 W !! Q
18 ;
19HDR2 W @IOF,!,"C&P Final Report",?71,"Page: ",PG,!!,"Name: ",PNAM,?38,"SSN: ",SSN,?60,"C-number: ",CNUM,!,EXHD,!
20 F ZI=1:1:80 W "="
21 W !
22 Q
23 ;
24HDR3 W @IOF,!,"C&P Reprint of Final Report",?71,"Page: ",PG,!!,"Name: ",PNAM,?38,"SSN: ",SSN,?60,"C-number: ",CNUM,!,EXHD,!
25 F ZI=1:1:80 W "="
26 W !
27 Q
28 ;
29DUZ2 ;select station number
30 S DVBCD2=$S($D(^DIC(4,DUZ(2),99)):$P(^(99),U,1),1:0)
31 Q
32 ;
33TST W ?3
34 F DA=0:0 S DA=$O(^DVB(396.4,"C",DA(1),DA)) Q:DA="" K PRINT S TSTAT=$P(^DVB(396.4,DA,0),U,4),TST=$P(^DVB(396.4,DA,0),U,3),PRTNM=$S($D(^DVB(396.6,TST,0)):$P(^(0),U,2),1:"") D TST1
35 Q
36TST1 S TSTA1=""
37 I $D(^DVB(396.4,DA,"CAN")) S TSTA1=$P(^DVB(396.4,DA,"CAN"),U,3)
38 I $D(^DVB(396.4,DA,"TRAN")) S X=$P(^DVB(396.4,DA,"TRAN"),U,3)
39 S:TSTA1]"" TSTA1=$P(^DVB(396.5,TSTA1,0),U,1) ;tsta1=cancellation reason
40 W:($L(PRTNM)+$L(TSTA1)+$X)>55 !?3 W $S(PRTNM]"":PRTNM,1:"Missing exam name")_$S(TSTA1]"":" - cancelled ("_TSTA1_")",TSTAT="T":" - Transferred",TSTAT="":" (Unknown status)",1:"")
41 I TSTAT="T" S X=$S($D(^DIC(4.2,+X,0)):$P(^(0),U,1),1:"unknown site") W " to ",$P(X,".",1)
42 W "; "
43 Q
44 ;
45RQCODE ; ** Cancel an entire 2507 request after cancellation of last exam **
46 N LASTTME
47 S LASTTME=$O(^TMP("DVBA",$J,""))
48 S CCODE=^TMP("DVBA",$J,LASTTME)
49 D BULL^DVBCCNC1
50 Q
51 ;
52PROCDAY(REQDA) ; ** Calculate processing time for REQDA (v2.7 - Enhc 13)
53 ;** NOTICE: This tag is part of an implementation of a Nationally
54 ;** Controlled Procedure. Local modifications to this routine
55 ;** are prohibited per VHA Directive 10-93-142
56 ;
57 ;** PROCDAY receives the variable REQDA as the IEN of the 2507
58 ;** request to calculate the processing time for
59 ;** Processing time returned to calling routine via PROCTME
60 ;
61 N STOPDT,STARTDT,LSORVTRS,PRESTRT,DAY30CUT,PROCTME,ADJTME
62 N LPDT,LPDA,FSDTVTRS,LINKNODE
63 S (STOPDT,STARTDT,LSORVTRS,PRESTRT,FSDTVTRS)=0
64 ;
65 ;** FSDTVTRS is earliest date on 396.95 rec of
66 ;** Current and Vet Resch dates
67 ;** Find FSDTVTRS for each 396.95 rec, PRESTRT is latest FSDTVTRS of
68 ;** all 396.95 recs for request
69 S LPDT=""
70 F S LPDT=$O(^DVB(396.95,"ARO",REQDA,LPDT)) Q:LPDT="" DO
71 .F LPDA=0:0 S LPDA=$O(^DVB(396.95,"ARO",REQDA,LPDT,LPDA)) Q:LPDA="" DO
72 ..S STOPDT=LPDT ;**Find the last original appt date (equals Stop Date)
73 ..S LINKNODE=^DVB(396.95,LPDA,0)
74 ..I +$P(LINKNODE,U,4)=1 DO ;**FSDTVTRS=earliest of fields .03 and .05
75 ...S LSORVTRS=$P(LINKNODE,U,2) ;**'ARO' - Original; Vet rsch date latest
76 ...I $P(LINKNODE,U,3)<$P(LINKNODE,U,5) S FSDTVTRS=$P(LINKNODE,U,3)
77 ...I $P(LINKNODE,U,3)'<$P(LINKNODE,U,5) S FSDTVTRS=$P(LINKNODE,U,5)
78 ...S:FSDTVTRS>PRESTRT PRESTRT=FSDTVTRS ;**PRESTRT=latest FSDTVTRS
79 ;
80 ;** Calculate the Start Date
81 S PRESTRT=PRESTRT\1
82 S LSORVTRS=LSORVTRS\1
83 S STOPDT=STOPDT\1
84 S X1=LSORVTRS S X2=30 D C^%DTC S DAY30CUT=X K X,X1,X2 ;**30 day cut off
85 ;
86 ;** Find clock start date
87 ;** (Start can't be >30 days from latest original date on an
88 ; appt reschd by vet)
89 S:DAY30CUT<PRESTRT STARTDT=DAY30CUT
90 S:DAY30CUT'<PRESTRT STARTDT=PRESTRT
91 S:STARTDT>$P(^DVB(396.3,REQDA,0),U,14)\1 STARTDT=$P(^DVB(396.3,REQDA,0),U,14)\1
92 S X1=STARTDT,X2=STOPDT D ^%DTC S ADJTME=X K X,X1,X2 ;**Days to subtract
93 S X2=($P(^DVB(396.3,REQDA,0),U,5)\1)
94 S X1=($P(^DVB(396.3,REQDA,0),U,14)\1)
95 D ^%DTC S PROCTME=X S:+ADJTME>0 PROCTME=PROCTME-ADJTME
96 K X,X1,X2
97 Q PROCTME
Note: See TracBrowser for help on using the repository browser.