?
Solved

help with a DB schema..

Posted on 2012-04-04
3
Medium Priority
?
320 Views
Last Modified: 2012-04-05
Hi, I am building a calendar application in PHP with a Mysql db. I have got the front end to work ( attached is the jpeg image). This calendar schedule is for each one of my patients. A patient may have 1 to  6 visits per week over  period of 60 days ( that is the reason the calendar has a 60 day view ). The max number of visits can be upto 3 times per day. Can someone suggest a schema I can use to build this calendar. I have another table that has all the patient details and each patient has a unique ID. Thank you for the help.

A
calendar.jpg
0
Comment
Question by:aej1973
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Scott Madeira earned 1000 total points
ID: 37806286
I think you need the following fields in your calendar table:

visitID - int, primary Key
patientID - int

description varchar(50) // If you want the ability to have different kinds of appointments.
OR
descriptionID (int) // If you want to have a defined selection of appointment types chosen from a drop-down  You would
                              // have a separate description table

startDate  - datetime
endDate - datetime
//Give the ability to cancel an appointment but not delete it from the database
active - int or boolean

// Information on
createdBy - varchar(50)
createdDate - datetime
updatedBy - varchar(50)
updatedDate - datetime

For your business rules on appointments you would need to check those in your PHP code before creating an appointment or updating an existing appointment.  I don't think you want to track that info in your database.

HTH...
0
 

Author Comment

by:aej1973
ID: 37806468
Thanks smadeira. My problem is how do I capture the appointments datewise? Right now we are capturing only the start and end dates. For example, I fill the appointment sheet for 3 weeks at a time. I go to each cell in the calendar to fill the appointments between the start and the end date. The calendar needs to show the appointments scheduled for each of those dates. From which field in the DB will this datewise information be picked up from? Thanks for the help.
0
 

Author Comment

by:aej1973
ID: 37811547
ok, I got what you suggested. What I had in my mind was to be update all cells in the calendar with one submit button, I have now changed my logic. Thanks for the help.

A
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question