source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDSCINS.m@ 771

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1SDSCINS ;ALB/JAM/RBS - ASCD Check on Newly Identified Insurance ; 2/15/07 12:57pm ; 4/3/07 11:19am
2 ;;5.3;Scheduling;**495**;Aug 13, 1993;Build 50
3 ;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
4 ;;known as Service Connected Automated Monitoring (SCAM).
5 ;
6 ;**Program Description**
7 ; This program will check the Audit file for any newly identified
8 ; insurance policies
9 Q
10EN(SDSCINS,SDSCSVC) ; Entry point
11 ;
12 ; Input: SDSCINS and SDSCSVC passed by reference
13 ;
14 ; Output:
15 ; SDSCINS - count of records found with late-identified insurance
16 ; SDSCSVC - count of those found records just filed to (#409.48)
17 ;
18 N SDSCPAR
19 K SDSCBDT,SDSCEDT
20 ;if audit not turned on quit
21 D FIELD^DID(2,.3192,"","AUDIT","SDSCPAR")
22 I $G(SDSCPAR("AUDIT"))'["YES" Q
23 K SDSCPAR
24 D FIELD^DID(2.312,.01,"","AUDIT","SDSCPAR")
25 I $G(SDSCPAR("AUDIT"))'["YES" Q
26 ; Get encounter date range to check - start with from 24 months back
27 S SDSCBDT=$$FMADD^XLFDT(DT,-731),SDSCEDT=$O(^SDSC(409.48,"AE",""),-1)\1
28 ;
29 N SDSCADT,SDEADT,SDINS
30 S SDSCADT=$$FMADD^XLFDT(DT,-1),SDEADT=$$FMADD^XLFDT(DT,-1)
31 F S SDSCADT=$O(^DIA(2,"C",SDSCADT)) Q:SDSCADT=""!((SDSCADT\1)>SDEADT) D
32 . S SDIEN="" F S SDIEN=$O(^DIA(2,"C",SDSCADT,SDIEN)) Q:SDIEN="" D
33 .. S SDUFLD=$P(^DIA(2,SDIEN,0),U,3)
34 .. I SDUFLD'=.3192,SDUFLD'[.3121 Q
35 .. I SDUFLD=.3192 D COV Q:'SDCOV
36 .. I SDUFLD=".3121,.01" D NINS Q:'SDIN
37 .. S SDFN=$P(^DIA(2,SDIEN,0),U,1) S:SDFN["," SDFN=$P(SDFN,",",1)
38 .. ;
39 .. ; check if this patient has encounters for the date range
40 .. S SDECDT=SDSCBDT
41 .. F S SDECDT=$O(^SCE("ADFN",SDFN,SDECDT)) Q:SDECDT=""!((SDECDT\1)>SDSCEDT) D
42 ... S IEN="" F S IEN=$O(^SCE("ADFN",SDFN,SDECDT,IEN)) Q:IEN="" D
43 .... S SDINS=SDSCSVC
44 .... S SDOE=IEN,SDOEDT=$P(^SCE(SDOE,0),U,1) D OPT1^SDSCOMP
45 .... ; count the number of service connected records from late-identified insurance
46 .... I SDINS'=SDSCSVC S SDSCINS=SDSCINS+1
47 ;
48EXIT ; Exit
49 K SDOE,IEN,SDECDT,SDIN,SDCOV
50 K SDUFLD,SDFN,SDIEN,SDOEDT
51 Q
52 ;
53AUDIT(SDTEXT,SDCNT) ; Check if auditing is turned on
54 N SDSCPAR,SDARY,SDCT
55 S SDCT=0,SDCNT=$G(SDCNT)
56 D FIELD^DID(2,.3192,"","AUDIT","SDSCPAR")
57 I $G(SDSCPAR("AUDIT"))'["YES" D
58 . S SDCT=SDCT+1,SDARY(SDCT)="Auditing is not turned on for field COVERED BY HEALTH INSURANCE?"
59 K SDSCPAR
60 D FIELD^DID(2.312,.01,"","AUDIT","SDSCPAR")
61 I $G(SDSCPAR("AUDIT"))'["YES" D
62 . S SDCT=SDCT+1,SDARY(SDCT)="Auditing is not turned on for field INSURANCE TYPE"
63 I SDCT D
64 . S SDCNT=SDCNT+1,SDTEXT(SDCNT)="",SDCNT=SDCNT+1
65 . S SDTEXT(SDCNT)="ASCD Late Insurance Check:"
66 . S SDCT=0 F S SDCT=$O(SDARY(SDCT)) Q:'SDCT D
67 . . S SDCNT=SDCNT+1,SDTEXT(SDCNT)=SDARY(SDCT)
68 Q
69MMSG ; Send mail message
70 I $G(DUZ)="" S XMZ(.5)=""
71 S XMZ(DUZ)="",XMDUZ="ASCD Insurance Check",XMY("G.SDSC NIGHTLY TALLY")=""
72 S XMTEXT="SDTEXT(",XMSUB="ASCD Insurance Identified"
73 D ^XMD
74 K XMY,XMDUZ,XMTEXT,SDTEXT,XMSUB,XMZ
75 Q
76 ;
77COV ; Covered by insurance
78 N SDOLD,SDNEW
79 S SDCOV=0
80 S SDOLD=$G(^DIA(2,SDIEN,2)),SDNEW=$G(^DIA(2,SDIEN,3))
81 I SDOLD="NO",SDNEW="YES" S SDCOV=1 Q
82 Q
83 ;
84NINS ; New insurance company added
85 N SDOLD,SDNEW
86 S SDIN=0
87 S SDOLD=$G(^DIA(2,SDIEN,2)),SDNEW=$G(^DIA(2,SDIEN,3))
88 I SDOLD="",SDNEW'="" S SDIN=1
89 Q
Note: See TracBrowser for help on using the repository browser.