Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
chonguschonguschongus committed Nov 7, 2023
2 parents 710d318 + 60ec3e9 commit 0bf21f4
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 94 deletions.
47 changes: 27 additions & 20 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ in our current version:

Examples:

* `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 pt/T0123456H`
* `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 t/Pediatrician`
* `add-doctor n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/Surgeon`

### Adding a Patient: `add-patient`
Expand All @@ -128,7 +128,10 @@ Format: `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e
- Phone Numbers and Emails have to be in a valid format.
- PHONE_NUMBER must have exactly 8 digits.
- EMAIL must contain email domain (eg. `@gmail.com`).
- DOCTOR must contain the valid IC of a doctor in the Database.
- TAG must indicate Priority Level of the Patient and be one of the following:
- Low
- Medium
- High
- EMERGENCY_CONTACT must contain valid emergency contact number, which needs to be a valid phone number.
- Blood type must be a combination of A/B/AB/O and +/-.
- A patient can only have up to one tag at any time.
Expand All @@ -139,8 +142,8 @@ Format: `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e

Examples:

* `add-patient n/John Doe ic/S9851386G g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 c/pneumothorax b/O+`
* `add-patient n/Betsy Crowe ic/S9851586G g/F p/98765433 ec/98765432 e/betsycrowe@example.com a/#104-C, Wakanda St 42 t/High Priority c/Flu b/O-`
* `add-patient n/John Doe ic/S9851386G g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 c/pneumothorax b/O+ t/Low`
* `add-patient n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 c/AIDS b/O+ t/High`

### Creating an Appointment : `new-appt`

Expand All @@ -152,9 +155,10 @@ Format: `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm`
**:information_source: Take Note:**<br>

- All fields are Required.
- TIME must follow the specified format (ie. `yyyy-MM-dd HH:mm:ss`).
- TIME must follow the specified format (ie. `yyyy-MM-dd HH:mm`), where `HH:mm` follows the 24hr format.
- PATIENT must contain the valid IC of a Patient in the Database.
- DOCTOR must contain the valid IC of a Doctor in the Database.
- There must not be conflicting Appointments (eg the doctor already has an appointment with another patient at the same time)

</div>

