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

APCCUTL.m

Go to the documentation of this file.
  1. APCCUTL ; IHS/CMI/LAB - PCC UTILITIES ;
  1. ;;2.0;IHS PCC SUITE;**10**;MAY 14, 2009;Build 88
  1. ;
  1. DL(APCCV,APCCD,APCCP,APCCT,APCCA) ;PEP - called to log the printing of a clinical summary or other document
  1. ;APCCV - Visit array with visit ien^document ID
  1. ; e.g.: APCCV(1)="3299999^DOC1234567"
  1. ; APCCV(2)="32991000^ABC12345"
  1. ; I am including a document ID because someone suggested it, the measure doesn't
  1. ; require it but pass it if you know it, it might help during testing or as a trail
  1. ; to make sure there really was a document.
  1. ;APCCD - date/time in internal fileman format - when the document was printed, assumption, per Fay
  1. ; is that all visits in the array were printed at the same time
  1. ;APCCP - user who printed (if not passed will default to DUZ)
  1. ;APCCT - type of document
  1. ; 1 - Clinical Summary
  1. ; 2 - Transition of Care
  1. ; this list may expand in the future
  1. ; NOTE: only 1 type of document can be used per call, assumption is that all visits had the
  1. ; same document type, date/time, user and action
  1. ;APCCA - action. for now the only allowable value is "P" which stands for PRINTED.
  1. ; I added this action field so that if, in the future, we need to log that documents
  1. ; were, for example, emailed or mailed or sent by pigeon we can do so without creating
  1. ; a new log
  1. ;
  1. ;
  1. ;RETURN VALUE WILL BE 1 IF LOG UPDATED SUCCESSFULLY, IT WILL BE 0 IF NOT, DOUBT ANY
  1. ;CALLER CARES BUT JUST IN CASE, ESPECIALLY DURING TESTING I AM SENDING BACK A VALUE
  1. ;
  1. I '$O(APCCV(0)) Q 0 ;NO VISIT IENS PASSED
  1. I $G(APCCD)="" Q 0 ;NO DATE/TIME PASSED (I WONDER IF I SHOULD DEFAULT TO $$NOW^XLFDT if blank????)
  1. I $G(APCCP)="" S APCCP=$G(DUZ) ;IF NO USER USE DUZ
  1. I '$D(^VA(200,APCCP,0)) Q 0 ;USER INVALID
  1. I $G(APCCT)="" Q 0 ;I NEED A DOCUMENT TYPE
  1. ;I APCCT'=1 Q 0 ;I ONLY CARE ABOUT CLINICAL SUMMARY AT THIS POINT SO DON'T LOG ANY OTHERS
  1. I $G(APCCA)="" Q 0 ;NEED TO KNOW THE ACTION
  1. ;I $G(APCCA)'="P" Q 0 ;I ONLY CARE ABOUT PRINTED FOR THIS MEASURE AT THIS TIME
  1. ;now create an entry for each visit ien
  1. NEW APCCV1,DIC,DR,X,Y,DA,DIADD,DLAYGO,APCCF,APCCX,DINUM
  1. S APCCF=1,APCCX=0
  1. F S APCCX=$O(APCCV(APCCX)) Q:APCCX="" D
  1. .S APCCV1=$P(APCCV(APCCX),U,1)
  1. .I 'APCCV1 S APCCF=0 Q ;NO VISIT IEN
  1. .I '$D(^AUPNVSIT(APCCV1,0)) S APCCF=0 Q ;NO VISIT??
  1. .S DA=$O(^APCCDPL("B",APCCV1,0))
  1. .I DA D UPD Q
  1. .;CREATE ENTRY
  1. .K DA
  1. .S X=APCCV1,DIC="^APCCDPL(",DIADD=1,DINUM=X,DLAYGO=9001205,DIC(0)="L" D FILE^DICN K DIADD,DLAYGO,DIC,DINUM,DIC
  1. .I Y=-1 S APCCF=0 Q
  1. .S DA=+Y
  1. .D UPD
  1. .Q
  1. Q APCCF
  1. UPD ;
  1. ;UPDATE MULTIPLE
  1. NEW APCCIENS,APCCFDA,APCCERR
  1. S APCCIENS=DA_","
  1. S APCCFDA(9001205.1,"+2,"_APCCIENS,.01)=APCCD
  1. S APCCFDA(9001205.1,"+2,"_APCCIENS,.02)=APCCA
  1. S APCCFDA(9001205.1,"+2,"_APCCIENS,.03)=APCCP
  1. S APCCFDA(9001205.1,"+2,"_APCCIENS,.04)=APCCT
  1. S APCCFDA(9001205.1,"+2,"_APCCIENS,.05)=$P(APCCV(APCCX),U,2)
  1. D UPDATE^DIE("","APCCFDA","APCCIENS","APCCERR(1)")
  1. I $D(APCCERR) S APCCF=0 Q
  1. Q
  1. TEST ;
  1. K V
  1. S V(1)="3299699^ABC123456"
  1. S V(2)="3299709^XYZ123456"
  1. S V(3)="3299711^DOC345666"
  1. S X=$$DL(.V,$$NOW^XLFDT(),DUZ,1,"P")
  1. Q