一、PatientBannerDefaultResource.xaml 定义 DataTemplate(定义x:Name="_spClinicalTrialSubject" )
<StackPanel Grid.Column="14" Orientation="Horizontal" x:Name="_spClinicalTrialSubject" >
<Label FontStyle="Italic" Foreground="Gray" VerticalAlignment="Center" FontSize="12" Content="是否临床试验者" />
<CheckBox Margin="2,0,0,0" VerticalAlignment="Center" Name="_chkClinicalTrialSubject" FontSize="12" IsThreeState="False" IsChecked="{Binding IsClinicalTrialSubject}" />
</StackPanel>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:scs="clr-namespace:System.Collections.Specialized;assembly=System"
xmlns:js="http://schemas.jetsun.com.cn/his/2009/presentation"
xmlns:controls="clr-namespace:JetSun.Presentation.Controls;assembly=Core.Cui"
xmlns:emr="clr-namespace:JetSun.ClinicalManagement.EMR">
<emr:StatusConverter x:Key="StatusConverter"/>
<emr:DecimalToChineseCurrencyConverter x:Key="DecimalToChineseCurrencyConverter"/>
<emr:RemainingAmountToDescConverter x:Key="RemainingAmountToDescConverter"/>
<emr:RemainingAccountAmountToDescConverter x:Key="RemainingAccountAmountToDescConverter"/>
<emr:PatientTypeConverter x:Key="PatientTypeConverter"/>
<emr:PatientTypeDescConverter x:Key="PatientTypeDescConverter"/>
<emr:TelAndEmailsConverter x:Key="TelAndEmailsConverter"/>
<emr:IsNegationConverter x:Key="IsNegationConverter" />
<emr:AddressConverter x:Key="AddressConverter"/>
<emr:MedicationConverter x:Key="MedicationConverter"/>
<emr:EncounterParticipationConverter x:Key="EncounterParticipationConverter"/>
<emr:PatientNameWithSecurityLevelConverter x:Key="PatientNameWithSecurityLevelConverter"/>
<Style TargetType="js:LabelContentControl">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Foreground" Value="Gray" />
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontSize" Value="13.5"/>
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontStyle" Value="Normal" />
<Setter Property="ToolTip" Value="{Binding Text}" />
</Style>
<Style x:Key="contentCenterStyle" TargetType="{x:Type TextBlock}">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<DataTemplate x:Key="OperateListTemplate">
<DataGrid IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="操作时间" Width="120" ElementStyle="{StaticResource contentCenterStyle}" Binding="{Binding OperatedOn,StringFormat='yyyy-MM-dd HH:mm'}"/>
<DataGridTextColumn Header="操作者" Width="70" ElementStyle="{StaticResource contentCenterStyle}" Binding="{Binding Operator.Name}"/>
<DataGridTextColumn Header="说明" Width="*" Binding="{Binding Description}"/>
<DataGridTextColumn Header="分类" ElementStyle="{StaticResource contentCenterStyle}" Width="80" Binding="{Binding OperateKind}"/>
</DataGrid.Columns>
</DataGrid>
</DataTemplate>
<DataTemplate x:Key="AddressSectionHeader">
<js:LabelContentControl Label="地址 ">
<TextBlock Text="{Binding Person.LivingAddressText}" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="AddressSectionExpandedHeader">
<js:LabelContentControl Label="地址 " Foreground="White">
<TextBlock Text="{Binding Person.LivingAddressText}" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="AddressSectionContent">
<ItemsControl ItemsSource="{Binding Converter={StaticResource AddressConverter}}" Margin="5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Margin="5,0,0,0" Text="{Binding}" ToolTip="{Binding}" TextWrapping="WrapWithOverflow" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="EncounterParticipationSectionHeader">
<js:LabelContentControl Label="(副)主任医师 " >
<TextBlock Text="{Binding ChiefConsultant.Name}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="EncounterParticipationSectionExpandedHeader">
<js:LabelContentControl Label="(副)主任医师 " Foreground="White">
<TextBlock HorizontalAlignment="Right" Text="{Binding ChiefConsultant.Name}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="EncounterParticipationSectionContent">
<ItemsControl Margin="5">
<ItemsControl.Items>
<js:LabelContentControl Label=" 住院医师 ">
<TextBlock HorizontalAlignment="Right" Text="{Binding Physician.Name}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label=" 主治医师 ">
<TextBlock HorizontalAlignment="Right" Text="{Binding AttendingPhysician.Name}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label=" 科主任 ">
<TextBlock HorizontalAlignment="Right" Text="{Binding DepartmentDirector.Name}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label=" 管床医师 ">
<TextBlock HorizontalAlignment="Right" Text="{Binding ManagePhysician.Name}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label=" 提交 " x:Name="_lccMrSubmitOn" Visibility="Collapsed">
<TextBlock HorizontalAlignment="Right" x:Name="_tbMrSubmitOn" Text="{Binding SubmitOn, StringFormat='yyyy-MM-dd HH:mm'}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" Visibility="Collapsed" />
</js:LabelContentControl>
<js:LabelContentControl Label=" 暂核 " x:Name="_lccMrPartAuditedOn" Visibility="Collapsed">
<TextBlock HorizontalAlignment="Right" x:Name="_tbMrPartAuditedOn" Text="{Binding PartAuditedOn, StringFormat='yyyy-MM-dd HH:mm'}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" Visibility="Collapsed" />
</js:LabelContentControl>
<js:LabelContentControl Label=" 质控通过 " x:Name="_lccMrPassOn" Visibility="Collapsed">
<TextBlock HorizontalAlignment="Right" x:Name="_tbMrPassOn" Text="{Binding PassOn, StringFormat='yyyy-MM-dd HH:mm'}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" Visibility="Collapsed" />
</js:LabelContentControl>
</ItemsControl.Items>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="TelAndEmailSectionHeader">
<js:LabelContentControl Label="电话和Email ">
<TextBlock Text="{Binding Converter={StaticResource TelAndEmailsConverter}, ConverterParameter=Items}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="TelAndEmailSectionExpandedHeader">
<js:LabelContentControl Label="电话和Email " Foreground="White">
<TextBlock Text="{Binding Converter={StaticResource TelAndEmailsConverter}, ConverterParameter=Items}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="TelAndEmailSectionContent">
<ItemsControl ItemsSource="{Binding Converter={StaticResource TelAndEmailsConverter}, ConverterParameter=Desc}" Margin="5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<js:LabelContentControl Label="{Binding Key}">
<TextBlock Text="{Binding Value}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="ContactWaySectionHeader">
<js:LabelContentControl Label="联系方式 ">
<TextBlock Text="{Binding Converter={StaticResource TelAndEmailsConverter}, ConverterParameter=Items}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="ContactWaySectionExpandedHeader">
<js:LabelContentControl Label="联系方式 " Foreground="White">
<TextBlock Text="{Binding Converter={StaticResource TelAndEmailsConverter}, ConverterParameter=Items}" TextTrimming="CharacterEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="ContactWaySectionContent">
<StackPanel Margin="5">
<js:LabelContentControl Label="地址 ">
<TextBlock Text="{Binding Person.LivingAddressText}" TextTrimming="None" TextWrapping="Wrap" HorizontalAlignment="Right"
ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<ItemsControl ItemsSource="{Binding Converter={StaticResource TelAndEmailsConverter}, ConverterParameter=Desc}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<js:LabelContentControl Label="{Binding Key}">
<TextBlock Text="{Binding Value}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="ExpenseSectionHeader">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<js:LinkLabel FontSize="14" Content="总额" Command="{x:Static js:ClinicalCommands.ExpenseFeekindSummary}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{Binding Foregift.TotalExpenses, Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" VerticalAlignment="Center" TextTrimming="WordEllipsis" Margin="5,0" Foreground="Black" FontSize="16" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
<js:LabelContentControl Grid.Column="2" Label="余额 " Foreground="Black" FontStyle="Normal" FontSize="14" HorizontalAlignment="Right" >
<TextBlock Text="{Binding Foregift.BalanceAmount, Converter={StaticResource DecimalToChineseCurrencyConverter}}" TextTrimming="WordEllipsis" Margin="5,0" Foreground="Red" FontSize="16" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</Grid>
</DataTemplate>
<DataTemplate x:Key="ExpenseSectionExpandedHeader">
<js:LabelContentControl Label="住院总额 " Foreground="White">
<TextBlock Text="{Binding Foregift.TotalExpenses,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextTrimming="WordEllipsis" Margin="5,0" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="ExpenseSectionContent">
<ItemsControl Margin="5">
<ItemsControl.Items>
<js:LabelContentControl Label="余额">
<TextBlock Text="{Binding Foregift.BalanceAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="未结总额">
<TextBlock Text="{Binding Foregift.TotalUnpaidAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="记帐余额">
<TextBlock HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource RemainingAccountAmountToDescConverter}">
<Binding Path="Foregift.IsSelfPaid"/>
<Binding Path="Foregift.RemainingAccountAmount"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</js:LabelContentControl>
<js:LabelContentControl Label="药费余额">
<TextBlock Text="{Binding Foregift.RemainingMedicineAmount,Converter={StaticResource RemainingAmountToDescConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="其中自负">
<TextBlock Text="{Binding Foregift.SelfUnpaidAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="按金">
<TextBlock Text="{Binding Foregift.RemainingForegiftAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="中草药医嘱费用">
<TextBlock Text="{Binding Foregift.AllTCMOrderAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="所有临嘱费用">
<TextBlock Text="{Binding Foregift.AllTempOrderAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="新开临嘱费用">
<TextBlock Text="{Binding Foregift.NewTempOrderAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="当天长嘱费用">
<TextBlock Text="{Binding Foregift.DayLongAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
<js:LabelContentControl Label="当天新开长嘱费用">
<TextBlock Text="{Binding Foregift.NewDayLongAmount,Converter={StaticResource DecimalToChineseCurrencyConverter}}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</ItemsControl.Items>
<!--<ItemsControl.ItemTemplate>
<DataTemplate>
<js:LabelContentControl Label="{Binding Key}">
<TextBlock Text="{Binding Value}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>-->
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="PatientTypeSectionHeader">
<js:LabelContentControl Label="" Margin="15,0,0,0">
<TextBlock Text="{Binding Converter={StaticResource PatientTypeDescConverter}}"
HorizontalAlignment="Left" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="PatientTypeSectionExpandedHeader">
<js:LabelContentControl Label="" Foreground="White">
<TextBlock Text="{Binding Converter={StaticResource PatientTypeDescConverter}}"
HorizontalAlignment="Left" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="PatientTypeSectionContent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ItemsControl ItemsSource="{Binding Converter={StaticResource PatientTypeConverter}}" Margin="5" Grid.Row="0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<js:LabelContentControl Label="{Binding Key}">
<TextBlock Text="{Binding Value}" HorizontalAlignment="Right" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" ToolTip="{Binding RelativeSource={RelativeSource Self},Path=Text,Converter={x:Static js:Converters.EmptyAsNull}}" />
</js:LabelContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<emr:PatientTypeSectionContent Grid.Row="1" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="AllergySectionHeader">
<emr:AllergySectionHeader />
</DataTemplate>
<DataTemplate x:Key="AllergySectionExpandedHeader">
<StackPanel Margin="5" Orientation="Horizontal">
<Image Source="{Binding AllergyCode.ImageSource}" DockPanel.Dock="Left" Height="16" Width="16" VerticalAlignment="Center" />
<TextBlock Text="{Binding AllergyCode.Name}" Margin="5,0" TextTrimming="WordEllipsis" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="AllergySectionContent">
<ItemsControl ItemsSource="{Binding Allergies}" Margin="5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" FontSize ="14" FontWeight = "Bold">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}{1} {2:yyyy年MM月dd日}">
<Binding Path="IsNegation" Converter="{StaticResource IsNegationConverter}" />
<Binding Path="DescriptionWithNegationNone"/>
<Binding Path="RecordedOn" />
</MultiBinding>
</TextBlock.Text>
<TextBlock.ToolTip>
<Binding RelativeSource="{RelativeSource Self}" Path="Text" />
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="MedicationSectionHeader">
<emr:MedicationSectionHeader />
</DataTemplate>
<DataTemplate x:Key="MedicationSectionExpandedHeader">
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Text="用药史" Margin="5,0" TextTrimming="WordEllipsis" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="MedicationSectionContent">
<ItemsControl ItemsSource="{Binding Converter={StaticResource MedicationConverter}}" Margin="5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" FontSize ="14" FontWeight = "Bold">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1:0.####}{2} {3} {4} {5}">
<Binding Path="Substance.Name"/>
<Binding Path="Dose"/>
<Binding Path="Substance.DosageUnit.Name"/>
<Binding Path="OrderDisplayRoute.Name"/>
<Binding Path="OrderDisplayFrequencyDesc"/>
<Binding Path="Owner.DaDateDesc" />
</MultiBinding>
</TextBlock.Text>
<TextBlock.ToolTip>
<Binding RelativeSource="{RelativeSource Self}" Path="Text" />
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="LifeDiagnoseSectionHeader">
<js:LabelContentControl Label="终生诊断 ">
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="LifeDiagnoseSectionExpandedHeader">
<js:LabelContentControl Label="终生诊断 " Foreground="White">
</js:LabelContentControl>
</DataTemplate>
<DataTemplate x:Key="LifeDiagnoseSectionContent">
<ItemsControl Margin="5">
<ItemsControl.Items>
<TextBlock Text="{Binding LifeDiagnoseText}" TextWrapping="Wrap" />
</ItemsControl.Items>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="NoticeSectionHeader">
<emr:NoticeSectionHeader/>
</DataTemplate>
<DataTemplate x:Key="NoticeSectionExpandedHeader">
<js:LabelContentControl Label="注意事项 " Foreground="White"/>
</DataTemplate>
<DataTemplate x:Key="NoticeSectionContent"/>
<emr:PatientBannerSetting x:Key="Setting">
<emr:PatientBannerSetting.InformationTemplate>
<DataTemplate>
<Grid >
<Grid.Resources>
<Style TargetType="js:LabelContentControl">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="10,5"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Foreground" Value="Gray" />
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="Label">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Foreground" Value="Gray" />
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<js:LabelContentControl Margin="15,0,15,0" Grid.Column="0">
<!--<TextBlock Text="{Binding Encounter.DisplayName}" FontSize="22" HorizontalAlignment="Center"/>-->
<TextBlock Text="{Binding Path=Encounter,Converter={StaticResource PatientNameWithSecurityLevelConverter }}" FontSize="22" HorizontalAlignment="Center"/>
</js:LabelContentControl>
<StackPanel Orientation ="Horizontal" Grid.Column="1"
Visibility="{Binding Path=Encounter.EncounterCode.IsInpatient,Converter={x:Static js:Converters.BooleanToVisibility}}">
<js:LabelContentControl AutoCollapsed="True">
<TextBlock Text="{Binding Encounter.SickBedNoWithSuffix}" FontSize="22" VerticalAlignment="Center"/>
</js:LabelContentControl>
<js:LabelContentControl AutoCollapsed="True">
<TextBox Text="{Binding Encounter.SeqNoText}" FontSize="22" VerticalAlignment="Center" IsReadOnly="True" BorderThickness="0,0,0,0" Background="#FFFFFEE6" FontWeight="Bold"/>
</js:LabelContentControl>
</StackPanel>
<js:LabelContentControl Margin="0,0,15,0" Grid.Column="2">
<TextBlock Text="{Binding Encounter.DayTimeText}" FontSize="22" HorizontalAlignment="Center"/>
</js:LabelContentControl>
<Grid Grid.Column="3">
<Grid.Resources>
<Style TargetType="js:LabelContentControl">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="10,5"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Foreground" Value="Gray" />
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="Label">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Foreground" Value="Gray" />
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<js:LabelContentControl Grid.Column="0">
<TextBlock Text="{Binding ICDAuditedLable}" Foreground="Red" />
</js:LabelContentControl>
<js:LabelContentControl Grid.Column="1" AutoCollapsed="True">
<TextBlock Text="{Binding QCResubmit}" Foreground="Red"/>
</js:LabelContentControl>
<js:LabelContentControl Grid.Column="2">
<TextBlock Text="{Binding Encounter.Gender.Name}" />
</js:LabelContentControl>
<js:LabelContentControl Grid.Column="3">
<TextBlock Text="{Binding Encounter.CurrentAge.AgeText}"/>
</js:LabelContentControl>
<StackPanel Orientation ="Horizontal" Grid.Column="4" VerticalAlignment="Center"
Visibility="{Binding Path=IsValidateIsInpatient,Converter={x:Static js:Converters.BooleanToVisibility}}">
<Label Content=" 体重" VerticalAlignment="Center" />
<TextBlock Text="{Binding Encounter.WeightByNursingRecord,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
<Label Content="KG" VerticalAlignment="Center"/>
<StackPanel Orientation ="Horizontal"
Visibility="{Binding Path=Encounter.Person.Gender.IsFemale,Converter={x:Static js:Converters.BooleanToVisibility}}">
<Label Content=" 孕周" VerticalAlignment="Center" />
<TextBlock Text="{Binding Encounter.PregnancyWeek}" VerticalAlignment="Center"/>
<Label Content=" 哺乳" VerticalAlignment="Center" />
<TextBlock Text="{Binding Encounter.IsBreastFeeding.Name}" VerticalAlignment="Center"/>
</StackPanel>
<Label Content=" 分诊级别" VerticalAlignment="Center" />
<TextBlock Text="{Binding Encounter.TriageLevel.Name}" Foreground="{Binding Encounter.TriageLevel.Foreground}" VerticalAlignment="Center"/>
</StackPanel>
<js:LabelContentControl Label="住院日期 " Grid.Column="5" AutoCollapsed="True">
<TextBlock Text="{Binding Encounter.AdmitDischargeDateRangeDesc}"
Visibility="{Binding Path=IsValidateIsInpatient,Converter={x:Static js:Converters.BooleanToVisibility}}"/>
</js:LabelContentControl>
<StackPanel Orientation ="Horizontal" Grid.Column="6"
Visibility="{Binding Path=IsValidateIsInpatient,Converter={x:Static js:Converters.BooleanToVisibility}}">
<Label Content="/"/>
<TextBlock Text="{Binding Encounter.TotalDays}" VerticalAlignment="Center"/>
<Label Content="天"/>
</StackPanel>
<StackPanel Orientation ="Horizontal" Grid.Column="7" VerticalAlignment="Center"
Visibility="{Binding Path=IsValidateIsInpatient,Converter={x:Static js:Converters.BooleanToVisibility}}">
<Label Content=" 第" VerticalAlignment="Center" />
<TextBlock Text="{Binding Encounter.IPTimes}" VerticalAlignment="Center"/>
<Label Content="次住院" VerticalAlignment="Center"/>
</StackPanel>
<js:LabelContentControl Grid.Column="8">
<TextBlock Text="{Binding Encounter.ResponsibleDepartment.Name}"/>
</js:LabelContentControl>
<js:LabelContentControl Grid.Column="9" AutoCollapsed="True">
<TextBlock Text="" Visibility="{Binding Path=IsValidateIsAmbulatory,Converter={x:Static js:Converters.BooleanToVisibility}}"/>
</js:LabelContentControl>
<StackPanel Orientation ="Horizontal" Grid.Column="10"
VerticalAlignment="Center" Visibility="{Binding Path=IsQCDockdesk,Converter={x:Static js:Converters.BooleanToVisibility}}">
<Label Content="病历状态" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Status }" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation ="Horizontal" Grid.Column="11"
VerticalAlignment="Center" Visibility="{Binding Path=IsQCDockdesk,Converter={x:Static js:Converters.BooleanToVisibility}}">
<Label Content="操作时间" VerticalAlignment="Center"/>
<TextBlock Text="{Binding StatusTime ,StringFormat='yyyy-MM-dd'}" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Grid.Column="12" Text="{Binding Encounter.FirstAdmissionDiagnoseName}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="13" Text="{Binding Encounter.SpecialComment}" VerticalAlignment="Center" Margin="20,0,0,0"/>
<StackPanel Grid.Column="14" Orientation="Horizontal" x:Name="_spClinicalTrialSubject" >
<Label FontStyle="Italic" Foreground="Gray" VerticalAlignment="Center" FontSize="12" Content="是否临床试验者" />
<CheckBox Margin="2,0,0,0" VerticalAlignment="Center" Name="_chkClinicalTrialSubject" FontSize="12" IsThreeState="False" IsChecked="{Binding IsClinicalTrialSubject}" />
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</emr:PatientBannerSetting.InformationTemplate>
<emr:PatientBannerSetting.Background>DarkGray</emr:PatientBannerSetting.Background>
<s:String>JetSun.ClinicalManagement.EMR.EncounterParticipationSection</s:String>
<s:String>JetSun.ClinicalManagement.EMR.PatientTypeSection</s:String>
<s:String>JetSun.ClinicalManagement.EMR.ExpenseSection</s:String>
<s:String>JetSun.ClinicalManagement.EMR.NoticeSection</s:String>
<s:String>JetSun.ClinicalManagement.EMR.AllergySection</s:String>
<s:String>JetSun.ClinicalManagement.EMR.LifeDiagnoseSection</s:String>
<s:String>JetSun.ClinicalManagement.Pathway.CarePathwaySection</s:String>
</emr:PatientBannerSetting>
</ResourceDictionary>
二、PatientBannerHostView.xaml.cs 代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using JetSun.ClinicalManagement.Layout;
using JetSun.DomainModel;
using JetSun.Infrastructure;
using JetSun.Presentation;
using JetSun.Presentation.Markups;
using Microsoft.Practices.Unity;
using System.Globalization;
using JetSun.PatientAdministration.Presentation;
using JetSun.ReportModel;
namespace JetSun.ClinicalManagement.EMR
{
/// <summary>
/// PatientBannerHostView.xaml 的交互逻辑
/// </summary>
[DefaultMapping(typeof(IPatientBannerHostView))]
public partial class PatientBannerHostView : UserControl, IPatientBannerHostView
{
private PatientBannerSetting _setting;
private FrameworkElement _infoDetail;
/// <summary>
///
/// </summary>
public PatientBannerHostView()
{
InitializeComponent();
_setting = PatientBannerResource.Instance.Setting;
_infoDetail = _setting.InformationTemplate.LoadContent() as FrameworkElement;
_chkClinicalTrialSubject = _infoDetail.FindName("_chkClinicalTrialSubject") as CheckBox;
if (_chkClinicalTrialSubject != null)
{
_chkClinicalTrialSubject.Checked -= _chkClinicalTrialSubject_Checked;
_chkClinicalTrialSubject.Checked += _chkClinicalTrialSubject_Checked;
_chkClinicalTrialSubject.Unchecked -= _chkClinicalTrialSubject_Checked;
_chkClinicalTrialSubject.Unchecked += _chkClinicalTrialSubject_Checked;
}
_sectionGrd.MouseLeftButtonUp -= _sectionGrd_MouseLeftButtonUp;
_sectionGrd.MouseLeftButtonUp += _sectionGrd_MouseLeftButtonUp;
_pop.MouseLeftButtonUp -= _sectionGrd_MouseLeftButtonUp;
_pop.MouseLeftButtonUp += _sectionGrd_MouseLeftButtonUp;
}
CheckBox _chkClinicalTrialSubject;
private bool isChangedByCode = false;
private void _chkClinicalTrialSubject_Checked(object sender, RoutedEventArgs e)
{
if (isChangedByCode) return;
if (_encounter.GetId() < 0) return;
isChangedByCode = true;
bool isClinicalTrialSubject = _chkClinicalTrialSubject.IsChecked.HasValue && _chkClinicalTrialSubject.IsChecked.Value;
string msg = isClinicalTrialSubject ? @"是否设置该患者为“临床试验者”?" : @"是否取消设置该患者为“临床试验者”?";
if (MessageHelper.ShowDialog(msg, "提示", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes)
{
if (!isClinicalTrialSubject)
Repository.DeleteAttributes(_encounter, "IsClinicalTrialSubject");
else
Repository.SaveOneAttribute(_encounter.Id, "IsClinicalTrialSubject", "1");
_encounter.IsClinicalTrialSubject = isClinicalTrialSubject;
}
else
{
_encounter.IsClinicalTrialSubject = !isClinicalTrialSubject;
}
isChangedByCode = false;
}
private static IEncounterRepository _repository;
public static IEncounterRepository Repository
{
get
{
if (_repository == null)
_repository = ModuleBase.Resolve<IEncounterRepository>();
return _repository;
}
}
bool GetIsQCResubmit(IMedicalRecord mr)
{
if (mr == null) return false;
if (Presenter.UseCase.GetDockdeskKind() != DockdeskKind.EmrQC) return false;
if (!mr.Status.IsPackaged || mr.ICDAuditStatus != ICDAuditStatus.CancelAudited) return false;
IList<MedicalRecordOperateInfo> infos = MedicalRecordRepository.GetOperateInfoById(_encounter.Id).ToList();
bool hasPackaged = infos.Where(a => a.Description != null && a.Description.Contains("取消提交")).Count() > 0;
return hasPackaged;
}
static IMedicalRecordRepository _medicalRecordRepository;
static IMedicalRecordRepository MedicalRecordRepository
{
get
{
if (_medicalRecordRepository == null)
_medicalRecordRepository = UseCaseItem.Current.GetLocalItem<IMedicalRecordRepository>();
return _medicalRecordRepository;
}
}
void _sectionGrd_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
_pop.IsOpen = !_pop.IsOpen;
}
void PatientBannerHostView_Loaded(object sender, RoutedEventArgs e)
{
this.Loaded -= new RoutedEventHandler(PatientBannerHostView_Loaded);
Refresh();
}
#region IPresenterDependency<PatientBannerHostPresenter> 成员
private IPatientBannerPresenter _presenter;
/// <summary>
///
/// </summary>
public IPatientBannerPresenter Presenter
{
get { return _presenter; }
set { _presenter = value; }
}
#endregion
public void OnInitialize(FrameworkElement seeker, DockdeskKind deskKind)
{
if (seeker != null && !seeker.HasLocalValue(FrameworkElement.MinWidthProperty))
seeker.MinWidth = 150;
_hostSeeker.SetView(seeker);
InitGrid(deskKind);
}
IEncounter _encounter;
public void SetEncounter(IEncounter encounter)
{
_encounter = encounter;
if (this.IsLoaded)
{
Refresh();
}
else
{
this.Loaded -= new RoutedEventHandler(PatientBannerHostView_Loaded);
this.Loaded += new RoutedEventHandler(PatientBannerHostView_Loaded);
}
}
private void Refresh()
{
//上下文改为病案
IMedicalRecord mr;
if (_encounter == null)
mr = null;
else
{
mr = Presenter.UseCase.GetMedicalRecord();
if (mr != null)
{
if (GetIsQCResubmit(mr))
mr.QCResubmit = "重新提交";
else
mr.QCResubmit = null;
if (mr.ICDAuditStatus.IsAudited && Presenter.UseCase.GetDockdeskKind() == DockdeskKind.EmrQC)
mr.ICDAuditedLable = "ICD已审核";
else
mr.ICDAuditedLable = null;
if (Presenter.UseCase.GetDockdeskKind() == DockdeskKind.EmrQC)
mr.IsQCDockdesk = true;
else
mr.IsQCDockdesk = false;
}
}
_hostGrid.DataContext = null;
_hostGrid.DataContext = mr;
Dispatcher.BeginInvoke((Action)DoRefresh, System.Windows.Threading.DispatcherPriority.Input);
}
private void DoRefresh()
{
if (this.IsVisible)
foreach (var item in Sections)
{
if (item is EncounterParticipationSection)
{
EncounterParticipationSection section = item as EncounterParticipationSection;
IMedicalRecord mr = Presenter.UseCase.GetMedicalRecord();
if (mr != null) mr.IsQCDockdesk = Presenter.UseCase.GetDockdeskKind() == DockdeskKind.EmrQC;
section.MedicalRecord = mr;
}
item.Refresh(_encounter, true);
}
}
IList<PatientBannerSection> _sections;
private IEnumerable<PatientBannerSection> Sections
{
get
{
if (_sections == null)
{
_sections = new List<PatientBannerSection>();
UseCaseItem useCase = Presenter.UseCase;
foreach (Type t in _setting.GetSections())
{
_sections.Add(useCase.Items.AddNew<PatientBannerSection>(t));
}
}
return _sections;
}
}
SolidColorBrush BannerMiddleBorderBrush
{
get { return this.Resources["BannerMiddleBorderBrush"] as SolidColorBrush; }
}
private void InitGrid(DockdeskKind deskKind)
{
_inforGrid.Children.Add(_infoDetail.Detached());
Grid.SetColumn(_infoDetail, 1);
int col = 0;
INotifyDockdeskInitialized ndi;
foreach (var item in Sections)
{
ndi = item as INotifyDockdeskInitialized;
if (ndi != null)
ndi.OnInitialize(deskKind);
item.Header.Detach();
item.ExpandedHeader.Detach();
item.Content.Detach();
Binding binding = new Binding("IsHidden");
binding.Source = item;
GridLength sectionWidth = item.SectionWidth;
ExpenseSection es = item as ExpenseSection;
if (es != null)
{
sectionWidth = item.SectionWidth.IsStar ? new GridLength(2, GridUnitType.Star) : new GridLength(2 * item.SectionWidth.Value);
}
ColumnDefinition cd = new ColumnDefinition { Width = sectionWidth };
MarkupHelper.SetHiddenBinding(cd, binding);
_sectionGrd.ColumnDefinitions.Add(cd);
Border headerBor = new Border { BorderThickness = new Thickness(0.5), BorderBrush = BannerMiddleBorderBrush };
headerBor.Child = item.Header;
_sectionGrd.Children.Add(headerBor);
Grid.SetColumn(headerBor, col);
cd = new ColumnDefinition { Width = sectionWidth };
MarkupHelper.SetHiddenBinding(cd, binding);
_expandGrd.ColumnDefinitions.Add(cd);
Border expanderBor = new Border { BorderThickness = new Thickness(0.5), BorderBrush = BannerMiddleBorderBrush, Background = _setting.Background };
expanderBor.Child = item.ExpandedHeader;
_expandGrd.Children.Add(expanderBor);
Grid.SetColumn(expanderBor, col);
cd = new ColumnDefinition { Width = sectionWidth };
MarkupHelper.SetHiddenBinding(cd, binding);
_contentGrd.ColumnDefinitions.Add(cd);
Border contentBor = new Border { BorderThickness = new Thickness(0.5), BorderBrush = BannerMiddleBorderBrush };
contentBor.Child = item.Content;
_contentGrd.Children.Add(contentBor);
Grid.SetColumn(contentBor, col);
col++;
}
}
}
}
浙公网安备 33010602011771号