コード例 #1
0
ファイル: Doctor.java プロジェクト: VictoriaLacroix/umple
 public void delete() {
   ArrayList<Patient> copyOfPatients = new ArrayList<Patient>(patients);
   patients.clear();
   for (Patient aPatient : copyOfPatients) {
     aPatient.removeDoctor(this);
   }
   super.delete();
 }
コード例 #2
0
ファイル: DbUtil.java プロジェクト: G1DR4/buendia
 /** Sets an attribute on a person. */
 public static void setPersonAttributeValue(
     Patient patient, PersonAttributeType attrType, String value) {
   PersonService personService = Context.getPersonService();
   PersonAttribute attribute = patient.getAttribute(attrType);
   if (attribute == null) {
     attribute = new PersonAttribute();
     attribute.setAttributeType(attrType);
     attribute.setValue(value);
     patient.addAttribute(attribute);
   } else {
     attribute.setValue(value);
   }
   personService.savePerson(patient);
 }
コード例 #3
0
ファイル: Doctor.java プロジェクト: VictoriaLacroix/umple
  public boolean removePatient(Patient aPatient) {
    boolean wasRemoved = false;
    if (!patients.contains(aPatient)) {
      return wasRemoved;
    }

    int oldIndex = patients.indexOf(aPatient);
    patients.remove(oldIndex);
    if (aPatient.indexOfDoctor(this) == -1) {
      wasRemoved = true;
    } else {
      wasRemoved = aPatient.removeDoctor(this);
      if (!wasRemoved) {
        patients.add(oldIndex, aPatient);
      }
    }
    return wasRemoved;
  }
コード例 #4
0
ファイル: Doctor.java プロジェクト: VictoriaLacroix/umple
 public boolean addPatient(Patient aPatient) {
   boolean wasAdded = false;
   if (patients.contains(aPatient)) {
     return false;
   }
   if (patients.contains(aPatient)) {
     return false;
   }
   patients.add(aPatient);
   if (aPatient.indexOfDoctor(this) != -1) {
     wasAdded = true;
   } else {
     wasAdded = aPatient.addDoctor(this);
     if (!wasAdded) {
       patients.remove(aPatient);
     }
   }
   return wasAdded;
 }
