Changeset 179

Show
Ignore:
Timestamp:
03/25/08 12:38:43 (4 years ago)
Author:
daan
Message:

- Added initial version of the planning stuff.
- Updated some copyright notices.

Files:

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 
    117-- Table creation script for the 'Hospital Information System' database. 
    218-- Targets MySQL version 5.x. 
     
    193209    version                     BIGINT(20) NOT NULL default 0, 
    194210    uid                                 VARCHAR(255) NOT NULL, 
     211    description                         VARCHAR(255) NOT NULL, 
    195212    start_date                          DATETIME NOT NULL, 
    196213    end_date                            DATETIME NOT NULL, 
     214 
     215 
    197216 
    198217    PRIMARY KEY (id) 
     
    204223CREATE TABLE appointment_attendee ( 
    205224    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), 
    210228    appointment_id                              BIGINT(20) UNSIGNED NOT NULL, 
    211229 
  • his/trunk/data/pom.xml

    r157 r179  
    185185        </dependency> 
    186186 
     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 
    187200    </dependencies> 
    188201 
  • 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 
    116package org.joiningtracks.his.data.dao; 
    217 
     18import org.joda.time.DateTime; 
    319import org.joiningtracks.his.data.model.Appointment; 
    4 import org.joda.time.LocalDate; 
    520 
    621import java.util.List; 
     
    1833     * @param startDate    the start date of the period in which to find appointments 
    1934     * @param endDate      the end date of the period in which to find appointments 
    20      * @param from         index of first entry to find 
    21      * @param count        number of entries to return 
    2235     * @param sortProperty property to sort on or null for no sorting. 
    2336     *                     Valid values are: startDate, endDate etc. 
     
    2639     */ 
    2740 
    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 
    2943} 
  • his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/jpa/JpaAppointmentDao.java

    r142 r179  
    1616package org.joiningtracks.his.data.dao.jpa; 
    1717 
    18 import org.joda.time.LocalDate; 
     18import net.fortuna.ical4j.model.*; 
     19import net.fortuna.ical4j.model.component.VEvent; 
     20import org.apache.commons.logging.Log; 
     21import org.apache.commons.logging.LogFactory; 
     22import org.joda.time.DateTime; 
    1923import org.joiningtracks.his.data.dao.AppointmentDao; 
    2024import org.joiningtracks.his.data.model.Appointment; 
     25import org.joiningtracks.his.data.model.Attendee; 
     26import org.joiningtracks.his.data.util.CalDavConnector; 
     27import org.joiningtracks.his.data.util.CalDavUtil; 
    2128import org.joiningtracks.his.support.util.string.StringUtils; 
     29import org.osaf.caldav4j.CalDAV4JException; 
    2230 
    2331import javax.persistence.Query; 
    24 import java.util.ArrayList; 
    25 import java.util.HashMap; 
    26 import java.util.List; 
    27 import java.util.Map; 
     32import java.util.*; 
    2833 
    2934/** 
     
    3338 */ 
    3439public class JpaAppointmentDao extends AbstractJpaDao<Appointment> implements AppointmentDao { 
     40    private final static Log log = LogFactory.getLog(JpaAppointmentDao.class); 
    3541 
    3642    public JpaAppointmentDao() { 
     
    4349     * @param startDate    the start date of the period in which to find appointments 
    4450     * @param endDate      the end date of the period in which to find appointments 
    45      * @param from         index of first entry to find 
    46      * @param count        number of entries to return 
    4751     * @param sortProperty property to sort on or null for no sorting. 
    4852     *                     Valid values are: startDate, endDate etc. 
     
    5054     * @return found appointments (not null) 
    5155     */ 
    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) { 
    5357        Map<String, Object> parameters = new HashMap<String, Object>(); 
    5458 
     
    6670        } 
    6771        if (whereClauses.size() != 0) { 
    68             jql.append("where ").append(StringUtils.join(whereClauses, "and ")); 
     72            jql.append("where ").append(StringUtils.join(whereClauses, " and ")); 
    6973        } 
    7074 
    7175        if (sortProperty != null) { 
    7276            if (isValidSortProperty(sortProperty)) { 
    73                 jql.append(" order by p." + sortProperty); 
     77                jql.append(" order by p.").append(sortProperty); 
    7478 
    7579                if (!sortAsc) { 
     
    8387            query.setParameter(entry.getKey(), entry.getValue()); 
    8488        } 
    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; 
    8898    } 
    8999 
    90100    //=========================================== 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    } 
    91197 
    92198    /** 
    93199     * 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
    95201     * 
    96202     * @param sortProperty the given sort property 
     
    100206        String[] validSortProperties = {"startDate"}; 
    101207 
    102         for (String validPropertie : validSortProperties) { 
    103             if (sortProperty.equals(validPropertie)) { 
     208        for (String validProperty : validSortProperties) { 
     209            if (sortProperty.equals(validProperty)) { 
    104210                return true; 
    105211            } 
     
    108214    } 
    109215 
     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    } 
    110260} 
     261 
  • his/trunk/data/src/main/java/org/joiningtracks/his/data/model/Appointment.java

    r149 r179  
    3131@Entity 
    3232@Table(name = "appointment") 
    33 public class Appointment extends BasicEntity
     33public class Appointment extends BasicEntity implements Comparable<Appointment>
    3434 
     35    @Column(name = "uid") 
     36    @NotNull 
    3537    private String uid; 
     38 
     39    @Column(name = "description") 
     40    @NotNull 
     41    private String description; 
    3642 
    3743    @Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime") 
     
    4551    private DateTime endDate; 
    4652 
    47     @OneToMany(cascade = CascadeType.ALL
     53    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER
    4854    @JoinColumn(name="appointment_id", referencedColumnName = "id", nullable=false) 
    4955    private List<Attendee> attendees; 
     
    6066     * 
    6167     * @param uid       The CalDav UID of the Appointment 
     68     * @param description The description the Appointment 
    6269     * @param startDate The start date of the Appointment 
    6370     * @param endDate   The end date of the Appointment 
    6471     * @param attendees The attendees of the Appointment 
    6572     */ 
    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); 
    6875    } 
    6976 
     
    7380     * @param id        The internal id 
    7481     * @param uid       The Caldav UID of the Appointment 
     82     * @param description The description the Appointment 
    7583     * @param startDate The start date of the Appointment 
    7684     * @param endDate   The end date of the Appointment 
    7785     * @param attendees The attendees of the Appointment 
    7886     */ 
    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) { 
    8088        super(id); 
    8189        this.uid = uid; 
     90        this.description = description; 
    8291        this.startDate = startDate; 
    8392        this.endDate = endDate; 
     
    92101        Appointment other = (Appointment) o; 
    93102        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; 
    94104        if (startDate != null ? !startDate.equals(other.startDate) : other.startDate != null) return false; 
    95105        if (endDate != null ? !endDate.equals(other.endDate) : other.endDate != null) return false; 
     
    102112        int result = 0; 
    103113        result = 31 * result + (uid != null ? uid.hashCode() : 0); 
     114        result = 31 * result + (description != null ? description.hashCode() : 0); 
    104115        result = 31 * result + (startDate != null ? startDate.hashCode() : 0); 
    105116        result = 31 * result + (endDate != null ? endDate.hashCode() : 0); 
     
    117128    public void setUid(String uid) { 
    118129        this.uid = uid; 
     130    } 
     131 
     132    public String getDescription() { 
     133        return description; 
     134    } 
     135 
     136    public void setDescription(String description) { 
     137        this.description = description; 
    119138    } 
    120139 
     
    143162    } 
    144163 
     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    } 
    145173} 
  • his/trunk/data/src/main/java/org/joiningtracks/his/data/model/Attendee.java

    r142 r179  
    1818import org.hibernate.validator.NotNull; 
    1919 
    20 import javax.persistence.Embedded; 
    21 import javax.persistence.Entity; 
    22 import javax.persistence.Table; 
    23 import javax.persistence.Column; 
     20import javax.persistence.*; 
    2421 
    2522 
     
    10299                this.present = present; 
    103100        } 
     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    } 
    104110} 
  • 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 
    116package org.joiningtracks.his.data.dao; 
    217 
    318import static junit.framework.Assert.*; 
    4 import static junit.framework.Assert.assertEquals
     19import org.joda.time.DateTime
    520import org.joda.time.LocalDate; 
    6 import org.joda.time.DateTime; 
    7 import org.joda.time.LocalDateTime; 
    821import org.joda.time.contrib.hibernate.PersistentDateTime; 
    922import org.joiningtracks.his.data.model.Patient; 
     
    1427import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; 
    1528 
    16 import java.sql.ResultSet; 
    17 import java.sql.SQLException; 
    18 import java.sql.Timestamp; 
     29import java.sql.*; 
    1930import java.util.Date; 
    20 import java.util.ArrayList; 
    2131 
    2232/** 
     
    5767     * @param countryId           the id of the country of the patient 
    5868     * @param firstName           the firstname of the patient 
     69     * @param middleName          the middle name of the patient 
    5970     * @param lastName            the lastname of the patient 
    6071     * @param initals             the initals of the patient 
     
    118129     * @param countryId           the id of the country of the patient 
    119130     * @param firstName           the firstname of the patient 
     131     * @param middleName          the middle name of the patient 
    120132     * @param lastName            the lastname of the patient 
    121133     * @param initals             the initals of the patient 
     
    328340    //============================================== Appointment table ================================================= 
    329341 
     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 
    330351    public void insertAppointment( 
    331352            long id, 
    332353            String uid, 
     354            String description, 
    333355            DateTime startDate, 
    334356            DateTime endDate) { 
     
    340362                .addParameter("id", id) 
    341363                .addParameter("uid", uid) 
     364                .addParameter("description", description) 
    342365                .addParameter("start_date", new java.sql.Timestamp(startDate.toDateTime().getMillis())) 
    343366                .addParameter("end_date", new java.sql.Timestamp(endDate.toDateTime().getMillis())) 
     
    348371    } 
    349372 
     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     */ 
    350382    public void verifyAppointment( 
    351383            final long id, 
    352384            final String uid, 
     385            final String description, 
    353386            final DateTime startDate, 
    354387            final DateTime endDate, 
     
    360393                assertTrue(rs.next()); 
    361394                assertEquals(uid, rs.getString("uid")); 
     395                assertEquals(description, rs.getString("description")); 
    362396 
    363397                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  
    1313 * limitations under the License. 
    1414 */ 
     15 
    1516package org.joiningtracks.his.data.dao.jpa; 
    1617 
     
    4142        attendees.add(new Attendee("3", false)); 
    4243 
    43         return new Appointment("UID", startDate, endDate, attendees); 
     44        return new Appointment("UID", "Description", startDate, endDate, attendees); 
    4445    } 
    4546 
     
    5051        Appointment appointment = generateSimpleAppointment(); 
    5152        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); 
    5454    } 
    5555 
     
    7575        DateTime startDate = new DateTime(2008, 3, 2,  10, 0, 0, 0); 
    7676        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); 
    7878 
    7979        Appointment appointment = dao.getById(1L); 
     
    9797    /** 
    9898     * Tests {@link org.joiningtracks.his.data.dao.AppointmentDao#update(Object)} 
     99     * @throws java.lang.Exception 
    99100     */ 
    100101    public void testUpdate() throws Exception { 
     
    103104        DateTime startDate = new DateTime(2008, 3, 2,  10, 0, 0, 0); 
    104105        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); 
    106107 
    107         Appointment appointment = new Appointment(1L, "UID2", startDate, endDate, new ArrayList()); 
     108        Appointment appointment = new Appointment(1L, "UID2", "Description", startDate, endDate, new ArrayList<Attendee>()); 
    108109        appointment = dao.update(appointment); 
    109110        flush(); 
     
    113114        assertEquals("UID2", appointment.getUid()); 
    114115 
    115         db.verifyAppointment(1L, "UID2", startDate, endDate, VERSION_ID_AFTER_UPDATE); 
     116        db.verifyAppointment(1L, "UID2", "Description", startDate, endDate, VERSION_ID_AFTER_UPDATE); 
    116117 
    117118    } 
     
    123124        DateTime startDate = new DateTime(2008, 3, 2,  10, 0, 0, 0); 
    124125        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); 
    126127 
    127128        Appointment appointment = dao.removeById(1L); 
  • his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/HomePanel.java

    r156 r179  
    1616package org.joiningtracks.wui; 
    1717 
     18import org.apache.wicket.markup.html.panel.Panel; 
    1819import org.apache.wicket.model.StringResourceModel; 
    19 import org.apache.wicket.markup.html.panel.Panel
     20import org.joiningtracks.wui.generalpractitioner.GeneralPractitionerCreatePage
    2021import org.joiningtracks.wui.generalpractitioner.SearchGeneralPractitionerPage; 
    21 import org.joiningtracks.wui.generalpractitioner.GeneralPractitionerCreatePage; 
    2222import org.joiningtracks.wui.layout.ContextNavigationLinkInfo; 
    2323import org.joiningtracks.wui.layout.NavigationBox; 
    2424import org.joiningtracks.wui.patient.*; 
     25import org.joiningtracks.wui.planning.AppointmentsTodayPage; 
    2526 
    2627import java.util.ArrayList; 
     
    3435     * 
    3536     * @param id 
    36      * @param breadCrumbModel 
    3737     */ 
    3838    public HomePanel(final String id) { 
     
    6060        // Add planning navigation panel 
    6161        List<ContextNavigationLinkInfo> planningNavigationLinks = new ArrayList<ContextNavigationLinkInfo>(); 
     62        planningNavigationLinks.add(new ContextNavigationLinkInfo(this, "my_appointments", AppointmentsTodayPage.class)); 
    6263 
    6364        NavigationBox planningNavigationBox = new NavigationBox("planningNavigationBox", new StringResourceModel("planning", this, null), planningNavigationLinks, "image/planning_icon.png"); 
     
    7172        return getString("home_title"); 
    7273    } 
    73  
    74     /* 
    75     @Override 
    76     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     */ 
    8374} 
  • his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/WicketApplication.properties

    r165 r179  
    44search_patient_title= Search a patient 
    55search_generalpractitoner_title= Search a general practitioner 
     6my_appointments=My appointments 
    67 
    78patientDetails=Patient details 
     
    3637healthrecordinfo.type=Type 
    3738healthrecordinfo.createdOn=Date 
    38  
    39 #Patient Insurance 
    40 #insuranceNumber=Insurance number 
    41 #uzoviNumber=Uzovi number 
    4239 
    4340#Patient General Practioner 
     
    122119uniqueExternalSystemIdentifier.type=System type 
    123120uniqueExternalSystemIdentifier.uniqueIdentifier=Identifier 
    124 uniqueExternalSystemIdentifier.uniqueIdentifier.paper=PaperFile 
     121uniqueExternalSystemIdentifier.uniqueIdentifier.paper=Dossier number 
     122 
     123# Appointments 
     124noAppointmentsFound=No appointments found 
     125appointmentsOverviewHelp=Click on an appointment to see the details. 
     126closeWindow=Close the appointment window 
     127from=From 
     128to=To 
     129attendees=Attendees 
     130appointmentUpdateError=Error updating appointment 
     131appointmentUpdateOptimisticLockingError=Error updating appointment (someone else already updated this appointment) 
     132appointmentUpdateConstraintViolationExceptionError=Error updating appointment 
  • his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/WicketApplication_nl.properties

    r153 r179  
    44search_patient_title= Zoek een pati\u00ebnt 
    55search_generalpractitoner_title= Zoek een huisarts 
     6my_appointments=Mijn afspraken 
    67 
    78patientDetails=Pati\u00ebnt details 
     
    8586patientCreateError=Fout opgetreden bij aanmaken pati\u00ebnt 
    8687patientUpdateError=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 geupdate
     88patientUpdateOptimisticLockingError=Fout opgetreden bij wijzigen pati\u00ebnt (een andere gebruiker heeft de data van deze pati\u00ebnt al gewijzigd
    8889patientUpdateConstraintViolationExceptionError=Fout opgetreden bij wijzigen pati\u00ebnt (combinatie van verzekeringsmaatschappij, uzovi nummer en verzekeringnummer bestaat al) 
    8990 
     
    108109uniqueExternalSystemIdentifier=Unieke systeem identifier 
    109110uniqueExternalSystemIdentifier.type=Systeem type 
    110 uniqueExternalSystemIdentifier.uniqueIdentifier=PaperFile 
     111uniqueExternalSystemIdentifier.uniqueIdentifier=Dossiernummer 
     112 
     113# Appointments 
     114noAppointmentsFound=Geen afspraken gevonden 
     115appointmentsOverviewHelp=Klik op een afspraak om details te zien. 
     116closeWindow=Sluit het afspraakvenster 
     117from=Van 
     118to=Tot 
     119attendees=Deelnemers 
     120appointmentUpdateError=Fout opgetreden bij wijzigen van de afspraak 
     121appointmentUpdateOptimisticLockingError=Fout opgetreden bij wijzigen van de afspraak (een andere gebruiker heeft de data van deze afspraak al gewijzigd) 
     122appointmentUpdateConstraintViolationExceptionError=Fout opgetreden bij het wijzigen van de afspraak 
  • his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/patient/PatientCreatePage.html

    r156 r179  
    11<?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 
    217<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
    318<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 
    116package org.joiningtracks.wui.patient; 
    217 
     
    419import org.apache.wicket.markup.html.WebPage; 
    520import org.joiningtracks.wui.layout.SiteUserBorder; 
    6 import org.joiningtracks.wui.HomePanel; 
    721 
    822/** 
  • 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 
    116<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
    520 
    6             <div wicket:id="patient"></div> 
    7             <div wicket:id="insurance"></div> 
    8             <div wicket:id="generalPractioner2"></div> 
     21    <wicket:message key="appointmentsOverviewExplanation"/> 
    922 
    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> 
    2340</wicket:panel> 
  • his/trunk/frontend/internal/src/main/java/org/joiningtracks/wui/planning/AppointmentOverviewPanel.java

    r144 r179  
    1414 */ 
    1515 
    16 package org.joiningtracks.wui.patient
     16package org.joiningtracks.wui.planning
    1717 
    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; 
     18import org.apache.wicket.ajax.AjaxRequestTarget; 
     19import org.apache.wicket.ajax.markup.html.AjaxLink; 
     20import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; 
     21import org.apache.wicket.markup.html.basic.Label; 
     22import org.apache.wicket.markup.html.list.ListItem; 
     23import org.apache.wicket.markup.html.list.ListView; 
     24import org.apache.wicket.markup.html.panel.FeedbackPanel; 
    2325import 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; 
    2826import org.apache.wicket.model.PropertyModel; 
    29 import org.apache.wicket.model.StringResourceModel; 
    3027import 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; 
     28import org.joda.time.DateTime; 
     29import org.joiningtracks.his.data.model.Appointment; 
     30import org.joiningtracks.his.service.appointment.AppointmentService; 
    3831import 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; 
    4332 
     33import java.util.ArrayList; 
    4434import java.util.List; 
    45 import java.util.ArrayList; 
    4635 
    4736/** 
    48  * @author Tim van Baarsen 
    49  * @since Feb 22, 2008 
     37 * @author Daan van Etten 
    5038 */ 
    51 public class PatientDetailsPanel extends Panel { 
     39public class AppointmentOverviewPanel extends Panel { 
    5240 
    5341    @SpringBean 
    54     private PatientService patientService; 
     42    private AppointmentService appointmentService; 
    5543 
    56     @SpringBean 
    57     private FormManager formManager; 
     44    private ModalWindow appointmentDetailsWindow; 
     45    private List<Appointment> appointmentList = new ArrayList<Appointment>(); 
     46    private ListView appointmentListView; 
    5847 
    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) { 
    6549        super(id); 
    6650        setOutputMarkupId(true); 
    6751 
    68         final CompoundPropertyModel compoundPatientModel = new CompoundPropertyModel(patientModel.getObject()); 
    69         setModel(compoundPatientModel); 
     52        final FeedbackPanel feedback = new FeedbackPanel("feedback"); 
     53        add(feedback); 
    7054 
    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); 
    7588            } 
    7689        }; 
    7790 
    78         addPatientPanel(form); 
    79         addInsurancePanel(form); 
    80         addGeneralPractitionerPanel(form); 
    8191 
    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); 
    8893    } 
    8994 
    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        }         
    93102    } 
    94103 
    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     } 
    104104 
    105105    public String getTitle() { 
    106         return getString("patientDetailsTitle"); 
     106        return getString("appointmentOverviewTitle"); 
    107107    } 
    108108 
     
    110110        return null; 
    111111    } 
    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 using 
    124          * javascript if the selection changes. 
    125          * 
    126          * @return True if this component's onSelectionChanged event handler should 
    127          *         called using javascript if the selection changes 
    128          */ 
    129         protected boolean wantOnSelectionChangedNotifications() { 
    130             return true; 
    131         } 
    132  
    133         /** 
    134          * Called when a option is selected of a dropdown list that wants to be 
    135          * notified of this event. 
    136          * 
    137          * @param selectedOption The newly selected object of the backing model 
    138          */ 
    139         protected void onSelectionChanged(final Object selectedOption) { 
    140             if (selectedOption == null) { 
    141                 //do nothing 
    142                 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 localize 
    183                 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  
    197112} 
  • his/trunk/frontend/internal/src/main/webapp/style/jt-style.css

    r165 r179  
    11/* 
    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 
    86 * 
    9  *      http://www.apache.org/licenses/LICENSE-2.0 
     7 * http://www.apache.org/licenses/LICENSE-2.0 
    108 * 
    11  * Unless required by applicable law or agreed to in writing, software 
    12  * 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, 
    1311 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    1412 * See the License for the specific language governing permissions and 
    15  * limitations under the License. 
     13 * limitations under the License 
    1614 */ 
    1715 
     
    648646} 
    649647 
    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  
    1616package org.joiningtracks.his.service.appointment; 
    1717 
    18 import org.joda.time.LocalDate; 
    19 import org.joiningtracks.his.data.model.Patient; 
     18import org.joda.time.DateTime; 
    2019import org.joiningtracks.his.data.model.Appointment; 
    2120 
    22 import javax.persistence.EntityNotFoundException; 
    2321import java.util.List; 
    2422 
    2523/** 
    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}. 
    2726 * 
    2827 * @author Daan van Etten 
     
    6362 
    6463    /** 
    65      * Remove an appointment with a given id 
     64     * Remove an appointment with a given id. 
    6665     * 
    6766     * @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 
    6969     */ 
    7070    Appointment removeById(long id); 
     
    7575     * @param startDate    the start date of the period in which to find appointments 
    7676     * @param endDate      the end date of the period in which to find appointments 
    77      * @param from         index of first entry to find 
    78      * @param count        number of entries to return 
    7977     * @param sortProperty property to sort on or null for no sorting. 
    8078     *                     Valid values are: startDate, endDate etc. 
     
    8280     * @return found appointments (not null) 
    8381     */ 
    84     List<Appointment> findAppointments(LocalDate startDate, LocalDate endDate, int from, int count, String sortProperty, 
     82    List<Appointment> findAppointments(DateTime startDate, DateTime endDate, String sortProperty, 
    8583                               boolean sortAsc); 
    8684 
  • his/trunk/service/src/main/java/org/joiningtracks/his/service/appointment/impl/DefaultAppointmentService.java

    r142 r179  
    1616package org.joiningtracks.his.service.appointment.impl; 
    1717 
    18 import org.joda.time.LocalDate; 
     18import org.joda.time.DateTime; 
    1919import org.joiningtracks.his.data.dao.AppointmentDao; 
    2020import org.joiningtracks.his.data.model.Appointment; 
     
    7272    } 
    7373 
    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); 
    7676    } 
    7777 
  • his/trunk/service/src/test/java/org/joiningtracks/his/service/appointment/DefaultAppointmentServiceTest.java

    r149 r179  
    1818import junit.framework.TestCase; 
    1919import static org.easymock.classextension.EasyMock.*; 
    20 import org.joda.time.LocalDate; 
    2120import org.joda.time.DateTime; 
    2221import org.joiningtracks.his.data.dao.AppointmentDao; 
     
    4746        DateTime startDate = new DateTime(2008, 1, 1, 10, 0, 0, 0); 
    4847        DateTime endDate = new DateTime(2008, 1, 1, 12, 0, 0, 0); 
    49         ArrayList attendees = new ArrayList(); 
     48        ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 
    5049        attendees.add(new Attendee("2", false)); 
    5150        attendees.add(new Attendee("3", false)); 
    5251 
    5352 
    54         Appointment appointment = new Appointment("UID", startDate, endDate, attendees); 
     53        Appointment appointment = new Appointment("UID", "Description", startDate, endDate, attendees); 
    5554 
    5655        long expectedId = 1L; 
     
    7372        DateTime startDate = new DateTime(2008, 1, 1, 10, 0, 0, 0); 
    7473        DateTime endDate = new DateTime(2008, 1, 1, 12, 0, 0, 0); 
    75         ArrayList attendees = new ArrayList(); 
     74        ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 
    7675        attendees.add(new Attendee("2", false)); 
    7776        attendees.add(new Attendee("3", false)); 
    7877 
    7978 
    80         Appointment appointment = new Appointment(1L, "UID", startDate, endDate, attendees); 
     79        Appointment appointment = new Appointment(1L, "UID", "Description", startDate, endDate, attendees); 
    8180         
    8281        expect(appointmentDao.update(appointment)).andReturn(appointment); 
     
    9796        DateTime startDate = new DateTime(2008, 1, 1, 10, 0, 0, 0); 
    9897        DateTime endDate = new DateTime(2008, 1, 1, 12, 0, 0, 0); 
    99         ArrayList attendees = new ArrayList(); 
     98        ArrayList<Attendee> attendees = new ArrayList<Attendee>(); 
    10099        attendees.add(new Attendee("2", false)); 
    101100        attendees.add(new Attendee("3", false)); 
    102101 
    103102 
    104         Appointment appointment = new Appointment("UID", startDate, endDate, attendees); 
     103        Appointment appointment = new Appointment("UID", "Description", startDate, endDate, attendees); 
    105104 
    106105        try { 
     
    163162 
    164163    /** 
    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)} 
    166165     */ 
    167166    public void testFindAppointments() { 
     
    170169 
    171170        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); 
    173172        replay(appointmentDao); 
    174173 
    175         appointmentService.findAppointments(new LocalDate(), new LocalDate(), 0, 0, "sortProperty", true); 
     174        appointmentService.findAppointments(new DateTime(), new DateTime(), "sortProperty", true); 
    176175 
    177176        verify(appointmentDao);