public void LoadFile( InputStream fileContent, DAOFactory factory, EventLoggingAction loggingAction, long loggedInMID) throws IOException, DBException { NDCodesDAO ndcodesDAO = factory.getNDCodesDAO(); Scanner fileScanner = new Scanner(fileContent); while (fileScanner.hasNextLine()) { String ndCodeWithDash; MedicationBean bean = new MedicationBean(); StringTokenizer tok = new StringTokenizer(fileScanner.nextLine(), "\t"); ndCodeWithDash = tok.nextToken(); String parts[] = ndCodeWithDash.split("-"); // Skip drug type field tok.nextToken(); bean.setNDCode(parts[0].concat(parts[1])); bean.setDescription(tok.nextToken()); try { ndcodesDAO.addNDCode(bean); loggingAction.logEvent( TransactionType.DRUG_CODE_ADD, loggedInMID, 0, "" + bean.getNDCode() + bean.getDescription()); } catch (Exception e) { // We just want to skip duplicate-entries. Let it pass. } } }
/** * Super class validates the patient id * * @param factory The DAOFactory to be used in creating DAOs for this action. * @param loggedInMID The MID of the currently logged in user who is authorizing this action. * @param pidString The MID of the patient whose personal health records are being added. * @throws ITrustException * @throws NoHealthRecordsException */ public EditPHRAction(DAOFactory factory, long loggedInMID, String pidString) throws ITrustException { super(factory, pidString); this.patientDAO = factory.getPatientDAO(); this.allergyDAO = factory.getAllergyDAO(); this.familyDAO = factory.getFamilyDAO(); this.hrDAO = factory.getHealthRecordsDAO(); this.ovDAO = factory.getOfficeVisitDAO(); this.icdDAO = factory.getICDCodesDAO(); this.personnelDAO = factory.getPersonnelDAO(); this.HCPUAP = personnelDAO.getPersonnel(loggedInMID); this.patient = patientDAO.getPatient(pid); this.procDAO = factory.getProceduresDAO(); this.ndcodesDAO = factory.getNDCodesDAO(); // NEW this.loggingAction = new EventLoggingAction(factory); emailutil = new EmailUtil(factory); this.factory = factory; }