コード例 #5
0
  public SearchPatient(final String type, final int docID) {

    try {
      // "Load" the JDBC driver
      Class.forName("java.sql.Driver");

      // Establish the connection to the database
      String url = "jdbc:mysql://localhost:3306/cse";
      conn = DriverManager.getConnection(url, "root", "admin");
    } catch (Exception e) {
      System.err.println("Got an exception!");
      System.err.println(e.getMessage());
    }

    // Menu
    // MENU ACTIONS

    // Action to view new patient registered
    class NewPatientAction extends AbstractAction {
      private static final long serialVersionUID = 1L;

      public NewPatientAction() {
        putValue(SHORT_DESCRIPTION, "View list of new patients");
      }

      public void actionPerformed(ActionEvent e) {
        ViewRegisteredPatients vp = new ViewRegisteredPatients("new");
        vp.setVisible(true);
        ViewRegisteredPatients.hasNew = false;
      }
    }
    Action newPatientAction = new NewPatientAction();

    // Action to view all patient registered
    class AllPatientAction extends AbstractAction {
      private static final long serialVersionUID = 1L;

      public AllPatientAction() {
        putValue(SHORT_DESCRIPTION, "View list of all patients");
      }

      public void actionPerformed(ActionEvent e) {
        ViewRegisteredPatients vp = new ViewRegisteredPatients("all");
        vp.setVisible(true);
      }
    }
    Action allPatientAction = new AllPatientAction();

    // Action to open Statistical Report
    class StatsReportAction implements MenuListener {
      public void menuSelected(MenuEvent e) {
        StatsReport report = new StatsReport();
        setAlwaysOnTop(false);
        report.setVisible(true);
        report.setAlwaysOnTop(true);
      }

      public void menuDeselected(MenuEvent e) {}

      public void menuCanceled(MenuEvent e) {}
    }

    // Action to open Statistical Report
    class ProfileAction implements MenuListener {
      public void menuSelected(MenuEvent e) {
        Profile profilePage = new Profile("staff", docID, type);
        profilePage.setVisible(true);
        dispose();
      }

      public void menuDeselected(MenuEvent e) {}

      public void menuCanceled(MenuEvent e) {}
    }

    // MENU COMPONENTS
    menu = new JMenuBar();

    menuOp1 = new JMenu();
    menuOp2 = new JMenu();
    menuOp3 = new JMenu();
    menuOp4 = new JMenu();
    menuOp5 = new JMenu();

    menuOp1.setText("Profile");
    menuOp1.addMenuListener(new ProfileAction());

    optionsFrame = new JFrame("Options");

    optionsContainer = new JPanel();
    optionsContainer.setLayout(new BoxLayout(optionsContainer, BoxLayout.Y_AXIS));
    optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));

    if (type.equals("Doctor")) // if a doctor is logging in
    {
      menuOp2.setText("Patients");
      menuOp3.setText("Appointments Request");
      menuOp4.setText("View Medical Alerts");

      menuItem1 = new JMenuItem("Search Patient");

      menuOp2.add(menuItem1);

      menu.add(menuOp1);
      menu.add(menuOp2);
      menu.add(menuOp3);
      menu.add(menuOp4);

      // optionsFrame
      optionUpdateHCC = new JLabel("Update Healthcare Condition");
      optionUpdateHCC.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCC.addMouseListener(new MouseUpdateHCCListener());

      optionPrescription = new JLabel("e-Prescription");
      optionPrescription.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      // optionPrescription.addMouseListener(new MousePrescriptionListener());

      optionLabRecord = new JLabel("View Lab Records");
      optionLabRecord.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionLabRecord.addMouseListener(new MouseLabRecordListener());

      optionUpdateHCR = new JLabel("Update Healthcare Records");
      optionUpdateHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCR.addMouseListener(new MouseUpdateHCRListener());

      // add option to container
      optionsContainer.add(optionUpdateHCC);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionPrescription);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionUpdateHCR);
    } else if (type.equals("HSP")) // if the HSP is logging in
    {
      menuOp2.setText("Patients");
      menuOp3.setText("Appointment Request");
      menuOp4.setText("View Medical Alerts");
      menuOp5.setText("Generate Statistical Report");
      menuOp5.addMenuListener(new StatsReportAction());

      menuItem1 = new JMenuItem("Search Patient");
      menuOp6 = new JMenu("List of Registered Patient");
      menuOp6.setMnemonic(KeyEvent.VK_S);

      menuItem2 = new JMenuItem(newPatientAction);
      menuItem2.setText("List of New Registered Patient");
      menuItem3 = new JMenuItem(allPatientAction);
      menuItem3.setText("List of All Registered Patient");

      menuOp2.add(menuItem1);
      menuOp2.add(menuOp6);
      menuOp6.add(menuItem2);
      menuOp6.add(menuItem3);

      menu.add(menuOp1);
      menu.add(menuOp2);
      menu.add(menuOp3);
      menu.add(menuOp4);
      menu.add(menuOp5);

      // optionsFrame
      optionUpdateHCC = new JLabel("Update Healthcare Condition");
      optionUpdateHCC.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCC.addMouseListener(new MouseUpdateHCCListener());

      optionLabRecord = new JLabel("View Lab Records");
      optionLabRecord.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionLabRecord.addMouseListener(new MouseLabRecordListener());

      optionHCR = new JLabel("Upload Healthcare Records");
      optionHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionHCR.addMouseListener(new MouseUploadHCRListener());

      optionUpdateHCR = new JLabel("Update Healthcare Records");
      optionUpdateHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCR.addMouseListener(new MouseUpdateHCRListener());

      // add option to container
      optionsContainer.add(optionUpdateHCC);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionLabRecord);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionHCR);
      optionsContainer.add(Box.createRigidArea(new Dimension(20, 5)));
      optionsContainer.add(optionUpdateHCR);
    } else if (type.equals("Pharmacist")) // if the Pharmacist is logging in
    {
      menuOp2.setText("Patients");

      menuItem1 = new JMenuItem("Search Patients");

      menuOp2.add(menuItem1);

      menu.add(menuOp1);
      menu.add(menuOp2);

      // optionsFrame
      optionViewPrescription = new JLabel("View e-Prescription");
      optionViewPrescription.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionViewPrescription.addMouseListener(new MouseViewPrescriptionListener());

      // add option to container
      optionsContainer.add(optionViewPrescription);

    } else if (type.equals("Nurse")) // if the nurse is logging in
    {
      menuOp2.setText("Patients");

      menuItem1 = new JMenuItem("Search Patients");

      menuOp2.add(menuItem1);

      menu.add(menuOp1);
      menu.add(menuOp2);

      // optionsFrame
      optionUpdateHCR = new JLabel("Update Healthcare Records");
      optionUpdateHCR.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      optionUpdateHCR.addMouseListener(new MouseUpdateHCRListener());

      // add option to container
      optionsContainer.add(optionUpdateHCR);
    }

    // Labels
    firstNameLabel = new JLabel(" First name:"); // first name label
    lastNameLabel = new JLabel("Last name:"); // last name label
    patientListLabel = new JLabel("Patient List:"); // patient list label

    // Text Fields
    firstNameField = new JTextField(10); // first name text field
    lastNameField = new JTextField(10); // last name text field

    // Buttons
    searchButton = new JButton("Search"); // search button
    searchButton.addActionListener(new SearchButtonListener()); // add listener

    selectButton = new JButton("Select");
    selectButton.addActionListener(new SelectButtonListener()); // add listener

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new CancelButtonListener()); // add listener

    // JPanels
    firstNamePanel = new JPanel(); // First name panel
    firstNamePanel.add(firstNameLabel);
    firstNamePanel.add(firstNameField);

    lastNamePanel = new JPanel(); // Last name panel
    lastNamePanel.add(lastNameLabel);
    lastNamePanel.add(lastNameField);

    patientInfoPanel = new JPanel();
    patientInfoPanel.setLayout(new BoxLayout(patientInfoPanel, BoxLayout.X_AXIS));
    patientInfoPanel.add(firstNamePanel);
    patientInfoPanel.add(lastNamePanel);
    patientInfoPanel.add(searchButton);

    buttonPanel = new JPanel(); // button panel
    buttonPanel.add(selectButton);
    buttonPanel.add(cancelButton);

    // Patient List
    patientVector = new Vector(); // Vector of Patient objects
    patientList =
        new JList(patientVector); // creates a JList that show the content of the recordVector

    scrollPatientList = new JScrollPane(patientList); // add scroll option to the list
    patientList.setSelectionMode(
        ListSelectionModel.SINGLE_SELECTION); // Allow the selection of only one item at a time

    String[] patients = new String[1000000];

    // Populates the patient list with the patients from the database
    if (type.equals("Doctor")) {
      int i = 0;
      try {
        // checks if the patient is a patient of the doctor logged
        statement = conn.createStatement();
        rs =
            statement.executeQuery(
                "SELECT * FROM appointments WHERE `docID`='" + docID + "' ORDER BY `patientID`");

        while (rs.next()) {
          int patientID = rs.getInt("patientID");
          patients[i] = String.valueOf(patientID);

          i++;
        }

        String[] patientSet =
            (String[]) new HashSet(Arrays.asList(patients)).toArray(new String[0]);

        // gets information from the specific set of patients
        for (int j = 0; j < patientSet.length; j++) {
          statement = conn.createStatement();
          rs =
              statement.executeQuery(
                  "SELECT * FROM patient WHERE `idpatient`='" + patientSet[j] + "';");

          while (rs.next()) {
            Patient obj = new Patient();
            obj.setFirstName(rs.getString("fname"));
            obj.setLastName(rs.getString("lname"));
            obj.setDOB(rs.getString("dob"));
            obj.setPatientId(Integer.parseInt(patientSet[j]));

            patientVector.add(obj);
          }
        }

      } catch (Exception e) {
        System.err.println("Got an exception! ");
        System.err.println(e.getMessage());
        System.err.println(e);
      }
    } else {
      try {
        statement = conn.createStatement();
        rs = statement.executeQuery("SELECT * FROM patient ORDER BY fname");

        while (rs.next()) {
          Patient obj = new Patient();
          obj.setFirstName(rs.getString("fname"));
          obj.setLastName(rs.getString("lname"));
          obj.setDOB(rs.getString("dob"));
          obj.setPatientId(rs.getInt("idpatient"));

          patientVector.add(obj);
        }
      } catch (Exception e) {
        System.err.println("Got an exception! ");
        System.err.println(e.getMessage());
      }
    }

    searchVector = new Vector();

    // set options frame
    optionsFrame.add(optionsContainer);
    optionsFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // close the window on close
    optionsFrame.setSize(300, 150); // set size of window
    optionsFrame.setLocation(600, 280);
    optionsFrame.setVisible(false);

    searchPanel = new JPanel();
    searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.Y_AXIS));
    searchPanel.add(patientInfoPanel);
    searchPanel.add(patientListLabel);
    searchPanel.add(scrollPatientList);
    searchPanel.add(buttonPanel);

    Border padding = BorderFactory.createEmptyBorder(20, 20, 10, 10);
    searchPanel.setBorder(padding);

    setJMenuBar(menu);
    add(searchPanel);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(1200, 580);
  }
