Advertisement
nemanja-zigic

Untitled

Apr 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.56 KB | None | 0 0
  1. Select
  2. hec_act_plannedactions.PlannedFor_Date As TreatmentDate,
  3. Concat_Ws(' ', cmn_per_personinfo1.Title, cmn_per_personinfo1.FirstName,
  4. cmn_per_personinfo1.LastName) As OctDoctorName,
  5. Concat_Ws(', ', hec_cas_cases.Patient_LastName,
  6. hec_cas_cases.Patient_FirstName) As PatientName,
  7. hec_act_plannedactions1.IsCancelled,
  8. hec_act_performedaction_diagnosisupdate_localizations.IM_PotentialDiagnosisLocalization_Code As Localization,
  9. hec_cas_cases.Patient_BirthDate As PatientBirthDate,
  10. hec_act_plannedactions.IsPerformed As IsOpPerformed,
  11. hec_act_plannedactions1.Creation_Timestamp,
  12. hec_cas_case_universalpropertyvalue.Value_String,
  13. hec_cas_case_universalpropertyvalue.Value_Boolean
  14. From
  15. hec_cas_cases Inner Join
  16. hec_cas_case_relevantperformedactions
  17. On hec_cas_cases.HEC_CAS_CaseID =
  18. hec_cas_case_relevantperformedactions.Case_RefID And
  19. hec_cas_case_relevantperformedactions.Tenant_RefID =
  20. x'3cc9b86bf340704696977ddb940a51e1' And
  21. hec_cas_case_relevantperformedactions.IsDeleted = 0 Inner Join
  22. hec_act_plannedactions
  23. On hec_cas_case_relevantperformedactions.PerformedAction_RefID =
  24. hec_act_plannedactions.IfPlannedFollowup_PreviousAction_RefID And
  25. hec_act_plannedactions.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1'
  26. And
  27. hec_act_plannedactions.IsDeleted = 0 Inner Join
  28. cmn_bpt_businessparticipants
  29. On hec_act_plannedactions.ToBePerformedBy_BusinessParticipant_RefID =
  30. cmn_bpt_businessparticipants.CMN_BPT_BusinessParticipantID And
  31. cmn_bpt_businessparticipants.Tenant_RefID =
  32. x'3cc9b86bf340704696977ddb940a51e1' And
  33. cmn_bpt_businessparticipants.IsDeleted = 0 Inner Join
  34. cmn_per_personinfo
  35. On cmn_bpt_businessparticipants.IfNaturalPerson_CMN_PER_PersonInfo_RefID =
  36. cmn_per_personinfo.CMN_PER_PersonInfoID And
  37. cmn_per_personinfo.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  38. cmn_per_personinfo.IsDeleted = 0 Inner Join
  39. hec_cas_case_relevantplannedactions
  40. On hec_cas_cases.HEC_CAS_CaseID =
  41. hec_cas_case_relevantplannedactions.Case_RefID And
  42. hec_cas_case_relevantplannedactions.Tenant_RefID =
  43. x'3cc9b86bf340704696977ddb940a51e1' And
  44. hec_cas_case_relevantplannedactions.IsDeleted = 0 Inner Join
  45. hec_act_plannedactions hec_act_plannedactions1
  46. On hec_cas_case_relevantplannedactions.PlannedAction_RefID =
  47. hec_act_plannedactions1.HEC_ACT_PlannedActionID And
  48. hec_act_plannedactions1.IsPerformed = 0 And
  49. hec_act_plannedactions1.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1'
  50. And
  51. hec_act_plannedactions1.IsDeleted = 0 Inner Join
  52. hec_act_plannedaction_2_actiontype
  53. On hec_act_plannedactions1.HEC_ACT_PlannedActionID =
  54. hec_act_plannedaction_2_actiontype.HEC_ACT_PlannedAction_RefID And
  55. hec_act_plannedaction_2_actiontype.Tenant_RefID =
  56. x'3cc9b86bf340704696977ddb940a51e1' And
  57. hec_act_plannedaction_2_actiontype.IsDeleted = 0 Inner Join
  58. hec_act_actiontype
  59. On hec_act_plannedaction_2_actiontype.HEC_ACT_ActionType_RefID =
  60. hec_act_actiontype.HEC_ACT_ActionTypeID And
  61. hec_act_actiontype.GlobalPropertyMatchingID =
  62. 'mm.docconect.doc.app.planned.action.oct' And
  63. hec_act_actiontype.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  64. hec_act_actiontype.IsDeleted = 0 Inner Join
  65. cmn_bpt_businessparticipants cmn_bpt_businessparticipants1
  66. On hec_act_plannedactions1.ToBePerformedBy_BusinessParticipant_RefID =
  67. cmn_bpt_businessparticipants1.CMN_BPT_BusinessParticipantID And
  68. cmn_bpt_businessparticipants1.Tenant_RefID =
  69. x'3cc9b86bf340704696977ddb940a51e1' And
  70. cmn_bpt_businessparticipants1.IsDeleted = 0 Inner Join
  71. cmn_per_personinfo cmn_per_personinfo1
  72. On cmn_bpt_businessparticipants1.IfNaturalPerson_CMN_PER_PersonInfo_RefID =
  73. cmn_per_personinfo1.CMN_PER_PersonInfoID And
  74. cmn_per_personinfo1.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  75. cmn_per_personinfo1.IsDeleted = 0 Inner Join
  76. hec_act_performedaction_diagnosisupdates
  77. On hec_act_performedaction_diagnosisupdates.HEC_ACT_PerformedAction_RefID =
  78. hec_cas_case_relevantperformedactions.PerformedAction_RefID And
  79. hec_act_performedaction_diagnosisupdates.Tenant_RefID =
  80. x'3cc9b86bf340704696977ddb940a51e1' And
  81. hec_act_performedaction_diagnosisupdates.IsDeleted = 0 Inner Join
  82. hec_act_performedaction_diagnosisupdate_localizations
  83. On
  84. hec_act_performedaction_diagnosisupdates.HEC_ACT_PerformedAction_DiagnosisUpdateID = hec_act_performedaction_diagnosisupdate_localizations.HEX_EXC_Action_DiagnosisUpdate_RefID And
  85. hec_act_performedaction_diagnosisupdate_localizations.Tenant_RefID =
  86. x'3cc9b86bf340704696977ddb940a51e1' And
  87. hec_act_performedaction_diagnosisupdate_localizations.IsDeleted = 0
  88. Inner Join
  89. hec_dia_potentialdiagnoses
  90. On hec_act_performedaction_diagnosisupdates.PotentialDiagnosis_RefID =
  91. hec_dia_potentialdiagnoses.HEC_DIA_PotentialDiagnosisID And
  92. hec_dia_potentialdiagnoses.Tenant_RefID =
  93. x'3cc9b86bf340704696977ddb940a51e1' And
  94. hec_dia_potentialdiagnoses.IsDeleted = 0 Inner Join
  95. hec_dia_potentialdiagnosis_catalogcodes
  96. On hec_dia_potentialdiagnoses.HEC_DIA_PotentialDiagnosisID =
  97. hec_dia_potentialdiagnosis_catalogcodes.PotentialDiagnosis_RefID And
  98. hec_dia_potentialdiagnosis_catalogcodes.Tenant_RefID =
  99. x'3cc9b86bf340704696977ddb940a51e1' And
  100. hec_dia_potentialdiagnosis_catalogcodes.IsDeleted = 0 Inner Join
  101. hec_doctors
  102. On hec_act_plannedactions.ToBePerformedBy_BusinessParticipant_RefID =
  103. hec_doctors.BusinessParticipant_RefID And
  104. hec_doctors.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  105. hec_doctors.IsDeleted = 0 Inner Join
  106. hec_doctors hec_doctors1
  107. On hec_act_plannedactions1.ToBePerformedBy_BusinessParticipant_RefID =
  108. hec_doctors1.BusinessParticipant_RefID And
  109. hec_doctors1.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  110. hec_doctors1.IsDeleted = 0 Inner Join
  111. cmn_bpt_ctm_organizationalunit_staff
  112. On hec_act_plannedactions.ToBePerformedBy_BusinessParticipant_RefID =
  113. cmn_bpt_ctm_organizationalunit_staff.BusinessParticipant_RefID And
  114. cmn_bpt_ctm_organizationalunit_staff.Tenant_RefID =
  115. x'3cc9b86bf340704696977ddb940a51e1' And
  116. cmn_bpt_ctm_organizationalunit_staff.IsDeleted = 0 Inner Join
  117. cmn_bpt_ctm_organizationalunits
  118. On cmn_bpt_ctm_organizationalunit_staff.OrganizationalUnit_RefID =
  119. cmn_bpt_ctm_organizationalunits.CMN_BPT_CTM_OrganizationalUnitID And
  120. cmn_bpt_ctm_organizationalunits.Tenant_RefID =
  121. x'3cc9b86bf340704696977ddb940a51e1' And
  122. cmn_bpt_ctm_organizationalunits.IsDeleted = 0 Inner Join
  123. cmn_bpt_ctm_organizationalunit_staff cmn_bpt_ctm_organizationalunit_staff1
  124. On hec_act_plannedactions1.ToBePerformedBy_BusinessParticipant_RefID =
  125. cmn_bpt_ctm_organizationalunit_staff1.BusinessParticipant_RefID And
  126. cmn_bpt_ctm_organizationalunit_staff1.Tenant_RefID =
  127. x'3cc9b86bf340704696977ddb940a51e1' And
  128. cmn_bpt_ctm_organizationalunit_staff1.IsDeleted = 0 Inner Join
  129. cmn_bpt_ctm_organizationalunits cmn_bpt_ctm_organizationalunits1
  130. On cmn_bpt_ctm_organizationalunit_staff1.OrganizationalUnit_RefID =
  131. cmn_bpt_ctm_organizationalunits1.CMN_BPT_CTM_OrganizationalUnitID And
  132. cmn_bpt_ctm_organizationalunits1.Tenant_RefID =
  133. x'3cc9b86bf340704696977ddb940a51e1' And
  134. cmn_bpt_ctm_organizationalunits1.IsDeleted = 0 Inner Join
  135. cmn_bpt_ctm_customers
  136. On cmn_bpt_ctm_organizationalunits.Customer_RefID =
  137. cmn_bpt_ctm_customers.CMN_BPT_CTM_CustomerID And
  138. cmn_bpt_ctm_customers.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  139. cmn_bpt_ctm_customers.IsDeleted = 0 Inner Join
  140. cmn_bpt_businessparticipants cmn_bpt_businessparticipants2
  141. On cmn_bpt_ctm_customers.Ext_BusinessParticipant_RefID =
  142. cmn_bpt_businessparticipants2.CMN_BPT_BusinessParticipantID And
  143. cmn_bpt_businessparticipants2.Tenant_RefID =
  144. x'3cc9b86bf340704696977ddb940a51e1' And
  145. cmn_bpt_businessparticipants2.IsDeleted = 0 Inner Join
  146. hec_cas_case_universalpropertyvalue
  147. On hec_cas_case_relevantperformedactions.Case_RefID =
  148. hec_cas_case_universalpropertyvalue.HEC_CAS_Case_RefID Inner Join
  149. hec_cas_case_universalproperties
  150. On hec_cas_case_universalproperties.HEC_CAS_Case_UniversalPropertyID =
  151. hec_cas_case_universalpropertyvalue.HEC_CAS_Case_UniversalProperty_RefID
  152. Where
  153. hec_cas_cases.Patient_RefID = x'c0d00607c5d8eb4b8eceaf3f294d6157' And
  154. hec_cas_cases.Tenant_RefID = x'3cc9b86bf340704696977ddb940a51e1' And
  155. hec_cas_cases.IsDeleted = 0 And
  156. hec_cas_case_universalproperties.GlobalPropertyMatchingID Like '%until%'
  157. Order By
  158. TreatmentDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement