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

PXRRPECS.m

Go to the documentation of this file.
  1. PXRRPECS ;ISL/PKR - Build a list of Person Class entries. ;12/11/96
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**12**;Aug 12, 1996
  1. ;
  1. ;=======================================================================
  1. PCLASS ;Build a list of person classes.
  1. N BELL,IC,INDENT,JC,NOCC,NS,NSPEC,NSUB,OCC,OCCIEN,PCLASS
  1. N SELECT,SOCC,SOCCW,SPEC,SPECIEN,SSPEC,SSPECW,SUB,SSUB,TEMP,WC,X,Y
  1. ;We will need a DBIA for reading the Person Class file.
  1. ;Build a list of the OCCUPATION entries in the Person Class file.
  1. S IC=0
  1. F S IC=$O(^USC(8932.1,IC)) Q:+IC=0 D
  1. . S TEMP=$P(^USC(8932.1,IC,0),U,1)
  1. . I $L(TEMP)>0 S OCC($$UPPRCASE^PXRRPECU(TEMP))=TEMP
  1. ;
  1. ;Count the number of Occupation entries.
  1. S NOCC=0
  1. S IC=""
  1. F S IC=$O(OCC(IC)) Q:IC="" D
  1. . S NOCC=NOCC+1
  1. ;
  1. S BELL=$C(7)
  1. ;Set the wildcard to be *.
  1. S WC="*"
  1. ;NS is NOT SPECIFIED.
  1. S NS="NOT SPECIFIED"
  1. S INDENT=3
  1. S NCL=0
  1. K PXRRPECL
  1. MPROMPT W !,"Select PERSON CLASS (OCCUPATION, SPECIALTY, SUBSPECIALTY)"
  1. K DTOUT,DUOUT
  1. W !
  1. NPCLASS ;
  1. I NCL'<1 W !!,"Select another PERSON CLASS OCCUPATION"
  1. ;Select an occupation.
  1. NOCC S DIR(0)="FAOU^1:60"
  1. S DIR("?")="^D OCCHLP^PXRRPECS"
  1. S DIR("??")="^D LISTA^PXRRPECU(.OCC)"
  1. S DIR("A")=" Select OCCUPATION (enter "_WC_" for all, return to end selection): "
  1. W !
  1. D ^DIR
  1. K DIR
  1. I $D(DIROUT) S DTOUT=1
  1. I $D(DTOUT)!$D(DUOUT) Q
  1. S SOCC=$$FDME^PXRRPECU(Y,.OCC)
  1. I SOCC=-1 W " ??",BELL G NOCC
  1. I ($P(SOCC,U,1)="")&(NCL=0) D G MPROMPT
  1. . W !,"You must select a person class!"
  1. I $P(SOCC,U,1)="" Q
  1. I $P(SOCC,U,1)=WC S SOCCW=1
  1. E S SOCCW=0
  1. ;
  1. ;Build a list of iens for SOCC (Selected OCCupation).
  1. K OCCIEN
  1. K SPEC
  1. I ('SOCCW) D
  1. . S TEMP=$E($P(SOCC,U,2),1,30)
  1. . S IC=0
  1. . F S IC=$O(^USC(8932.1,"B",TEMP,IC)) Q:+IC=0 D
  1. .. S OCCIEN(IC)=""
  1. ;
  1. ;Build a list of specialties valid for SOCC.
  1. S IC=0
  1. F S IC=$O(OCCIEN(IC)) Q:+IC=0 D
  1. . S TEMP=$P(^USC(8932.1,IC,0),U,2)
  1. . I TEMP="" S TEMP=NS
  1. . S SPEC($$UPPRCASE^PXRRPECU(TEMP))=TEMP
  1. ;
  1. ;Special case for Occupation selected as wildcard.
  1. I SOCCW D
  1. . S IC=0
  1. . F S IC=$O(^USC(8932.1,IC)) Q:+IC=0 D
  1. .. S TEMP=$P(^USC(8932.1,IC,0),U,2)
  1. .. I TEMP="" S TEMP=NS
  1. .. S SPEC($$UPPRCASE^PXRRPECU(TEMP))=TEMP
  1. ;
  1. ;Count the number of Specialty entries compatible with the selected
  1. ;Occupation.
  1. S NSPEC=0
  1. S IC=0
  1. F S IC=$O(SPEC(IC)) Q:IC="" D
  1. . S NSPEC=NSPEC+1
  1. ;
  1. I NSPEC=0 D G NPCLASS
  1. . W !,"There are no specialties for:"
  1. . W !,?INDENT,"OCCUPATION: ",$P(SOCC,U,1)
  1. . S NCL=NCL+1
  1. . S PXRRPECL(NCL)=$P(SOCC,U,2)_U_NS_U_NS
  1. ;
  1. ;Select a specialty.
  1. S SSPEC=""
  1. NSPEC I (NCL>0)&($L(SSPEC)>0) D VERIFY^PXRRPECU
  1. S DIR(0)="FAOU^1:50"
  1. S DIR("?")="^D SPECHLP^PXRRPECS"
  1. S DIR("??")="^D LISTA^PXRRPECU(.SPEC)"
  1. S DIR("A")=" Select SPECIALTY (enter "_WC_" for all, return to change OCCUPATION): "
  1. W !!,"The currently selected OCCUPATION is:"
  1. W !," ",$P(SOCC,U,2)
  1. D ^DIR K DIR
  1. I $D(DIROUT) S DTOUT=1
  1. I $D(DTOUT) Q
  1. I $D(DUOUT) G NOCC
  1. I $L(Y)=0 G NPCLASS
  1. S SSPEC=$$FDME^PXRRPECU(Y,.SPEC)
  1. I $P(SSPEC,U,1)="" G NPCLASS
  1. I SSPEC=-1 W " ??",BELL G NSPEC
  1. I $P(SSPEC,U,1)=WC S SSPECW=1
  1. E S SSPECW=0
  1. ;
  1. ;Build a list of iens for SSPEC (Selected SPECialty). Trim the OCCIEN
  1. ;list so it only contains entries valid for SOCC and SSPEC.
  1. K SPECIEN
  1. K SUB
  1. S IC=0
  1. F S IC=$O(OCCIEN(IC)) Q:+IC=0 D
  1. . S SPECIEN(IC)=OCCIEN(IC)
  1. ;
  1. ;If SSPEC was selected as the wildcard then we don't need to do
  1. ;anything.
  1. I ('SSPECW)&('SOCCW) D
  1. . S TEMP=$P(SSPEC,U,2)
  1. . S IC=0
  1. . F S IC=$O(SPECIEN(IC)) Q:+IC=0 D
  1. .. I $P(^USC(8932.1,IC,0),U,2)'=TEMP K SPECIEN(IC)
  1. ;
  1. ;Special case with SOCC=WC and SSPEC'=WC
  1. I ('SSPECW)&(SOCCW) D
  1. . S TEMP=$P(SSPEC,U,2)
  1. . S IC=0
  1. . F S IC=$O(^USC(8932.1,IC)) Q:+IC=0 D
  1. .. I $P(^USC(8932.1,IC,0),U,2)=TEMP S SPECIEN(IC)=""
  1. ;
  1. ;Build a list of subspecialties valid for SOCC and SSPEC.
  1. S IC=0
  1. F S IC=$O(SPECIEN(IC)) Q:+IC=0 D
  1. . S TEMP=$P(^USC(8932.1,IC,0),U,3)
  1. . I TEMP="" S TEMP=NS
  1. . S SUB($$UPPRCASE^PXRRPECU(TEMP))=TEMP
  1. ;
  1. ;Special case SOCC and SSPEC are wild.
  1. I (SSPECW)&(SOCCW) D
  1. . S IC=0
  1. . F S IC=$O(^USC(8932.1,IC)) Q:+IC=0 D
  1. .. S TEMP=$P(^USC(8932.1,IC,0),U,3)
  1. .. I TEMP="" S TEMP=NS
  1. .. S SUB($$UPPRCASE^PXRRPECU(TEMP))=TEMP
  1. ;
  1. ;Count the number of entries.
  1. S NSUB=0
  1. S IC=""
  1. F S IC=$O(SUB(IC)) Q:IC="" D
  1. . S NSUB=NSUB+1
  1. ;
  1. I (NSUB=0)!((NSUB=1)&($D(SUB(NS)))) D G NSPEC
  1. . W !,"There are no subspecialties for:"
  1. . W !,?INDENT,"OCCUPATION: ",$P(SOCC,U,1)
  1. . W !,?INDENT,"SPECIALTY: ",$P(SSPEC,U,1)
  1. . S NCL=NCL+1
  1. . S PXRRPECL(NCL)=$P(SOCC,U,2)_U_$P(SSPEC,U,2)_U_NS
  1. ;
  1. ;Select a subspecialty.
  1. NSUB S DIR(0)="FAOU^1:50"
  1. S DIR("?")="^D SUBHLP^PXRRPECS"
  1. S DIR("??")="^D LISTA^PXRRPECU(.SUB)"
  1. S DIR("A")=" Select SUBSPECIALTY (enter "_WC_" for all): "
  1. D ^DIR K DIR
  1. I $D(DIROUT) S DTOUT=1
  1. I $D(DTOUT) Q
  1. I $D(DUOUT) G NSPEC
  1. I $L(Y)=0 S SSUB=NS_U_NS
  1. E S SSUB=$$FDME^PXRRPECU(Y,.SUB)
  1. I SSUB=-1 W " ??",BELL G NSUB
  1. ;
  1. ;Save the selections.
  1. S TEMP=$L($P(SOCC,U,1))+$L($P(SSPEC,U,1))+$L($P(SSUB,U,1))
  1. I TEMP=0 Q
  1. I TEMP>0 D
  1. . S NCL=NCL+1
  1. . S PXRRPECL(NCL)=$P(SOCC,U,2)_U_$P(SSPEC,U,2)_U_$P(SSUB,U,2)
  1. I $D(DUOUT) G PCLASS
  1. I (NCL=0)&($D(DIRUT)!$D(DUOUT)) Q
  1. I (NCL=0) W !,"You must select a PERSON CLASS!" G PCLASS
  1. G NSPEC
  1. ;
  1. ;=======================================================================
  1. OCCHLP ;Help for occupation input.
  1. N PROMPT
  1. W !!,"Answer with an OCCUPATION, note ",WC," matches all OCCUPATIONS"
  1. S PROMPT="Do you want the entire "_NOCC_"-entry occupation list? "
  1. I $$GETYORN^PXRRPECU(PROMPT) D LISTA^PXRRPECU(.OCC)
  1. Q
  1. ;
  1. ;=======================================================================
  1. SPECHLP ;Help for specialty input.
  1. N PROMPT
  1. W !!,"Answer with a SPECIALTY, note ",WC," matches all SPECIALTIES"
  1. S PROMPT="Do you want the entire "_NSPEC_"-entry specialty list? "
  1. I $$GETYORN^PXRRPECU(PROMPT) D LISTA^PXRRPECU(.SPEC)
  1. Q
  1. ;
  1. ;=======================================================================
  1. SUBHLP ;Help for subspecialty input.
  1. N PROMPT
  1. W !!,"Answer with a SUBSPECIALTY, note ",WC," matches all SUBSPECIALTIES"
  1. S PROMPT="Do you want the entire "_NSUB_"-entry subspecialty list? "
  1. I $$GETYORN^PXRRPECU(PROMPT) D LISTA^PXRRPECU(.SUB)
  1. Q
  1. ;