source: qrda/C0Q/branches/ohum/p/C0QHF.m@ 1495

Last change on this file since 1495 was 1292, checked in by George Lilly, 13 years ago

reorganizing the project for ohum contributions

File size: 2.8 KB
Line 
1C0QHF ; GPL - Health Factor Utility Routines ;9/02/11 17:05
2 ;;0.1;C0Q;nopatch;noreleasedate;Build 19
3 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 Q
21 ;
22 ; these routines are for quick lookups on HEALTH FACTOR and V HEALTH FACTOR
23 ; files...
24 ;
25 ; from the DD:
26 ;STANDARD DATA DICTIONARY #9000010.23 -- V HEALTH FACTORS FILE
27 ;STORED IN ^AUPNVHF( (6744 ENTRIES)
28 ;CROSS REFERENCED BY: PATIENT NAME(AATOO), HEALTH FACTOR(AATOO1), VISIT(AD),
29 ; VISIT(AV10), HEALTH FACTOR(B), PATIENT NAME(C)
30 ;
31 ;STANDARD DATA DICTIONARY #9999999.64 -- HEALTH FACTORS FILE
32 ;STORED IN ^AUTTHF( (8656 ENTRIES)
33 ;CROSS REFERENCED BY: CATEGORY(AC), ENTRY TYPE(AD), FACTOR(B), SYNONYM(D)
34 ;
35HFYN(DFN,C0QHF) ; EXTRINSIC RETURNS 1 (YES) OR 0 (NO) IF A PATIENT
36 ; HAS A HEALTH FACTOR
37 N ZI,ZJ,ZR
38 S ZI=$O(^AUTTHF("B",C0QHF,"")) ; HEALTH FACTOR IEN
39 I $D(^AUPNVHF("AA",DFN,ZI)) S ZR=1
40 E S ZR=0
41 Q ZR
42 ;
43HFCAT(RTN,DFN,C0QHFCAT) ; C0QFHCAT IS A HEALTH FACTOR CATEGORY
44 ; RTN IS PASSED BY REFERENCE AND RETURNS AN ARRAY OF HEALTH FACTORS
45 ; THAT THE PATIENT HAS IN THE CATEGORY. RETURNS NULL IF NONE
46 ; FORMAT RNT(HEALTH FACTOR IEN,HEALTH FACTOR NAME)=""
47 N ZI
48 S ZI=$O(^AUTTHF("B",C0QHFCAT,"")) ; HEALTH FACTOR CATEGORY IEN
49 N C0QN,C0QO
50 S C0QO=$NA(^AUPNVHF("AA",DFN)) ; ALL THE PATIENT'S HEALTH FACTORS
51 S C0QN=$NA(^AUTTHF("AC",ZI)) ; ALL HEALTH FACTORS IN THIS CATEGORY
52 D UNITY^C0QSET("C0QR",C0QN,C0QO) ; THE DIFFERENCE
53 K RTN ; CLEAR THE RETURN ARRAY
54 N ZJ S ZJ=""
55 F S ZJ=$O(C0QR(1,ZJ)) Q:ZJ="" D ; FOR ALL HEALTH FACTOR MATCHES
56 . S RTN(ZJ,$P(^AUTTHF(ZJ,0),"^",1))=""
57 Q
58 ;
59HFLCAT(RTN,C0QHFCAT) ; RETURNS A LIST OF PATIENTS WHO HAVE A HEALTH FACTOR
60 ; IN THE C0QHFCAT CATEGORY. RTN IS PASSED BY REFERENCE
61 ; THIS WILL BE HARD TO DO WITHOUT SOME NEW INDEXES
62 Q
63 ;
64HFLPAT(RTN,C0QHF) ; RETURNS A LIST OF PATIENTS WHO HAVE A SPECIFIC HEALTH
65 ; FACTOR. RTN IS PASSED BY REFERENCE
66 ; THIS ONE ALSO WILL BE HARD TO DO QUICKLY WITHOUT A NEW INDEX
67 Q
68 ;
69INDEXES(DDREF) ;PRINT THE INDEXES ACTUALLY ON FILE DDREF
70 ; IE D INDEXES($NA(^DD))
71 N ZI
72 S ZI="A"
73 F S ZI=$O(@DDREF@(ZI)) Q:ZI="" W !,ZI
74 Q
75 ;
Note: See TracBrowser for help on using the repository browser.