ISPatientRule.AddRuleDay

Description

This function adds the specified rule day to the patient rule.

Syntax

object.AddRuleDay aDayIndex

Part Attribute Type Description
object Required
The object always implements the ISPatientRule interface
aDayIndex In, Required
int
The index of the day to be added

Example

Add the specified rule day to the patient rule and display the patient rules loaded by the specified patient ID, their descriptions, dates when they were created and the provider they were created by.

sub main
  Dim aTrans
  Dim aPatient
  Dim aPatientId
  Dim aRules
  Dim aRule
  Dim aMessage

  set aTrans = Profile.StartMapTransaction
  Set aPatient = Profile.SelectPatient 
  aPatientId = aPatient.Id
  
  set aRules = Profile.LoadPatientRules(aPatientId)
  aMessage = "Before adding the day: " & vbNewLine & GetpatientRulesAsText(aRules)

  if aRules.Count > 0 then
    set aRule = aRules.Item(0) 
    aMessage = aMessage & vbNewLine & "Try to add a rule day" & aRule.Description &_
      vbNewLine 
    aRule.AddRuleDay 5
  end if  

  aTrans.Commit
  
  set aTrans = Profile.StartMapTransaction  
  set aRules = Profile.LoadPatientRules(aPatientId)
  
  aMessage = aMessage & vbNewLine & "After adding the day: " & vbNewLine &_
    GetpatientRulesAsText(aRules)
  
  Profile.MsgBox(aMessage)  


end sub

function GetpatientRulesAsText(aRules)
  Dim aText
  Dim aProvider
  Dim aRule
  Dim i
  aText = "The number of the patint rules is " & aRules.Count & vbNewLine
  for i = 0 to aRules.Count - 1
    set aRule = aRules.Item(i)
    set aProvider = Profile.LoadProviderById(aRule.CreatedBy)
    aText = aText & "The patient rule '" & aRule.Description &_
      "' was created on " & aRule.CreatedOn & " by " & aProvider.FullName & vbNewLine  
  next  
    
  GetpatientRulesAsText = aText
end function 
Note:

In Profile Client v8 on User Interface Added Rule Days can be found in Patient > Alter Patient > Bookings > Patient Rules > Days.

Version information

Added in v8.1.0