xuechun 5 years ago
parent
commit
d739ca4da5
37 changed files with 3849 additions and 0 deletions
  1. 21 0
      DataAccess/App.Config
  2. 133 0
      DataAccess/DataAccess.csproj
  3. 32 0
      DataAccess/LabMaster.cs
  4. 26 0
      DataAccess/LabResult.cs
  5. 35 0
      DataAccess/Object.Context.cs
  6. 636 0
      DataAccess/Object.Context.tt
  7. 10 0
      DataAccess/Object.Designer.cs
  8. 9 0
      DataAccess/Object.cs
  9. 480 0
      DataAccess/Object.edmx
  10. 17 0
      DataAccess/Object.edmx.diagram
  11. 733 0
      DataAccess/Object.tt
  12. 48 0
      DataAccess/Order.cs
  13. 39 0
      DataAccess/OrderCheck.cs
  14. 48 0
      DataAccess/Patient.cs
  15. 24 0
      DataAccess/PatientVitalSign.cs
  16. 36 0
      DataAccess/Properties/AssemblyInfo.cs
  17. 25 0
      DataAccess/Repository/LabMasterRepository.cs
  18. 25 0
      DataAccess/Repository/LabResultRepository.cs
  19. 25 0
      DataAccess/Repository/OrderCheckRepository.cs
  20. 25 0
      DataAccess/Repository/OrderRepository.cs
  21. 25 0
      DataAccess/Repository/PatientRepository.cs
  22. 25 0
      DataAccess/Repository/PatientVitalSignRepository.cs
  23. 5 0
      DataAccess/packages.config
  24. 36 0
      Utils/Properties/AssemblyInfo.cs
  25. 54 0
      Utils/Utils.csproj
  26. 86 0
      Utils/XmlUtils.cs
  27. 34 0
      WebServiceDemo.sln
  28. 79 0
      WebServiceDemo/ApplicationInsights.config
  29. 563 0
      WebServiceDemo/Model/WoundModel.cs
  30. 35 0
      WebServiceDemo/Properties/AssemblyInfo.cs
  31. 48 0
      WebServiceDemo/Web.config
  32. 1 0
      WebServiceDemo/WebServiceDemo.asmx
  33. 141 0
      WebServiceDemo/WebServiceDemo.asmx.cs
  34. 211 0
      WebServiceDemo/WebServiceDemo.csproj
  35. 1 0
      WebServiceDemo/WebServiceWound.asmx
  36. 56 0
      WebServiceDemo/WebServiceWound.asmx.cs
  37. 22 0
      WebServiceDemo/packages.config

+ 21 - 0
DataAccess/App.Config

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+  </configSections>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+      <parameters>
+        <parameter value="mssqllocaldb" />
+      </parameters>
+    </defaultConnectionFactory>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
+  <connectionStrings>
+    <add name="DB" connectionString="metadata=res://*/Object.csdl|res://*/Object.ssdl|res://*/Object.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=localhost;initial catalog=WebServiceDemo;user id=sa;password=xuechun;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+  </connectionStrings>
+</configuration>

+ 133 - 0
DataAccess/DataAccess.csproj

@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{0F8F6A38-AF7C-4F65-980B-4F909FA93A9F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>DataAccess</RootNamespace>
+    <AssemblyName>DataAccess</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.Entity" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="LabMaster.cs">
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="LabResult.cs">
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Object.Context.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Object.Context.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Object.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Object.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Object.edmx</DependentUpon>
+    </Compile>
+    <Compile Include="Order.cs">
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="OrderCheck.cs">
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Patient.cs">
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="PatientVitalSign.cs">
+      <DependentUpon>Object.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Repository\OrderCheckRepository.cs" />
+    <Compile Include="Repository\LabResultRepository.cs" />
+    <Compile Include="Repository\LabMasterRepository.cs" />
+    <Compile Include="Repository\OrderRepository.cs" />
+    <Compile Include="Repository\PatientRepository.cs" />
+    <Compile Include="Repository\PatientVitalSignRepository.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <EntityDeploy Include="Object.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>Object.Designer.cs</LastGenOutput>
+    </EntityDeploy>
+    <None Include="App.Config" />
+    <None Include="Object.edmx.diagram">
+      <DependentUpon>Object.edmx</DependentUpon>
+    </None>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Object.Context.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <DependentUpon>Object.edmx</DependentUpon>
+      <LastGenOutput>Object.Context.cs</LastGenOutput>
+    </Content>
+    <Content Include="Object.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <DependentUpon>Object.edmx</DependentUpon>
+      <LastGenOutput>Object.cs</LastGenOutput>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Domain\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 32 - 0
DataAccess/LabMaster.cs

@@ -0,0 +1,32 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class LabMaster
+    {
+        public long Id { get; set; }
+        public string TestNo { get; set; }
+        public string PatientID { get; set; }
+        public string NotesForSpcm { get; set; }
+        public string Subject { get; set; }
+        public string Specimen { get; set; }
+        public Nullable<System.DateTime> RequestedDateTime { get; set; }
+        public string OrderingProvider { get; set; }
+        public string OrderingDept { get; set; }
+        public string PerformedBy { get; set; }
+        public Nullable<System.DateTime> SampleDateTime { get; set; }
+        public string SPCMCollector { get; set; }
+        public string ResultStatus { get; set; }
+        public string VisitId { get; set; }
+    }
+}

+ 26 - 0
DataAccess/LabResult.cs

@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class LabResult
+    {
+        public long Id { get; set; }
+        public string ItemNo { get; set; }
+        public string ReportItemName { get; set; }
+        public string Result { get; set; }
+        public string Units { get; set; }
+        public string AbnormalFlag { get; set; }
+        public string PrintContext { get; set; }
+        public string TestNo { get; set; }
+    }
+}

+ 35 - 0
DataAccess/Object.Context.cs

@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Data.Entity;
+    using System.Data.Entity.Infrastructure;
+    
+    public partial class DB : DbContext
+    {
+        public DB()
+            : base("name=DB")
+        {
+        }
+    
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            throw new UnintentionalCodeFirstException();
+        }
+    
+        public virtual DbSet<LabMaster> LabMaster { get; set; }
+        public virtual DbSet<LabResult> LabResult { get; set; }
+        public virtual DbSet<Order> Order { get; set; }
+        public virtual DbSet<OrderCheck> OrderCheck { get; set; }
+        public virtual DbSet<Patient> Patient { get; set; }
+        public virtual DbSet<PatientVitalSign> PatientVitalSign { get; set; }
+    }
+}

+ 636 - 0
DataAccess/Object.Context.tt

@@ -0,0 +1,636 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@
+ output extension=".cs"#><#
+
+const string inputFile = @"Object.edmx";
+var textTransform = DynamicTextTransformation.Create(this);
+var code = new CodeGenerationTools(this);
+var ef = new MetadataTools(this);
+var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
+var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
+var itemCollection = loader.CreateEdmItemCollection(inputFile);
+var modelNamespace = loader.GetModelNamespace(inputFile);
+var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
+
+var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
+if (container == null)
+{
+    return string.Empty;
+}
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
+//
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+<#
+
+var codeNamespace = code.VsNamespaceSuggestion();
+if (!String.IsNullOrEmpty(codeNamespace))
+{
+#>
+namespace <#=code.EscapeNamespace(codeNamespace)#>
+{
+<#
+    PushIndent("    ");
+}
+
+#>
+using System;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+<#
+if (container.FunctionImports.Any())
+{
+#>
+using System.Data.Entity.Core.Objects;
+using System.Linq;
+<#
+}
+#>
+
+<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
+{
+    public <#=code.Escape(container)#>()
+        : base("name=<#=container.Name#>")
+    {
+<#
+if (!loader.IsLazyLoadingEnabled(container))
+{
+#>
+        this.Configuration.LazyLoadingEnabled = false;
+<#
+}
+
+foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+{
+    // Note: the DbSet members are defined below such that the getter and
+    // setter always have the same accessibility as the DbSet definition
+    if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
+    {
+#>
+        <#=codeStringGenerator.DbSetInitializer(entitySet)#>
+<#
+    }
+}
+#>
+    }
+
+    protected override void OnModelCreating(DbModelBuilder modelBuilder)
+    {
+        throw new UnintentionalCodeFirstException();
+    }
+
+<#
+    foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+    {
+#>
+    <#=codeStringGenerator.DbSet(entitySet)#>
+<#
+    }
+
+    foreach (var edmFunction in container.FunctionImports)
+    {
+        WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
+    }
+#>
+}
+<#
+
+if (!String.IsNullOrEmpty(codeNamespace))
+{
+    PopIndent();
+#>
+}
+<#
+}
+#>
+<#+
+
+private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+{
+    if (typeMapper.IsComposable(edmFunction))
+    {
+#>
+
+    [DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
+    <#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
+    {
+<#+
+        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
+#>
+        <#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
+    }
+<#+
+    }
+    else
+    {
+#>
+
+    <#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
+    {
+<#+
+        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
+#>
+        <#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
+    }
+<#+
+        if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
+        {
+            WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
+        }
+    }
+}
+
+public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
+{
+#>
+        var <#=name#> = <#=isNotNull#> ?
+            <#=notNullInit#> :
+            <#=nullInit#>;
+
+<#+
+}
+
+public const string TemplateId = "CSharp_DbContext_Context_EF6";
+
+public class CodeStringGenerator
+{
+    private readonly CodeGenerationTools _code;
+    private readonly TypeMapper _typeMapper;
+    private readonly MetadataTools _ef;
+
+    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(typeMapper, "typeMapper");
+        ArgumentNotNull(ef, "ef");
+
+        _code = code;
+        _typeMapper = typeMapper;
+        _ef = ef;
+    }
+
+    public string Property(EdmProperty edmProperty)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            Accessibility.ForProperty(edmProperty),
+            _typeMapper.GetTypeName(edmProperty.TypeUsage),
+            _code.Escape(edmProperty),
+            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
+            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
+    }
+
+    public string NavigationProperty(NavigationProperty navProp)
+    {
+        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
+            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
+            _code.Escape(navProp),
+            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
+            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
+    }
+    
+    public string AccessibilityAndVirtual(string accessibility)
+    {
+        return accessibility + (accessibility != "private" ? " virtual" : "");
+    }
+    
+    public string EntityClassOpening(EntityType entity)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1}partial class {2}{3}",
+            Accessibility.ForType(entity),
+            _code.SpaceAfter(_code.AbstractOption(entity)),
+            _code.Escape(entity),
+            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
+    }
+    
+    public string EnumOpening(SimpleType enumType)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} enum {1} : {2}",
+            Accessibility.ForType(enumType),
+            _code.Escape(enumType),
+            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
+        }
+    
+    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
+    {
+        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
+            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
+        }
+    }
+    
+    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} IQueryable<{1}> {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            _code.Escape(edmFunction),
+            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
+    }
+    
+    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            edmFunction.NamespaceName,
+            edmFunction.Name,
+            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
+            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
+    }
+    
+    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
+        if (includeMergeOption)
+        {
+            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+        }
+
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            _code.Escape(edmFunction),
+            paramList);
+    }
+    
+    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
+            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            edmFunction.Name,
+            callParams);
+    }
+    
+    public string DbSet(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
+            Accessibility.ForReadOnlyProperty(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType),
+            _code.Escape(entitySet));
+    }
+
+    public string DbSetInitializer(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} = Set<{1}>();",
+            _code.Escape(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType));
+    }
+
+    public string UsingDirectives(bool inHeader, bool includeCollections = true)
+    {
+        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
+            ? string.Format(
+                CultureInfo.InvariantCulture,
+                "{0}using System;{1}" +
+                "{2}",
+                inHeader ? Environment.NewLine : "",
+                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
+                inHeader ? "" : Environment.NewLine)
+            : "";
+    }
+}
+
+public class TypeMapper
+{
+    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
+
+    private readonly System.Collections.IList _errors;
+    private readonly CodeGenerationTools _code;
+    private readonly MetadataTools _ef;
+
+    public static string FixNamespaces(string typeName)
+    {
+        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
+    }
+
+    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(ef, "ef");
+        ArgumentNotNull(errors, "errors");
+
+        _code = code;
+        _ef = ef;
+        _errors = errors;
+    }
+
+    public string GetTypeName(TypeUsage typeUsage)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
+    }
+
+    public string GetTypeName(EdmType edmType)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
+    }
+
+    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, string modelNamespace)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
+    {
+        if (edmType == null)
+        {
+            return null;
+        }
+
+        var collectionType = edmType as CollectionType;
+        if (collectionType != null)
+        {
+            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
+        }
+
+        var typeName = _code.Escape(edmType.MetadataProperties
+                                .Where(p => p.Name == ExternalTypeNameAttributeName)
+                                .Select(p => (string)p.Value)
+                                .FirstOrDefault())
+            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
+                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
+                _code.Escape(edmType));
+
+        if (edmType is StructuralType)
+        {
+            return typeName;
+        }
+
+        if (edmType is SimpleType)
+        {
+            var clrType = UnderlyingClrType(edmType);
+            if (!IsEnumType(edmType))
+            {
+                typeName = _code.Escape(clrType);
+            }
+
+            typeName = FixNamespaces(typeName);
+
+            return clrType.IsValueType && isNullable == true ?
+                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
+                typeName;
+        }
+
+        throw new ArgumentException("edmType");
+    }
+    
+    public Type UnderlyingClrType(EdmType edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        var primitiveType = edmType as PrimitiveType;
+        if (primitiveType != null)
+        {
+            return primitiveType.ClrEquivalentType;
+        }
+
+        if (IsEnumType(edmType))
+        {
+            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
+        }
+
+        return typeof(object);
+    }
+    
+    public object GetEnumMemberValue(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var valueProperty = enumMember.GetType().GetProperty("Value");
+        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
+    }
+    
+    public string GetEnumMemberName(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var nameProperty = enumMember.GetType().GetProperty("Name");
+        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
+    }
+
+    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        var membersProperty = enumType.GetType().GetProperty("Members");
+        return membersProperty != null 
+            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
+            : Enumerable.Empty<MetadataItem>();
+    }
+    
+    public bool EnumIsFlags(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+        
+        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
+        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
+    }
+
+    public bool IsEnumType(GlobalItem edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        return edmType.GetType().Name == "EnumType";
+    }
+
+    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
+    }
+
+    public string CreateLiteral(object value)
+    {
+        if (value == null || value.GetType() != typeof(TimeSpan))
+        {
+            return _code.CreateLiteral(value);
+        }
+
+        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
+    }
+    
+    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
+    {
+        ArgumentNotNull(types, "types");
+        ArgumentNotNull(sourceFile, "sourceFile");
+        
+        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+        if (types.Any(item => !hash.Add(item)))
+        {
+            _errors.Add(
+                new CompilerError(sourceFile, -1, -1, "6023",
+                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
+            return false;
+        }
+        return true;
+    }
+    
+    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
+    {
+        return GetItemsToGenerate<SimpleType>(itemCollection)
+            .Where(e => IsEnumType(e));
+    }
+    
+    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
+    {
+        return itemCollection
+            .OfType<T>()
+            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
+            .OrderBy(i => i.Name);
+    }
+
+    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
+    {
+        return itemCollection
+            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
+            .Select(g => GetGlobalItemName(g));
+    }
+
+    public string GetGlobalItemName(GlobalItem item)
+    {
+        if (item is EdmType)
+        {
+            return ((EdmType)item).Name;
+        }
+        else
+        {
+            return ((EntityContainer)item).Name;
+        }
+    }
+
+    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+    
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+
+    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type);
+    }
+    
+    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
+    }
+    
+    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
+        return returnParamsProperty == null
+            ? edmFunction.ReturnParameter
+            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
+    }
+
+    public bool IsComposable(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
+        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
+    }
+
+    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
+    {
+        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+    }
+
+    public TypeUsage GetReturnType(EdmFunction edmFunction)
+    {
+        var returnParam = GetReturnParameter(edmFunction);
+        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
+    }
+    
+    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
+    {
+        var returnType = GetReturnType(edmFunction);
+        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
+    }
+}
+
+public static void ArgumentNotNull<T>(T arg, string name) where T : class
+{
+    if (arg == null)
+    {
+        throw new ArgumentNullException(name);
+    }
+}
+#>

