source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGCLAPI1.m@ 1722

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

initial load of WorldVistAEHR

File size: 2.7 KB
RevLine 
[613]1DGCLAPI1 ;ALB/TMK - Utilities for OEF/OIF/UNKNOWN OEF/OIF conflict loc; 10/20/05
2 ;;5.3;Registration;**673**;Aug 13, 1993
3 Q
4 ;
5OEIFUPD(DGDFN,DGOEIF) ;
6 ;Entry point for OEF, OIF, UNKNOWN OEF/OIF conflict data
7 ; updates via the ZMH HL7 message upload.
8 ;
9 ; Input:
10 ; DGDFN - PATIENT file (#2) IEN
11 ; DGOEIF - update values array passed by reference
12 ; DGOEIF("COUNT") - count of the # of entries
13 ; DGOEIF("LOC") - Conflict Location Indicator
14 ; DGOEIF("FR") - OEF/OIF/UNKNOWN OEF/OIF Date From
15 ; DGOEIF("TO") - OEF/OIF/UNKNOWN OEF/OIF Date To
16 ; DGOEIF("SITE") - Source of data (ptr to file 4 or null for CEV)
17 ;
18 ; Output:
19 ; Function result 1-success, 0-failure
20 ;
21 N DA,DIC,DIK,DGRSLT,DGX,DGX1,DGARY,DGCHG,X,Y,DO,DD
22 ;
23 S DGCHG=0,DGRSLT=1,DGDFN=+$G(DGDFN)
24 I DGDFN>0,$D(^DPT(DGDFN)),$$CHANGE(DGDFN,.DGOEIF) S DGCHG=1
25 ; If changes found, delete the existing data, add new records
26 I DGCHG D
27 . S DGRSLT=0
28 . S DA=0 F S DA=$O(^DPT(DGDFN,.3215,DA)) Q:'DA S DA(1)=DGDFN,DIK="^DPT("_DA(1)_",.3215," D ^DIK
29 . F DGX="LOC","FR","TO","LOCK","SITE" S DGX1=0 F S DGX1=$O(DGOEIF(DGX,DGX1)) Q:'DGX1 S DGARY(DGX1,DGX)=DGOEIF(DGX,DGX1)
30 . S DGX=0 F S DGX=$O(DGARY(DGX)) Q:'DGX D Q:'DGRSLT
31 .. ; Add a new entry
32 .. S DIC(0)="L",DIC("DR")=".02////"_$G(DGARY(DGX,"FR"))_";.03////"_$G(DGARY(DGX,"TO"))_";.04////1"_$S($G(DGARY(DGX,"SITE"))'="":";.06////"_DGARY(DGX,"SITE"),1:"")
33 .. S DA(1)=DGDFN,DIC="^DPT("_DA(1)_",.3215,"
34 .. S X=$G(DGARY(DGX,"LOC")),X=$S(X="OIF":1,X="OEF":2,X="UNK":3,1:"") I X D FILE^DICN K DIC S DGRSLT=(Y>0)
35 Q DGRSLT
36 ;
37CHANGE(DGDFN,DGOEIF) ;Did the data change?
38 ; Input
39 ; DGDFN - Patients DFN
40 ; DGOEIF("COUNT") - the count of the # of entries in the multiple
41 ; DGOEIF("LOC",n)=Conflict Location Indicator
42 ; DGOEIF("FR",n)=OEF/OIF/UNKNOWN OEF/OIF Date From
43 ; DGOEIF("TO",n)=OEF/OIF/UNKNOWN OEF/OIF Date To
44 ; DGOEIF("LOCK")=Lock flag for HEC data
45 ; DGOEIF("site",n)=Source of data if a site or null if CEV
46 ;
47 ; Output
48 ; Returns 0 if no status change
49 ; 1 if status changed
50 ;
51 N DGCHG,DGOEIFO,DGX,DGX1,Z
52 ;
53 I +$G(DGDFN)'>0 Q 0
54 S DGOEIF("COUNT")=$G(DGOEIF("COUNT"))
55 S DGCHG=0
56 I 'DGOEIF("COUNT"),'$O(^DPT(DGDFN,.3215,0)) S DGCHG=0 G CHNGQ
57 S Z=+$$GET^DGENOEIF(DGDFN,.DGOEIFO,0)
58 I DGOEIF("COUNT")'=Z S DGCHG=1 G CHNGQ
59 S Z=0 F S Z=$O(DGOEIFO("LOC",Z)) Q:'Z S DGOEIFO("LOC",Z)=$E($$EXTERNAL^DILFD(2.3215,.01,,+DGOEIFO("LOC",Z)),1,3)
60 S DGX="" F S DGX=$O(DGOEIF(DGX)) Q:DGX=""!DGCHG D Q:DGCHG
61 . S DGX1=0 F S DGX1=$O(DGOEIF(DGX,DGX1)) Q:'DGX1 D Q:DGCHG
62 .. I DGX="SITE",$S($G(DGOEIF("SITE",DGX1))="":$G(DGOEIFO("SITE",DGX1))="CEV",1:0) Q
63 .. I DGX="LOCK",$G(DGOEIFO("LOCK",DGX1))=1 Q
64 .. I $G(DGOEIFO(DGX,DGX1))'=$G(DGOEIF(DGX,DGX1)) S DGCHG=1 Q
65CHNGQ Q DGCHG
66 ;
Note: See TracBrowser for help on using the repository browser.