Expand Down Expand Up @@ -220,12 +224,13 @@ Format: `edit NRIC [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `t/` without
specifying any tags after it.
* Note: In our app, the Remark Section will be left blank by default. Edit Command can be used to add any misc info not captured by other fields such as possible allergies, medical history, etc.

Examples:

* `edit T0123456A p/91234567 e/johndoe@example.com g/F` Edits the phone number and email address of the 1st person to
be `91234567` and `johndoe@example.com` respectively.
* `edit S9876543B pt/T0123456A n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all
* `edit S9876543B n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all
existing tags.

### Locating persons by name: `find`
Expand Down Expand Up @@ -355,18 +360,20 @@ the data of your previous MediLink Contacts home folder.

## Command summary

| Action | Format, Examples |
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **New Doctor** | `add-doctor n/NAME ic/IC g/GENDER p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​` <br> e.g., `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 pt/T0123456H` |
| **New Patient** | `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e/EMAIL a/ADDRESS [t/TAG] [d/DOCTOR] [c/CONDITION] [b/BLOODTYPE]​` <br> e.g., `add-patient n/John Doe ic/S9851386G g/M p/98765432 ec/90123456 e/johnd@example.com a/John street, block 123, #01-01 d/T0123456H c/pneumothorax b/O+` |
| **New Appointment** | `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm:ss` <br> e.g., `new-appt pic/T0123456H dic/S9851586G time/yyyy-MM-dd 13:00:00` |
| **Clear** | `clear` |
| **Undo** | `undo` |
| **Redo** | `redo` |
| **Delete** | `delete NRIC`<br> e.g., `delete T0666485G` |
| **Edit** | `edit NRIC [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`<br> e.g.,`edit S9760431H n/James Lee e/jameslee@example.com` |
| **Find** | `find KEYWORD [MORE_KEYWORDS]`<br> e.g., `find James Jake` |
| **List** | `list` |
| **Remark** | `remark NRIC r/REMARK`<br> e.g., `remark S4876031G r/Injured` |
| **Help** | `help` |
| Action | Format, Examples |
|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **New Doctor** | `add-doctor n/NAME ic/IC g/GENDER p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​` <br> e.g., `add-doctor n/John Doe ic/S9851386G g/M p/98765432 e/johnd@example.com a/John street, block 123, #01-01 t/Pediatrician` |
| **New Patient** | `add-patient n/NAME ic/IC g/GENDER p/PHONE_NUMBER ec/EMERGENCY_CONTACT e/EMAIL a/ADDRESS [t/TAG] [d/DOCTOR] [c/CONDITION] [b/BLOODTYPE] …​` <br> e.g., `add-patient n/Betsy Crowe ic/S9851586G g/F p/98765433 e/betsycrowe@example.com a/#104-C, Wakanda St 42 c/AIDS b/O+ t/High` |
| **New Appointment** | `new-appt pic/IC dic/IC time/yyyy-MM-dd HH:mm` <br> e.g., `new-appt pic/T0123456H dic/S9851586G time/2023-10-30 13:00` |
| **Delete Appointment** | `delete-appt INDEX` <br> e.g., delete-appt 1 |
| **Find Appointment** | `find-appt NRIC` <br> e.g., find-appt T00012220 |
| **Clear** | `clear` |
| **Undo** | `undo` |
| **Redo** | `redo` |
| **Delete** | `delete NRIC`<br> e.g., `delete T0666485G` |
| **Edit** | `edit NRIC [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`<br> e.g.,`edit S9760431H n/James Lee e/jameslee@example.com` |
| **Find** | `find KEYWORD [MORE_KEYWORDS]`<br> e.g., `find James Jake` |
| **List** | `list` |
| **Help** | `help` |
| **Exit** | `exit` |

