Code |
N CT,DXIEN,DXN,DXREC,DXV,ICD9,ICDR,ORFMDAT,TXFACTRS S (CT,DXN)=0 I '$G(^OR(100,ORIEN,0)) S Y=-1 I '$D(^OR(100,ORIEN,5.1,1,0)) S Y=0 E D S Y=CT . ; Get order date for CSV/CTD/HIPAA usage . S ORFMDAT=$$ORFMDAT^ORWDBA3(ORIEN) . ; Go through all Dx's for an order . F S DXN=$O(^OR(100,ORIEN,5.1,DXN)) Q:DXN'?1N.N D .. ; Get diagnosis record and IEN .. S DXREC=$G(^OR(100,ORIEN,5.1,DXN,0)),DXIEN=$P(DXREC,U) .. S ICDR=$$ICDDATA^ICDXCODE("DIAGNOSIS",$G(DXIEN),ORFMDAT) .. S DXV=$P(ICDR,U,4),ICD9=$P(ICDR,U,2) .. ; Convert internal to external Treatment Factors .. S TXFACTRS=$$TFGBLGUI(^OR(100,ORIEN,5.2)) .. S CT=CT+1,Y(CT)=DXN_U_$G(DXIEN)_U_ICD9_U_DXV_U_TXFACTRS
|