+ 10 - 0
DataAccess/Object.Designer.cs

@@ -0,0 +1,10 @@
+// 为模型“E:\meehealth\WebServiceDemo\DataAccess\Object.edmx”启用了 T4 代码生成。
+// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
+// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时,此属性会出现在
+// “属性”窗口中。
+
+// 如果没有生成任何上下文和实体类,可能是因为您创建了空模型但是
+// 尚未选择要使用的实体框架版本。要为您的模型生成一个上下文类和实体
+// 类,请在设计器中打开该模型,右键单击设计器图面,然后
+// 选择“从数据库更新模型...”、“从模型生成数据库...”或“添加代码生成
+// 项...”。

+ 9 - 0
DataAccess/Object.cs

@@ -0,0 +1,9 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+

+ 480 - 0
DataAccess/Object.edmx

@@ -0,0 +1,480 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+  <!-- EF Runtime content -->
+  <edmx:Runtime>
+    <!-- SSDL content -->
+    <edmx:StorageModels>
+    <Schema Namespace="WebServiceDemoModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+        <EntityType Name="LabMaster">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="TestNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="PatientID" Type="nvarchar" MaxLength="255" />
+          <Property Name="NotesForSpcm" Type="nvarchar" MaxLength="255" />
+          <Property Name="Subject" Type="nvarchar" MaxLength="255" />
+          <Property Name="Specimen" Type="nvarchar" MaxLength="255" />
+          <Property Name="RequestedDateTime" Type="datetime" />
+          <Property Name="OrderingProvider" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderingDept" Type="nvarchar" MaxLength="255" />
+          <Property Name="PerformedBy" Type="nvarchar" MaxLength="255" />
+          <Property Name="SampleDateTime" Type="datetime" />
+          <Property Name="SPCMCollector" Type="nvarchar" MaxLength="255" />
+          <Property Name="ResultStatus" Type="nvarchar" MaxLength="255" />
+          <Property Name="VisitId" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityType Name="LabResult">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="ItemNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="ReportItemName" Type="nvarchar" MaxLength="255" />
+          <Property Name="Result" Type="nvarchar" MaxLength="255" />
+          <Property Name="Units" Type="nvarchar" MaxLength="255" />
+          <Property Name="AbnormalFlag" Type="nvarchar" MaxLength="255" />
+          <Property Name="PrintContext" Type="nvarchar" MaxLength="255" />
+          <Property Name="TestNo" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityType Name="Order">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="OrderId" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderSubNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="RepeatIndicator" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderClass" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderText" Type="nvarchar" MaxLength="255" />
+          <Property Name="Dosage" Type="nvarchar" MaxLength="255" />
+          <Property Name="DosageUnits" Type="nvarchar" MaxLength="255" />
+          <Property Name="DrugSpec" Type="nvarchar" MaxLength="255" />
+          <Property Name="FirmId" Type="nvarchar" MaxLength="255" />
+          <Property Name="Administration" Type="nvarchar" MaxLength="255" />
+          <Property Name="Frequency" Type="nvarchar" MaxLength="255" />
+          <Property Name="FreqCounter" Type="nvarchar" MaxLength="255" />
+          <Property Name="FreqInterval" Type="nvarchar" MaxLength="255" />
+          <Property Name="FreqIntervalUnit" Type="nvarchar" MaxLength="255" />
+          <Property Name="FreqDetail" Type="nvarchar" MaxLength="255" />
+          <Property Name="PerformSchedule" Type="nvarchar" MaxLength="255" />
+          <Property Name="PerformResult" Type="nvarchar" MaxLength="255" />
+          <Property Name="StartDateTime" Type="datetime" />
+          <Property Name="StopDateTime" Type="datetime" />
+          <Property Name="StartDoctor" Type="nvarchar" MaxLength="255" />
+          <Property Name="StartNurse" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderStatus" Type="nvarchar" MaxLength="255" />
+          <Property Name="BillingAttr" Type="nvarchar" MaxLength="255" />
+          <Property Name="DrugBillingAttr" Type="nvarchar" MaxLength="255" />
+          <Property Name="ApplyNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="LastPerformDateTime" Type="datetime" />
+          <Property Name="PatientId" Type="nvarchar" MaxLength="255" />
+          <Property Name="VisitId" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityType Name="OrderCheck">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="SheetClass" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderId" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderSubNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="RepeatIndicator" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderClass" Type="nvarchar" MaxLength="255" />
+          <Property Name="OrderText" Type="nvarchar" MaxLength="255" />
+          <Property Name="DosageUnits" Type="nvarchar" MaxLength="255" />
+          <Property Name="Administration" Type="nvarchar" MaxLength="255" />
+          <Property Name="Frequency" Type="nvarchar" MaxLength="255" />
+          <Property Name="PerformSchedule" Type="nvarchar" MaxLength="255" />
+          <Property Name="ScheduleDateTime" Type="datetime" />
+          <Property Name="StartDateTime" Type="datetime" />
+          <Property Name="StopDateTime" Type="datetime" />
+          <Property Name="OrderStatus" Type="nvarchar" MaxLength="255" />
+          <Property Name="NursePerform" Type="nvarchar" MaxLength="255" />
+          <Property Name="PerformDateTime" Type="datetime" />
+          <Property Name="NurseCheck" Type="nvarchar" MaxLength="255" />
+          <Property Name="PatientId" Type="nvarchar" MaxLength="255" />
+          <Property Name="VisitId" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityType Name="Patient">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="VisitDate" Type="datetime" />
+          <Property Name="VisitNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="ClinicLabel" Type="nvarchar" MaxLength="255" />
+          <Property Name="PVID" Type="nvarchar" MaxLength="255" />
+          <Property Name="PatientId" Type="nvarchar" MaxLength="255" />
+          <Property Name="Doctor" Type="nvarchar" MaxLength="255" />
+          <Property Name="Sex" Type="nvarchar" MaxLength="255" />
+          <Property Name="IndentityNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="TriageDate" Type="datetime" />
+          <Property Name="TriageBy" Type="nvarchar" MaxLength="255" />
+          <Property Name="TriageTarget" Type="nvarchar" MaxLength="255" />
+          <Property Name="TriageLevel" Type="nvarchar" MaxLength="255" />
+          <Property Name="VisitID" Type="nvarchar" MaxLength="255" />
+          <Property Name="PatientName" Type="nvarchar" MaxLength="255" />
+          <Property Name="PatientBirthDate" Type="datetime" />
+          <Property Name="ChargeType" Type="nvarchar" MaxLength="255" />
+          <Property Name="Identity" Type="nvarchar" MaxLength="255" />
+          <Property Name="ContectPhone" Type="nvarchar" MaxLength="255" />
+          <Property Name="ContectPerson" Type="nvarchar" MaxLength="255" />
+          <Property Name="PatientAddress" Type="nvarchar" MaxLength="255" />
+          <Property Name="GreenRoad" Type="nvarchar" MaxLength="255" />
+          <Property Name="Diagnosis" Type="nvarchar" MaxLength="255" />
+          <Property Name="Status" Type="nvarchar" MaxLength="255" />
+          <Property Name="RegisterFrom" Type="nvarchar" MaxLength="255" />
+          <Property Name="Nation" Type="nvarchar" MaxLength="255" />
+          <Property Name="InDeptTime" Type="datetime" />
+          <Property Name="BedNo" Type="nvarchar" MaxLength="255" />
+          <Property Name="BloodType" Type="nvarchar" MaxLength="255" />
+          <Property Name="RhType" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityType Name="PatientVitalSign">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="DataDT" Type="datetime" />
+          <Property Name="ItemName" Type="nvarchar" MaxLength="255" />
+          <Property Name="ItemValue" Type="nvarchar" MaxLength="255" />
+          <Property Name="ItemArtificial" Type="nvarchar" MaxLength="255" />
+          <Property Name="PVID" Type="nvarchar" MaxLength="255" />
+        </EntityType>
+        <EntityContainer Name="WebServiceDemoModelStoreContainer">
+          <EntitySet Name="LabMaster" EntityType="Self.LabMaster" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="LabResult" EntityType="Self.LabResult" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Order" EntityType="Self.Order" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="OrderCheck" EntityType="Self.OrderCheck" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Patient" EntityType="Self.Patient" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="PatientVitalSign" EntityType="Self.PatientVitalSign" Schema="dbo" store:Type="Tables" />
+        </EntityContainer>
+      </Schema></edmx:StorageModels>
+    <!-- CSDL content -->
+    <edmx:ConceptualModels>
+      <Schema Namespace="WebServiceDemoModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
+        <EntityContainer Name="DB" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="LabMaster" EntityType="WebServiceDemoModel.LabMaster" />
+          <EntitySet Name="LabResult" EntityType="WebServiceDemoModel.LabResult" />
+          <EntitySet Name="Order" EntityType="WebServiceDemoModel.Order" />
+          <EntitySet Name="OrderCheck" EntityType="WebServiceDemoModel.OrderCheck" />
+          <EntitySet Name="Patient" EntityType="WebServiceDemoModel.Patient" />
+          <EntitySet Name="PatientVitalSign" EntityType="WebServiceDemoModel.PatientVitalSign" />
+        </EntityContainer>
+        <EntityType Name="LabMaster">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="TestNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PatientID" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="NotesForSpcm" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Subject" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Specimen" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="RequestedDateTime" Type="DateTime" Precision="3" />
+          <Property Name="OrderingProvider" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderingDept" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PerformedBy" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="SampleDateTime" Type="DateTime" Precision="3" />
+          <Property Name="SPCMCollector" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ResultStatus" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="VisitId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <EntityType Name="LabResult">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="ItemNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ReportItemName" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Result" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Units" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="AbnormalFlag" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PrintContext" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="TestNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <EntityType Name="Order">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="OrderId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderSubNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="RepeatIndicator" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderClass" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderText" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Dosage" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="DosageUnits" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="DrugSpec" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="FirmId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Administration" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Frequency" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="FreqCounter" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="FreqInterval" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="FreqIntervalUnit" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="FreqDetail" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PerformSchedule" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PerformResult" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="StartDateTime" Type="DateTime" Precision="3" />
+          <Property Name="StopDateTime" Type="DateTime" Precision="3" />
+          <Property Name="StartDoctor" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="StartNurse" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderStatus" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="BillingAttr" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="DrugBillingAttr" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ApplyNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="LastPerformDateTime" Type="DateTime" Precision="3" />
+          <Property Name="PatientId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="VisitId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <EntityType Name="OrderCheck">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="SheetClass" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderSubNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="RepeatIndicator" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderClass" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="OrderText" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="DosageUnits" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Administration" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Frequency" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PerformSchedule" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ScheduleDateTime" Type="DateTime" Precision="3" />
+          <Property Name="StartDateTime" Type="DateTime" Precision="3" />
+          <Property Name="StopDateTime" Type="DateTime" Precision="3" />
+          <Property Name="OrderStatus" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="NursePerform" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PerformDateTime" Type="DateTime" Precision="3" />
+          <Property Name="NurseCheck" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PatientId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="VisitId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <EntityType Name="Patient">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="VisitDate" Type="DateTime" Precision="3" />
+          <Property Name="VisitNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ClinicLabel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PVID" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PatientId" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Doctor" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Sex" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="IndentityNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="TriageDate" Type="DateTime" Precision="3" />
+          <Property Name="TriageBy" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="TriageTarget" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="TriageLevel" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="VisitID" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PatientName" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PatientBirthDate" Type="DateTime" Precision="3" />
+          <Property Name="ChargeType" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Identity" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ContectPhone" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ContectPerson" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PatientAddress" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="GreenRoad" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Diagnosis" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Status" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="RegisterFrom" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="Nation" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="InDeptTime" Type="DateTime" Precision="3" />
+          <Property Name="BedNo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="BloodType" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="RhType" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+        </EntityType>
+        <EntityType Name="PatientVitalSign">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Name="Id" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="DataDT" Type="DateTime" Precision="3" />
+          <Property Name="ItemName" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ItemValue" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="ItemArtificial" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+          <Property Name="PVID" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
+        </EntityType>
+        </Schema>
+    </edmx:ConceptualModels>
+    <!-- C-S mapping content -->
+    <edmx:Mappings>
+      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
+        <EntityContainerMapping StorageEntityContainer="WebServiceDemoModelStoreContainer" CdmEntityContainer="DB">
+          <EntitySetMapping Name="LabMaster">
+            <EntityTypeMapping TypeName="WebServiceDemoModel.LabMaster">
+              <MappingFragment StoreEntitySet="LabMaster">
+                <ScalarProperty Name="VisitId" ColumnName="VisitId" />
+                <ScalarProperty Name="ResultStatus" ColumnName="ResultStatus" />
+                <ScalarProperty Name="SPCMCollector" ColumnName="SPCMCollector" />
+                <ScalarProperty Name="SampleDateTime" ColumnName="SampleDateTime" />
+                <ScalarProperty Name="PerformedBy" ColumnName="PerformedBy" />
+                <ScalarProperty Name="OrderingDept" ColumnName="OrderingDept" />
+                <ScalarProperty Name="OrderingProvider" ColumnName="OrderingProvider" />
+                <ScalarProperty Name="RequestedDateTime" ColumnName="RequestedDateTime" />
+                <ScalarProperty Name="Specimen" ColumnName="Specimen" />
+                <ScalarProperty Name="Subject" ColumnName="Subject" />
+                <ScalarProperty Name="NotesForSpcm" ColumnName="NotesForSpcm" />
+                <ScalarProperty Name="PatientID" ColumnName="PatientID" />
+                <ScalarProperty Name="TestNo" ColumnName="TestNo" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="LabResult">
+            <EntityTypeMapping TypeName="WebServiceDemoModel.LabResult">
+              <MappingFragment StoreEntitySet="LabResult">
+                <ScalarProperty Name="TestNo" ColumnName="TestNo" />
+                <ScalarProperty Name="PrintContext" ColumnName="PrintContext" />
+                <ScalarProperty Name="AbnormalFlag" ColumnName="AbnormalFlag" />
+                <ScalarProperty Name="Units" ColumnName="Units" />
+                <ScalarProperty Name="Result" ColumnName="Result" />
+                <ScalarProperty Name="ReportItemName" ColumnName="ReportItemName" />
+                <ScalarProperty Name="ItemNo" ColumnName="ItemNo" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Order">
+            <EntityTypeMapping TypeName="WebServiceDemoModel.Order">
+              <MappingFragment StoreEntitySet="Order">
+                <ScalarProperty Name="VisitId" ColumnName="VisitId" />
+                <ScalarProperty Name="PatientId" ColumnName="PatientId" />
+                <ScalarProperty Name="LastPerformDateTime" ColumnName="LastPerformDateTime" />
+                <ScalarProperty Name="ApplyNo" ColumnName="ApplyNo" />
+                <ScalarProperty Name="DrugBillingAttr" ColumnName="DrugBillingAttr" />
+                <ScalarProperty Name="BillingAttr" ColumnName="BillingAttr" />
+                <ScalarProperty Name="OrderStatus" ColumnName="OrderStatus" />
+                <ScalarProperty Name="StartNurse" ColumnName="StartNurse" />
+                <ScalarProperty Name="StartDoctor" ColumnName="StartDoctor" />
+                <ScalarProperty Name="StopDateTime" ColumnName="StopDateTime" />
+                <ScalarProperty Name="StartDateTime" ColumnName="StartDateTime" />
+                <ScalarProperty Name="PerformResult" ColumnName="PerformResult" />
+                <ScalarProperty Name="PerformSchedule" ColumnName="PerformSchedule" />
+                <ScalarProperty Name="FreqDetail" ColumnName="FreqDetail" />
+                <ScalarProperty Name="FreqIntervalUnit" ColumnName="FreqIntervalUnit" />
+                <ScalarProperty Name="FreqInterval" ColumnName="FreqInterval" />
+                <ScalarProperty Name="FreqCounter" ColumnName="FreqCounter" />
+                <ScalarProperty Name="Frequency" ColumnName="Frequency" />
+                <ScalarProperty Name="Administration" ColumnName="Administration" />
+                <ScalarProperty Name="FirmId" ColumnName="FirmId" />
+                <ScalarProperty Name="DrugSpec" ColumnName="DrugSpec" />
+                <ScalarProperty Name="DosageUnits" ColumnName="DosageUnits" />
+                <ScalarProperty Name="Dosage" ColumnName="Dosage" />
+                <ScalarProperty Name="OrderText" ColumnName="OrderText" />
+                <ScalarProperty Name="OrderClass" ColumnName="OrderClass" />
+                <ScalarProperty Name="RepeatIndicator" ColumnName="RepeatIndicator" />
+                <ScalarProperty Name="OrderSubNo" ColumnName="OrderSubNo" />
+                <ScalarProperty Name="OrderNo" ColumnName="OrderNo" />
+                <ScalarProperty Name="OrderId" ColumnName="OrderId" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="OrderCheck">
+            <EntityTypeMapping TypeName="WebServiceDemoModel.OrderCheck">
+              <MappingFragment StoreEntitySet="OrderCheck">
+                <ScalarProperty Name="VisitId" ColumnName="VisitId" />
+                <ScalarProperty Name="PatientId" ColumnName="PatientId" />
+                <ScalarProperty Name="NurseCheck" ColumnName="NurseCheck" />
+                <ScalarProperty Name="PerformDateTime" ColumnName="PerformDateTime" />
+                <ScalarProperty Name="NursePerform" ColumnName="NursePerform" />
+                <ScalarProperty Name="OrderStatus" ColumnName="OrderStatus" />
+                <ScalarProperty Name="StopDateTime" ColumnName="StopDateTime" />
+                <ScalarProperty Name="StartDateTime" ColumnName="StartDateTime" />
+                <ScalarProperty Name="ScheduleDateTime" ColumnName="ScheduleDateTime" />
+                <ScalarProperty Name="PerformSchedule" ColumnName="PerformSchedule" />
+                <ScalarProperty Name="Frequency" ColumnName="Frequency" />
+                <ScalarProperty Name="Administration" ColumnName="Administration" />
+                <ScalarProperty Name="DosageUnits" ColumnName="DosageUnits" />
+                <ScalarProperty Name="OrderText" ColumnName="OrderText" />
+                <ScalarProperty Name="OrderClass" ColumnName="OrderClass" />
+                <ScalarProperty Name="RepeatIndicator" ColumnName="RepeatIndicator" />
+                <ScalarProperty Name="OrderSubNo" ColumnName="OrderSubNo" />
+                <ScalarProperty Name="OrderNo" ColumnName="OrderNo" />
+                <ScalarProperty Name="OrderId" ColumnName="OrderId" />
+                <ScalarProperty Name="SheetClass" ColumnName="SheetClass" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Patient">
+            <EntityTypeMapping TypeName="WebServiceDemoModel.Patient">
+              <MappingFragment StoreEntitySet="Patient">
+                <ScalarProperty Name="RhType" ColumnName="RhType" />
+                <ScalarProperty Name="BloodType" ColumnName="BloodType" />
+                <ScalarProperty Name="BedNo" ColumnName="BedNo" />
+                <ScalarProperty Name="InDeptTime" ColumnName="InDeptTime" />
+                <ScalarProperty Name="Nation" ColumnName="Nation" />
+                <ScalarProperty Name="RegisterFrom" ColumnName="RegisterFrom" />
+                <ScalarProperty Name="Status" ColumnName="Status" />
+                <ScalarProperty Name="Diagnosis" ColumnName="Diagnosis" />
+                <ScalarProperty Name="GreenRoad" ColumnName="GreenRoad" />
+                <ScalarProperty Name="PatientAddress" ColumnName="PatientAddress" />
+                <ScalarProperty Name="ContectPerson" ColumnName="ContectPerson" />
+                <ScalarProperty Name="ContectPhone" ColumnName="ContectPhone" />
+                <ScalarProperty Name="Identity" ColumnName="Identity" />
+                <ScalarProperty Name="ChargeType" ColumnName="ChargeType" />
+                <ScalarProperty Name="PatientBirthDate" ColumnName="PatientBirthDate" />
+                <ScalarProperty Name="PatientName" ColumnName="PatientName" />
+                <ScalarProperty Name="VisitID" ColumnName="VisitID" />
+                <ScalarProperty Name="TriageLevel" ColumnName="TriageLevel" />
+                <ScalarProperty Name="TriageTarget" ColumnName="TriageTarget" />
+                <ScalarProperty Name="TriageBy" ColumnName="TriageBy" />
+                <ScalarProperty Name="TriageDate" ColumnName="TriageDate" />
+                <ScalarProperty Name="IndentityNo" ColumnName="IndentityNo" />
+                <ScalarProperty Name="Sex" ColumnName="Sex" />
+                <ScalarProperty Name="Doctor" ColumnName="Doctor" />
+                <ScalarProperty Name="PatientId" ColumnName="PatientId" />
+                <ScalarProperty Name="PVID" ColumnName="PVID" />
+                <ScalarProperty Name="ClinicLabel" ColumnName="ClinicLabel" />
+                <ScalarProperty Name="VisitNo" ColumnName="VisitNo" />
+                <ScalarProperty Name="VisitDate" ColumnName="VisitDate" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="PatientVitalSign">
+            <EntityTypeMapping TypeName="WebServiceDemoModel.PatientVitalSign">
+              <MappingFragment StoreEntitySet="PatientVitalSign">
+                <ScalarProperty Name="PVID" ColumnName="PVID" />
+                <ScalarProperty Name="ItemArtificial" ColumnName="ItemArtificial" />
+                <ScalarProperty Name="ItemValue" ColumnName="ItemValue" />
+                <ScalarProperty Name="ItemName" ColumnName="ItemName" />
+                <ScalarProperty Name="DataDT" ColumnName="DataDT" />
+                <ScalarProperty Name="Id" ColumnName="Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+        </EntityContainerMapping>
+      </Mapping>
+    </edmx:Mappings>
+  </edmx:Runtime>
+  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <Connection>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
+      </DesignerInfoPropertySet>
+    </Connection>
+    <Options>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="ValidateOnBuild" Value="true" />
+        <DesignerProperty Name="EnablePluralization" Value="false" />
+        <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
+        <DesignerProperty Name="UseLegacyProvider" Value="false" />
+        <DesignerProperty Name="CodeGenerationStrategy" Value="无" />
+      </DesignerInfoPropertySet>
+    </Options>
+    <!-- Diagram content (shape and connector positions) -->
+    <Diagrams></Diagrams>
+  </Designer>
+</edmx:Edmx>

