Changeset 1605 for fmts


Ignore:
Timestamp:
Feb 6, 2013, 5:59:51 PM (12 years ago)
Author:
Sam Habiel
Message:

Now adds allergies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmts/trunk/p/C0XPT0.m

    r1604 r1605  
    1 C0XPT0 ; VEN/SMH - Get patient data and do something about it ;2013-02-04  3:41 PM
     1C0XPT0 ; VEN/SMH - Get patient data and do something about it ;2013-02-06  3:08 PM
    22 ;;1.1;FILEMAN TRIPLE STORE;;
    33 ;
     
    5555 ; This is optional of course
    5656 ;
    57  QUIT $$UP^DILIBF(FAMILY_","_GIVEN_" "_MIDDLE)
     57 QUIT $$UP^XLFSTR(FAMILY_","_GIVEN_" "_MIDDLE)
    5858 ;
    5959 ;
     
    209209 . D PROBADD(DFN,CODE,TEXT,EXPIEN,STARTDT) ; Add problem to VISTA.
    210210 QUIT
     211 ;
     212NP() ; New Person Entry
     213        N C0XFDA,C0XIEN,C0XERR
     214        S C0XFDA(200,"?+1,",.01)="PROVIDER,UNKNOWN SMART" ; Name
     215        S C0XFDA(200,"?+1,",1)="USP" ; Initials
     216        S C0XFDA(200,"?+1,",28)="SMART" ; Mail Code
     217        ;
     218        N DIC S DIC(0)="" ; An XREF in File 200 requires this.
     219        D UPDATE^DIE("E",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR)) ; Typical UPDATE
     220        Q C0XIEN(1) ;Provider IEN
     221        ;
    211222PROBADD(DFN,CODE,TEXT,EXPIEN,STARTDT) ; Add a problem to a patient's record.
    212223        ; Input
     
    219230        ; Output:
    220231        ; NONE
    221         ; Crash expectd if code fails to add a problem.
     232        ; Crash expected if code fails to add a problem.
    222233        ;
    223234        ;
     
    226237        ;
    227238        ; Add unknown provider to database
    228         N C0XFDA,C0XIEN,C0XERR
    229         S C0XFDA(200,"?+1,",.01)="PROVIDER,UNKNOWN SMART" ; Name
    230         S C0XFDA(200,"?+1,",1)="USP" ; Initials
    231         S C0XFDA(200,"?+1,",28)="SMART" ; Mail Code
    232         ;
    233         N DIC S DIC(0)="" ; An XREF in File 200 requires this.
    234         D UPDATE^DIE("E",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR)) ; Typical UPDATE
    235         N GMPPROV S GMPPROV=C0XIEN(1) ;Provider IEN
     239        N GMPPROV S GMPPROV=$$NP^C0XPT0() ;Smart Provider IEN
    236240        ;
    237241        N GMPVAMC S GMPVAMC=$$KSP^XUPARAM("INST") ; Problem Institution. Ideally, the external one. But we are taking a shortcut here.
     
    296300        . I ALLERGYTYPE="F" D  ; Food
    297301        . . S ALLERGEN=$$UP^XLFSTR($$GSPO1^C0XGET3(G,RETURN(S),"sp:otherAllergen.dcterms:title")) ; uppercase the allergen
    298         . . I ALLERGEN="PEANUT" S ALLERGEN="PEANUTS" ; temporary fix
     302        . . I ALLERGEN="PEANUT" S ALLERGEN="PEANUTS" ; TODO: temporary fix
    299303        . . S ALLERGENI=$$GMRA^C0XPT0(ALLERGEN) ; Get internal representation for GMRA call
    300304        . ;
     
    310314        . . S ALLERGEN=$P(DC,"/",$L(DC,"/")) ; Get last piece
    311315        . . ; TODO: Resolve drug class properly. Need all of RxNorm for that.
    312         . . I ALLERGEN="N0000175503"
     316        . . N STR S STR=$$UP^XLFSTR($$GSPO1^C0XGET3(G,RETURN(S),"sp:drugClassAllergen.dcterms:title"))
     317        . . I ALLERGEN="N0000175503" S ALLERGENI=STR_U_"23;PS(50.605," ; hard codeded for sulfonamides
     318        . . ;
     319        . ; DEBUG.ASSERT THAT allergen Internal isn't empty
     320        . I '$L(ALLERGENI) S $EC=",U1,"
     321        . ;
     322        . ; Get Severity (Mild or Severe) - We get free text rather than SNOMED
     323        . N SEVERITY S SEVERITY=$$UP^XLFSTR($$GSPO1^C0XGET3(G,RETURN(S),"sp:severity.dcterms:title"))
     324        . I '$L(SEVERITY) S $EC=",U1,"
     325        . ;
     326        . ; Get Reaction - We get free text rather than SNOMED
     327        . N REACTION S REACTION=$$UP^XLFSTR($$GSPO1^C0XGET3(G,RETURN(S),"sp:allergicReaction.dcterms:title"))
     328        . I '$L(REACTION) S $EC=",U1,"
     329        . ;
     330        . ; Now that we have determined the allergy, add it
     331        . D FILEADR^C0XPT0(DFN,ALLERGENI,REACTION,SEVERITY,ALLERGYTYPE) ; Internal API
    313332        QUIT
    314333        ;
     
    332351        I GMRAGNT["GMRD(120.82," Q $$GET1^DIQ(120.82,C0PIEN,"ALLERGY TYPE","I")_U_$$GET1^DIQ(120.82,C0PIEN,"ALLERGY TYPE","E")
    333352        Q "D^Drug" ; otherwise, it's a drug
     353        ;
     354FILEADR(DFN,AGENT,REACTION,SEVERITY,TYPE)       ; Private Proc - File Drug Reaction
     355        N C0XRXN
     356        S C0XRXN("GMRAGNT")=AGENT ; Agent^Agent in variable pointer format
     357        S C0XRXN("GMRATYPE")=TYPE ; F(ood), D(rug), or O(ther) or combination.
     358        S C0XRXN("GMRANATR")="U^Unknown" ; Allergic, Pharmacologic, or Unknown
     359        S C0XRXN("GMRAORIG")=$$NP^C0XPT0 ; New Person generated for SMART
     360        ; S C0XRXN("GMRACHT",0)=1 ; Mark Chart as allergy document - commented out b/c depends on Paper Docs
     361        ; S C0XRXN("GMRACHT",1)=$$NOW^XLFDT ; Chart documentation date - commented out depends on Paper Docs
     362        S C0XRXN("GMRAORDT")=$$NOW^XLFDT
     363        S C0XRXN("GMRAOBHX")="h^HISTORICAL"
     364        S C0XRXN("GMRACMTS",0)=1 ; Comments
     365        S C0XRXN("GMRACMTS",1)=SEVERITY ; Store severity in the comments
     366        N ORY ; Return value 0: success; -1: failure; discarded.
     367        D UPDATE^GMRAGUI1("",DFN,$NA(C0XRXN))
     368        QUIT
Note: See TracChangeset for help on using the changeset viewer.