4 changes: 1 addition & 3 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ public static String format(Appointment appointment) {
.append("; Doctor involved: ")
.append(appointment.getDoctor())
.append("; Time of appointment: ")
.append(appointment.getAppointmentTime())
.append("; Status: ")
.append(appointment.getStatus());
.append(appointment.getAppointmentTime());
return builder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class AddDoctorCommand extends Command {
+ PREFIX_EMAIL + "johnd@example.com "
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
+ PREFIX_GENDER + "M "
+ PREFIX_NRIC + "S1234567Z"
+ PREFIX_NRIC + "S1234567Z "
+ PREFIX_TAG + "SURGEON";

public static final String MESSAGE_SUCCESS = "New doctor added: %1$s";
Expand Down
16 changes: 2 additions & 14 deletions src/main/java/seedu/address/model/appointment/Appointment.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class Appointment {
private Ic doctorIc;
private Ic patientIc;
private AppointmentTime appointmentTime;
private String status = "Scheduled";

/**
* Constructs a new appointment with the specified doctor, patient, and appointment time.
Expand Down Expand Up @@ -49,7 +48,6 @@ public Appointment(Ic doctorIc, Ic patientIc, AppointmentTime appointmentTime, S
this.doctorIc = doctorIc;
this.patientIc = patientIc;
this.appointmentTime = appointmentTime;
this.status = status;
}

public AppointmentTime getAppointmentTime() {
Expand All @@ -64,12 +62,7 @@ public Ic getPatient() {
return patientIc;
}

public String getStatus() {
return status;
}

public void setAppointmentTime(AppointmentTime appointmentTime) {
this.appointmentTime = appointmentTime;
}

public void changeDoctor(Ic newDoctorIc) {
Expand All @@ -80,10 +73,6 @@ public void changePatient(Ic newPatientIc) {
this.patientIc = newPatientIc;
}

public void changeStatus(String newStatus) {
this.status = newStatus;
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand All @@ -98,13 +87,12 @@ public boolean equals(Object other) {
Appointment otherAppointment = (Appointment) other;
return this.doctorIc.equals(otherAppointment.doctorIc)
&& this.patientIc.equals(otherAppointment.patientIc)
&& this.appointmentTime.equals(otherAppointment.appointmentTime)
&& this.status.equals(otherAppointment.status);
&& this.appointmentTime.equals(otherAppointment.appointmentTime);
}

@Override
public int hashCode() {
return Objects.hash(doctorIc, patientIc, appointmentTime, status);
return Objects.hash(doctorIc, patientIc, appointmentTime);
}

@Override
Expand Down
16 changes: 2 additions & 14 deletions src/main/java/seedu/address/storage/JsonAdaptedAppointment.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@ class JsonAdaptedAppointment {
private final String doctorIc;
private final String patientIc;
private final String appointmentTime;
private final String status;

/**
* Constructs a {@code JsonAdaptedTag} with the given {@code tagName}.
*/
@JsonCreator
public JsonAdaptedAppointment(@JsonProperty("doctorIc") String doctorIc,
@JsonProperty("patientIc") String patientIc,
@JsonProperty("appointmentTime") String appointmentTime,
@JsonProperty("status") String status) {
@JsonProperty("appointmentTime") String appointmentTime) {
this.doctorIc = doctorIc;
this.patientIc = patientIc;
this.appointmentTime = appointmentTime;
this.status = status;
}

/**
Expand All @@ -42,14 +39,6 @@ public JsonAdaptedAppointment(Appointment source) {
doctorIc = source.getDoctor().value;
patientIc = source.getPatient().value;
appointmentTime = source.getAppointmentTime().toString();
status = source.getStatus();
}

public String checkStatus() throws IllegalValueException {
if (status == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, "Status"));
}
return status;
}

public AppointmentTime checkAppointmentTime() throws IllegalValueException {
Expand Down Expand Up @@ -92,8 +81,7 @@ public Appointment toModelType() throws IllegalValueException {
final Ic modelDoctor = checkIc(doctorIc);
final Ic modelPatient = checkIc(patientIc);
final AppointmentTime modelAppointmentTime = checkAppointmentTime();
final String modelStatus = checkStatus();
return new Appointment(modelDoctor, modelPatient, modelAppointmentTime, modelStatus);
return new Appointment(modelDoctor, modelPatient, modelAppointmentTime);
}
}

3 changes: 3 additions & 0 deletions src/main/java/seedu/address/ui/AppointmentCard.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package seedu.address.ui;

import java.time.format.DateTimeFormatter;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
Expand All @@ -12,6 +14,7 @@
public class AppointmentCard extends UiPart<Region> {

private static final String FXML = "AppointmentListCard.fxml";
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

/**
* Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX.
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/seedu/address/ui/DoctorCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.address.model.appointment.Appointment;
import seedu.address.model.person.Doctor;


Expand Down Expand Up @@ -42,8 +41,6 @@ public class DoctorCard extends UiPart<Region> {
@FXML
private FlowPane tags;
@FXML
private FlowPane appointments;
@FXML
private Label remark;
@FXML
private Label gender;
Expand All @@ -67,14 +64,5 @@ public DoctorCard(Doctor doctor, int displayedIndex) {
doctor.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
doctor.getAppointments().stream()
.sorted(Comparator.comparing(Appointment::getAppointmentTime))
.forEach(appointment -> {
Label appointmentLabel = new Label("Appointment with Patient: " + appointment.getPatient() + " at "
+ appointment.getAppointmentTime().toString());
appointmentLabel.setWrapText(true); // Enable text wrapping
appointmentLabel.setPrefWidth(250); // Set the maximum width for text wrapping (adjust as needed)
appointments.getChildren().add(appointmentLabel);
});
}
}
Loading

0 comments on commit 0bf21f4

Please sign in to comment.