+ 17 - 0
DataAccess/Object.edmx.diagram

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+ <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <!-- Diagram content (shape and connector positions) -->
+    <edmx:Diagrams>
+      <Diagram DiagramId="dd0f77bcfcc34af1ae47e85095afe2d4" Name="Diagram1" ZoomLevel="87">
+        <EntityTypeShape EntityType="WebServiceDemoModel.LabMaster" Width="1.5" PointX="0.75" PointY="0.75" />
+        <EntityTypeShape EntityType="WebServiceDemoModel.LabResult" Width="1.5" PointX="2.75" PointY="0.75" />
+        <EntityTypeShape EntityType="WebServiceDemoModel.Order" Width="1.5" PointX="4.75" PointY="0.75" />
+        <EntityTypeShape EntityType="WebServiceDemoModel.OrderCheck" Width="1.5" PointX="0.75" PointY="5.75" />
+        <EntityTypeShape EntityType="WebServiceDemoModel.Patient" Width="1.5" PointX="6.75" PointY="0.75" />
+        <EntityTypeShape EntityType="WebServiceDemoModel.PatientVitalSign" Width="1.5" PointX="8.75" PointY="0.75" />
+      </Diagram>
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>

+ 733 - 0
DataAccess/Object.tt

@@ -0,0 +1,733 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@ 
+ output extension=".cs"#><#
+
+const string inputFile = @"Object.edmx";
+var textTransform = DynamicTextTransformation.Create(this);
+var code = new CodeGenerationTools(this);
+var ef = new MetadataTools(this);
+var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
+var	fileManager = EntityFrameworkTemplateFileManager.Create(this);
+var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
+var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
+
+if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
+{
+    return string.Empty;
+}
+
+WriteHeader(codeStringGenerator, fileManager);
+
+foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
+{
+    fileManager.StartNewFile(entity.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
+<#=codeStringGenerator.EntityClassOpening(entity)#>
+{
+<#
+    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
+    var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
+    var complexProperties = typeMapper.GetComplexProperties(entity);
+
+    if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
+    {
+#>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+    public <#=code.Escape(entity)#>()
+    {
+<#
+        foreach (var edmProperty in propertiesWithDefaultValues)
+        {
+#>
+        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
+<#
+        }
+
+        foreach (var navigationProperty in collectionNavigationProperties)
+        {
+#>
+        this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
+<#
+        }
+
+        foreach (var complexProperty in complexProperties)
+        {
+#>
+        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
+<#
+        }
+#>
+    }
+
+<#
+    }
+
+    var simpleProperties = typeMapper.GetSimpleProperties(entity);
+    if (simpleProperties.Any())
+    {
+        foreach (var edmProperty in simpleProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+
+    if (complexProperties.Any())
+    {
+#>
+
+<#
+        foreach(var complexProperty in complexProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(complexProperty)#>
+<#
+        }
+    }
+
+    var navigationProperties = typeMapper.GetNavigationProperties(entity);
+    if (navigationProperties.Any())
+    {
+#>
+
+<#
+        foreach (var navigationProperty in navigationProperties)
+        {
+            if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
+            {
+#>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+<#
+            }
+#>
+    <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
+<#
+        }
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
+{
+    fileManager.StartNewFile(complex.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
+<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
+{
+<#
+    var complexProperties = typeMapper.GetComplexProperties(complex);
+    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
+
+    if (propertiesWithDefaultValues.Any() || complexProperties.Any())
+    {
+#>
+    public <#=code.Escape(complex)#>()
+    {
+<#
+        foreach (var edmProperty in propertiesWithDefaultValues)
+        {
+#>
+        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
+<#
+        }
+
+        foreach (var complexProperty in complexProperties)
+        {
+#>
+        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
+<#
+        }
+#>
+    }
+
+<#
+    }
+
+    var simpleProperties = typeMapper.GetSimpleProperties(complex);
+    if (simpleProperties.Any())
+    {
+        foreach(var edmProperty in simpleProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+
+    if (complexProperties.Any())
+    {
+#>
+
+<#
+        foreach(var edmProperty in complexProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
+{
+    fileManager.StartNewFile(enumType.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
+<#
+    if (typeMapper.EnumIsFlags(enumType))
+    {
+#>
+[Flags]
+<#
+    }
+#>
+<#=codeStringGenerator.EnumOpening(enumType)#>
+{
+<#
+    var foundOne = false;
+    
+    foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
+    {
+        foundOne = true;
+#>
+    <#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
+<#
+    }
+
+    if (foundOne)
+    {
+        this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+fileManager.Process();
+
+#>
+<#+
+
+public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
+{
+    fileManager.StartHeader();
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
+//
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
+// </auto-generated>
+//------------------------------------------------------------------------------
+<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
+<#+
+    fileManager.EndBlock();
+}
+
+public void BeginNamespace(CodeGenerationTools code)
+{
+    var codeNamespace = code.VsNamespaceSuggestion();
+    if (!String.IsNullOrEmpty(codeNamespace))
+    {
+#>
+namespace <#=code.EscapeNamespace(codeNamespace)#>
+{
+<#+
+        PushIndent("    ");
+    }
+}
+
+public void EndNamespace(CodeGenerationTools code)
+{
+    if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
+    {
+        PopIndent();
+#>
+}
+<#+
+    }
+}
+
+public const string TemplateId = "CSharp_DbContext_Types_EF6";
+
+public class CodeStringGenerator
+{
+    private readonly CodeGenerationTools _code;
+    private readonly TypeMapper _typeMapper;
+    private readonly MetadataTools _ef;
+
+    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(typeMapper, "typeMapper");
+        ArgumentNotNull(ef, "ef");
+
+        _code = code;
+        _typeMapper = typeMapper;
+        _ef = ef;
+    }
+
+    public string Property(EdmProperty edmProperty)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            Accessibility.ForProperty(edmProperty),
+            _typeMapper.GetTypeName(edmProperty.TypeUsage),
+            _code.Escape(edmProperty),
+            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
+            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
+    }
+
+    public string NavigationProperty(NavigationProperty navProp)
+    {
+        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
+            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
+            _code.Escape(navProp),
+            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
+            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
+    }
+    
+    public string AccessibilityAndVirtual(string accessibility)
+    {
+        return accessibility + (accessibility != "private" ? " virtual" : "");
+    }
+    
+    public string EntityClassOpening(EntityType entity)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1}partial class {2}{3}",
+            Accessibility.ForType(entity),
+            _code.SpaceAfter(_code.AbstractOption(entity)),
+            _code.Escape(entity),
+            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
+    }
+    
+    public string EnumOpening(SimpleType enumType)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} enum {1} : {2}",
+            Accessibility.ForType(enumType),
+            _code.Escape(enumType),
+            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
+        }
+    
+    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
+    {
+        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
+            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
+        }
+    }
+    
+    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} IQueryable<{1}> {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            _code.Escape(edmFunction),
+            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
+    }
+    
+    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            edmFunction.NamespaceName,
+            edmFunction.Name,
+            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
+            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
+    }
+    
+    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
+        if (includeMergeOption)
+        {
+            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+        }
+
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            _code.Escape(edmFunction),
+            paramList);
+    }
+    
+    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
+            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            edmFunction.Name,
+            callParams);
+    }
+    
+    public string DbSet(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
+            Accessibility.ForReadOnlyProperty(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType),
+            _code.Escape(entitySet));
+    }
+
+    public string UsingDirectives(bool inHeader, bool includeCollections = true)
+    {
+        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
+            ? string.Format(
+                CultureInfo.InvariantCulture,
+                "{0}using System;{1}" +
+                "{2}",
+                inHeader ? Environment.NewLine : "",
+                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
+                inHeader ? "" : Environment.NewLine)
+            : "";
+    }
+}
+
+public class TypeMapper
+{
+    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
+
+    private readonly System.Collections.IList _errors;
+    private readonly CodeGenerationTools _code;
+    private readonly MetadataTools _ef;
+
+    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(ef, "ef");
+        ArgumentNotNull(errors, "errors");
+
+        _code = code;
+        _ef = ef;
+        _errors = errors;
+    }
+
+    public static string FixNamespaces(string typeName)
+    {
+        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
+    }
+
+    public string GetTypeName(TypeUsage typeUsage)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
+    }
+
+    public string GetTypeName(EdmType edmType)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
+    }
+
+    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, string modelNamespace)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
+    {
+        if (edmType == null)
+        {
+            return null;
+        }
+
+        var collectionType = edmType as CollectionType;
+        if (collectionType != null)
+        {
+            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
+        }
+
+        var typeName = _code.Escape(edmType.MetadataProperties
+                                .Where(p => p.Name == ExternalTypeNameAttributeName)
+                                .Select(p => (string)p.Value)
+                                .FirstOrDefault())
+            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
+                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
+                _code.Escape(edmType));
+
+        if (edmType is StructuralType)
+        {
+            return typeName;
+        }
+
+        if (edmType is SimpleType)
+        {
+            var clrType = UnderlyingClrType(edmType);
+            if (!IsEnumType(edmType))
+            {
+                typeName = _code.Escape(clrType);
+            }
+
+            typeName = FixNamespaces(typeName);
+
+            return clrType.IsValueType && isNullable == true ?
+                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
+                typeName;
+        }
+
+        throw new ArgumentException("edmType");
+    }
+    
+    public Type UnderlyingClrType(EdmType edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        var primitiveType = edmType as PrimitiveType;
+        if (primitiveType != null)
+        {
+            return primitiveType.ClrEquivalentType;
+        }
+
+        if (IsEnumType(edmType))
+        {
+            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
+        }
+
+        return typeof(object);
+    }
+    
+    public object GetEnumMemberValue(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var valueProperty = enumMember.GetType().GetProperty("Value");
+        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
+    }
+    
+    public string GetEnumMemberName(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var nameProperty = enumMember.GetType().GetProperty("Name");
+        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
+    }
+
+    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        var membersProperty = enumType.GetType().GetProperty("Members");
+        return membersProperty != null 
+            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
+            : Enumerable.Empty<MetadataItem>();
+    }
+    
+    public bool EnumIsFlags(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+        
+        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
+        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
+    }
+
+    public bool IsEnumType(GlobalItem edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        return edmType.GetType().Name == "EnumType";
+    }
+
+    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
+    }
+
+    public string CreateLiteral(object value)
+    {
+        if (value == null || value.GetType() != typeof(TimeSpan))
+        {
+            return _code.CreateLiteral(value);
+        }
+
+        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
+    }
+    
+    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
+    {
+        ArgumentNotNull(types, "types");
+        ArgumentNotNull(sourceFile, "sourceFile");
+        
+        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+        if (types.Any(item => !hash.Add(item)))
+        {
+            _errors.Add(
+                new CompilerError(sourceFile, -1, -1, "6023",
+                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
+            return false;
+        }
+        return true;
+    }
+    
+    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
+    {
+        return GetItemsToGenerate<SimpleType>(itemCollection)
+            .Where(e => IsEnumType(e));
+    }
+    
+    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
+    {
+        return itemCollection
+            .OfType<T>()
+            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
+            .OrderBy(i => i.Name);
+    }
+
+    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
+    {
+        return itemCollection
+            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
+            .Select(g => GetGlobalItemName(g));
+    }
+
+    public string GetGlobalItemName(GlobalItem item)
+    {
+        if (item is EdmType)
+        {
+            return ((EdmType)item).Name;
+        }
+        else
+        {
+            return ((EntityContainer)item).Name;
+        }
+    }
+
+    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+    
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+
+    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type);
+    }
+    
+    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
+    }
+    
+    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
+        return returnParamsProperty == null
+            ? edmFunction.ReturnParameter
+            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
+    }
+
+    public bool IsComposable(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
+        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
+    }
+
+    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
+    {
+        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+    }
+
+    public TypeUsage GetReturnType(EdmFunction edmFunction)
+    {
+        var returnParam = GetReturnParameter(edmFunction);
+        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
+    }
+    
+    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
+    {
+        var returnType = GetReturnType(edmFunction);
+        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
+    }
+}
+
+public static void ArgumentNotNull<T>(T arg, string name) where T : class
+{
+    if (arg == null)
+    {
+        throw new ArgumentNullException(name);
+    }
+}
+#>

