Solved

help with a DB schema..

Posted on 2012-04-04
3
305 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
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Scott Madeira earned 250 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

685 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