Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BMCAPI1

BMCAPI1.m

Go to the documentation of this file.
BMCAPI1 ;IHS/OIT/FCJ-API BY REQ FIELDS
 ;;4.0;REFERRED CARE INFO SYSTEM;**4**;JAN 09, 2006;Build 101
 ;IHS/OIT/FCJ NEW ROUTINE RELEASED W/PATCH 4
 ;
 ;NOTE: Currently not used for multiple or word processing fields
 ;BMCDFN=Array of PATIENT IEN's subcripted by the IEN (Not REQUIRED If Beginning date)
 ;BMCBDT=BEG DT (NOT REQUIRED if Patient IEN Array sent)
 ;BMCEDT=END DT (NOT REQUIRED)
 ;BMCFLDS=LIST OF FIELDS TO DEFINE (REQUIRED)
 ;  Format=".01/I;.02/E"
 ;  I=INTERAL FORMAT
 ;  E=EXTERNAL FORMAT
 ;  B=BOTH
 ;BMCGLB=GLOBAL TO SET THE LIST OF FIELDS (Required)
 ;FIELDS WILL BE SET IN GLOBAL IN ORDER SUBMITTED
 ;Example: BMCDFN,BMCRIEN,ORDER,BMCFLD,BMCTYP=VALUE
 ;
API(BMCPDFN,BMCBDT,BMCEDT,BMCFLDS,BMCGLB) ;EP FOR RCIS REFERRALS
 Q:$G(BMCFLDS)=""
 Q:$G(BMCGLB)=""
 ;
 S BMCDT="",BMCQ="",BMCPFLG=0
 I $G(BMCBDT)'="" S BMCDT=BMCBDT-1
 ;TEST PAT IEN ARRAY
 S Y="" F I=0:1 S Y=$O(BMCPDFN(Y)) Q:(Y'?1N.N)!(I>0)
 I I>0 S BMCPFLG=1 D PAT Q
 I BMCBDT="",BMCPFLG=0 Q
 ;
DT ;SORT BY DATE IF PAT IEN NOT SENT
 F  S BMCDT=$O(^BMCREF("B",BMCDT)) Q:(BMCDT'?1N.N)  D  Q:BMCQ
 .I $G(BMCEDT),BMCDT>BMCEDT S BMCQ=1 Q
 .S BMCRIEN=""
 .F  S BMCRIEN=$O(^BMCREF("B",BMCDT,BMCRIEN)) Q:BMCRIEN'?1.N.N  D
 ..S BMCDFN=$P(^BMCREF(BMCRIEN,0),U,3)
 ..D SET
 D EXIT
 Q
 ;
PAT ; SORT BY PATIENT THEN DATE IF EXISTS
 ;
 S BMCDFN=0 F  S BMCDFN=$O(BMCPDFN(BMCDFN)) S BMCDT=BMCBDT-1 Q:BMCDFN'?1N.N  D
 .F  S BMCDT=$O(^BMCREF("AA",BMCDFN,BMCDT)) Q:BMCDT'?1N.N  D  Q:BMCQ
 ..I $G(BMCEDT),BMCDT>BMCEDT S BMCQ=1 Q
 ..S BMCRIEN=""
 ..F  S BMCRIEN=$O(^BMCREF("AA",BMCDFN,BMCDT,BMCRIEN)) Q:BMCRIEN'?1N.N  D SET
 D EXIT
 Q
 ;
SET ;SET REQUESTED FIELDS IN GLB
 F I=1:1 D  Q:'$G(BMC(I))
 .Q:$P(BMCFLDS,";",I)=""
 .S BMC(I)=$P(BMCFLDS,";",I)
 .S BMCTYP=$P(BMC(I),"/",2)
 .D:BMCTYP="B" INT,EXT
 .D:BMCTYP="I" INT
 .D:BMCTYP="E" EXT
 Q
INT ;INTERNAL FORMAT
 S @BMCGLB@(BMCDFN,BMCRIEN,I,$P(BMC(I),"/"),"I")=$$VALI^XBDIQ1(90001,BMCRIEN,$P(BMC(I),"/"))
 Q
EXT ;EXTERNAL FORMAT
 S @BMCGLB@(BMCDFN,BMCRIEN,I,$P(BMC(I),"/"),"E")=$$VAL^XBDIQ1(90001,BMCRIEN,$P(BMC(I),"/"))
 Q
EXIT ;
 K BMCDFN,BMCBDT,BMCEDT,BMCFLDS,BMCGLB,BMCDT,BMCRIEN,BMCDFN,I,BMCTYP,BMC,BMCQ,BMCPFLG
 Q