source: WorldVistAEHR/trunk/r/EVENT_CAPTURE-EC--ECT--ECX/ECV5RPC.m@ 1639

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1ECV5RPC ;ALB/ACS;Event Capture Spreadsheet Data Validation ;07 Aug 01
2 ;;2.0; EVENT CAPTURE ;**25,30,36,47**;8 May 96
3 ;
4 ;-----------------------------------------------------------------------
5 ; Validates the following Event Capture Spreadsheet Upload fields for
6 ; records sent to PCE:
7 ; 1. DIAGNOSIS CODE
8 ; 2. ASSOCIATED CLINIC
9 ;-----------------------------------------------------------------------
10 ;=======================================================================
11 ;MODIFICATIONS
12 ;08/2001 EC*2.0*30 Updated the Diagnosis validation logic
13 ;=======================================================================
14 ;
15VALDIAG ;Validate Diagnosis Code. Make sure it exists on the ICD9 file
16 N ECDT
17 S %DT="XST",X=$G(ECENCV,"NOW") D ^%DT S ECDT=+Y
18 I ECDXV="" D
19 . ; Spreadsheet is missing diagnosis code
20 . S ECERRMSG=$P($T(DIAG1^ECV5RPC),";;",2)
21 . S ECCOLERR=ECDXPC
22 . D ERROR
23 ;if diag invalid, send error message
24 I ECDXV'="" S (ECDXIEN,ECSFOUND)=0 D
25 . S ECDXIEN=$$ICDDX^ICDCODE(ECDXV,ECDT)
26 . I +ECDXIEN>0,$P(ECDXIEN,"^",10) S ECDXIEN=+ECDXIEN,ECSFOUND=1 Q
27 . I 'ECSFOUND D
28 . . ; Invalid Diagnosis code
29 . . S ECERRMSG=$P($T(DIAG2^ECV5RPC),";;",2)
30 . . S ECCOLERR=ECDXPC
31 . . D ERROR
32 . . Q
33 . Q
34 Q
35 ;
36VALCLIN ;Validate Associated Clinic. Make sure the clinic is active for
37 ;the date of the encounter
38 S ECERRFLG=0
39 I ECCLNV="" D
40 . ; Spreadsheet is missing the associated clinic
41 . S ECERRMSG=$P($T(CLIN1^ECV5RPC),";;",2)
42 . S ECCOLERR=ECCLNPC
43 . D ERROR
44 . Q
45 I 'ECERRFLG,'$D(^SC("B",ECCLNV)) D
46 . ; No B x-ref on file
47 . S ECERRMSG=$P($T(CLIN2^ECV5RPC),";;",2)
48 . S ECCOLERR=ECCLNPC
49 . D ERROR
50 . Q
51 I 'ECERRFLG,$D(^SC("B",ECCLNV)) D
52 . ;get associated clinic ien
53 . S ECCLNIEN=$O(^SC("B",ECCLNV,0))
54 . I '$D(^SC(ECCLNIEN,0)) D
55 . . ; Associated clinic ien not on file
56 . . S ECERRMSG=$P($T(CLIN3^ECV5RPC),";;",2)
57 . . S ECCOLERR=ECCLNPC
58 . . D ERROR
59 . . Q
60 . I 'ECERRFLG D
61 . . ;make sure it is of type 'clinic'
62 . . N CLINDATA
63 . . S CLINDATA=$G(^SC(ECCLNIEN,0))
64 . . I $P(CLINDATA,U,3)'="C" D
65 . . . S ECERRMSG=$P($T(CLIN4^ECV5RPC),";;",2)
66 . . . S ECCOLERR=ECCLNPC
67 . . . D ERROR
68 . . . Q
69 . . Q
70 . ;
71 . ;check for inactivate and reactivate dates
72 . I 'ECERRFLG,$D(^SC(ECCLNIEN,"I")) D
73 . . ;get inactivated and reactivated dates
74 . . N INACT,REACT
75 . . S INACT=$P(^SC(ECCLNIEN,"I"),U,1),REACT=$P(^SC(ECCLNIEN,"I"),U,2)
76 . . I INACT'="" D
77 . . . I REACT="",ECENCV'<INACT D CLINERR^ECV5RPC
78 . . . I REACT,ECENCV'<INACT,ECENCV<REACT D CLINERR^ECV5RPC
79 . . . Q
80 . . Q
81 . Q
82 Q
83 ;;
84CLINERR ;Clinic inactive for this encounter date
85 S ECERRMSG=$P($T(CLIN5^ECV5RPC),";;",2)
86 S ECCOLERR=ECCLNPC
87 D ERROR
88 Q
89 ;;
90ERROR ;--Set up array entry to contain the following:
91 ;1. record number
92 ;2. column number on spreadsheet containing the record number
93 ;3. column number on spreadsheet containing the data in error
94 ;4. error message
95 ;
96 S ECINDEX=ECINDEX+1
97 S RESULTS(ECINDEX)=ECRECV_"^"_ECRECPC_"^"_ECCOLERR_"^"_ECERRMSG_"^"
98 S ECERRFLG=1
99 Q
100 ;
101 ;Error messages:
102 ;
103DIAG1 ;;Diagnosis code is required for this DSS Unit
104DIAG2 ;;Invalid Diagnosis code
105CLIN1 ;;Associated Clinic is required for this DSS Unit
106CLIN2 ;;Assoc Clinic "B" x-ref not found on Hosp Location File(#44)
107CLIN3 ;;Assoc Clinic not found on Hosp Location File(#44)
108CLIN4 ;;Assoc Clinic must be of type "C" (clinic)
109CLIN5 ;;Assoc Clinic inactive for this encounter date
Note: See TracBrowser for help on using the repository browser.