コード例 #6
0
 public void actionPerformed(ActionEvent event) {
   optionsFrame.setVisible(true);
   Patient p1 = (Patient) patientList.getSelectedValue();
   patientID = p1.getpatientID();
 }
コード例 #7
0
    public void actionPerformed(ActionEvent event) {
      // if both names are entered on the search
      if (!firstNameField.getText().equals("") && !lastNameField.getText().equals("")) {
        searchVector.clear();
        for (int i = 0; i < patientVector.size(); i++) {
          Patient p1 = (Patient) patientVector.elementAt(i);
          if (firstNameField.getText().matches(p1.getFirstName())
              && lastNameField.getText().equals(p1.getLastName())) searchVector.add(p1);
        }
        if (searchVector.size() == 0)
          JOptionPane.showMessageDialog(patientListLabel, "Patient not found! 1");
        else {
          searchList = new JList(searchVector);
          searchList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          scrollSearchList = new JScrollPane(searchList);
          searchPanel.removeAll();
          searchPanel.add(patientInfoPanel);
          searchPanel.add(patientListLabel);
          searchPanel.add(scrollSearchList);
          searchPanel.add(buttonPanel);
          repaint();
          revalidate();
        }
      }

      // if only the first name is entered on the search
      else if (lastNameField.getText().equals("") && !firstNameField.getText().equals("")) {
        searchVector.clear();
        System.out.println("dasdas");
        for (int i = 0; i < patientVector.size(); i++) {
          System.out.println("dasdas" + i);
          Patient p1 = (Patient) patientVector.elementAt(i);
          if (firstNameField.getText().matches(p1.getFirstName())) searchVector.add(p1);
        }
        if (searchVector.size() == 0)
          JOptionPane.showMessageDialog(patientListLabel, "Patient not found!2");
        else {
          searchList = new JList(searchVector);
          searchList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          scrollSearchList = new JScrollPane(searchList);
          searchPanel.removeAll();
          searchPanel.add(patientInfoPanel);
          searchPanel.add(patientListLabel);
          searchPanel.add(scrollSearchList);
          searchPanel.add(buttonPanel);
          repaint();
          revalidate();
        }
      }
      // if only the last name is entered on the search
      else if (firstNameField.getText().equals("") && !lastNameField.getText().equals("")) {
        searchVector.clear();
        for (int i = 0; i < patientVector.size(); i++) {
          Patient p1 = (Patient) patientVector.elementAt(i);
          if (lastNameField.getText().matches(p1.getLastName())) searchVector.add(p1);
        }
        if (searchVector.size() == 0)
          JOptionPane.showMessageDialog(patientListLabel, "Patient not found!");
        else {
          searchList = new JList(searchVector);
          searchList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          scrollSearchList = new JScrollPane(searchList);
          searchPanel.removeAll();
          searchPanel.add(patientInfoPanel);
          searchPanel.add(patientListLabel);
          searchPanel.add(scrollSearchList);
          searchPanel.add(buttonPanel);
          repaint();
          revalidate();
        }
      }
      // if the fields are empty, show the complete set of patient
      else {
        searchPanel.removeAll();
        searchPanel.add(patientInfoPanel);
        searchPanel.add(patientListLabel);
        searchPanel.add(scrollPatientList);
        searchPanel.add(buttonPanel);
        repaint();
        revalidate();
      }
    }
