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

PXRMPCMM.m

Go to the documentation of this file.
  1. PXRMPCMM ;SLC/PKR - Computed findings for PCMM. ;07/01/2012
  1. ;;2.0;CLINICAL REMINDERS;**18,24**;Feb 04, 2005;Build 193
  1. ;References to SCAPMC supported by DBIA #1916.
  1. ;====================================
  1. INSTPCTM(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;VA-PCMM PC TEAM
  1. ;INSTITUTION computed finding. Return the institution and team for
  1. ;the patient's primary care team as of the evaluation date.
  1. N IND,EFFDATE,RESULT
  1. S EFFDATE=$$NOW^PXRMDATE
  1. S RESULT=$$INSTPCTM^SCAPMC(DFN,EFFDATE)
  1. I RESULT=0 S NFOUND=0 Q
  1. S NFOUND=1,DATE(1)=EFFDATE,TEST(1)=1
  1. S (DATA(1,"PCMM TEAM"),DATA(1,"VALUE"))=$P(RESULT,U,2)
  1. S DATA(1,"INSTITUTION")=$P(RESULT,U,4)
  1. S TEXT(1)="Primary care team is "_DATA(1,"PCMM TEAM")_", Institution is "_DATA(1,"INSTITUTION")_"."
  1. Q
  1. ;
  1. ;====================================
  1. MHTC(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;VA-PCMM MHTC computed
  1. ;finding. MHTC stands for Mental Health Treatment Coordinator.
  1. N RESULT
  1. ;DBIA #5697
  1. S RESULT=$$START^SCMCMHTC(DFN)
  1. I RESULT="" S NFOUND=0 Q
  1. ;S NFOUND=1,DATE(1)=$$NOW^PXRMDATE,TEST(1)=1
  1. ;The API does not currently take a date.
  1. S NFOUND=1,DATE(1)=$$NOW^XLFDT,TEST(1)=1
  1. S (DATA(1,"MHTC"),DATA(1,"VALUE"))=$P(RESULT,U,2)
  1. S DATA(1,"TEAM POSITION")=$P(RESULT,U,3)
  1. S DATA(1,"ROLE")=$P(RESULT,U,4)
  1. S DATA(1,"TEAM")=$P(RESULT,U,5)
  1. S TEXT(1)="Team Position is "_DATA(1,"TEAM POSITION")_", Role is "_DATA(1,"ROLE")_", Team is "_DATA(1,"TEAM")_"."
  1. Q
  1. ;
  1. ;====================================
  1. PRPT(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;VA-PCMM PRACTITIONERS
  1. ;ASSIGNED TO A PATIENT computed finding. Return a list of
  1. ;practitioners assigned to a patient.
  1. N DATES,ERR,INCL,IND,LIST,RESULT
  1. S INCL=+$P(TEST,U,1)
  1. S DATES("BEGIN")=BDT,DATES("END")=EDT,DATES("INCL")=INCL
  1. S RESULT=$$PRPT^SCAPMC(DFN,"DATES","","","","","LIST","ERR")
  1. S NFOUND=+$G(LIST(0))
  1. I NFOUND=0 Q
  1. F IND=1:1:NFOUND D
  1. . S TEST(IND)=1
  1. . S DATA(IND,"PROVIDER IEN")=$P(LIST(IND),U,1)
  1. . S DATA(IND,"PROVIDER")=$P(LIST(IND),U,2)
  1. . S DATA(IND,"POSITION")=$P(LIST(IND),U,4)
  1. . S (DATA(IND,"ACTIVATION DATE"),DATE(IND))=$P(LIST(IND),U,9)
  1. . S TEXT(IND)="Provider: "_DATA(IND,"PROVIDER")_"; Position: "_DATA(IND,"POSITION")
  1. Q
  1. ;
  1. ;====================================
  1. PTPR(NGET,BDT,EDT,PLIST,PARAM) ;VA-PCMM PATIENTS ASSIGNED TO A PRACTITIONER.
  1. ;List type computed finding that returns a list of patients
  1. ;assigned to a list of practitioners within a time period.
  1. N DATES,ERR,INCL,IND,JND,LIST,NPAT,NPR,PRAC,PRACLIST,RESULT
  1. K ^TMP($J,PLIST)
  1. S PRACLIST=$P(PARAM,U,1)
  1. S INCL=+$P(PARAM,U,2)
  1. S NPR=$L(PRACLIST,";")
  1. S DATES("BEGIN")=BDT,DATES("END")=EDT,DATES("INCL")=INCL
  1. F IND=1:1:NPR D
  1. . S PRAC=$P(PRACLIST,";",IND)
  1. . S PRAC=$$FIND1^DIC(200,,"ABX",PRAC,,,"MSG")
  1. . I PRAC=0 Q
  1. . K LIST
  1. . S RESULT=$$PTPR^SCAPMC(PRAC,"DATES","","","LIST","ERR","")
  1. . S NPAT=+$G(LIST(0)) I NPAT=0 Q
  1. . F JND=1:1:NPAT D
  1. .. S DFN=$P(LIST(JND),U,1)
  1. .. S ^TMP($J,PLIST,DFN,1)=U_$P(LIST(JND),U,4)_U_DFN_U_$P(LIST(JND),U,2)
  1. .. S ^TMP($J,PLIST,DFN,1,"VALUE")=DFN
  1. Q
  1. ;
  1. ;====================================
  1. PTTM(NGET,BDT,EDT,PLIST,PARAM) ;VA-PCMM PATIENTS ASSIGNED TO A TEAM
  1. ;List type computed finding that returns a list of patients
  1. ;assigned to a team for a time period.
  1. N DATES,ERR,INCL,LIST,MSG,RESULT,TEAM
  1. S TEAM=$P(PARAM,U,1)
  1. S TEAM=$$FIND1^DIC(404.51,,"ABX",TEAM,,,"MSG")
  1. I TEAM=0 Q
  1. S INCL=+$P(PARAM,U,2)
  1. S DATES("BEGIN")=BDT,DATES("END")=EDT,DATES("INCL")=INCL
  1. ;Return list in ^TMP.
  1. S RESULT=$$PTTM^SCAPMC(TEAM,"DATES","LIST","MSG")
  1. K ^TMP($J,PLIST)
  1. S IND=0
  1. F S IND=+$O(LIST(IND)) Q:IND=0 D
  1. . S DFN=$P(LIST(IND),U,1)
  1. . S ^TMP($J,PLIST,DFN,1)=U_$P(LIST(IND),U,4)_U_DFN_U_$P(LIST(IND),U,2)
  1. . S ^TMP($J,PLIST,DFN,1,"VALUE")=DFN
  1. Q
  1. ;