+ 48 - 0
DataAccess/Order.cs

@@ -0,0 +1,48 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Order
+    {
+        public long Id { get; set; }
+        public string OrderId { get; set; }
+        public string OrderNo { get; set; }
+        public string OrderSubNo { get; set; }
+        public string RepeatIndicator { get; set; }
+        public string OrderClass { get; set; }
+        public string OrderText { get; set; }
+        public string Dosage { get; set; }
+        public string DosageUnits { get; set; }
+        public string DrugSpec { get; set; }
+        public string FirmId { get; set; }
+        public string Administration { get; set; }
+        public string Frequency { get; set; }
+        public string FreqCounter { get; set; }
+        public string FreqInterval { get; set; }
+        public string FreqIntervalUnit { get; set; }
+        public string FreqDetail { get; set; }
+        public string PerformSchedule { get; set; }
+        public string PerformResult { get; set; }
+        public Nullable<System.DateTime> StartDateTime { get; set; }
+        public Nullable<System.DateTime> StopDateTime { get; set; }
+        public string StartDoctor { get; set; }
+        public string StartNurse { get; set; }
+        public string OrderStatus { get; set; }
+        public string BillingAttr { get; set; }
+        public string DrugBillingAttr { get; set; }
+        public string ApplyNo { get; set; }
+        public Nullable<System.DateTime> LastPerformDateTime { get; set; }
+        public string PatientId { get; set; }
+        public string VisitId { get; set; }
+    }
+}

