dr-dilshod / SDLCExample

Software Development Life cycle example in UML and Java
8 stars 5 forks source link

Symptom #7

Open Shohruh88 opened 5 years ago

Shohruh88 commented 5 years ago
Shohruh88 commented 5 years ago

package uz.ubtuit.se.medhistoryservice.symptom; import java.sql.Date; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import static javax.swing.text.html.FormSubmitEvent.MethodType.GET; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import uz.ubtuit.se.medhistoryservice.config.DBConnection; import uz.ubtuit.se.medhistoryservice.doctor.Doctor; public class SymptomController { @GET @Path(value = "getAllSymptoms") @Produces(value = MediaType.APPLICATION_JSON) public List getAllSymptoms() { DBConnection mysqlConnect = new DBConnection(); String sql = "SELECT * FROM symptom"; List symptoms = new ArrayList<>(); try { ResultSet resultSet = mysqlConnect.connect().createStatement().executeQuery(sql); while (resultSet.next()) { int ID = resultSet.getInt("ID"); String Name = resultSet.getString("Name"); String Information = resultSet.getString("Information"); Symptom symp = new Symptom();
symp.setName(Name); symp.setID(ID); symp.setInformation(Information);
symptoms.add(symp); } } catch (SQLException e) { e.printStackTrace(); } finally { mysqlConnect.disconnect(); } return symptoms; }

@Override
public String toString() {
    return "SymptomController{" + '}';
}

}

Shohruh88 commented 5 years ago

package uz.ubtuit.se.medhistoryservice.symptom; /*p

}