(#2)增加万仕达处方调用记录
This commit is contained in:
		
							parent
							
								
									82b02fcbfd
								
							
						
					
					
						commit
						10f1e7187e
					
				@ -192,6 +192,7 @@
 | 
			
		||||
    <Compile Include="Dal\Queryes\HisDrugQuery.cs" />
 | 
			
		||||
    <Compile Include="Dal\Queryes\HisPrescriptionQuery.cs" />
 | 
			
		||||
    <Compile Include="Dal\Queryes\IDbQuery.cs" />
 | 
			
		||||
    <Compile Include="Dal\Tables\WsdRequestLog.cs" />
 | 
			
		||||
    <Compile Include="Dal\Wappers\HisDrugInfoWapper.cs" />
 | 
			
		||||
    <Compile Include="Dal\Wappers\HisPrescriptyInfoWapper.cs" />
 | 
			
		||||
    <Compile Include="Controllers\HomeController.cs" />
 | 
			
		||||
@ -204,6 +205,7 @@
 | 
			
		||||
    </Compile>
 | 
			
		||||
    <Compile Include="Models\HisInfoModels.cs" />
 | 
			
		||||
    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
			
		||||
    <Compile Include="WebContext.cs" />
 | 
			
		||||
    <Compile Include="WebSettings.cs" />
 | 
			
		||||
    <Compile Include="ws\HisInterface.asmx.cs">
 | 
			
		||||
      <DependentUpon>HisInterface.asmx</DependentUpon>
 | 
			
		||||
 | 
			
		||||
@ -28,5 +28,9 @@ namespace Cmdjy.Dal
 | 
			
		||||
        /// 药品信息
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DbSet<HisDrugInfo> DrugInfos { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 万仕达下载日志
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DbSet<WsdRequestLog> WsdRequestLogs { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										41
									
								
								WebSiteCode/Cmdjy/Cmdjy/Dal/Tables/WsdRequestLog.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								WebSiteCode/Cmdjy/Cmdjy/Dal/Tables/WsdRequestLog.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,41 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.ComponentModel.DataAnnotations.Schema;
 | 
			
		||||
 | 
			
		||||
namespace Cmdjy.Dal.Tables
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 客户端下载处方记录
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [Table("WsdRequestLog")]
 | 
			
		||||
    public class WsdRequestLog
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键。日志流水号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 日志记录时间
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DateTime LogDatatime { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 客户端地址
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string ClientAddress { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取的处方流水
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PrescriptionId { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取的药品流水号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string DrugId { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 开始编号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string StartNo { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取最大记录数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string MaxCount { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								WebSiteCode/Cmdjy/Cmdjy/WebContext.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								WebSiteCode/Cmdjy/Cmdjy/WebContext.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Web;
 | 
			
		||||
 | 
			
		||||
namespace Cmdjy
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 网站执行上下文
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public static class WebContext
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 记录日志记录
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="msg">日志信息</param>
 | 
			
		||||
        public static void Log(string msg) {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -4,6 +4,7 @@ using System.Linq;
 | 
			
		||||
using System.Web.Services;
 | 
			
		||||
using Cmdjy.Bll;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Cmdjy.ws
 | 
			
		||||
{
 | 
			
		||||
@ -71,12 +72,39 @@ namespace Cmdjy.ws
 | 
			
		||||
            try {
 | 
			
		||||
                var resStr = JsonConvert.SerializeObject(result);
 | 
			
		||||
                var mw = DesHelper.GetHelper().Encrypty(resStr);
 | 
			
		||||
                logWsdRequest(info,result,resStr,mw);
 | 
			
		||||
                return mw;
 | 
			
		||||
            }
 | 
			
		||||
            catch(Exception ex) {
 | 
			
		||||
                return ex.ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 记录日志
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="info">请求信息</param>
 | 
			
		||||
        /// <param name="result">响应对象</param>
 | 
			
		||||
        /// <param name="resStr">响应字符串</param>
 | 
			
		||||
        /// <param name="mw">响应密文</param>
 | 
			
		||||
        private void logWsdRequest(WsdRequest info,WsdResult result,string resStr,string mw) {
 | 
			
		||||
            using(var db = new Dal.DjyDbContext()) {
 | 
			
		||||
                if(result != null && result.Prescriptions != null) {
 | 
			
		||||
                    foreach(var p in result.Prescriptions) {
 | 
			
		||||
                        if(p.Drugs != null) {
 | 
			
		||||
                            foreach(var d in p.Drugs) {
 | 
			
		||||
                                db.WsdRequestLogs.Add(new Dal.Tables.WsdRequestLog {
 | 
			
		||||
                                    StartNo = info.StartNo,MaxCount = info.MaxCount,
 | 
			
		||||
                                    ClientAddress = this.Context.Request.UserHostAddress,
 | 
			
		||||
                                    LogDatatime = DateTime.Now,DrugId = d.Id.ToString(),
 | 
			
		||||
                                    PrescriptionId = p.Id.ToString(),
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                db.SaveChanges();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 从数据库获取药品列表
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user