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

BMCAPIS.m

Go to the documentation of this file.
BMCAPIS ; IHS/CAS/FS - REFERRED CARE INFO SYSTEM API FOR MU2 ;     
 ;;4.0;REFERRED CARE INFO SYSTEM;**8**;JAN 09, 2006;Build 101
 ;4.0*8 IHS/ITSC/FS NEW ROUTINE 
 ; RPC code for RCIS GUI Application
 ; Routines contains code for Reading data from RCIS REFERRAL, V REFERRAL, VENDOR and VISIT files
 ;
GETREFFV(RSLT,VISITS) ; search referral w.r.t Visit
 ;Input parameter is array as per following format
 ;S VISITS(1)="3707743"
 ;S VISITS(2)="3601325"
 ;D GETREFFV^BMCAPIS(.R,.VISITS) ZW @R
 ;S RSLT="VISIT^RCIS REFERRAL IEN^PATIENT IEN^RCIS REFERRAL PURPOSE^RCIS REFERRAL STATUS^RCIS REFERRAL#^VENDOR FAX^VENDOR EMAIL PARTICIPANT YES NO^VENDOR EMAIL ADDRESS^VENDOR NAME" Q
 K BMCOUT,BMCMSG,SCR,KBTOUT,^TMP("BMCDATA",$J)
 N INDX,INDEX,VREFIEN,RREFIEN,VPATIEN,RRPURPOSE,RRSTATUS,RRVNDRIEN,VNDFAX,VNDPARYN,VNDEMAIL,RRVNDRNM
 I $D(VISITS)  D
 . N INDX,U
 . S INDX=$O(VISITS(""))
 . I +INDX>0 F  D  Q:(+INDX'>0)
 . . S VISIT=$G(VISITS(INDX))
 . . S SCR="I $P($G("_"^"_"(0)),""^"",3)=$G(VISIT)"
 . . D LIST^DIC(9000010.59,"","@;.01I;.02I;.06I","","*","","","B",SCR,"","BMCOUT","BMCMSG")
 . . S INDEX=$O(BMCOUT("DILIST","ID",0))
 . . I +INDEX>0 F  D  Q:(+INDEX'>0)
 . . . S VREFIEN=$G(BMCOUT("DILIST",2,INDEX))
 . . . S RREFIEN=$G(BMCOUT("DILIST","ID",INDEX,.06))
 . . . S VPATIEN=$G(BMCOUT("DILIST","ID",INDEX,.02))
 . . . ;Moving into RCIS REFERRAL file
 . . . I $G(RREFIEN)'=""  D
 . . . . S RRPURPOSE=$$GET1^DIQ(90001,RREFIEN_",",1201)
 . . . . S RRSTATUS=$$GET1^DIQ(90001,RREFIEN_",",.15)
 . . . . S RRVNDRIEN=$$GET1^DIQ(90001,RREFIEN_",",.07,"I")
 . . . . S RRNUMBER=$$GET1^DIQ(90001,RREFIEN_",",.02)
 . . . . ;Moving into VENDOR file to get data from 1114(FAX), 2104 (DIRECT PARTICIPANT) and 2105 (DIRECT EMAIL ADDRESS)
 . . . . I $G(RRVNDRIEN)'=""  D
 . . . . . S RRVNDRNM=$$GET1^DIQ(9999999.11,RRVNDRIEN_",",.01)
 . . . . . S VNDFAX=$$GET1^DIQ(9999999.11,RRVNDRIEN_",",1114)
 . . . . . S VNDPARYN=$$GET1^DIQ(9999999.11,RRVNDRIEN_",",2104)
 . . . . . S VNDEMAIL=$$GET1^DIQ(9999999.11,RRVNDRIEN_",",2105)
 . . . S ^TMP("BMCDATA",$J,INDX,INDEX)=$G(VISIT)_"^"_$G(RREFIEN)_"^"_$G(VPATIEN)_"^"_$G(RRPURPOSE)_"^"_$G(RRSTATUS)_"^"_$G(RRNUMBER)_"^"_$G(VNDFAX)_"^"_$G(VNDPARYN)_"^"_$G(VNDEMAIL)_"^"_$G(RRVNDRNM)
 . . . S VREFIEN="",RREFIEN="",VPATIEN="",RRPURPOSE="",RRSTATUS="",RRVNDRIEN="",VNDFAX="",VNDPARYN="",VNDEMAIL="",RRVNDRNM=""
 . . . S INDEX=$O(BMCOUT("DILIST","ID",INDEX))
 . . S INDX=$O(VISITS(INDX))
 S RSLT=$NA(^TMP("BMCDATA",$J))
 Q
 ;
CRENTOCD(RSLT,RRIEN,PRTXDATE,PRTXBY,DOCTYPE,CCDADOCID) ; Create entry in 600 (TRANSITION OF CARE DOCUMENT) multiple of RCIS REFERRAL (90001) file
 ; D CRENTOCD^BMCAPIS(.R,"4","JAN 11, 2013","4","C32","Done") W @R
 ; RRIEN = RCIS Feferral IEN
 ; PRTXDATE = DATE TIME PRINTED OR TRANSMITTED FILE for example May 16, 2013
 ; PRTXBY = PRINTED-TRANSMITTED BY (IEN of NEW PERSON (200) File)
 ; DOCTYPE = Accept Set Of Code Internal Format only C32, CP or CT
 ; CCDADOCID = Free text
 ; RSLT=IEN of entry created in 600 (TRANSITION OF CARE DOCUMENT) multiple
 K FDA,FDAMSG,FDAIEN
 N FDADA
 ;
 S FDA(42,90001.6,"+1,"_RRIEN_",",.01)=$$X2FM($G(PRTXDATE))
 S FDA(42,90001.6,"+1,"_RRIEN_",",.02)=$G(PRTXBY)
 S FDA(42,90001.6,"+1,"_RRIEN_",",.04)=$G(DOCTYPE)
 S FDA(42,90001.6,"+1,"_RRIEN_",",.05)=$G(CCDADOCID)
 D UPDATE^DIE("","FDA(42)","FDAIEN","FDAMSG")
 S FDADA=+$G(FDAIEN(1))
 I $D(FDAMSG) D
 . W !!,"The following error message was returned:",!!
 . S FDAMSG="" F  S FDAMSG=$O(FDAMSG("DIERR",1,"TEXT",FDAMSG)) Q:FDAMSG=""  W FDAMSG("DIERR",1,"TEXT",FDAMSG),!
 I $G(FDADA)=""  S RSLT=$G(FDAMSG) Q
 S RSLT=$G(FDADA)
 Q
 ;
X2FM(X)       ; return FM date given relative date
 N %DT S %DT="TS" D ^%DT
 Q Y
 ;
CRENVREF(RSLT,SNOMEDCT,SNOMEDPT,PATIENT,VISIT,PROBLEM,RREFIEN,EVENTDT,OPROVIDER,CLINIC,ENCPROVIDER,PARENT,OUTSIDEPROV,ORDERINGLOC,ENTEREDBY) ;Create Entry in V Referral
 ; D CRENTOCD^BMCAPIS(.R,"4","JAN 11, 2013","4","C32","Done") W @R
 ; RRIEN = RCIS Feferral IEN
 ; PRTXDATE = DATE TIME PRINTED OR TRANSMITTED FILE for example May 16, 2013
 ; PRTXBY = PRINTED-TRANSMITTED BY (IEN of NEW PERSON (200) File)
 ; DOCTYPE = Accept Set Of Code Internal Format only C32, CP or CT
 ; CCDADOCID = Free text
 ; RSLT=IEN of entry created in 600 (TRANSITION OF CARE DOCUMENT) multiple
 K FDA,FDAMSG,FDAIEN
 N FDADA
 ;
 S FDA(9000010.59,"+1,",.01)=$G(SNOMEDCT)
 S FDA(9000010.59,"+1,",.02)=$G(PATIENT)
 S FDA(9000010.59,"+1,",.03)=$G(VISIT)
 S FDA(9000010.59,"+1,",.04)=$G(PROBLEM)
 S FDA(9000010.59,"+1,",.06)=$G(RREFIEN)
 S FDA(9000010.59,"+1,",1201)=$$X2FM($G(EVENTDT))
 S FDA(9000010.59,"+1,",1202)=$G(OPROVIDER)
 S FDA(9000010.59,"+1,",1203)=$G(CLINIC)
 S FDA(9000010.59,"+1,",1204)=$G(ENCPROVIDER)
 S FDA(9000010.59,"+1,",1208)=$G(PARENT)
 S FDA(9000010.59,"+1,",1210)=$G(OUTSIDEPROV)
 S FDA(9000010.59,"+1,",1215)=$G(ORDERINGLOC)
 S %H=$H,%H=$S($P(%H,",",2):%H,1:%H-1)
 S FDA(9000010.59,"+1,",1216)=$G(%)
 S FDA(9000010.59,"+1,",1217)=$G(ENTEREDBY)
 D UPDATE^DIE("","FDA","FDAIEN","FDAMSG")
 S FDADA=+$G(FDAIEN(1))
 I $D(FDAMSG) D
 . W !!,"The following error message was returned:",!!
 . S FDAMSG="" F  S FDAMSG=$O(FDAMSG("DIERR",1,"TEXT",FDAMSG)) Q:FDAMSG=""  W FDAMSG("DIERR",1,"TEXT",FDAMSG),!
 I $G(FDADA)=""  S RSLT=$G(FDAMSG) Q
 S RSLT=$G(FDADA)
 Q
 ;