コード例 #8
0
  /**
   * Test importing of Clinical Data File.
   *
   * @throws DaoException Database Access Error.
   * @throws IOException IO Error.
   */
  @Test
  @Ignore("To be fixed")
  public void testImportClinicalDataSurvival() throws Exception {

    // TBD: change this to use getResourceAsStream()
    File clinicalFile = new File("target/test-classes/clinical_data.txt");
    ImportClinicalData importClinicalData = new ImportClinicalData(study, clinicalFile);
    importClinicalData.importData();

    LinkedHashSet<String> caseSet = new LinkedHashSet<String>();
    caseSet.add("TCGA-A1-A0SB");
    caseSet.add("TCGA-A1-A0SI");
    caseSet.add("TCGA-A1-A0SE");

    List<Patient> clinicalCaseList =
        DaoClinicalData.getSurvivalData(study.getInternalId(), caseSet);
    assertEquals(3, clinicalCaseList.size());

    Patient clinical0 = clinicalCaseList.get(0);
    assertEquals(new Double(79.04), clinical0.getAgeAtDiagnosis());
    assertEquals("DECEASED", clinical0.getOverallSurvivalStatus());
    assertEquals("Recurred/Progressed", clinical0.getDiseaseFreeSurvivalStatus());
    assertEquals(new Double(43.8), clinical0.getOverallSurvivalMonths());
    assertEquals(new Double(15.05), clinical0.getDiseaseFreeSurvivalMonths());

    Patient clinical1 = clinicalCaseList.get(1);
    assertEquals(new Double(55.53), clinical1.getAgeAtDiagnosis());
    assertEquals("LIVING", clinical1.getOverallSurvivalStatus());
    assertEquals("DiseaseFree", clinical1.getDiseaseFreeSurvivalStatus());
    assertEquals(new Double(49.02), clinical1.getOverallSurvivalMonths());
    assertEquals(new Double(49.02), clinical1.getDiseaseFreeSurvivalMonths());

    Patient clinical2 = clinicalCaseList.get(2);
    assertEquals(null, clinical2.getDiseaseFreeSurvivalMonths());
  }
  public DataSetRow renderRow(
      Patient p,
      PatientIdentifierType patientIdentifierType,
      Location location,
      Date startDate,
      Date endDate) {

    PatientDataHelper pdh = new PatientDataHelper();
    ProgramHelper ph = new ProgramHelper();
    HivMetadata hivMetadata = new HivMetadata();

    DataSetRow row = new DataSetRow();
    pdh.addCol(row, "#", p.getPatientId());
    pdh.addCol(row, "KS ID", pdh.preferredIdentifierAtLocation(p, patientIdentifierType, location));
    pdh.addCol(
        row,
        "ART ID",
        pdh.preferredIdentifierAtLocation(p, lookupPatientIdentifierType("ARV Number"), location));
    pdh.addCol(row, "Birthdate", pdh.getBirthdate(p));
    pdh.addCol(row, "Gender", pdh.getGender(p));
    pdh.addCol(row, "VHW", pdh.vhwName(p, false));
    pdh.addCol(row, "Village", pdh.getVillage(p));

    PatientProgram latestKsProgram =
        ph.getMostRecentProgramEnrollmentAtLocation(
            p, lookupProgram("Kaposis sarcoma program"), location);

    Date latestKsProgramDate = null;
    if (latestKsProgram != null) {
      latestKsProgramDate = latestKsProgram.getDateEnrolled();
      pdh.addCol(row, "KS Program Enrollment Date", pdh.formatYmd(latestKsProgramDate));

      for (PatientState ps : ph.getActiveStatesOnDate(p, latestKsProgramDate)) {
        String programName = ps.getPatientProgram().getProgram().getName();
        pdh.addCol(row, programName + " Status at Enrollment", pdh.formatStateName(ps));
        pdh.addCol(row, programName + " Status Date at Enrollment", pdh.formatStateStartDate(ps));
      }
    }

    Obs mostRecentDxDate = pdh.getLatestObs(p, "DATE OF HIV DIAGNOSIS", null, endDate);
    pdh.addCol(row, "Date HIV Diagnosis", pdh.formatValueDatetime(mostRecentDxDate));

    Program hivProgram = hivMetadata.getHivProgram();
    ProgramWorkflowState onArvState = hivMetadata.getOnArvsState();

    PatientState earliestOnArvsState = ph.getFirstTimeInState(p, hivProgram, onArvState, endDate);
    Date arvStartDate = (earliestOnArvsState == null ? null : earliestOnArvsState.getStartDate());

    if (latestKsProgramDate != null) {
      pdh.addCol(
          row,
          "On ART at KS Enrollment",
          arvStartDate != null && arvStartDate.compareTo(latestKsProgramDate) <= 0);
    }

    Map<String, String> reasonsForStartingArvs = pdh.getReasonStartingArvs(p, endDate);
    for (String reasonKey : reasonsForStartingArvs.keySet()) {
      pdh.addCol(row, "ARV Reason " + reasonKey, reasonsForStartingArvs.get(reasonKey));
    }

    if (arvStartDate != null) {
      pdh.addCol(row, "Start Date for ART", pdh.formatStateStartDate(earliestOnArvsState));
      if (latestKsProgramDate != null) {
        pdh.addCol(
            row,
            "Months on ART at KS Enrollment",
            DateUtil.monthsBetween(arvStartDate, latestKsProgramDate));
      }
    }

    if (latestKsProgramDate != null) {
      Obs artRegimen =
          pdh.getLatestObs(p, "Malawi Antiretroviral drugs received", null, latestKsProgramDate);
      pdh.addCol(row, "ART Regimen Obs at Enrollment", pdh.formatValue(artRegimen));

      Set<Concept> drugOrdersAtEnrollment = pdh.getDrugsTakingOnDate(p, latestKsProgramDate);
      pdh.addCol(
          row, "Drugs Taking at Enrollment", pdh.formatConcepts(drugOrdersAtEnrollment, "+"));

      Obs cd4 = pdh.getLatestObs(p, "CD4 count", null, latestKsProgramDate);
      pdh.addCol(row, "CD4 at enrollment", pdh.formatValue(cd4));
      pdh.addCol(row, "CD4 at enrollment date", pdh.formatObsDatetime(cd4));
    }

    Obs height = pdh.getLatestObs(p, "Height (cm)", null, endDate);
    pdh.addCol(row, "Latest Height", pdh.formatValue(height));
    pdh.addCol(row, "Latest Height Date", pdh.formatObsDatetime(height));

    Obs firstTaxolObs = pdh.getEarliestObs(p, "Paclitaxel (taxol) dose received", null, endDate);
    pdh.addCol(row, "First Taxol Dose Received Date", pdh.formatObsDatetime(firstTaxolObs));

    DrugOrder firstTaxolOrder = pdh.getEarliestDrugOrder(p, "Paclitaxel", endDate);
    pdh.addCol(row, "First Taxol Drug Order Date", pdh.formatOrderStartDate(firstTaxolOrder));

    Date firstTaxolDate = null;
    if (firstTaxolObs != null) {
      firstTaxolDate = firstTaxolObs.getObsDatetime();
    }
    if (firstTaxolOrder != null) {
      if (firstTaxolDate == null || firstTaxolOrder.getStartDate().before(firstTaxolDate)) {
        firstTaxolDate = firstTaxolOrder.getStartDate();
      }
    }
    pdh.addCol(row, "First Taxol Date", pdh.formatYmd(firstTaxolDate));

    if (firstTaxolDate != null) {
      Obs cd4AtTaxol = pdh.getLatestObs(p, "CD4 count", null, firstTaxolDate);
      pdh.addCol(row, "Most recent CD4 at First Taxol", pdh.formatValue(cd4AtTaxol));
      pdh.addCol(row, "Most recent CD4 at First Taxol Date", pdh.formatObsDatetime(cd4AtTaxol));
    }

    for (PatientState ps : ph.getActiveStatesOnDate(p, endDate)) {
      String ed = pdh.formatYmd(endDate);
      String programName = ps.getPatientProgram().getProgram().getName();
      pdh.addCol(row, programName + " Status on " + ed, pdh.formatStateName(ps));
      pdh.addCol(row, programName + " Status Date on " + ed, pdh.formatStateStartDate(ps));
    }

    pdh.addCol(row, "Death Date", pdh.formatYmd(p.getDeathDate()));

    return row;
  }
コード例 #10
0
ファイル: Patient.java プロジェクト: turdona193/seniorPoject
 public static void main(String[] args) {
   Patient pt = new Patient();
   System.out.println(pt.printLong());
   pt.toFile();
 }