home *** CD-ROM | disk | FTP | other *** search
- /*#############################################################################
- Name: CRDEMO.DO
- Version: 2.0
- Date: 8/25/91
- Description: create DBASE files for demo application DEMO.DO
- Copyright (c) 1991 Intelligent Systems Research
- Permission granted to copy or re-use without restriction
- #############################################################################*/
-
- /*
- create the OFFICE database
- this file stores the cost center codes for each location
- */
- office = createDbf("office",[
- ["ccenter",'N',4,0], % cost center id (4-digit numeric)
- ["location",'C',24,0]]); % name of location
-
- /*
- store records for existing cost centers (offices)
- */
- ccenter = 1000;
- location = "Chicago";
- write(office,0L);
- ccenter = 1001;
- location = "New York";
- write(office,0L);
- ccenter = 1002;
- location = "San Fransisco";
- write(office,0L);
- ccenter = 1003;
- location = "Dallas";
- write(office,0L);
- close(office);
- ? "Office (Cost Center) database created";
-
- /*
- create the DOCTOR database
- this database stores the ID and names of all current doctors
- */
- doctor = createDbf("doctor",[
- ["docid",'N',4,0], % 4-digit ID (numeric)
- ["lname",'C',32,0], % last name
- ["fname",'C',24,0], % first name
- ["indate",'D',0,0]]); % date this doctor started
-
- /*
- store some doctor records
- */
- docid = 1;
- lname = "Jones";
- fname = "Joseph";
- indate = date();
- write(doctor,0L);
- docid = 2;
- lname = "Smith";
- fname = "Stanley";
- indate = date();
- write(doctor,0L);
- close(doctor);
- ? "Doctor database created";
-
- /*
- create the officed database
- this file stores the doctors assigned to each office
-
- Assumptions:
- each doctor can be assigned to one or more offices
-
- */
- officed = createDbf("officed",[
- ["ccenter",'N',4,0], % cost center id (4-digit numeric)
- ["docid",'N',4,0]]); % case worker id (4-digit numeric)
-
- /*
- store some doctor assignments
- */
- ccenter = 1000;
- docid = 1;
- write(officed,0L);
- ccenter = 1001;
- docid = 1;
- write(officed,0L);
- ccenter = 1000;
- docid = 2;
- write(officed,0L);
- ccenter = 1002;
- docid = 1;
- write(officed,0L);
- close(officed);
- ? "Office - Doctor table created";
-
-
- /*
- create the BILLRATE database
- this file stores the history of billing rates for a patient
- */
- billrate = createDbf("billrate",[
- ["caseno",'C',7,0], % patient ID (case number)
- ["date",'D',0,0], % date this billing rate entered
- ["rate",'N',8,0]]); % billing rate for this patient ($/hour)
- ? "Billing rate database created";
-
-
- /*
- create the patient database
- */
- patient = createDbf("patient",[
- ["caseno",'C',7,0], % case number
- ["lname",'C',14,0], % patient last name
- ["fname",'C',14,0], % patient first name
- ["indate",'D',0,0], % date that this person became a patient
- ["program",'N',4,0], % program ID
- ["docid",'N',4,0]]); % ID of doctor assigned to this patient
-
- /*
- create the VISIT database
- store one record for each visit for each patient
- */
- visit = createDbf("visit",[
- ["caseno",'C',7,0],
- ["date",'D',0,0],
- ["service",'C',1,0],
- ["diag1",'C',5,0],
- ["diag2",'C',5,0],
- ["proc1",'C',8,0],
- ["proc2",'C',8,0],
- ["proc3",'C',8,0],
- ["proc4",'C',8,0],
- ["hours",'N',2,0],
- ["due",'N',6,2],
- ["paid",'N',6,2],
- ["scale",'N',6,2]]);
-
- for(i=0;i<10;i=i+1) {
-
- /*
- create a patient record for this patient
- */
- select(patient);
- caseno = "00311"+asString(i)+"A";
- mcaseno = caseno;
- lname = "LASTNAME"+asString(i);
- fname = "FIRSTNAME"+asString(i);
- docid = 1;
- write(patient,0L);
-
- /*
- create a billing rate record for this new patient
- */
- select(billrate);
- caseno = mcaseno;
- date = date();
- rate = i;
- write(billrate,0L);
-
- /*
- create a series of visits for this patient on different dates
- */
- number_of_visits = 5;
- for(j=0; j < number_of_visits; j=j+1) {
- select(visit);
- caseno = mcaseno;
- date = date()+j;
- service='A';
- hours = i;
- due=hours*70.0;
- paid = 0;
- scale = 0;
- write(visit,0L);
- ? recno(visit);
- }
- }
-
- close(patient);
- close(visit);
- close(billrate);
- ? "Patient and Visit databases created";
-
-