+ 39 - 0
DataAccess/OrderCheck.cs

@@ -0,0 +1,39 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class OrderCheck
+    {
+        public long Id { get; set; }
+        public string SheetClass { get; set; }
+        public string OrderId { get; set; }
+        public string OrderNo { get; set; }
+        public string OrderSubNo { get; set; }
+        public string RepeatIndicator { get; set; }
+        public string OrderClass { get; set; }
+        public string OrderText { get; set; }
+        public string DosageUnits { get; set; }
+        public string Administration { get; set; }
+        public string Frequency { get; set; }
+        public string PerformSchedule { get; set; }
+        public Nullable<System.DateTime> ScheduleDateTime { get; set; }
+        public Nullable<System.DateTime> StartDateTime { get; set; }
+        public Nullable<System.DateTime> StopDateTime { get; set; }
+        public string OrderStatus { get; set; }
+        public string NursePerform { get; set; }
+        public Nullable<System.DateTime> PerformDateTime { get; set; }
+        public string NurseCheck { get; set; }
+        public string PatientId { get; set; }
+        public string VisitId { get; set; }
+    }
+}

+ 48 - 0
DataAccess/Patient.cs

@@ -0,0 +1,48 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Patient
+    {
+        public long Id { get; set; }
+        public Nullable<System.DateTime> VisitDate { get; set; }
+        public string VisitNo { get; set; }
+        public string ClinicLabel { get; set; }
+        public string PVID { get; set; }
+        public string PatientId { get; set; }
+        public string Doctor { get; set; }
+        public string Sex { get; set; }
+        public string IndentityNo { get; set; }
+        public Nullable<System.DateTime> TriageDate { get; set; }
+        public string TriageBy { get; set; }
+        public string TriageTarget { get; set; }
+        public string TriageLevel { get; set; }
+        public string VisitID { get; set; }
+        public string PatientName { get; set; }
+        public Nullable<System.DateTime> PatientBirthDate { get; set; }
+        public string ChargeType { get; set; }
+        public string Identity { get; set; }
+        public string ContectPhone { get; set; }
+        public string ContectPerson { get; set; }
+        public string PatientAddress { get; set; }
+        public string GreenRoad { get; set; }
+        public string Diagnosis { get; set; }
+        public string Status { get; set; }
+        public string RegisterFrom { get; set; }
+        public string Nation { get; set; }
+        public Nullable<System.DateTime> InDeptTime { get; set; }
+        public string BedNo { get; set; }
+        public string BloodType { get; set; }
+        public string RhType { get; set; }
+    }
+}

+ 24 - 0
DataAccess/PatientVitalSign.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码已从模板生成。
+//
+//     手动更改此文件可能导致应用程序出现意外的行为。
+//     如果重新生成代码,将覆盖对此文件的手动更改。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataAccess
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class PatientVitalSign
+    {
+        public long Id { get; set; }
+        public Nullable<System.DateTime> DataDT { get; set; }
+        public string ItemName { get; set; }
+        public string ItemValue { get; set; }
+        public string ItemArtificial { get; set; }
+        public string PVID { get; set; }
+    }
+}

+ 36 - 0
DataAccess/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("DataAccess")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("DataAccess")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("0f8f6a38-af7c-4f65-980b-4f909fa93a9f")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 25 - 0
DataAccess/Repository/LabMasterRepository.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataAccess.Repository
+{
+    public static class LabMasterRepository
+    {
+        public static List<LabMaster> FindLabMastersByPatientIdAndVisitId(string patient, string visitId)
+        {
+            DB db = new DB();
+            return db.LabMaster.Where(t => object.Equals(t.PatientID, patient) && object.Equals(t.VisitId, visitId)).ToList();
+        }
+
+        public static LabMaster AddLabMaster(LabMaster labMaster)
+        {
+            DB db = new DB();
+            db.LabMaster.Add(labMaster);
+            db.SaveChanges();
+            return labMaster;
+        }
+    }
+}

+ 25 - 0
DataAccess/Repository/LabResultRepository.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataAccess.Repository
+{
+    public static class LabResultRepository
+    {
+        public static List<LabResult> FindLabResultsByTestNo(string TestNo)
+        {
+            DB db = new DB();
+            return db.LabResult.Where(t => object.Equals(t.TestNo, TestNo)).ToList();
+        }
+
+        public static LabResult AddLabResult(LabResult labResult)
+        {
+            DB db = new DB();
+            db.LabResult.Add(labResult);
+            db.SaveChanges();
+            return labResult;
+        }
+    }
+}

+ 25 - 0
DataAccess/Repository/OrderCheckRepository.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataAccess.Repository
+{
+    public static class OrderCheckRepository
+    {
+        public static List<OrderCheck> FindOrderChecksByPatientIdAndVisitId(string patient, string visitId)
+        {
+            DB db = new DB();
+            return db.OrderCheck.Where(t => object.Equals(t.PatientId, patient) && object.Equals(t.VisitId, visitId)).ToList();
+        }
+
+        public static OrderCheck AddOrderCheckr(OrderCheck orderCheck)
+        {
+            DB db = new DB();
+            db.OrderCheck.Add(orderCheck);
+            db.SaveChanges();
+            return orderCheck;
+        }
+    }
+}

+ 25 - 0
DataAccess/Repository/OrderRepository.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataAccess.Repository
+{
+    public static class OrderRepository
+    {
+        public static List<Order> FindOrdersByPatientIdAndVisitId(string patient, string visitId)
+        {
+            DB db = new DB();
+            return db.Order.Where(t => object.Equals(t.PatientId, patient) && object.Equals(t.VisitId, visitId)).ToList();
+        }
+
+        public static Order AddOrder(Order order)
+        {
+            DB db = new DB();
+            db.Order.Add(order);
+            db.SaveChanges();
+            return order;
+        }
+    }
+}

+ 25 - 0
DataAccess/Repository/PatientRepository.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataAccess.Repository
+{
+    public static class PatientRepository
+    {
+        public static List<Patient> FindAllPatients()
+        {
+            DB db = new DB();
+            return db.Patient.ToList();
+        }
+
+        public static Patient AddPatient(Patient patient)
+        {
+            DB db = new DB();
+            db.Patient.Add(patient);
+            db.SaveChanges();
+            return patient;
+        }
+    }
+}

+ 25 - 0
DataAccess/Repository/PatientVitalSignRepository.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataAccess.Repository
+{
+    public static class PatientVitalSignRepository
+    {
+        public static List<PatientVitalSign> FindPatientVitalSignByPVID(string pvid, DateTime startTime, DateTime afterTime)
+        {
+            DB db = new DB();
+            return db.PatientVitalSign.Where(t => t.PVID == pvid && t.DataDT >= startTime && t.DataDT <= afterTime).ToList(); ;
+        }
+
+        public static PatientVitalSign AddPatientVitalSign(PatientVitalSign patientVitalSign)
+        {
+            DB db = new DB();
+            db.PatientVitalSign.Add(patientVitalSign);
+            db.SaveChanges();
+            return patientVitalSign;
+        }
+    }
+}

+ 5 - 0
DataAccess/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
+  <package id="EntityFramework.zh-Hans" version="6.1.3" targetFramework="net452" />
+</packages>

+ 36 - 0
Utils/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("Utils")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Utils")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("a57ba67f-1059-4c73-b9d0-7569b4d4a7e5")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 54 - 0
Utils/Utils.csproj

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{A57BA67F-1059-4C73-B9D0-7569B4D4A7E5}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Utils</RootNamespace>
+    <AssemblyName>Utils</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="XmlUtils.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 86 - 0
Utils/XmlUtils.cs

@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Utils
+{
+    public static class XmlUtils
+    {
+        /// <summary>
+        /// 将object转换成xml格式的string
+        /// </summary>
+        /// <param name="o"></param>
+        /// <returns></returns>
+        public static string Object2XmlString(Object o)
+        {
+            XmlWriterSettings settings = new XmlWriterSettings();
+            settings.Indent = false;
+            settings.NewLineHandling = NewLineHandling.None;
+            settings.Encoding = Encoding.UTF8;
+            settings.OmitXmlDeclaration = true;
+
+            XmlSerializer xs = new XmlSerializer(o.GetType());
+            using (StringWriter ws = new StringWriter())
+            {
+                XmlWriter w = XmlWriter.Create(ws, settings);
+                try
+                {
+                    XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
+                    namespaces.Add(string.Empty, string.Empty);
+                    xs.Serialize(w, o, namespaces);
+                    return ws.ToString();
+                } finally
+                {
+                    w.Dispose();
+                }
+            }
+        }
+
+        /// <summary>
+        /// 将xml格式的string转换层实体类
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="xmlStr"></param>
+        /// <returns></returns>
+        public static T XmlString2Object<T>(string xmlStr)
+        {
+            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xmlStr)))
+            {
+                XmlSerializer serializer = new XmlSerializer(typeof(T));
+                return (T)serializer.Deserialize(stream);
+            }
+        }
+
+        /// <summary>
+        /// 将xml格式stream转换层实体类
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="stream"></param>
+        /// <returns></returns>
+        public static T XmlStream2Object<T>(Stream stream)
+        {
+            XmlSerializer serializer = new XmlSerializer(typeof(T));
+            return (T)serializer.Deserialize(stream);
+        }
+
+        /// <summary>
+        /// 将xml格式文件转换层实体类
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        public static T XmlFile2Object<T>(string fileName)
+        {
+            using (Stream stream = new FileStream(fileName, FileMode.Open))
+            {
+                XmlSerializer serializer = new XmlSerializer(typeof(T));
+                return (T)serializer.Deserialize(stream);
+            }
+        }
+    }
+}

+ 34 - 0
WebServiceDemo.sln

