Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 4.66 KB | None | 0 0
  1. /**
  2.  * Sets up the database with all the Hospitals, HCPs, Prescriptions, and
  3.  * Lab precedures required to pass the acceptance tests.  Does not set up
  4.  * previous office visists with existing patients.
  5.  */
  6.  
  7. /**
  8.  * Adding Central, Eastern, and Northern Hospitals
  9.  */
  10. INSERT INTO Hospitals(HospitalID, HospitalName) VALUES
  11.  
  12. ('0000000000','Central Hospital'),
  13. ('1111111111','Eastern Hospital'),
  14. ('2222222222','Northern Hospital') ON DUPLICATE KEY UPDATE HospitalID = HospitalID;
  15.  
  16. /**
  17.  * Adding HCP Antonio Medico
  18.  */
  19. INSERT INTO Personnel(
  20. MID,
  21. AMID,
  22. ROLE,
  23. lastName,
  24. firstName,
  25. address1,
  26. address2,
  27. city,
  28. state,
  29. zip,
  30. zip1,
  31. zip2,
  32. phone,
  33. phone1,
  34. phone2,
  35. phone3,
  36. specialty,
  37. email)
  38. VALUES (
  39. 9000000012,
  40. NULL,
  41. 'hcp',
  42. 'Medico',
  43. 'Antonio',
  44. '4321 My Road St',
  45. 'PO BOX 2',
  46. 'CityName',
  47. 'NY',
  48. '12345-1234',
  49. '12345',
  50. '1234',
  51. '999-888-7777',
  52. '999',
  53. '888',
  54. '7777',
  55. NULL,
  56. 'amedico@iTrust.org'
  57. ) ON DUPLICATE KEY UPDATE MID = MID;
  58.  
  59. INSERT INTO Users(MID, password, ROLE, sQuestion, sAnswer) VALUES(9000000012, 'pw', 'hcp', 'first letter?', 'a')
  60. ON DUPLICATE KEY UPDATE MID = MID;
  61.  
  62. INSERT INTO HCPAssignedHos(HCPID, HosID) VALUES(9000000012,'9191919191'), (9000000012,'0000000000'))
  63. ON DUPLICATE KEY UPDATE HCPID = HCPID;
  64.  
  65.  
  66. /**
  67.  * Adding HCP Sarah Soulcrusher
  68.  */
  69. INSERT INTO Personnel(
  70. MID,
  71. AMID,
  72. ROLE,
  73. lastName,
  74. firstName,
  75. address1,
  76. address2,
  77. city,
  78. state,
  79. zip,
  80. zip1,
  81. zip2,
  82. phone,
  83. phone1,
  84. phone2,
  85. phone3,
  86. specialty,
  87. email)
  88. VALUES (
  89. 9000000011,
  90. NULL,
  91. 'hcp',
  92. 'Soulcrusher',
  93. 'Sarah',
  94. '4321 My Road St',
  95. 'PO BOX 2',
  96. 'CityName',
  97. 'NY',
  98. '12345-1234',
  99. '12345',
  100. '1234',
  101. '999-888-7777',
  102. '999',
  103. '888',
  104. '7777',
  105. NULL,
  106. 'amedico@iTrust.org'
  107. ) ON DUPLICATE KEY UPDATE MID = MID;
  108.  
  109. INSERT INTO Users(MID, password, ROLE, sQuestion, sAnswer) VALUES(9000000011, 'pw', 'hcp', 'first letter?', 'a')
  110. ON DUPLICATE KEY UPDATE MID = MID;
  111.  
  112. INSERT INTO HCPAssignedHos(HCPID, HosID) VALUES(9000000011,'9191919191'), (9000000011,'1111111111')
  113. ON DUPLICATE KEY UPDATE HCPID = HCPID;
  114.  
  115.  
  116. /**
  117.  * Adding Ibuprofen prescription
  118.  */
  119. INSERT INTO NDCodes(Code, Description) VALUES
  120. ('67877-1191', 'Ibuprofen')
  121.  
  122. ON DUPLICATE KEY UPDATE Code = Code;
  123.  
  124.  
  125. /**
  126.  * Adding bacteria identification test lab procedure
  127.  */
  128. INSERT INTO LOINC
  129. (LaboratoryProcedureCode,Component,KindOfProperty,TimeAspect,System,ScaleType,MethodType)
  130. VALUES
  131. ('45335-7', 'Bacteria Identification Test', 'ACnc', 'Pt', 'Isolate', 'Ord', 'culture');
  132.  
  133.  
  134. /**
  135.  * Adding Aspirin allergy to Andy Programmer
  136.  */
  137. INSERT INTO Allergies(PatientID,Description, FirstFound)
  138.     VALUES (2, 'Aspirin', '1999-03-14 20:33:58');
  139.  
  140.  
  141.    
  142.  /**
  143.  * Adding office visit to Baby Programmer (scenario 3)
  144.  */
  145. INSERT INTO OfficeVisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
  146. VALUES (6001,SELECT CURRDATE() - INTERVAL DAY,9000000003,'Hates getting shots','2222222222',5)
  147.  ON DUPLICATE KEY UPDATE id = id;
  148.  
  149.  
  150.  /**
  151.  * Adding office visit to Andy Programmer (scenario 4)
  152.  */
  153. INSERT INTO OfficeVisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
  154. VALUES (6002,'2011-01-2',9000000012,'Second medical visit on two days','0000000000',2)
  155.  ON DUPLICATE KEY UPDATE id = id;
  156.  
  157.  
  158.  /**
  159.  * Adding office visit to Random Person (scenario 5)
  160.  */
  161. INSERT INTO OfficeVisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
  162. VALUES (6003,'2011-01-26',9000000011,'Seems fine to me','1111111111',1)
  163.  ON DUPLICATE KEY UPDATE id = id;
  164.  
  165.    
  166.  
  167. /**
  168.  * Adding immunizations to Baby Programmer (scenario 3)
  169.  */
  170. INSERT INTO OVProcedure(CPTCode, VisitID) VALUES ('90707', 6001), ('90371', 6001), ('90712', 6001);
  171.  
  172.  
  173. /**
  174.  * Adding lab procedure to Baby Programmer (scenario 3)
  175.  */
  176. INSERT INTO LabProcedure
  177. (PatientMID,LaboratoryProcedureCode,Rights,STATUS,Commentary,Results,OfficeVisitID, UpdatedDate)
  178. VALUES  (5,'13495-7','ALLOWED','COMPLETED','','',6001,SELECT CURRDATE() - INTERVAL DAY);
  179.  
  180.  
  181.  
  182. /**
  183.  * Adding prescription to Andy Programmer (scenario 4)
  184.  */
  185. INSERT INTO OVMedication(VisitID, NDCode, StartDate, EndDate, Dosage, Instructions)
  186.        VALUES (6002, 67877-1191, '2011-02-02', '2011-02-09', 200, 'Take once daily with a meal');
  187.  
  188.  
  189. /**
  190.  * Adding diagnosis to Random Person (scenario 5)
  191.  */
  192. INSERT INTO OVDiagnosis(ID, ICDCode, VisitID)
  193.     VALUES  (7395, 11.40, 6003)
  194.      ON DUPLICATE KEY UPDATE id = id;
  195.  
  196.      
  197. /**
  198.  * Adding procedures to Random Person (scenario 5)
  199.  */
  200. INSERT INTO OVProcedure(CPTCode, VisitID) VALUES ('1270F', 6003);
  201.    
  202.  
  203. /**
  204.  * Adding lab procedure to Random Person (scenario 5)
  205.  */
  206. INSERT INTO LabProcedure
  207. (PatientMID,LaboratoryProcedureCode,Rights,STATUS,Commentary,Results,OfficeVisitID, UpdatedDate)
  208. VALUES  (1,'45335-7','ALLOWED','COMPLETED','','',6003,'2011-01-26');
  209.      
  210. /**
  211.  * Adding prescription to Random Person (scenario 5)
  212.  */
  213. INSERT INTO OVMedication(VisitID, NDCode, StartDate, EndDate, Dosage, Instructions)
  214.    VALUES (6003, 67877-1191, '2011-01-26', '2011-02-05', 200, 'Take once daily');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement