source: WorldVistAEHR/trunk/r/AUTOMATED_MED_INFO_EXCHANGE-DVBA-DVBC/DVBCAMR2.m@ 1764

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1DVBCAMR2 ;ALB/GTS-557/THM-REGIONAL OFFICE AMIS 290 REPORT, CALCULATIONS ; 9/28/91 6:43 AM
2 ;;2.7;AMIE;;Apr 10, 1995
3 ;
4 ;** Version Changes
5 ; 2.7 - GTS/Coded to adjust 35 day clock calc (Enhc 13)
6 ;
7DAY30 K ^TMP("DVBC",$J)
8 F FA=DTRPT-.1:0 S FA=$O(^DPT(PNAM,"S",FA)) Q:FA=""!(FA>EDATE) I $D(^(FA,0)) S L=^(0),C=+L S YY=$P(L,U,2) I YY'="N"&(YY'="C")&(YY'="NA")&(YY'="CA")&(YY'="PC")&(YY'="PCA") I FA'>EDATE S ^TMP("DVBC",$J,9999999-FA,FA)=""
9 Q:'$D(^TMP("DVBC",$J)) S FB=$O(^TMP("DVBC",$J,0)),FA=$O(^TMP("DVBC",$J,FB,0)) I FA]"" S X2=FA,X1=$S(DTSCHEDC]"":DTSCHEDC,1:DVBCNOW) D ^%DTC I X>30 S TOT("30DAYEX")=TOT("30DAYEX")+1
10 Q
11 ;
12PENDCNT I X'<0&(X'>90) S TOT("P90")=TOT("P90")+1
13 I X>90&(X'>120) S TOT("P121")=TOT("P121")+1
14 I X>120&(X'>150) S TOT("P151")=TOT("P151")+1
15 I X>150&(X'>180) S TOT("P181")=TOT("P181")+1
16 I X>180&(X'>365) S TOT("P365")=TOT("P365")+1
17 I X>365 S TOT("P366")=TOT("P366")+1
18 Q
19 ;
20SET S DTA=^DVB(396.3,REQDA,0),DTREQ=$P(DTA,U,2),XRONUM=$P(DTA,U,3),XRONUM=$S($D(^DIC(4,+XRONUM,99)):$P(^(99),U,1),1:0) Q:XRONUM'=RONUM&(RONUM'="ALL")
21 K XRONUM S DTRPT=$P(DTA,U,5),DTSCHEDC=$P(DTA,U,6),DTRQCMP=$P(DTA,U,7),DTTRANS=$P(DTA,U,12),DTREL=$P(DTA,U,14),RQSTAT=$P(DTA,U,18),DTCAN=$P(DTA,U,19),PRIO=$P(DTA,U,10) K DTA
22 I DTRPT="",DTCAN]"" S DTRPT=DTCAN
23 Q:DTRPT="" ;requests never printed
24 I DTREL'<BDATE,DTREL'>EDATE D DAY30
25 I DTRPT'<BDATE,DTRPT'>EDATE S TOT("SENT")=TOT("SENT")+1
26 I DTRPT'<BDATE,DTRPT'>EDATE,RQSTAT'["X" S X1=$S(DTSCHEDC]"":DTSCHEDC,1:DVBCNOW),X2=DTRPT D ^%DTC I X>3 S TOT("3DAYSCH")=TOT("3DAYSCH")+1
27 I DTREL'<BDATE&(DTREL'>EDATE),RQSTAT="C"!(RQSTAT="R") S:PRIO'="E" DVBCPCTM=$$PROCDAY^DVBCUTL2(REQDA) S:PRIO="E" DVBCPCTM=$$INSFTME^DVBCUTA1(REQDA) S TOT("DAYS")=TOT("DAYS")+DVBCPCTM K DVBCPCTM
28 I DTRPT'>EDATE,"^P^S^T"[RQSTAT S TOT("PENDADJ")=TOT("PENDADJ")+1,X1=EDATE,X2=DTRPT D ^%DTC,PENDCNT
29 I DTRPT'>EDATE,"^C^CT^R^RX^X^"[RQSTAT,(+DTREL>EDATE)!(+DTCAN>EDATE) S TOT("PENDADJ")=TOT("PENDADJ")+1,X1=EDATE,X2=DTRPT D ^%DTC,PENDCNT
30 I DTREL'<BDATE&(DTREL'>EDATE),RQSTAT["C"!(RQSTAT="R") S TOT("COMPLETED")=TOT("COMPLETED")+1
31 I DTRPT'<BDATE,DTRPT'>EDATE,PRIO="E" S TOT("INSUFF")=TOT("INSUFF")+1
32 I DTCAN'<BDATE&(DTCAN'>EDATE),RQSTAT="X"!(RQSTAT="RX") S TOT("INCOMPLETE")=TOT("INCOMPLETE")+1
33 K DTRPT Q
34 ;
35GO S %DT="TS",X="NOW" D ^%DT S DVBCNOW=Y K ^TMP($J)
36 S PNAM="" F JJ=0:0 S PNAM=$O(^DVB(396.3,"B",PNAM)) Q:PNAM="" F REQDA=0:0 S REQDA=$O(^DVB(396.3,"B",PNAM,REQDA)) Q:REQDA="" D SET
37 S TOT("AVGDAYS")=0 I TOT("COMPLETED")>0 S TOT("AVGDAYS")=TOT("DAYS")/TOT("COMPLETED"),TOT("AVGDAYS")=$J(TOT("AVGDAYS"),5,1)
38 D BULLTXT^DVBCAMR1
39 U IO D HDR F JI=0:0 S JI=$O(^TMP($J,JI)) Q:JI="" W ^(JI,0),!
40 I IOST?1"C-".E W *7,!,"Press RETURN to continue " R ANS:DTIME I '$T!(ANS=U) W:SBULL="Y" !!,*7,"Bulletin will NOT be sent!!",*7,! H 2 G EXIT
41 D ^%ZISC
42 S:'$D(XMY) SBULL="N" I SBULL="Y" D SEND
43 ;
44EXIT D:$D(ZTQUEUED) KILL^%ZTLOAD K PREVMO,UPDATE G KILL^DVBCUTIL
45 ;
46BULL W ! S XMDUZ=DUZ,XMMG=$S($D(^VA(200,DUZ,0)):$P(^(0),U,1),1:"") D DES^XMA21
47 S XMSUB="RO AMIS 290 Report - " S Y=BDATE1 X ^DD("DD") S XMSUB=XMSUB_Y S Y=EDATE1 X ^DD("DD") S XMSUB=XMSUB_" to "_Y,XMTEXT="^TMP($J,"
48 Q
49 ;
50SEND D ^XMD K XMY,XMTEXT,XMSUB K ^TMP($J)
51 I '$D(ZTSK) W !!,*7,">>> Mail message transmitted. <<<",!! H 2
52 Q
53 ;
54HDR W @IOF,"Regional Office AMIS 290 Report for C&P Examinations",?(IOM-9),"Page: 1",!
55 W "For date range: " S Y=BDATE1 X ^DD("DD") W Y W " to " S Y=EDATE1 X ^DD("DD") W Y,!
56 F LINE=1:1:80 W "-"
57 W !!
58 Q
Note: See TracBrowser for help on using the repository browser.