@@ -0,0 +1,34 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServiceDemo", "WebServiceDemo\WebServiceDemo.csproj", "{72283083-1051-4947-9E95-02E795E4EFC6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataAccess", "DataAccess\DataAccess.csproj", "{0F8F6A38-AF7C-4F65-980B-4F909FA93A9F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Utils\Utils.csproj", "{A57BA67F-1059-4C73-B9D0-7569B4D4A7E5}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{72283083-1051-4947-9E95-02E795E4EFC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{72283083-1051-4947-9E95-02E795E4EFC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{72283083-1051-4947-9E95-02E795E4EFC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{72283083-1051-4947-9E95-02E795E4EFC6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0F8F6A38-AF7C-4F65-980B-4F909FA93A9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0F8F6A38-AF7C-4F65-980B-4F909FA93A9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0F8F6A38-AF7C-4F65-980B-4F909FA93A9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0F8F6A38-AF7C-4F65-980B-4F909FA93A9F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A57BA67F-1059-4C73-B9D0-7569B4D4A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A57BA67F-1059-4C73-B9D0-7569B4D4A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A57BA67F-1059-4C73-B9D0-7569B4D4A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A57BA67F-1059-4C73-B9D0-7569B4D4A7E5}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 79 - 0
WebServiceDemo/ApplicationInsights.config

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
+	<TelemetryInitializers>
+		<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
+			<!-- Extended list of bots:
+            search|spider|crawl|Bot|Monitor|BrowserMob|BingPreview|PagePeeker|WebThumb|URL2PNG|ZooShot|GomezA|Google SketchUp|Read Later|KTXN|KHTE|Keynote|Pingdom|AlwaysOn|zao|borg|oegp|silk|Xenu|zeal|NING|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|Java|JNLP|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr-agent|http client|Python-urllib|AppEngine-Google|semanticdiscovery|facebookexternalhit|web/snippet|Google-HTTP-Java-Client-->
+			<Filters>search|spider|crawl|Bot|Monitor|AlwaysOn</Filters>
+		</Add>
+		<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
+	</TelemetryInitializers>
+	<TelemetryModules>
+		<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
+		<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
+			<!--
+      Use the following syntax here to collect additional performance counters:
+      
+      <Counters>
+        <Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
+        ...
+      </Counters>
+      
+      PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
+      
+      NOTE: performance counters configuration will be lost upon NuGet upgrade.
+      
+      The following placeholders are supported as InstanceName:
+        ??APP_WIN32_PROC?? - instance name of the application process  for Win32 counters.
+        ??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
+        ??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
+      -->
+		</Add>
+		<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
+		<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
+			<Handlers>
+				<!-- 
+        Add entries here to filter out additional handlers: 
+        
+        NOTE: handler configuration will be lost upon NuGet upgrade.
+        -->
+				<Add>System.Web.Handlers.TransferRequestHandler</Add>
+				<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
+				<Add>System.Web.StaticFileHandler</Add>
+				<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
+				<Add>System.Web.Optimization.BundleHandler</Add>
+				<Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
+				<Add>System.Web.Handlers.TraceHandler</Add>
+				<Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
+				<Add>System.Web.HttpDebugHandler</Add>
+			</Handlers>
+		</Add>
+		<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
+	</TelemetryModules>
+	<TelemetryProcessors>
+		<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
+		<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
+			<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
+		</Add>
+	</TelemetryProcessors>
+	<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
+<!-- 
+    Learn more about Application Insights configuration with ApplicationInsights.config here: 
+    http://go.microsoft.com/fwlink/?LinkID=513840
+    
+    Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
+  --></ApplicationInsights>

+ 563 - 0
WebServiceDemo/Model/WoundModel.cs

@@ -0,0 +1,563 @@
+using DataAccess;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Xml.Serialization;
+
+namespace WebServiceDemo.Model
+{
+    public class WoundModel
+    {
+        [XmlRoot(ElementName = "Response")]
+        public class WoundResponseItemList<T>
+        {
+            public string ResultCode { get; set; }
+            public string ErrorMsg { get; set; }
+            [XmlArray("ItemList"), XmlArrayItem("Item")]
+            public List<T> Datas { get; set; }
+        }
+
+        public class WoundPatient
+        {
+            public WoundPatient() { }
+
+            public WoundPatient(Patient patient)
+            {
+                this.visitDate = patient.VisitDate;
+                this.VisitNo = patient.VisitNo;
+                this.ClinicLabel = patient.ClinicLabel;
+                this.PVID = patient.PVID;
+                this.PatientId = patient.PatientId;
+                this.Doctor = patient.Doctor;
+                this.Sex = patient.Sex;
+                this.IndentityNo = patient.IndentityNo;
+                this.triageDate = patient.TriageDate;
+                this.TriageBy = patient.TriageBy;
+                this.TriageTarget = patient.TriageTarget;
+                this.TriageLevel = patient.TriageLevel;
+                this.VisitID = patient.VisitID;
+                this.PatientName = patient.PatientName;
+                this.patientBirthDate = patient.PatientBirthDate;
+                this.ChargeType = patient.ChargeType;
+                this.Identity = patient.Identity;
+                this.ContectPhone = patient.ContectPhone;
+                this.ContectPerson = patient.ContectPerson;
+                this.PatientAddress = patient.PatientAddress;
+                this.GreenRoad = patient.GreenRoad;
+                this.Diagnosis = patient.Diagnosis;
+                this.Status = patient.Status;
+                this.RegisterFrom = patient.RegisterFrom;
+                this.Nation = patient.Nation;
+                this.inDeptTime = patient.InDeptTime;
+                this.BedNo = patient.BedNo;
+                this.BloodType = patient.BloodType;
+                this.RhType = patient.RhType;
+            }
+            
+            public Patient ToPatient()
+            {
+                Patient patient = new Patient();
+                patient.VisitDate = this.visitDate;
+                patient.VisitNo = this.VisitNo;
+                patient.ClinicLabel = this.ClinicLabel;
+                patient.PVID = this.PVID;
+                patient.PatientId = this.PatientId;
+                patient.Doctor = this.Doctor;
+                patient.Sex = this.Sex;
+                patient.IndentityNo = this.IndentityNo;
+                patient.TriageDate = this.triageDate;
+                patient.TriageBy = this.TriageBy;
+                patient.TriageTarget = this.TriageTarget;
+                patient.TriageLevel = this.TriageLevel;
+                patient.VisitID = this.VisitID;
+                patient.PatientName = this.PatientName;
+                patient.PatientBirthDate = this.patientBirthDate;
+                patient.ChargeType = this.ChargeType;
+                patient.Identity = this.Identity;
+                patient.ContectPhone = this.ContectPhone;
+                patient.ContectPerson = this.ContectPerson;
+                patient.PatientAddress = this.PatientAddress;
+                patient.GreenRoad = this.GreenRoad;
+                patient.Diagnosis = this.Diagnosis;
+                patient.Status = this.Status;
+                patient.RegisterFrom = this.RegisterFrom;
+                patient.Nation = this.Nation;
+                patient.InDeptTime = this.inDeptTime;
+                patient.BedNo = this.BedNo;
+                patient.BloodType = this.BloodType;
+                patient.RhType = this.RhType;
+                return patient;
+            }
+
+            [XmlIgnore]
+            public DateTime? visitDate { get; set; }
+            [XmlElement("VisitDate")]
+            public string VisitDate
+            {
+                get { return visitDate.HasValue ? visitDate.Value.ToString("yyyy-MM-dd") : ""; }
+                set { visitDate = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string VisitNo { get; set; }
+            public string ClinicLabel { get; set; }
+            public string PVID { get; set; }
+            public string PatientId { get; set; }
+            public string Doctor { get; set; }
+            public string Sex { get; set; }
+            public string IndentityNo { get; set; }
+            [XmlIgnore]
+            public DateTime? triageDate { get; set; }
+            [XmlElement("TriageDate")]
+            public string TriageDate
+            {
+                get { return triageDate.HasValue ? triageDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; }
+                set { triageDate = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string TriageBy { get; set; }
+            public string TriageTarget { get; set; }
+            public string TriageLevel { get; set; }
+            public string VisitID { get; set; }
+            public string PatientName { get; set; }
+            [XmlIgnore]
+            public DateTime? patientBirthDate { get; set; }
+            [XmlElement("PatientBirthDate")]
+            public string PatientBirthDate
+            {
+                get { return patientBirthDate.HasValue ? patientBirthDate.Value.ToString("yyyy-MM-dd") : ""; }
+                set { patientBirthDate = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string ChargeType { get; set; }
+            public string Identity { get; set; }
+            public string ContectPhone { get; set; }
+            public string ContectPerson { get; set; }
+            public string PatientAddress { get; set; }
+            public string GreenRoad { get; set; }
+            public string Diagnosis { get; set; }
+            public string Status { get; set; }
+            public string RegisterFrom { get; set; }
+            public string Nation { get; set; }
+            [XmlIgnore]
+            public DateTime? inDeptTime { get; set; }
+            [XmlElement("InDeptTime")]
+            public string InDeptTime
+            {
+                get { return inDeptTime.HasValue ? inDeptTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; }
+                set { inDeptTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string BedNo { get; set; }
+            public string BloodType { get; set; }
+            public string RhType { get; set; }
+        }
+
+        [XmlRoot(ElementName = "Response")]
+        public class WoundResponseVital<T>
+        {
+            public string ResultCode { get; set; }
+            public string ErrorMsg { get; set; }
+            [XmlArray("ItemList"), XmlArrayItem("vitalSigns")]
+            public List<T> Datas { get; set; }
+        }
+        
+        public class VitalSign
+        {
+            public VitalSign() { }
+
+            public VitalSign(PatientVitalSign sign) {
+                this.ID = sign.Id;
+                this.dataDT = sign.DataDT;
+                this.ItemName = sign.ItemName;
+                this.ItemValue = sign.ItemValue;
+                this.ItemArtificial = sign.ItemArtificial;
+            }
+
+            public PatientVitalSign TpPatientVitalSign()
+            {
+                PatientVitalSign sign = new PatientVitalSign();
+                sign.Id = this.ID;
+                sign.DataDT = this.dataDT;
+                sign.ItemName = this.ItemName;
+                sign.ItemValue = this.ItemValue;
+                sign.ItemArtificial = this.ItemArtificial;
+                return sign;
+            }
+
+            public long ID { get; set; }
+            [XmlIgnore]
+            public DateTime? dataDT { get; set; }
+            [XmlElement("DataDT")]
+            public string DataDT
+            {
+                get { return dataDT.HasValue ? dataDT.Value.ToString("yyyy/MM/dd HH:mm:ss") : ""; }
+                set { dataDT = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string ItemName { get; set; }
+            public string ItemValue { get; set; }
+            public string ItemArtificial { get; set; }
+        }
+
+        [XmlRoot(ElementName = "Response")]
+        public class EMGResponseItemlist<T>
+        {
+            public string ResultCode { get; set; }
+            public string ErrorMsg { get; set; }
+            [XmlArray("Itemlist"), XmlArrayItem("Item")]
+            public List<T> Datas { get; set; }
+        }
+
+        [XmlRoot(ElementName = "Response")]
+        public class EMGResponseItemlistMaster<T>
+        {
+            public string ResultCode { get; set; }
+            public string ErrorMsg { get; set; }
+            [XmlArray("Itemlist"), XmlArrayItem("Master")]
+            public List<T> Datas { get; set; }
+        }
+
+        public class Order
+        {
+            public Order() { }
+            public Order(DataAccess.Order order) {
+                this.OrderId = order.OrderId;
+                this.OrderNo = order.OrderNo;
+                this.OrderSubNo = order.OrderSubNo;
+                this.RepeatIndicator = order.RepeatIndicator;
+                this.OrderClass = order.OrderClass;
+                this.OrderText = order.OrderText;
+                this.Dosage = order.Dosage;
+                this.DosageUnits = order.DosageUnits;
+                this.DrugSpec = order.DrugSpec;
+                this.FirmId = order.FirmId;
+                this.Administration = order.Administration;
+                this.Frequency = order.Frequency;
+                this.FreqCounter = order.FreqCounter;
+                this.FreqInterval = order.FreqInterval;
+                this.FreqIntervalUnit = order.FreqIntervalUnit;
+                this.FreqDetail = order.FreqDetail;
+                this.PerformSchedule = order.PerformSchedule;
+                this.PerformResult = order.PerformResult;
+                this.startDateTime = order.StartDateTime;
+                this.stopDateTime = order.StopDateTime;
+                this.StartDoctor = order.StartDoctor;
+                this.StartNurse = order.StartNurse;
+                this.OrderStatus = order.OrderStatus;
+                this.BillingAttr = order.BillingAttr;
+                this.DrugBillingAttr = order.DrugBillingAttr;
+                this.ApplyNo = order.ApplyNo;
+                this.lastPerformDateTime = order.LastPerformDateTime;
+            }
+
+            public DataAccess.Order ToOrder()
+            {
+                DataAccess.Order order = new DataAccess.Order();
+                order.OrderId = this.OrderId;
+                order.OrderNo = this.OrderNo;
+                order.OrderSubNo = this.OrderSubNo;
+                order.RepeatIndicator = this.RepeatIndicator;
+                order.OrderClass = this.OrderClass;
+                order.OrderText = this.OrderText;
+                order.Dosage = this.Dosage;
+                order.DosageUnits = this.DosageUnits;
+                order.DrugSpec = this.DrugSpec;
+                order.FirmId = this.FirmId;
+                order.Administration = this.Administration;
+                order.Frequency = this.Frequency;
+                order.FreqCounter = this.FreqCounter;
+                order.FreqInterval = this.FreqInterval;
+                order.FreqIntervalUnit = this.FreqIntervalUnit;
+                order.FreqDetail = this.FreqDetail;
+                order.PerformSchedule = this.PerformSchedule;
+                order.PerformResult = this.PerformResult;
+                order.StartDateTime = this.startDateTime;
+                order.StopDateTime = this.stopDateTime;
+                order.StartDoctor = this.StartDoctor;
+                order.StartNurse = this.StartNurse;
+                order.OrderStatus = this.OrderStatus;
+                order.BillingAttr = this.BillingAttr;
+                order.DrugBillingAttr = this.DrugBillingAttr;
+                order.ApplyNo = this.ApplyNo;
+                order.LastPerformDateTime = this.lastPerformDateTime;
+                return order;
+            }
+
+            [XmlElement("ORDER_ID")]
+            public string OrderId { get; set; }
+            [XmlElement("ORDER_NO")]
+            public string OrderNo { get; set; }
+            [XmlElement("ORDER_SUB_NO")]
+            public string OrderSubNo { get; set; }
+            [XmlElement("REPEAT_INDICATOR")]
+            public string RepeatIndicator { get; set; }
+            [XmlElement("ORDER_CLASS")]
+            public string OrderClass { get; set; }
+            [XmlElement("ORDER_TEXT")]
+            public string OrderText { get; set; }
+            [XmlElement("DOSAGE")]
+            public string Dosage { get; set; }
+            [XmlElement("DOSAGE_UNITS")]
+            public string DosageUnits { get; set; }
+            [XmlElement("DRUG_SPEC")]
+            public string DrugSpec { get; set; }
+            [XmlElement("FIRM_ID")]
+            public string FirmId { get; set; }
+            [XmlElement("ADMINISTRATION")]
+            public string Administration { get; set; }
+            [XmlElement("FREQUENCY")]
+            public string Frequency { get; set; }
+            [XmlElement("FREQ_COUNTER")]
+            public string FreqCounter { get; set; }
+            [XmlElement("FREQ_INTERVAL")]
+            public string FreqInterval { get; set; }
+            [XmlElement("FREQ_INTERVAL_UNIT")]
+            public string FreqIntervalUnit { get; set; }
+            [XmlElement("FREQ_DETAIL")]
+            public string FreqDetail { get; set; }
+            [XmlElement("PERFORM_SCHEDULE")]
+            public string PerformSchedule { get; set; }
+            [XmlElement("PERFORM_RESULT")]
+            public string PerformResult { get; set; }
+            [XmlIgnore]
+            public DateTime? startDateTime { get; set; }
+            [XmlElement("START_DATE_TIME")]
+            public string StartDateTime
+            {
+                get { return startDateTime.HasValue ? startDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { startDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            [XmlIgnore]
+            public DateTime? stopDateTime { get; set; }
+            [XmlElement("STOP_DATE_TIME")]
+            public string StopDateTime
+            {
+                get { return stopDateTime.HasValue ? stopDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { stopDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            [XmlElement("START_DOCTOR")]
+            public string StartDoctor { get; set; }
+            [XmlElement("START_NURSE")]
+            public string StartNurse { get; set; }
+            [XmlElement("ORDER_STATUS")]
+            public string OrderStatus { get; set; }
+            [XmlElement("BILLING_ATTR")]
+            public string BillingAttr { get; set; }
+            [XmlElement("DRUG_BILLING_ATTR")]
+            public string DrugBillingAttr { get; set; }
+            [XmlElement("APPLY_NO")]
+            public string ApplyNo { get; set; }
+            [XmlIgnore]
+            public DateTime? lastPerformDateTime { get; set; }
+            [XmlElement("LAST_PERFORM_DATE_TIME")]
+            public string LastPerformDateTime
+            {
+                get { return lastPerformDateTime.HasValue ? lastPerformDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { lastPerformDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+        }
+
+        public class OrderCheck
+        {
+            public OrderCheck() { }
+
+            public OrderCheck(DataAccess.OrderCheck orderCheck) {
+                this.SheetClass = orderCheck.SheetClass;
+                this.OrderId = orderCheck.OrderId;
+                this.OrderNo = orderCheck.OrderNo;
+                this.OrderSubNo = orderCheck.OrderSubNo;
+                this.RepeatIndicator = orderCheck.RepeatIndicator;
+                this.OrderClass = orderCheck.OrderClass;
+                this.OrderText = orderCheck.OrderText;
+                this.DosageUnits = orderCheck.DosageUnits;
+                this.administration = orderCheck.Administration;
+                this.frequency = orderCheck.Frequency;
+                this.PerformSchedule = orderCheck.PerformSchedule;
+                this.scheduleDateTime = orderCheck.ScheduleDateTime;
+                this.startDateTime = orderCheck.StartDateTime;
+                this.stopDateTime = orderCheck.StopDateTime;
+                this.OrderStatus = orderCheck.OrderStatus;
+                this.NursePerform = orderCheck.NursePerform;
+                this.performDateTime = orderCheck.PerformDateTime;
+                this.NurseCheck = orderCheck.NurseCheck;
+            }
+
+            public DataAccess.OrderCheck ToOrderCheck()
+            {
+                DataAccess.OrderCheck orderCheck = new DataAccess.OrderCheck();
+                orderCheck.SheetClass = this.SheetClass;
+                orderCheck.OrderId = this.OrderId;
+                orderCheck.OrderNo = this.OrderNo;
+                orderCheck.OrderSubNo = this.OrderSubNo;
+                orderCheck.RepeatIndicator = this.RepeatIndicator;
+                orderCheck.OrderClass = this.OrderClass;
+                orderCheck.OrderText = this.OrderText;
+                orderCheck.DosageUnits = this.DosageUnits;
+                orderCheck.Administration = this.administration;
+                orderCheck.Frequency = this.frequency;
+                orderCheck.PerformSchedule = this.PerformSchedule;
+                orderCheck.ScheduleDateTime = this.scheduleDateTime;
+                orderCheck.StartDateTime = this.startDateTime;
+                orderCheck.StopDateTime = this.stopDateTime;
+                orderCheck.OrderStatus = this.OrderStatus;
+                orderCheck.NursePerform = this.NursePerform;
+                orderCheck.PerformDateTime = this.performDateTime;
+                orderCheck.NurseCheck = this.NurseCheck;
+                return orderCheck;
+            }
+
+            [XmlElement("SHEET_CLASS")]
+            public string SheetClass { get; set; }
+            [XmlElement("ORDER_ID")]
+            public string OrderId { get; set; }
+            [XmlElement("ORDER_NO")]
+            public string OrderNo { get; set; }
+            [XmlElement("ORDER_SUB_NO")]
+            public string OrderSubNo { get; set; }
+            [XmlElement("REPEAT_INDICATOR")]
+            public string RepeatIndicator { get; set; }
+            [XmlElement("ORDER_CLASS")]
+            public string OrderClass { get; set; }
+            [XmlElement("ORDER_TEXT")]
+            public string OrderText { get; set; }
+            [XmlElement("DOSAGE_UNITS")]
+            public string DosageUnits { get; set; }
+            [XmlElement("ADMINISTRATION")]
+            public string administration { get; set; }
+            [XmlElement("FREQUENCY")]
+            public string frequency { get; set; }
+            [XmlElement("PERFORM_SCHEDULE")]
+            public string PerformSchedule { get; set; }
+            [XmlIgnore]
+            public DateTime? scheduleDateTime { get; set; }
+            [XmlElement("SCHEDULE_DATE_TIME")]
+            public string ScheduleDateTime
+            {
+                get { return scheduleDateTime.HasValue ? scheduleDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { scheduleDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            [XmlIgnore]
+            public DateTime? startDateTime { get; set; }
+            [XmlElement("START_DATE_TIME")]
+            public string StartDateTime
+            {
+                get { return startDateTime.HasValue ? startDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { startDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            [XmlIgnore]
+            public DateTime? stopDateTime { get; set; }
+            [XmlElement("STOP_DATE_TIME")]
+            public string StopDateTime
+            {
+                get { return stopDateTime.HasValue ? stopDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { stopDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            [XmlElement("ORDER_STATUS")]
+            public string OrderStatus { get; set; }
+            [XmlElement("NURSE_PERFORM")]
+            public string NursePerform { get; set; }
+            [XmlIgnore]
+            public DateTime? performDateTime { get; set; }
+            [XmlElement("PERFORM_DATE_TIME")]
+            public string PerformDateTime
+            {
+                get { return performDateTime.HasValue ? performDateTime.Value.ToString("yyyy-MM-dd HH:mm") : ""; }
+                set { performDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            [XmlElement("NURSE_CHECK")]
+            public string NurseCheck { get; set; }
+        }
+
+        public class LabMaster
+        {
+            public LabMaster() { }
+
+            public LabMaster(DataAccess.LabMaster labMaster) {
+                this.TestNo = labMaster.TestNo;
+                this.PatientID = labMaster.PatientID;
+                this.NotesForSpcm = labMaster.NotesForSpcm;
+                this.Subject = labMaster.Subject;
+                this.Specimen = labMaster.Specimen;
+                this.requestedDateTime = labMaster.RequestedDateTime;
+                this.OrderingProvider = labMaster.OrderingProvider;
+                this.OrderingDept = labMaster.OrderingDept;
+                this.PerformedBy = labMaster.PerformedBy;
+                this.sampleDateTime = labMaster.SampleDateTime;
+                this.SPCMCollector = labMaster.SPCMCollector;
+                this.ResultStatus = labMaster.ResultStatus;
+            }
+
+            public DataAccess.LabMaster ToLabMaster()
+            {
+                DataAccess.LabMaster labMaster = new DataAccess.LabMaster();
+                labMaster.TestNo = this.TestNo;
+                labMaster.PatientID = this.PatientID;
+                labMaster.NotesForSpcm = this.NotesForSpcm;
+                labMaster.Subject = this.Subject;
+                labMaster.Specimen = this.Specimen;
+                labMaster.RequestedDateTime = this.requestedDateTime;
+                labMaster.OrderingProvider = this.OrderingProvider;
+                labMaster.OrderingDept = this.OrderingDept;
+                labMaster.PerformedBy = this.PerformedBy;
+                labMaster.SampleDateTime = this.sampleDateTime;
+                labMaster.SPCMCollector = this.SPCMCollector;
+                labMaster.ResultStatus = this.ResultStatus;
+                return labMaster;
+            }
+
+            public string TestNo { get; set; }
+            public string PatientID { get; set; }
+            public string NotesForSpcm { get; set; }
+            public string Subject { get; set; }
+            public string Specimen { get; set; }
+            [XmlIgnore]
+            public DateTime? requestedDateTime { get; set; }
+            public string RequestedDateTime
+            {
+                get { return requestedDateTime.HasValue ? requestedDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; }
+                set { requestedDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string OrderingProvider { get; set; }
+            public string OrderingDept { get; set; }
+            public string PerformedBy { get; set; }
+            [XmlIgnore]
+            public DateTime? sampleDateTime { get; set; }
+            public string SampleDateTime
+            {
+                get { return sampleDateTime.HasValue ? sampleDateTime.Value.ToString("yyyy/MM/dd HH:mm:ss") : ""; }
+                set { sampleDateTime = string.IsNullOrEmpty(value) ? null : (DateTime?)DateTime.Parse(value); }
+            }
+            public string SPCMCollector { get; set; }
+            public string ResultStatus { get; set; }
+        }
+
+        public class LabResult
+        {
+            public LabResult() { }
+
+            public LabResult(DataAccess.LabResult labResult) {
+                this.ItemNo = labResult.ItemNo;
+                this.ReportItemName = labResult.ReportItemName;
+                this.Result = labResult.Result;
+                this.Units = labResult.Units;
+                this.AbnormalFlag = labResult.AbnormalFlag;
+                this.PrintContext = labResult.PrintContext;
+            }
+
+            public DataAccess.LabResult ToLabResult()
+            {
+                DataAccess.LabResult labResult = new DataAccess.LabResult();
+                labResult.ItemNo = this.ItemNo;
+                labResult.ReportItemName = this.ReportItemName;
+                labResult.Result = this.Result;
+                labResult.Units = this.Units;
+                labResult.AbnormalFlag = this.AbnormalFlag;
+                labResult.PrintContext = this.PrintContext;
+                return labResult;
+            }
+
+            public string ItemNo { get; set; }
+            public string ReportItemName { get; set; }
+            public string Result { get; set; }
+            public string Units { get; set; }
+            public string AbnormalFlag { get; set; }
+            public string PrintContext { get; set; }
+        }
+    }
+}

+ 35 - 0
WebServiceDemo/Properties/AssemblyInfo.cs

@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的常规信息通过下列特性集
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("WebServiceDemo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("WebServiceDemo")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+// 对 COM 组件不可见。如果需要
+// 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
+[assembly: Guid("72283083-1051-4947-9e95-02e795e4efc6")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+//      主版本
+//      次版本
+//      内部版本号
+//      修订版本
+//
+// 可以指定所有值,也可以使用“修订号”和“内部版本号”的默认值,
+// 方法是按如下所示使用 "*":
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 48 - 0
WebServiceDemo/Web.config

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  有关如何配置 ASP.NET 应用程序的详细信息,请访问
+  http://go.microsoft.com/fwlink/?LinkId=169433
+  -->
+<configuration>
+  <system.web>
+    <compilation debug="true" targetFramework="4.5.2" />
+    <httpRuntime targetFramework="4.5.2" />
+    <httpModules>
+      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
+    </httpModules>
+  </system.web>
+  <system.codedom>
+    <compilers>
+      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
+      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
+    </compilers>
+  </system.codedom>
+  <system.webServer>
+    <validation validateIntegratedModeConfiguration="false" />
+    <modules>
+      <remove name="ApplicationInsightsWebTracking" />
+      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
+    </modules>
+  <handlers>
+      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
+      <remove name="OPTIONSVerbHandler" />
+      <remove name="TRACEVerbHandler" />
+      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
+    </handlers>
+  </system.webServer>
+  <connectionStrings>
+    <add name="DB" connectionString="metadata=res://*/Object.csdl|res://*/Object.ssdl|res://*/Object.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=localhost;initial catalog=demo;user id=sa;password=xuechun;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+  </connectionStrings>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 1 - 0
WebServiceDemo/WebServiceDemo.asmx

@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="WebServiceDemo.asmx.cs" Class="WebServiceDemo.WebServiceDemo" %>

+ 141 - 0
WebServiceDemo/WebServiceDemo.asmx.cs

@@ -0,0 +1,141 @@
+using DataAccess;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Web.Services;
+using System.Xml;
+using System.Xml.Serialization;
+using Utils;
+using WebServiceDemo.Model;
+
+namespace WebServiceDemo
+{
+    /// <summary>
+    /// WebServiceDemo 的摘要说明
+    /// </summary>
+    [WebService(Namespace = "http://plagh.emergency/")]
+    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
+    [System.ComponentModel.ToolboxItem(false)]
+    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 
+    // [System.Web.Script.Services.ScriptService]
+    public class WebServiceDemo : System.Web.Services.WebService
+    {
+
+        //[WebMethod]
+        //public string GetInDeptPatientList()
+        //{
+        //    List<Patient> patients = DataAccess.Repository.PatientRepository.FindAllPatients();
+        //    List<WoundModel.WoundPatient> woundPatients = patients.ConvertAll<WoundModel.WoundPatient>(t => new WoundModel.WoundPatient(t));
+
+        //    WoundModel.WoundResponseItemList<WoundModel.WoundPatient> response = new WoundModel.WoundResponseItemList<WoundModel.WoundPatient>();
+        //    response.ResultCode = "000";
+        //    response.ErrorMsg = "";
+        //    response.Datas = woundPatients;
+        //    return XmlUtils.Object2XmlString(response);
+        //}
+
+        //[WebMethod]
+        //public string GetPatientVitalSign(string PVID, string BeginDate, string EndDate)
+        //{
+        //    DateTime start = DateTime.Parse(BeginDate);
+        //    DateTime end = DateTime.Parse(EndDate);
+
+        //    List<PatientVitalSign> signs = DataAccess.Repository.PatientVitalSignRepository.FindPatientVitalSignByPVID(PVID, start, end);
+        //    List<WoundModel.VitalSign> woundSigns = signs.ConvertAll<WoundModel.VitalSign>(t => new WoundModel.VitalSign(t));
+
+        //    WoundModel.WoundResponseVital<WoundModel.VitalSign> response = new WoundModel.WoundResponseVital<WoundModel.VitalSign>();
+        //    response.ResultCode = "000";
+        //    response.ErrorMsg = "";
+        //    response.Datas = woundSigns;
+        //    return XmlUtils.Object2XmlString(response);
+        //}
+
+        [WebMethod]
+        public string FindOrder(string patientId, string visitId)
+        {
+
+            List<Order> orders = DataAccess.Repository.OrderRepository.FindOrdersByPatientIdAndVisitId(patientId, visitId);
+            List<WoundModel.Order> woundOrders = orders.ConvertAll<WoundModel.Order>(t => new WoundModel.Order(t));
+
+            WoundModel.EMGResponseItemlist<WoundModel.Order> response = new WoundModel.EMGResponseItemlist<WoundModel.Order>();
+            response.ResultCode = "000";
+            response.ErrorMsg = "";
+            response.Datas = woundOrders;
+            return XmlUtils.Object2XmlString(response);
+        }
+
+        [WebMethod]
+        public string FindOrderCheckList(string patientId, string visitId)
+        {
+
+            List<OrderCheck> orderChecks = DataAccess.Repository.OrderCheckRepository.FindOrderChecksByPatientIdAndVisitId(patientId, visitId);
+            List<WoundModel.OrderCheck> woundOrderChecks = orderChecks.ConvertAll<WoundModel.OrderCheck>(t => new WoundModel.OrderCheck(t));
+
+            WoundModel.EMGResponseItemlist<WoundModel.OrderCheck> response = new WoundModel.EMGResponseItemlist<WoundModel.OrderCheck>();
+            response.ResultCode = "000";
+            response.ErrorMsg = "";
+            response.Datas = woundOrderChecks;
+            return XmlUtils.Object2XmlString(response);
+        }
+
+        [WebMethod]
+        public string FindLabMaster(string patientId, string visitId)
+        {
+
+            List<LabMaster> labMasters = DataAccess.Repository.LabMasterRepository.FindLabMastersByPatientIdAndVisitId(patientId, visitId);
+            List<WoundModel.LabMaster> woundLabMasters = labMasters.ConvertAll<WoundModel.LabMaster>(t => new WoundModel.LabMaster(t));
+
+            WoundModel.EMGResponseItemlistMaster<WoundModel.LabMaster> response = new WoundModel.EMGResponseItemlistMaster<WoundModel.LabMaster>();
+            response.ResultCode = "000";
+            response.ErrorMsg = "";
+            response.Datas = woundLabMasters;
+            return XmlUtils.Object2XmlString(response);
+        }
+
+        [WebMethod]
+        public string FindLabResult(string testNo)
+        {
+
+            List<LabResult> labResults = DataAccess.Repository.LabResultRepository.FindLabResultsByTestNo(testNo);
+            List<WoundModel.LabResult> woundLabResults = labResults.ConvertAll<WoundModel.LabResult>(t => new WoundModel.LabResult(t));
+
+            WoundModel.EMGResponseItemlist<WoundModel.LabResult> response = new WoundModel.EMGResponseItemlist<WoundModel.LabResult>();
+            response.ResultCode = "000";
+            response.ErrorMsg = "";
+            response.Datas = woundLabResults;
+            return XmlUtils.Object2XmlString(response);
+        }
+
+        //[WebMethod]
+        //public string LoadOrders()
+        //{
+        //    List<WoundModel.Order> list = XmlUtils.XmlFile2Object<WoundModel.EMGResponseItemlist<WoundModel.Order>>("E:/meehealth/cdssData/shi/patient_findOrder_K0489693_2019090600050061.xml").Datas;
+        //    list.ForEach(t =>
+        //    {
+        //        DataAccess.Order order = t.ToOrder();
+        //        order.PatientId = "30251";
+        //        order.VisitId = "P30251";
+        //        DataAccess.Repository.OrderRepository.AddOrder(order);
+        //    });
+        //    return "OK";
+        //}
+
+
+        //[WebMethod]
+        //public string LoadOrderCheck()
+        //{
+        //    List<WoundModel.OrderCheck> list = XmlUtils.XmlFile2Object<WoundModel.EMGResponseItemlist<WoundModel.OrderCheck>>("E:/meehealth/cdssData/patient_findOrderCheckList_Y4602299_2019090900050122.xml").Datas;
+        //    list.ForEach(t =>
+        //    {
+        //        DataAccess.OrderCheck orderCheck = t.ToOrderCheck();
+        //        orderCheck.PatientId = "30251";
+        //        orderCheck.VisitId = "P30251";
+        //        DataAccess.Repository.OrderCheckRepository.AddOrderCheckr(orderCheck);
+        //    });
+        //    return "OK";
+        //}
+    }
+}

+ 211 - 0
WebServiceDemo/WebServiceDemo.csproj

@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
+  <Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>
+    </ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{72283083-1051-4947-9E95-02E795E4EFC6}</ProjectGuid>
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>WebServiceDemo</RootNamespace>
+    <AssemblyName>WebServiceDemo</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <UseIISExpress>true</UseIISExpress>
+    <IISExpressSSLPort />
+    <IISExpressAnonymousAuthentication />
+    <IISExpressWindowsAuthentication />
+    <IISExpressUseClassicPipelineMode />
+    <UseGlobalApplicationHostFile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.AI.Agent.Intercept, Version=2.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.6\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.AI.DependencyCollector, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.2.0\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.AI.PerfCounterCollector, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.AI.ServerTelemetryChannel, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.AI.Web, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.2.0\lib\net45\Microsoft.AI.Web.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.AI.WindowsServer, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.2.2.0\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.ApplicationInsights, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Data.SqlClient.4.6.1\lib\net451\System.Data.SqlClient.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Web.DynamicData" />
+    <Reference Include="System.Web.Entity" />
+    <Reference Include="System.Web.ApplicationServices" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.EnterpriseServices" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="packages.config" />
+    <Content Include="ApplicationInsights.config">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <None Include="Properties\PublishProfiles\App.pubxml" />
+    <None Include="Web.Debug.config">
+      <DependentUpon>Web.config</DependentUpon>
+    </None>
+    <None Include="Web.Release.config">
+      <DependentUpon>Web.config</DependentUpon>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Web.config">
+      <SubType>Designer</SubType>
+    </Content>
+    <Content Include="WebServiceWound.asmx" />
+    <Content Include="WebServiceDemo.asmx" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Model\WoundModel.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="WebServiceWound.asmx.cs">
+      <DependentUpon>WebServiceWound.asmx</DependentUpon>
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="WebServiceDemo.asmx.cs">
+      <DependentUpon>WebServiceDemo.asmx</DependentUpon>
+      <SubType>Component</SubType>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\DataAccess\DataAccess.csproj">
+      <Project>{0f8f6a38-af7c-4f65-980b-4f909fa93a9f}</Project>
+      <Name>DataAccess</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\Utils\Utils.csproj">
+      <Project>{a57ba67f-1059-4c73-b9d0-7569b4d4a7e5}</Project>
+      <Name>Utils</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup />
+  <PropertyGroup>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+  </PropertyGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
+  <ProjectExtensions>
+    <VisualStudio>
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+        <WebProjectProperties>
+          <UseIIS>True</UseIIS>
+          <AutoAssignPort>True</AutoAssignPort>
+          <DevelopmentServerPort>60378</DevelopmentServerPort>
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
+          <IISUrl>http://localhost:60378/</IISUrl>
+          <NTLMAuthentication>False</NTLMAuthentication>
+          <UseCustomServer>False</UseCustomServer>
+          <CustomServerUrl>
+          </CustomServerUrl>
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+        </WebProjectProperties>
+      </FlavorProperties>
+    </VisualStudio>
+  </ProjectExtensions>
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
+    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
+  </Target>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 1 - 0
WebServiceDemo/WebServiceWound.asmx

@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="WebServiceWound.asmx.cs" Class="WebServiceDemo.WebServiceWound" %>

+ 56 - 0
WebServiceDemo/WebServiceWound.asmx.cs

@@ -0,0 +1,56 @@
+using DataAccess;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Web.Services;
+using System.Xml;
+using System.Xml.Serialization;
+using Utils;
+using WebServiceDemo.Model;
+
+namespace WebServiceDemo
+{
+    /// <summary>
+    /// WebServiceDemo 的摘要说明
+    /// </summary>
+    [WebService(Namespace = "http://tempuri.org/")]
+    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
+    [System.ComponentModel.ToolboxItem(false)]
+    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 
+    // [System.Web.Script.Services.ScriptService]
+    public class WebServiceWound : System.Web.Services.WebService
+    {
+
+        [WebMethod]
+        public string GetInDeptPatientList()
+        {
+            List<Patient> patients = DataAccess.Repository.PatientRepository.FindAllPatients();
+            List<WoundModel.WoundPatient> woundPatients = patients.ConvertAll<WoundModel.WoundPatient>(t => new WoundModel.WoundPatient(t));
+
+            WoundModel.WoundResponseItemList<WoundModel.WoundPatient> response = new WoundModel.WoundResponseItemList<WoundModel.WoundPatient>();
+            response.ResultCode = "000";
+            response.ErrorMsg = "";
+            response.Datas = woundPatients;
+            return XmlUtils.Object2XmlString(response);
+        }
+
+        [WebMethod]
+        public string GetPatientVitalSign(string PVID, string BeginDate, string EndDate)
+        {
+            DateTime start = DateTime.Parse(BeginDate);
+            DateTime end = DateTime.Parse(EndDate);
+
+            List<PatientVitalSign> signs = DataAccess.Repository.PatientVitalSignRepository.FindPatientVitalSignByPVID(PVID, start, end);
+            List<WoundModel.VitalSign> woundSigns = signs.ConvertAll<WoundModel.VitalSign>(t => new WoundModel.VitalSign(t));
+
+            WoundModel.WoundResponseVital<WoundModel.VitalSign> response = new WoundModel.WoundResponseVital<WoundModel.VitalSign>();
+            response.ResultCode = "000";
+            response.ErrorMsg = "";
+            response.Datas = woundSigns;
+            return XmlUtils.Object2XmlString(response);
+        }
+    }
+}

+ 22 - 0
WebServiceDemo/packages.config

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" />
+  <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" />
+  <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" />
+  <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net452" />
+  <package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net452" />
+  <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net452" />
+  <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.Client.zh-Hans" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.Core.zh-Hans" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.AspNet.WebApi.WebHost.zh-Hans" version="5.2.3" targetFramework="net452" />
+  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
+  <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
+  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
+  <package id="System.Data.Common" version="4.3.0" targetFramework="net452" />
+  <package id="System.Data.SqlClient" version="4.6.1" targetFramework="net452" />
+</packages>