Changeset 179
- Timestamp:
- 03/25/08 12:38:43 (4 years ago)
- Files:
-
- his/trunk/data/etc/create_db.sql (modified) (3 diffs)
- his/trunk/data/pom.xml (modified) (1 diff)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/AppointmentDao.java (modified) (3 diffs)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/jpa/JpaAppointmentDao.java (modified) (8 diffs)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/model/Appointment.java (modified) (8 diffs)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/model/Attendee.java (modified) (2 diffs)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/util/CalDavConnector.java (added)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/util/CalDavUtil.java (added)
- his/trunk/data/src/test/java/org/joiningtracks/his/data/dao/Database.java (modified) (8 diffs)
- his/trunk/data/src/test/java/org/joiningtracks/his/data/dao/jpa/JpaAppointmentDaoTest.java (modified) (8 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/HomePanel.java (modified) (4 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/WicketApplication.properties (modified) (3 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/WicketApplication_nl.properties (modified) (3 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientCreatePage.html (modified) (1 diff)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientCreatePage.java (modified) (2 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentDetailsPanel.html (added)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentDetailsPanel.java (added)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentOverviewPanel.html (copied) (copied from his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientDetailsPanel.html) (1 diff)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentOverviewPanel.java (copied) (copied from his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientDetailsPanel.java) (2 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentsTodayPage.html (added)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentsTodayPage.java (added)
- his/trunk/frontend/internal/src/main/webapp/image/details.png (added)
- his/trunk/frontend/internal/src/main/webapp/style/jt-style.css (modified) (2 diffs)
- his/trunk/service/src/main/java/org/joiningtracks/his/service/appointment/AppointmentService.java (modified) (4 diffs)
- his/trunk/service/src/main/java/org/joiningtracks/his/service/appointment/impl/DefaultAppointmentService.java (modified) (2 diffs)
- his/trunk/service/src/test/java/org/joiningtracks/his/service/appointment/DefaultAppointmentServiceTest.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
his/trunk/data/etc/create_db.sql
r157 r179 1 2 -- Copyright 2008 Stichting JoiningTracks, The Netherlands 3 -- Licensed under the Apache License, Version 2.0 (the "License"); 4 -- you may not use this file except in compliance with the License. 5 -- You may obtain a copy of the License at 6 -- 7 -- http://www.apache.org/licenses/LICENSE-2.0 8 -- 9 -- Unless required by applicable law or agreed to in writing, 10 -- software distributed under the License is distributed on an "AS IS" BASIS, 11 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 -- See the License for the specific language governing permissions and 13 -- limitations under the License. 14 15 16 1 17 -- Table creation script for the 'Hospital Information System' database. 2 18 -- Targets MySQL version 5.x. … … 193 209 version BIGINT(20) NOT NULL default 0, 194 210 uid VARCHAR(255) NOT NULL, 211 description VARCHAR(255) NOT NULL, 195 212 start_date DATETIME NOT NULL, 196 213 end_date DATETIME NOT NULL, 214 215 197 216 198 217 PRIMARY KEY (id) … … 204 223 CREATE TABLE appointment_attendee ( 205 224 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, 206 version BIGINT(20) NOT NULL default 0, 207 patient_ref VARCHAR(255) NOT NULL, 208 present BOOL default FALSE, 209 225 version BIGINT(20) NOT NULL default 0, 226 patient_ref VARCHAR(255) NOT NULL, 227 present BIT(1), 210 228 appointment_id BIGINT(20) UNSIGNED NOT NULL, 211 229 his/trunk/data/pom.xml
r157 r179 185 185 </dependency> 186 186 187 <!-- Required for the Appointments that get fetched from caldav --> 188 <dependency> 189 <groupId>commons-httpclient</groupId> 190 <artifactId>commons-httpclient</artifactId> 191 <version>2.0.2</version> 192 </dependency> 193 194 <dependency> 195 <groupId>org.osaf</groupId> 196 <artifactId>caldav4j</artifactId> 197 <version>0.4-SNAPSHOT</version> 198 </dependency> 199 187 200 </dependencies> 188 201 his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/AppointmentDao.java
r142 r179 1 /* 2 * Copyright 2008 Stichting JoiningTracks, The Netherlands 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, 10 * software distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 1 16 package org.joiningtracks.his.data.dao; 2 17 18 import org.joda.time.DateTime; 3 19 import org.joiningtracks.his.data.model.Appointment; 4 import org.joda.time.LocalDate;5 20 6 21 import java.util.List; … … 18 33 * @param startDate the start date of the period in which to find appointments 19 34 * @param endDate the end date of the period in which to find appointments 20 * @param from index of first entry to find21 * @param count number of entries to return22 35 * @param sortProperty property to sort on or null for no sorting. 23 36 * Valid values are: startDate, endDate etc. … … 26 39 */ 27 40 28 List<Appointment> findAppointments(LocalDate startDate, LocalDate endDate, int from, int count, String sortProperty, boolean sortAsc); 41 List<Appointment> findAppointments(DateTime startDate, DateTime endDate, String sortProperty, boolean sortAsc); 42 29 43 } his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/jpa/JpaAppointmentDao.java
r142 r179 16 16 package org.joiningtracks.his.data.dao.jpa; 17 17 18 import org.joda.time.LocalDate; 18 import net.fortuna.ical4j.model.*; 19 import net.fortuna.ical4j.model.component.VEvent; 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 import org.joda.time.DateTime; 19 23 import org.joiningtracks.his.data.dao.AppointmentDao; 20 24 import org.joiningtracks.his.data.model.Appointment; 25 import org.joiningtracks.his.data.model.Attendee; 26 import org.joiningtracks.his.data.util.CalDavConnector; 27 import org.joiningtracks.his.data.util.CalDavUtil; 21 28 import org.joiningtracks.his.support.util.string.StringUtils; 29 import org.osaf.caldav4j.CalDAV4JException; 22 30 23 31 import javax.persistence.Query; 24 import java.util.ArrayList; 25 import java.util.HashMap; 26 import java.util.List; 27 import java.util.Map; 32 import java.util.*; 28 33 29 34 /** … … 33 38 */ 34 39 public class JpaAppointmentDao extends AbstractJpaDao<Appointment> implements AppointmentDao { 40 private final static Log log = LogFactory.getLog(JpaAppointmentDao.class); 35 41 36 42 public JpaAppointmentDao() { … … 43 49 * @param startDate the start date of the period in which to find appointments 44 50 * @param endDate the end date of the period in which to find appointments 45 * @param from index of first entry to find46 * @param count number of entries to return47 51 * @param sortProperty property to sort on or null for no sorting. 48 52 * Valid values are: startDate, endDate etc. … … 50 54 * @return found appointments (not null) 51 55 */ 52 public List<Appointment> findAppointments( LocalDate startDate, LocalDate endDate, int from, int count, String sortProperty, boolean sortAsc) {56 public List<Appointment> findAppointments(DateTime startDate, DateTime endDate, String sortProperty, boolean sortAsc) { 53 57 Map<String, Object> parameters = new HashMap<String, Object>(); 54 58 … … 66 70 } 67 71 if (whereClauses.size() != 0) { 68 jql.append("where ").append(StringUtils.join(whereClauses, " and "));72 jql.append("where ").append(StringUtils.join(whereClauses, " and ")); 69 73 } 70 74 71 75 if (sortProperty != null) { 72 76 if (isValidSortProperty(sortProperty)) { 73 jql.append(" order by p." +sortProperty);77 jql.append(" order by p.").append(sortProperty); 74 78 75 79 if (!sortAsc) { … … 83 87 query.setParameter(entry.getKey(), entry.getValue()); 84 88 } 85 query.setFirstResult(from); 86 query.setMaxResults(count); 87 return query.getResultList(); 89 90 List<Appointment> returnValue = query.getResultList(); 91 92 // First fetch the appointments from the database, then do a CalDav query 93 returnValue.addAll(fetchAppointments(startDate, endDate)); 94 95 Collections.sort(returnValue); 96 97 return returnValue; 88 98 } 89 99 90 100 //=========================================== Helper methods ======================================================= 101 102 /** 103 * Return all appointments from CalDav that are not yet in the database 104 * @param startDate The start date of the period from which to return appointments 105 * @param endDate The end date of the period from which to return appointments 106 * @return The appointments from CalDav 107 */ 108 private List<Appointment> fetchAppointments(DateTime startDate, DateTime endDate){ 109 // Fetch the appointments of some period from CalDav 110 ArrayList<Appointment> returnValue = new ArrayList<Appointment>(); 111 112 CalDavConnector caldavConnector = new CalDavConnector("arts02", "arts02"); 113 114 try { 115 log.debug("Getting events from: " + startDate + " to " + endDate); 116 List<VEvent> eventList = caldavConnector.getEvents(startDate, endDate); 117 log.debug("Events fetched"); 118 log.debug("Number of events: " + eventList.size()); 119 log.debug("Events:" + eventList.toString()); 120 Period queryPeriod = new Period(CalDavUtil.toIcalDate(startDate), CalDavUtil.toIcalDate(endDate)); 121 122 for (VEvent event : eventList) { 123 PeriodList periodList = event.calculateRecurrenceSet(queryPeriod); 124 log.debug(periodList); 125 126 for(Object each : periodList){ 127 Period period = (Period) each; 128 129 org.joda.time.DateTime periodStartDate=new org.joda.time.DateTime(period.getStart()); 130 org.joda.time.DateTime periodEndDate=new org.joda.time.DateTime(period.getEnd()); 131 132 // Does the appointment already exist? 133 String uid = event.getUid().getValue(); 134 log.debug("UID:" + uid); 135 136 Appointment appointment = getAppointment(uid, periodStartDate, periodEndDate); 137 // If appointment doesn't exist yet, then return it 138 if(appointment == null){ 139 log.debug("Appointment not yet exists in database"); 140 returnValue.add(createAppointmentFromEvent(event, period)); 141 } else { 142 log.debug("Appointment already exists in database"); 143 // Update appointment 144 Appointment updatedAppointment=updateAppointmentFromEvent(appointment, event); 145 update(updatedAppointment); 146 } 147 } 148 } 149 } 150 catch (CalDAV4JException e) { 151 log.error("Error occured while trying to fetch items via caldav", e); 152 } 153 return returnValue; 154 } 155 156 private Appointment updateAppointmentFromEvent(Appointment appointment, VEvent event) { 157 // Update description 158 try { 159 appointment.setDescription(event.getSummary().getValue()); 160 } catch(NullPointerException x) { 161 log.debug("Event with null description encountered (ignored)"); 162 } 163 164 // TODO: Update attendees 165 166 return appointment; 167 } 168 169 private Appointment createAppointmentFromEvent(VEvent event, Period period) { 170 String uid = event.getUid().getValue(); 171 172 ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 173 174 // Get a list of all attendees and add them to the appointment 175 for(Object attendeeObject : event.getProperties(Property.ATTENDEE)){ 176 net.fortuna.ical4j.model.property.Attendee attendee = (net.fortuna.ical4j.model.property.Attendee) attendeeObject; 177 178 log.debug("CalAddress: " + attendee.getCalAddress()); 179 log.debug("Value: " + attendee.getValue()); 180 181 attendees.add(new Attendee(attendee.getCalAddress().toString(), false)); 182 } 183 184 org.joda.time.DateTime periodStartDate=new org.joda.time.DateTime(period.getStart()); 185 org.joda.time.DateTime periodEndDate=new org.joda.time.DateTime(period.getEnd()); 186 187 String description = ""; 188 189 try { 190 description = event.getSummary().getValue(); 191 } catch(NullPointerException x) { 192 log.debug("Event with null description encountered (ignored)"); 193 } 194 195 return new Appointment(uid, description, periodStartDate, periodEndDate, attendees); 196 } 91 197 92 198 /** 93 199 * Returns true if the given sort property is valid. 94 * Valid sort properties: " firstName", "lastName", "initials", "birthDate", "gender" and "address.street"200 * Valid sort properties: "startDate" 95 201 * 96 202 * @param sortProperty the given sort property … … 100 206 String[] validSortProperties = {"startDate"}; 101 207 102 for (String validPropert ie: validSortProperties) {103 if (sortProperty.equals(validPropert ie)) {208 for (String validProperty : validSortProperties) { 209 if (sortProperty.equals(validProperty)) { 104 210 return true; 105 211 } … … 108 214 } 109 215 216 /** Get a single appointment from the database 217 * 218 * @param uid The CalDav UID 219 * @param startDate Start date and time of the appointment 220 * @param endDate End date and time of the appointment 221 * @return the appointment 222 */ 223 private Appointment getAppointment(String uid, DateTime startDate, DateTime endDate) { 224 Map<String, Object> parameters = new HashMap<String, Object>(); 225 226 StringBuilder jql = new StringBuilder(); 227 jql.append("select p from Appointment p "); 228 229 List<String> whereClauses = new ArrayList<String>(1); 230 231 whereClauses.add("p.uid = :uid"); 232 parameters.put("uid", uid); 233 234 if (startDate != null) { 235 whereClauses.add("p.startDate = :startDate"); 236 parameters.put("startDate", startDate); 237 } 238 if (endDate != null) { 239 whereClauses.add("p.endDate = :endDate"); 240 parameters.put("endDate", endDate); 241 } 242 if (whereClauses.size() != 0) { 243 jql.append("where ").append(StringUtils.join(whereClauses, " and ")); 244 } 245 246 Query query = entityManager.createQuery(jql.toString()); 247 for (Map.Entry<String, Object> entry : parameters.entrySet()) { 248 query.setParameter(entry.getKey(), entry.getValue()); 249 } 250 251 query.setMaxResults(1); 252 253 List rs = query.getResultList(); 254 255 if(rs.size()==1) 256 return (Appointment) rs.get(0); 257 else 258 return null; 259 } 110 260 } 261 his/trunk/data/src/main/java/org/joiningtracks/his/data/model/Appointment.java
r149 r179 31 31 @Entity 32 32 @Table(name = "appointment") 33 public class Appointment extends BasicEntity {33 public class Appointment extends BasicEntity implements Comparable<Appointment> { 34 34 35 @Column(name = "uid") 36 @NotNull 35 37 private String uid; 38 39 @Column(name = "description") 40 @NotNull 41 private String description; 36 42 37 43 @Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime") … … 45 51 private DateTime endDate; 46 52 47 @OneToMany(cascade = CascadeType.ALL )53 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) 48 54 @JoinColumn(name="appointment_id", referencedColumnName = "id", nullable=false) 49 55 private List<Attendee> attendees; … … 60 66 * 61 67 * @param uid The CalDav UID of the Appointment 68 * @param description The description the Appointment 62 69 * @param startDate The start date of the Appointment 63 70 * @param endDate The end date of the Appointment 64 71 * @param attendees The attendees of the Appointment 65 72 */ 66 public Appointment(String uid, DateTime startDate, DateTime endDate, List<Attendee> attendees) {67 this(null, uid, startDate, endDate, attendees);73 public Appointment(String uid, String description, DateTime startDate, DateTime endDate, List<Attendee> attendees) { 74 this(null, uid, description, startDate, endDate, attendees); 68 75 } 69 76 … … 73 80 * @param id The internal id 74 81 * @param uid The Caldav UID of the Appointment 82 * @param description The description the Appointment 75 83 * @param startDate The start date of the Appointment 76 84 * @param endDate The end date of the Appointment 77 85 * @param attendees The attendees of the Appointment 78 86 */ 79 public Appointment(Long id, String uid, DateTime startDate, DateTime endDate, List<Attendee> attendees) {87 public Appointment(Long id, String uid, String description, DateTime startDate, DateTime endDate, List<Attendee> attendees) { 80 88 super(id); 81 89 this.uid = uid; 90 this.description = description; 82 91 this.startDate = startDate; 83 92 this.endDate = endDate; … … 92 101 Appointment other = (Appointment) o; 93 102 if (uid != null ? !uid.equals(other.uid) : other.uid != null) return false; 103 if (description != null ? !uid.equals(other.description) : other.description != null) return false; 94 104 if (startDate != null ? !startDate.equals(other.startDate) : other.startDate != null) return false; 95 105 if (endDate != null ? !endDate.equals(other.endDate) : other.endDate != null) return false; … … 102 112 int result = 0; 103 113 result = 31 * result + (uid != null ? uid.hashCode() : 0); 114 result = 31 * result + (description != null ? description.hashCode() : 0); 104 115 result = 31 * result + (startDate != null ? startDate.hashCode() : 0); 105 116 result = 31 * result + (endDate != null ? endDate.hashCode() : 0); … … 117 128 public void setUid(String uid) { 118 129 this.uid = uid; 130 } 131 132 public String getDescription() { 133 return description; 134 } 135 136 public void setDescription(String description) { 137 this.description = description; 119 138 } 120 139 … … 143 162 } 144 163 164 public int compareTo(Appointment appointment) { 165 long startDate1 = this.getStartDate().getMillis(); 166 long startDate2 = appointment.getStartDate().getMillis(); 167 168 if (startDate1 < startDate2) return -1; 169 if (startDate2 < startDate1) return 1; 170 171 return 0; 172 } 145 173 } his/trunk/data/src/main/java/org/joiningtracks/his/data/model/Attendee.java
r142 r179 18 18 import org.hibernate.validator.NotNull; 19 19 20 import javax.persistence.Embedded; 21 import javax.persistence.Entity; 22 import javax.persistence.Table; 23 import javax.persistence.Column; 20 import javax.persistence.*; 24 21 25 22 … … 102 99 this.present = present; 103 100 } 101 102 public String toString(){ 103 StringBuilder returnValue=new StringBuilder(); 104 105 returnValue.append("patient_ref: ").append(getPatient_ref()).append("\n"); 106 returnValue.append("present: ").append(getPresent()).append("\n"); 107 108 return returnValue.toString(); 109 } 104 110 } his/trunk/data/src/test/java/org/joiningtracks/his/data/dao/Database.java
r157 r179 1 /* 2 * Copyright 2008 Stichting JoiningTracks, The Netherlands 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, 10 * software distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 1 16 package org.joiningtracks.his.data.dao; 2 17 3 18 import static junit.framework.Assert.*; 4 import static junit.framework.Assert.assertEquals;19 import org.joda.time.DateTime; 5 20 import org.joda.time.LocalDate; 6 import org.joda.time.DateTime;7 import org.joda.time.LocalDateTime;8 21 import org.joda.time.contrib.hibernate.PersistentDateTime; 9 22 import org.joiningtracks.his.data.model.Patient; … … 14 27 import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; 15 28 16 import java.sql.ResultSet; 17 import java.sql.SQLException; 18 import java.sql.Timestamp; 29 import java.sql.*; 19 30 import java.util.Date; 20 import java.util.ArrayList;21 31 22 32 /** … … 57 67 * @param countryId the id of the country of the patient 58 68 * @param firstName the firstname of the patient 69 * @param middleName the middle name of the patient 59 70 * @param lastName the lastname of the patient 60 71 * @param initals the initals of the patient … … 118 129 * @param countryId the id of the country of the patient 119 130 * @param firstName the firstname of the patient 131 * @param middleName the middle name of the patient 120 132 * @param lastName the lastname of the patient 121 133 * @param initals the initals of the patient … … 328 340 //============================================== Appointment table ================================================= 329 341 342 /** 343 * Inserts an appointment into the database 344 * @param id The appointments ID 345 * @param uid The CalDav UID 346 * @param description Description of the appointment 347 * @param startDate Start date and time of the appointment 348 * @param endDate End date and time of the appointment 349 */ 350 330 351 public void insertAppointment( 331 352 long id, 332 353 String uid, 354 String description, 333 355 DateTime startDate, 334 356 DateTime endDate) { … … 340 362 .addParameter("id", id) 341 363 .addParameter("uid", uid) 364 .addParameter("description", description) 342 365 .addParameter("start_date", new java.sql.Timestamp(startDate.toDateTime().getMillis())) 343 366 .addParameter("end_date", new java.sql.Timestamp(endDate.toDateTime().getMillis())) … … 348 371 } 349 372 373 /** 374 * Verifies an appointment with the data in the database 375 * @param id The appointments ID 376 * @param uid The CalDav UID 377 * @param description Description of the appointment 378 * @param startDate Start date and time of the appointment 379 * @param endDate End date and time of the appointment 380 * @param version The version of this row 381 */ 350 382 public void verifyAppointment( 351 383 final long id, 352 384 final String uid, 385 final String description, 353 386 final DateTime startDate, 354 387 final DateTime endDate, … … 360 393 assertTrue(rs.next()); 361 394 assertEquals(uid, rs.getString("uid")); 395 assertEquals(description, rs.getString("description")); 362 396 363 397 assertEquals(new Timestamp(startDate.toDateTime().getMillis()), rs.getTimestamp("start_date")); his/trunk/data/src/test/java/org/joiningtracks/his/data/dao/jpa/JpaAppointmentDaoTest.java
r149 r179 13 13 * limitations under the License. 14 14 */ 15 15 16 package org.joiningtracks.his.data.dao.jpa; 16 17 … … 41 42 attendees.add(new Attendee("3", false)); 42 43 43 return new Appointment("UID", startDate, endDate, attendees);44 return new Appointment("UID", "Description", startDate, endDate, attendees); 44 45 } 45 46 … … 50 51 Appointment appointment = generateSimpleAppointment(); 51 52 long appointmentId = dao.save(appointment); 52 System.out.println("Appointment id: " + appointmentId); 53 db.verifyAppointment(appointmentId, "UID", appointment.getStartDate(), appointment.getEndDate(), 0); 53 db.verifyAppointment(appointmentId, "UID", "Description", appointment.getStartDate(), appointment.getEndDate(), 0); 54 54 } 55 55 … … 75 75 DateTime startDate = new DateTime(2008, 3, 2, 10, 0, 0, 0); 76 76 DateTime endDate = new DateTime(2008, 3, 10, 10, 0, 0, 0); 77 db.insertAppointment(1L, "UID", startDate, endDate);77 db.insertAppointment(1L, "UID", "Description", startDate, endDate); 78 78 79 79 Appointment appointment = dao.getById(1L); … … 97 97 /** 98 98 * Tests {@link org.joiningtracks.his.data.dao.AppointmentDao#update(Object)} 99 * @throws java.lang.Exception 99 100 */ 100 101 public void testUpdate() throws Exception { … … 103 104 DateTime startDate = new DateTime(2008, 3, 2, 10, 0, 0, 0); 104 105 DateTime endDate = new DateTime(2008, 3, 10, 10, 0, 0, 0); 105 db.insertAppointment(1L, "UID", startDate, endDate);106 db.insertAppointment(1L, "UID", "Description", startDate, endDate); 106 107 107 Appointment appointment = new Appointment(1L, "UID2", startDate, endDate, new ArrayList());108 Appointment appointment = new Appointment(1L, "UID2", "Description", startDate, endDate, new ArrayList<Attendee>()); 108 109 appointment = dao.update(appointment); 109 110 flush(); … … 113 114 assertEquals("UID2", appointment.getUid()); 114 115 115 db.verifyAppointment(1L, "UID2", startDate, endDate, VERSION_ID_AFTER_UPDATE);116 db.verifyAppointment(1L, "UID2", "Description", startDate, endDate, VERSION_ID_AFTER_UPDATE); 116 117 117 118 } … … 123 124 DateTime startDate = new DateTime(2008, 3, 2, 10, 0, 0, 0); 124 125 DateTime endDate = new DateTime(2008, 3, 10, 10, 0, 0, 0); 125 db.insertAppointment(1L, "UID", startDate, endDate);126 db.insertAppointment(1L, "UID", "Description", startDate, endDate); 126 127 127 128 Appointment appointment = dao.removeById(1L); his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/HomePanel.java
r156 r179 16 16 package org.joiningtracks.wui; 17 17 18 import org.apache.wicket.markup.html.panel.Panel; 18 19 import org.apache.wicket.model.StringResourceModel; 19 import org. apache.wicket.markup.html.panel.Panel;20 import org.joiningtracks.wui.generalpractitioner.GeneralPractitionerCreatePage; 20 21 import org.joiningtracks.wui.generalpractitioner.SearchGeneralPractitionerPage; 21 import org.joiningtracks.wui.generalpractitioner.GeneralPractitionerCreatePage;22 22 import org.joiningtracks.wui.layout.ContextNavigationLinkInfo; 23 23 import org.joiningtracks.wui.layout.NavigationBox; 24 24 import org.joiningtracks.wui.patient.*; 25 import org.joiningtracks.wui.planning.AppointmentsTodayPage; 25 26 26 27 import java.util.ArrayList; … … 34 35 * 35 36 * @param id 36 * @param breadCrumbModel37 37 */ 38 38 public HomePanel(final String id) { … … 60 60 // Add planning navigation panel 61 61 List<ContextNavigationLinkInfo> planningNavigationLinks = new ArrayList<ContextNavigationLinkInfo>(); 62 planningNavigationLinks.add(new ContextNavigationLinkInfo(this, "my_appointments", AppointmentsTodayPage.class)); 62 63 63 64 NavigationBox planningNavigationBox = new NavigationBox("planningNavigationBox", new StringResourceModel("planning", this, null), planningNavigationLinks, "image/planning_icon.png"); … … 71 72 return getString("home_title"); 72 73 } 73 74 /*75 @Override76 public List<ContextNavigationLinkInfo> getContextLinks() {77 List<ContextNavigationLinkInfo> list = new ArrayList<ContextNavigationLinkInfo>(1);78 //list.add(new ContextNavigationLinkInfo(this, "new_patient", PatientCreatePanel.class));79 //list.add(new ContextNavigationLinkInfo(this, "search_patient", SearchPatientPanel.class));80 return list;81 }82 */83 74 } his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/WicketApplication.properties
r165 r179 4 4 search_patient_title= Search a patient 5 5 search_generalpractitoner_title= Search a general practitioner 6 my_appointments=My appointments 6 7 7 8 patientDetails=Patient details … … 36 37 healthrecordinfo.type=Type 37 38 healthrecordinfo.createdOn=Date 38 39 #Patient Insurance40 #insuranceNumber=Insurance number41 #uzoviNumber=Uzovi number42 39 43 40 #Patient General Practioner … … 122 119 uniqueExternalSystemIdentifier.type=System type 123 120 uniqueExternalSystemIdentifier.uniqueIdentifier=Identifier 124 uniqueExternalSystemIdentifier.uniqueIdentifier.paper=PaperFile 121 uniqueExternalSystemIdentifier.uniqueIdentifier.paper=Dossier number 122 123 # Appointments 124 noAppointmentsFound=No appointments found 125 appointmentsOverviewHelp=Click on an appointment to see the details. 126 closeWindow=Close the appointment window 127 from=From 128 to=To 129 attendees=Attendees 130 appointmentUpdateError=Error updating appointment 131 appointmentUpdateOptimisticLockingError=Error updating appointment (someone else already updated this appointment) 132 appointmentUpdateConstraintViolationExceptionError=Error updating appointment his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/WicketApplication_nl.properties
r153 r179 4 4 search_patient_title= Zoek een pati\u00ebnt 5 5 search_generalpractitoner_title= Zoek een huisarts 6 my_appointments=Mijn afspraken 6 7 7 8 patientDetails=Pati\u00ebnt details … … 85 86 patientCreateError=Fout opgetreden bij aanmaken pati\u00ebnt 86 87 patientUpdateError=Fout opgetreden bij wijzigen pati\u00ebnt 87 patientUpdateOptimisticLockingError=Fout opgetreden bij wijzigen pati\u00ebnt (een andere gebruiker heeft de data van deze pati\u00ebnt al ge update)88 patientUpdateOptimisticLockingError=Fout opgetreden bij wijzigen pati\u00ebnt (een andere gebruiker heeft de data van deze pati\u00ebnt al gewijzigd) 88 89 patientUpdateConstraintViolationExceptionError=Fout opgetreden bij wijzigen pati\u00ebnt (combinatie van verzekeringsmaatschappij, uzovi nummer en verzekeringnummer bestaat al) 89 90 … … 108 109 uniqueExternalSystemIdentifier=Unieke systeem identifier 109 110 uniqueExternalSystemIdentifier.type=Systeem type 110 uniqueExternalSystemIdentifier.uniqueIdentifier=PaperFile 111 uniqueExternalSystemIdentifier.uniqueIdentifier=Dossiernummer 112 113 # Appointments 114 noAppointmentsFound=Geen afspraken gevonden 115 appointmentsOverviewHelp=Klik op een afspraak om details te zien. 116 closeWindow=Sluit het afspraakvenster 117 from=Van 118 to=Tot 119 attendees=Deelnemers 120 appointmentUpdateError=Fout opgetreden bij wijzigen van de afspraak 121 appointmentUpdateOptimisticLockingError=Fout opgetreden bij wijzigen van de afspraak (een andere gebruiker heeft de data van deze afspraak al gewijzigd) 122 appointmentUpdateConstraintViolationExceptionError=Fout opgetreden bij het wijzigen van de afspraak his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientCreatePage.html
r156 r179 1 1 <?xml version="1.0"?> 2 <!-- 3 ~ Copyright 2008 Stichting JoiningTracks, The Netherlands 4 ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 ~ you may not use this file except in compliance with the License. 6 ~ You may obtain a copy of the License at 7 ~ 8 ~ http://www.apache.org/licenses/LICENSE-2.0 9 ~ 10 ~ Unless required by applicable law or agreed to in writing, 11 ~ software distributed under the License is distributed on an "AS IS" BASIS, 12 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ~ See the License for the specific language governing permissions and 14 ~ limitations under the License. 15 --> 16 2 17 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 18 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientCreatePage.java
r156 r179 1 /* 2 * Copyright 2008 Stichting JoiningTracks, The Netherlands 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, 10 * software distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 1 16 package org.joiningtracks.wui.patient; 2 17 … … 4 19 import org.apache.wicket.markup.html.WebPage; 5 20 import org.joiningtracks.wui.layout.SiteUserBorder; 6 import org.joiningtracks.wui.HomePanel;7 21 8 22 /** his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentOverviewPanel.html
r144 r179 1 <!-- 2 ~ Copyright 2008 Stichting JoiningTracks, The Netherlands 3 ~ Licensed under the Apache License, Version 2.0 (the "License"); 4 ~ you may not use this file except in compliance with the License. 5 ~ You may obtain a copy of the License at 6 ~ 7 ~ http://www.apache.org/licenses/LICENSE-2.0 8 ~ 9 ~ Unless required by applicable law or agreed to in writing, 10 ~ software distributed under the License is distributed on an "AS IS" BASIS, 11 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 ~ See the License for the specific language governing permissions and 13 ~ limitations under the License. 14 --> 15 1 16 <wicket:panel> 2 <div class="pageWindow">3 < div class="title"><wicket:message key="patientDetailsTitle"/></div>4 <form wicket:id="patientDetailsForm">17 <div id="feedbackPanel"> 18 <span wicket:id="feedback"/> 19 </div> 5 20 6 <div wicket:id="patient"></div> 7 <div wicket:id="insurance"></div> 8 <div wicket:id="generalPractioner2"></div> 21 <wicket:message key="appointmentsOverviewExplanation"/> 9 22 10 <p align="center"> 11 <input type="submit" wicket:id="editButton" value="edit"/> 12 </p> 13 14 <p align="center"> 15 <select wicket:id="healthRecordFormsChoice"> 16 <option value="1">Form X</option> 17 <option value="2">Form Y</option> 18 </select> 19 </p> 20 21 </form> 22 </div> 23 <div wicket:id="appointmentDetails"/> 24 25 <span wicket:id="appointments"> 26 <div class="appointment"> 27 <table> 28 <tr> 29 <td> 30 <span wicket:id="startdate">1/1/2004</span> <br/> 31 <span wicket:id="starttime">10:00</span> 32 </td> 33 <td> 34 <a wicket:id="detailslink"><span wicket:id="description">Description of appointment.</span></a> 35 </td> 36 </tr> 37 </table> 38 </div> 39 </span> 23 40 </wicket:panel> his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentOverviewPanel.java
r144 r179 14 14 */ 15 15 16 package org.joiningtracks.wui.p atient;16 package org.joiningtracks.wui.planning; 17 17 18 import org.apache.wicket.markup.html.form.Button; 19 import org.apache.wicket.markup.html.form.ChoiceRenderer; 20 import org.apache.wicket.markup.html.form.DropDownChoice; 21 import org.apache.wicket.markup.html.form.Form; 22 import org.apache.wicket.markup.html.form.IChoiceRenderer; 18 import org.apache.wicket.ajax.AjaxRequestTarget; 19 import org.apache.wicket.ajax.markup.html.AjaxLink; 20 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; 21 import org.apache.wicket.markup.html.basic.Label; 22 import org.apache.wicket.markup.html.list.ListItem; 23 import org.apache.wicket.markup.html.list.ListView; 24 import org.apache.wicket.markup.html.panel.FeedbackPanel; 23 25 import org.apache.wicket.markup.html.panel.Panel; 24 import org.apache.wicket.markup.html.panel.FeedbackPanel;25 import org.apache.wicket.model.CompoundPropertyModel;26 import org.apache.wicket.model.IModel;27 import org.apache.wicket.model.Model;28 26 import org.apache.wicket.model.PropertyModel; 29 import org.apache.wicket.model.StringResourceModel;30 27 import org.apache.wicket.spring.injection.annot.SpringBean; 31 import org.apache.wicket.MarkupContainer; 32 import org.joiningtracks.his.service.patient.PatientService; 33 import org.joiningtracks.his.frontend.internal.form.FormManager; 34 import org.joiningtracks.his.frontend.internal.form.FormDescriptor; 35 import org.joiningtracks.his.frontend.common.wicket.form.dom.DocumentSubmissionHandler; 36 import org.joiningtracks.his.frontend.common.wicket.form.FormWithAssociatedMarkup; 37 import org.joiningtracks.his.support.util.xml.XmlUtils; 28 import org.joda.time.DateTime; 29 import org.joiningtracks.his.data.model.Appointment; 30 import org.joiningtracks.his.service.appointment.AppointmentService; 38 31 import org.joiningtracks.wui.layout.ContextNavigationLinkInfo; 39 import org.joiningtracks.wui.panel.PatientDetailPanel;40 import org.joiningtracks.wui.panel.PatientGeneralPractitionerDetailPanel;41 import org.joiningtracks.wui.panel.PatientInsuranceDetailPanel;42 import org.w3c.dom.Document;43 32 33 import java.util.ArrayList; 44 34 import java.util.List; 45 import java.util.ArrayList;46 35 47 36 /** 48 * @author Tim van Baarsen 49 * @since Feb 22, 2008 37 * @author Daan van Etten 50 38 */ 51 public class PatientDetailsPanel extends Panel {39 public class AppointmentOverviewPanel extends Panel { 52 40 53 41 @SpringBean 54 private PatientService patientService;42 private AppointmentService appointmentService; 55 43 56 @SpringBean 57 private FormManager formManager; 44 private ModalWindow appointmentDetailsWindow; 45 private List<Appointment> appointmentList = new ArrayList<Appointment>(); 46 private ListView appointmentListView; 58 47 59 public PatientDetailsPanel(String id) { 60 super(id); 61 setOutputMarkupId(true); 62 } 63 64 public PatientDetailsPanel(String id, IModel patientModel) { 48 public AppointmentOverviewPanel(String id, final DateTime startDate, final DateTime endDate) { 65 49 super(id); 66 50 setOutputMarkupId(true); 67 51 68 final CompoundPropertyModel compoundPatientModel = new CompoundPropertyModel(patientModel.getObject());69 setModel(compoundPatientModel);52 final FeedbackPanel feedback = new FeedbackPanel("feedback"); 53 add(feedback); 70 54 71 Form form = new Form("patientDetailsForm", compoundPatientModel) { 72 protected void onSubmit() { 73 PatientEditPanel patientEditPanel = new PatientEditPanel("patientDetails", compoundPatientModel); 74 PatientDetailsPanel.this.getParent().replace(patientEditPanel); 55 loadData(startDate, endDate); 56 57 appointmentDetailsWindow = new ModalWindow("appointmentDetails"); 58 appointmentDetailsWindow.setInitialWidth(350); 59 appointmentDetailsWindow.setInitialHeight(300); 60 61 add(appointmentDetailsWindow); 62 63 appointmentListView = new ListView("appointments", appointmentList) { 64 public void populateItem(final ListItem listItem) { 65 Appointment appointment = (Appointment) listItem.getModelObject(); 66 67 listItem.add(new Label("startdate", appointment.getStartDate().toLocalDateTime().toString("dd-MM-yyyy"))); 68 listItem.add(new Label("starttime", appointment.getStartDate().toLocalDateTime().toString("HH:mm"))); 69 70 AjaxLink detailsLink = new AjaxLink("detailslink") { 71 public void onClick(AjaxRequestTarget target) { 72 appointmentDetailsWindow.setContent(new AppointmentDetailsPanel(appointmentDetailsWindow.getContentId(), appointmentDetailsWindow, (Appointment) listItem.getModelObject())); 73 appointmentDetailsWindow.setTitle(new PropertyModel(listItem.getModelObject(), "description")); 74 75 appointmentDetailsWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { 76 public void onClose(AjaxRequestTarget target) { 77 // Update the data when popup is closed. 78 loadData(startDate, endDate); 79 } 80 }); 81 82 appointmentDetailsWindow.show(target); 83 } 84 }; 85 86 detailsLink.add(new Label("description", new PropertyModel(listItem.getModelObject(), "description"))); 87 listItem.add(detailsLink); 75 88 } 76 89 }; 77 90 78 addPatientPanel(form);79 addInsurancePanel(form);80 addGeneralPractitionerPanel(form);81 91 82 Button button = new Button("editButton", new StringResourceModel("editButton", this, null)); 83 form.add(button); 84 85 form.add(new FormsDropDown("healthRecordFormsChoice")); 86 87 add(form); 92 add(appointmentListView); 88 93 } 89 94 90 private void addPatientPanel(Form form) { 91 Panel patientPanel = new PatientDetailPanel("patient"); 92 form.add(patientPanel); 95 96 public void loadData(DateTime startDate, DateTime endDate){ 97 appointmentList.clear(); 98 appointmentList.addAll(appointmentService.findAppointments(startDate, endDate, "startDate", true)); 99 if(appointmentList.size() == 0){ 100 error(getString("noAppointmentsFound")); 101 } 93 102 } 94 103 95 private void addInsurancePanel(Form form) {96 Panel insurancePanel = new PatientInsuranceDetailPanel("insurance", new PropertyModel(getModel(), "insurance"));97 form.add(insurancePanel);98 }99 100 private void addGeneralPractitionerPanel(Form form) {101 Panel generalPractionerPanel = new PatientGeneralPractitionerDetailPanel("generalPractioner2", new PropertyModel(getModel(), "generalPractioner"));102 form.add(generalPractionerPanel);103 }104 104 105 105 public String getTitle() { 106 return getString(" patientDetailsTitle");106 return getString("appointmentOverviewTitle"); 107 107 } 108 108 … … 110 110 return null; 111 111 } 112 113 //============================================== Inner Classes =====================================================114 115 protected class FormsDropDown extends DropDownChoice {116 117 public FormsDropDown(String id) {118 super(id, new Model(), new FormsDropDownModel(), new FormsChoiceRenderer());119 setNullValid(true);120 }121 122 /**123 * Whether this component's onSelectionChanged event handler should called using124 * javascript if the selection changes.125 *126 * @return True if this component's onSelectionChanged event handler should127 * called using javascript if the selection changes128 */129 protected boolean wantOnSelectionChangedNotifications() {130 return true;131 }132 133 /**134 * Called when a option is selected of a dropdown list that wants to be135 * notified of this event.136 *137 * @param selectedOption The newly selected object of the backing model138 */139 protected void onSelectionChanged(final Object selectedOption) {140 if (selectedOption == null) {141 //do nothing142 return;143 }144 final MarkupContainer parent = PatientDetailsPanel.this.getParent();145 FormDescriptor formDescriptor = (FormDescriptor) selectedOption;146 FormWithAssociatedMarkup form = formDescriptor.getFormFactory().createForm("form", new DocumentSubmissionHandler() {147 public void handle(FormWithAssociatedMarkup Form, Document document) {148 //TODO here we need to persist the document using the health record service.149 XmlUtils.printNice(document, System.out);150 parent.replace(PatientDetailsPanel.this);151 }152 });153 HealthRecordFormPanel healthRecordFormPanel = new HealthRecordFormPanel(PatientDetailsPanel.this.getId());154 healthRecordFormPanel.add(form);155 FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");156 healthRecordFormPanel.add(feedbackPanel);157 parent.replace(healthRecordFormPanel);158 }159 160 }161 162 /**163 * The model for this drop down. This model dynamically loads the list of available forms from the form manager.164 */165 protected class FormsDropDownModel implements IModel {166 167 public Object getObject() {168 return formManager.getAllFormDescriptors();169 }170 171 public void setObject(Object object) {172 }173 174 public void detach() {175 }176 }177 178 protected class FormsChoiceRenderer implements IChoiceRenderer {179 180 public Object getDisplayValue(Object object) {181 if (object == null) {182 //todo localize183 return getString("Choose Form");184 }185 FormDescriptor formDescriptor = (FormDescriptor)object;186 return String.format("%s (%s)", formDescriptor.getDisplayName(), formDescriptor.getVersion());187 }188 189 public String getIdValue(Object object, int index) {190 if (object == null) {191 return "";192 }193 return ((FormDescriptor)object).getId();194 }195 }196 197 112 } his/trunk/frontend/internal/src/main/webapp/style/jt-style.css
r165 r179 1 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 2 * Copyright 2008 Stichting JoiningTracks, The Netherlands 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 8 6 * 9 * http://www.apache.org/licenses/LICENSE-2.07 * http://www.apache.org/licenses/LICENSE-2.0 10 8 * 11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,9 * Unless required by applicable law or agreed to in writing, 10 * software distributed under the License is distributed on an "AS IS" BASIS, 13 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 12 * See the License for the specific language governing permissions and 15 * limitations under the License .13 * limitations under the License 16 14 */ 17 15 … … 648 646 } 649 647 650 /*div.tabpanel div.tab-row {*/ 651 /*background: #DAE0D2 url( '../image/tabs/bg.gif' ) repeat-x scroll center bottom;*/ 652 /*float: left;*/ 653 /*line-height: normal;*/ 654 /*width: 100%;*/ 655 /*}*/ 656 657 /*div.tabpanel div.tab-row ul {*/ 658 /*list-style-image: none;*/ 659 /*list-style-position: outside;*/ 660 /*list-style-type: none;*/ 661 /*margin: 0pt;*/ 662 /*padding: 10px 10px 0pt;*/ 663 /*}*/ 664 665 /*div.tabpanel div.tab-row li {*/ 666 /*background: transparent url( '../image/tabs/left.gif' ) no-repeat scroll left top;*/ 667 /*float: left;*/ 668 /*margin: 0pt;*/ 669 /*padding: 0pt 0pt 0pt 9px;*/ 670 /*}*/ 671 672 /*div.tabpanel div.tab-row a {*/ 673 /*background: transparent url( '../image/tabs/right.gif' ) no-repeat scroll right top;*/ 674 /*color: #776655;*/ 675 /*display: block;*/ 676 /*font-weight: bold;*/ 677 /*padding: 5px 15px 4px 6px;*/ 678 /*text-decoration: none;*/ 679 /*white-space: nowrap;*/ 680 /*}*/ 681 682 /*div.tabpanel div.tab-row a:hover {*/ 683 /*color: #333333;*/ 684 /*}*/ 685 686 /*div.tabpanel div.tab-row li.selected {*/ 687 /*background-image: url( '../image/tabs/left_on.gif' );*/ 688 /*}*/ 689 690 /*div.tabpanel div.tab-row li.selected a {*/ 691 /*background-image: url( '../image/tabs/right_on.gif' );*/ 692 /*color: #333333;*/ 693 /*padding-bottom: 5px;*/ 694 /*}*/ 695 696 div.tab-panel { 697 background-color: #D2E6FC; 698 } 699 700 div.tabpanel div.tab-row ul { 701 background: transparent url('../image/tabs/tab_bottom.gif') repeat-x scroll center bottom; 702 height: 20px; 703 margin: 0pt; 704 padding-left: 10px; 705 } 706 707 div.tabpanel div.tab-row li { 708 display: inline; 709 list-style-type: none; 710 margin: 0pt; 711 padding: 0pt; 712 } 713 714 div.tabpanel div.tab-row a:link, div.tabpanel div.tab-row a:visited { 715 background: #F3F3F3 none repeat scroll 0%; 716 border: 1px solid #CCCCCC; 717 color: #666666; 718 float: left; 719 font-size: 12px; 720 font-weight: bold; 721 line-height: 14px; 722 margin-right: 4px; 723 padding: 2px 10px; 724 text-decoration: none; 725 } 726 727 div.tabpanel div.tab-row li.selected a:link, div.tabpanel div.tab-row a.active:visited { 728 background: #FFFFFF none repeat scroll 0; 729 border-bottom: 1px solid #FFFFFF; 730 color: #000000; 731 } 732 733 div.tabpanel div.tab-row a:hover { 734 background: #FFFFFF none repeat scroll 0; 735 } 648 .appointment { 649 padding: 10px; 650 margin-left:25px; 651 background-color: #DDDDDD; 652 width: 400px; 653 margin-bottom:10px; 654 } 655 656 .popup_close { 657 bottom: 25px; 658 right: 25px; 659 position:absolute; 660 } 661 662 .w_close { 663 display: none; 664 } 665 666 .w_caption { 667 font-size: 15px; 668 margin-left: 0px; 669 } his/trunk/service/src/main/java/org/joiningtracks/his/service/appointment/AppointmentService.java
r142 r179 16 16 package org.joiningtracks.his.service.appointment; 17 17 18 import org.joda.time.LocalDate; 19 import org.joiningtracks.his.data.model.Patient; 18 import org.joda.time.DateTime; 20 19 import org.joiningtracks.his.data.model.Appointment; 21 20 22 import javax.persistence.EntityNotFoundException;23 21 import java.util.List; 24 22 25 23 /** 26 * Provides services related to {@link org.joiningtracks.his.data.model.Attendee attendees} and {@link org.joiningtracks.his.data.model.Appointment appointments}. 24 * Provides services related to {@link org.joiningtracks.his.data.model.Attendee attendees} and 25 * {@link org.joiningtracks.his.data.model.Appointment appointments}. 27 26 * 28 27 * @author Daan van Etten … … 63 62 64 63 /** 65 * Remove an appointment with a given id 64 * Remove an appointment with a given id. 66 65 * 67 66 * @param id the id of the Appointment 68 * @return the removed appointment or null when a non existing id for an Appointment is given 67 * @return the removed appointment or null when a non existing id for an 68 * Appointment is given 69 69 */ 70 70 Appointment removeById(long id); … … 75 75 * @param startDate the start date of the period in which to find appointments 76 76 * @param endDate the end date of the period in which to find appointments 77 * @param from index of first entry to find78 * @param count number of entries to return79 77 * @param sortProperty property to sort on or null for no sorting. 80 78 * Valid values are: startDate, endDate etc. … … 82 80 * @return found appointments (not null) 83 81 */ 84 List<Appointment> findAppointments( LocalDate startDate, LocalDate endDate, int from, int count, String sortProperty,82 List<Appointment> findAppointments(DateTime startDate, DateTime endDate, String sortProperty, 85 83 boolean sortAsc); 86 84 his/trunk/service/src/main/java/org/joiningtracks/his/service/appointment/impl/DefaultAppointmentService.java
r142 r179 16 16 package org.joiningtracks.his.service.appointment.impl; 17 17 18 import org.joda.time. LocalDate;18 import org.joda.time.DateTime; 19 19 import org.joiningtracks.his.data.dao.AppointmentDao; 20 20 import org.joiningtracks.his.data.model.Appointment; … … 72 72 } 73 73 74 public List<Appointment> findAppointments( LocalDate startDate, LocalDate endDate, int from, int count, String sortProperty, boolean sortAsc) {75 return appointmentDao.findAppointments(startDate, endDate, from, count,sortProperty, sortAsc);74 public List<Appointment> findAppointments(DateTime startDate, DateTime endDate, String sortProperty, boolean sortAsc) { 75 return appointmentDao.findAppointments(startDate, endDate, sortProperty, sortAsc); 76 76 } 77 77 his/trunk/service/src/test/java/org/joiningtracks/his/service/appointment/DefaultAppointmentServiceTest.java
r149 r179 18 18 import junit.framework.TestCase; 19 19 import static org.easymock.classextension.EasyMock.*; 20 import org.joda.time.LocalDate;21 20 import org.joda.time.DateTime; 22 21 import org.joiningtracks.his.data.dao.AppointmentDao; … … 47 46 DateTime startDate = new DateTime(2008, 1, 1, 10, 0, 0, 0); 48 47 DateTime endDate = new DateTime(2008, 1, 1, 12, 0, 0, 0); 49 ArrayList attendees = new ArrayList();48 ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 50 49 attendees.add(new Attendee("2", false)); 51 50 attendees.add(new Attendee("3", false)); 52 51 53 52 54 Appointment appointment = new Appointment("UID", startDate, endDate, attendees);53 Appointment appointment = new Appointment("UID", "Description", startDate, endDate, attendees); 55 54 56 55 long expectedId = 1L; … … 73 72 DateTime startDate = new DateTime(2008, 1, 1, 10, 0, 0, 0); 74 73 DateTime endDate = new DateTime(2008, 1, 1, 12, 0, 0, 0); 75 ArrayList attendees = new ArrayList();74 ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 76 75 attendees.add(new Attendee("2", false)); 77 76 attendees.add(new Attendee("3", false)); 78 77 79 78 80 Appointment appointment = new Appointment(1L, "UID", startDate, endDate, attendees);79 Appointment appointment = new Appointment(1L, "UID", "Description", startDate, endDate, attendees); 81 80 82 81 expect(appointmentDao.update(appointment)).andReturn(appointment); … … 97 96 DateTime startDate = new DateTime(2008, 1, 1, 10, 0, 0, 0); 98 97 DateTime endDate = new DateTime(2008, 1, 1, 12, 0, 0, 0); 99 ArrayList attendees = new ArrayList();98 ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 100 99 attendees.add(new Attendee("2", false)); 101 100 attendees.add(new Attendee("3", false)); 102 101 103 102 104 Appointment appointment = new Appointment("UID", startDate, endDate, attendees);103 Appointment appointment = new Appointment("UID", "Description", startDate, endDate, attendees); 105 104 106 105 try { … … 163 162 164 163 /** 165 * Tests {@link org.joiningtracks.his.service.appointment.impl.DefaultAppointmentService#findAppointments(org.joda.time. LocalDate, org.joda.time.LocalDate, int, int, String, boolean)}164 * Tests {@link org.joiningtracks.his.service.appointment.impl.DefaultAppointmentService#findAppointments(org.joda.time.DateTime, org.joda.time.DateTime, String, boolean)} 166 165 */ 167 166 public void testFindAppointments() { … … 170 169 171 170 List<Appointment> appointmentList = new ArrayList<Appointment>(); 172 expect(appointmentDao.findAppointments(new LocalDate(), new LocalDate(), 0, 0, "sortProperty", true)).andReturn(appointmentList);171 expect(appointmentDao.findAppointments(new DateTime(), new DateTime(), "sortProperty", true)).andReturn(appointmentList); 173 172 replay(appointmentDao); 174 173 175 appointmentService.findAppointments(new LocalDate(), new LocalDate(), 0, 0, "sortProperty", true);174 appointmentService.findAppointments(new DateTime(), new DateTime(), "sortProperty", true); 176 175 177 176 verify(appointmentDao);
