source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/routines/BMXADOFD.m@ 1672

Last change on this file since 1672 was 1147, checked in by Sam Habiel, 14 years ago

Mumps Routines 4 BMX4

File size: 2.9 KB
Line 
1BMXADOFD ; IHS/CIHA/GIS - RPC CALL FOR EXTENDED FUNCTIONALITY OF BMXNet UTILITIES ; 31 Jul 2009 12:41 PM
2 ;;4.1000;BMX;;Apr 17, 2011
3 ; THIS IS THE ADO RECORDSET FILER: ADO -> FILEMAN
4 ; CONTAINS SPECIAL ENTRY POINT FOR RPMS DATA ENTRY
5 ;
6 ;
7 ;
8 ; D SS^BMXADO(.XXX,53,"","~~~~~VMEAS~BMXADOFD~1.244A||PU\60|WT\175|HT\70") Q
9 ; D SS^BMXADO(.XXX,58,"X","AC~53~53~~~NOTES~BMXADOFD~53") Q
10 N FILE,DAS,DATA S FILE=9000010.07,DAS="+"
11 S DATA=".01|`8718"_$C(30)_".02|`1"_$C(30)_".03|`71168"_$C(30)_".04|DM--2"_$C(30,31)
12 D FILE^BMXADOF(.XXX,FILE,DAS,DATA) Q
13 ;
14VMEAS(DATA,IENS,MAX,OUT,TOT) ; VIEW MEASUREMENTS: CUSTOM ITERATOR
15 ; DATA=VCN|ALL|MTYPE1\VAL1|MTYPE2\VAL2|...|MTYPEn\VALn
16 N VAL,CNT,P,S,PTIEN,VIEN,%,X,Y,TYPE,N,ALL,STG,MEAS,MIEN,IX
17 S P="|",S="\",N=0
18 I '$G(TOT) Q ""
19 I '$L(OUT) Q ""
20 S VIEN=$P(DATA,P) I '$L(VCN) Q ""
21 S PTIEN=$P($G(^AUPNVSIT(VIEN,0)),U,5) I 'PTIEN Q ""
22 F CNT=2:1 S X=$P(DATA,P,CNT) Q:'$L(X) D ; CREATE PRELIMINARY DATA ARRAYS
23 . S VAL=$P(X,S,2) ; VALUE MUST EXIST
24 . I '$L(VAL) Q
25 . S TYPE=$P(X,S) ; TYPE MUST EXIST
26 . I '$L(TYPE) Q
27 . S MIEN=$O(^AUTTMSR("B",TYPE,0)) I 'MIEN Q
28 . S MEAS=$P($G(^AUTTMSR(MIEN,0)),U,2) I '$L(MEAS) Q
29 . S N=N+1
30 . S VAL(N)=VAL
31 . S TYPE(N)=MIEN_U_TYPE_U_MEAS
32 . S IX(MIEN)=N
33 . Q
34MG S N=0 F S N=$O(VAL(N)) Q:'N D
35 . S TOT=TOT+1
36 . S @OUT@(TOT)=+TYPE(N)_U_$P(TYPE(N),U,2)_U_"`"_PTIEN_U_"`"_VIEN_U_VAL(N)_U_$P(TYPE(N),U,3)_$C(30)
37 . Q
38 Q ""
39 ;
40ICDVAL(CODE) ; EP-RPC-VERIFY ICD CODE BY RETURNING ITS IEN
41 I '$L($G(CODE)) Q ""
42 N IEN
43 S IEN=$O(^ICD9("BA",CODE_" ",0))
44 I $L($T(CODEN^ICDCODE)) S IEN=+$$CODEN^ICDCODE(CODE,80) I IEN'>0 S IEN=""
45 I 'IEN Q ""
46 Q IEN
47 ;
48FACNIEN(PIEN,FIEN) ;EP - GIVEN A PROBLEM IEN AND FACILITY IEN, RETURN THE FACILITY-NOTE IEN
49 I '$D(^AUPNPROB(+$G(PIEN),0)) Q ""
50 I '$D(^DIC(4,+$G(FIEN),0)) Q ""
51 N NFIEN
52 S FNIEN=$O(^AUPNPROB(PIEN,11,"B",FIEN,0)) I FNIEN Q FNIEN ; IF AN FNIEN EXISTS RETURN IT
53 ; OTHERWISE-CREATE THE FM STUB NODES FOR THE FACILITY SUBFILE
54 S FNIEN=$O(^AUPNPROB(PIEN,11,999999),-1)+1
55 S ^AUPNPROB(PIEN,11,FNIEN,0)=FIEN
56 S ^AUPNPROB(PIEN,11,FNIEN,11,0)="^9000011.1111IA^^"
57 S ^AUPNPROB(PIEN,11,"B",FIEN,FNIEN)=""
58 Q FNIEN
59 ;
60NEXTPBN(DFN,FIEN) ; RETURN THE NEXT AVAILABLE PROBLEM NUMBER FOR A PATIENT AT THE FACILITY
61 N MAX,PIEN,X,Y
62 S MAX=0,PIEN=0
63 F S PIEN=$O(^AUPNPROB("AC",DFN,PIEN)) Q:'PIEN D ; FIND ALL PROBLEMS FOR THIS PATIENT
64 . S X=$G(^AUPNPROB(PIEN,0)) I '$L(X) Q ""
65 . I $P(X,U,6)'=FIEN Q ; ONLY CHECK NUMBERS AT THIS FACILITY
66 . S Y=$P(X,U,7)
67 . I Y>MAX S MAX=Y ; GET THE HIGHEST NUMBER THUS FAR
68 . Q
69 S MAX=(MAX\1)+1 ; GET NEXT AVAILABLE INTEGER
70 Q MAX
71 ;
72NN W $$NEXTNOTE(221,4585) Q
73NEXTNOTE(PIEN,FIEN) ; RETRUN THE NEXT NOTE NUMBER FOR A PROBLEM AND FACILITY
74 I '$D(^AUPNPROB(+$G(PIEN),0)) Q ""
75 I '$D(^DIC(4,+$G(FIEN),0)) Q ""
76 N MAX,NIEN,FNIEN,X,Y
77 S MAX=0,NIEN=0
78 S FNIEN=$$FACNIEN^BMXADOFD(PIEN,FIEN) I 'FNIEN Q ""
79 F S NIEN=$O(^AUPNPROB(PIEN,11,FNIEN,11,NIEN)) Q:'NIEN D
80 . S X=$G(^AUPNPROB(PIEN,11,FNIEN,11,NIEN,0)) I '$L(X) Q
81 . S Y=+X
82 . I Y>MAX S MAX=Y
83 . Q
84 S MAX=MAX+1
85 Q MAX
Note: See TracBrowser for help on using the repository browser.