Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
3c3f2018ad | |||
0271c8a701 | |||
edb8eaa72e | |||
5b6455cb91 |
|
@ -203,6 +203,7 @@
|
|||
<Compile Include="Controllers\HisInfoController.cs" />
|
||||
<Compile Include="Controllers\HisUpdataController.cs" />
|
||||
<Compile Include="Controllers\HospitalInfoController.cs" />
|
||||
<Compile Include="Controllers\InterFaceDocController.cs" />
|
||||
<Compile Include="Controllers\WsdInterfaceController.cs" />
|
||||
<Compile Include="Dal\Configuration.cs" />
|
||||
<Compile Include="Dal\DbContextFactory.cs" />
|
||||
|
@ -267,6 +268,7 @@
|
|||
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
|
||||
<Content Include="Scripts\modernizr-2.8.3.js" />
|
||||
<Content Include="Views\HospitalInfo\Index.cshtml" />
|
||||
<Content Include="Views\InterFaceDoc\Index.cshtml" />
|
||||
<None Include="Web.config" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using System.Web.Mvc;
|
||||
|
||||
namespace Cmdjy.Controllers
|
||||
{
|
||||
public class InterFaceDocController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace Cmdjy.Controllers
|
|||
public ActionResult Index() {
|
||||
var model = new WsdRequest {
|
||||
StartNo = "0",MaxCount = "10",
|
||||
CompanyCode = "1",CompanyName = "万仕达",
|
||||
CompanyCode = "1",CompanyName = "万仕诚代煎药",
|
||||
};
|
||||
return PartialView(model);
|
||||
}
|
||||
|
@ -51,44 +51,64 @@ namespace Cmdjy.Controllers
|
|||
result.Code = EnumCode.Exception;
|
||||
result.Msg = "Count值错误。";
|
||||
}
|
||||
if(result.Code != EnumCode.Exception) {
|
||||
result.Prescriptions = new List<WsdPrescriptionInfo>();
|
||||
count = count > WebSettings.WsdMaxCount ? WebSettings.WsdMaxCount : count;
|
||||
var cache = CacheFactory.Cache;
|
||||
for(int i = start;i < start + count;i++) {
|
||||
//从缓存获取
|
||||
var pkey = $"Company:Id:{info.CompanyCode}:Pre:Id:{i}";
|
||||
var one = cache.GetData<WsdPrescriptionInfo>(pkey);
|
||||
if(one == null) {
|
||||
//从数据库获取处方信息
|
||||
one = getPrescriptionInfoFromDb(info.CompanyCode,i);
|
||||
//判断是否为
|
||||
//获取药品信息
|
||||
if(one != null) one.Drugs = getDrugInfoFromDb(one.Id);
|
||||
//存缓存
|
||||
if(one != null) cache.SetData(pkey,one);
|
||||
DateTime sd = DateTime.MinValue;
|
||||
if(!string.IsNullOrEmpty(info.StartDate) && !DateTime.TryParse(info.StartDate,out sd)) {
|
||||
result.Code = EnumCode.Exception;
|
||||
result.Msg = "StartDate值格式错误,请修改正确格式或不提供该值。";
|
||||
}
|
||||
sd = new DateTime(sd.Year,sd.Month,sd.Day,0,0,0);//起始时间
|
||||
int i = start;//起始编号
|
||||
int maxId = db.PrescriptionInfos.Max(m => m.Id);//最大Id
|
||||
count = Math.Min(WebSettings.WsdMaxCount,count);//最大获取数量
|
||||
result.MaxId = maxId.ToString();//处方最大Id
|
||||
result.Prescriptions = new List<WsdPrescriptionInfo>();
|
||||
var cache = CacheFactory.Cache;
|
||||
while(result.Code != EnumCode.Exception && i <= maxId && result.Prescriptions.Count < count) {
|
||||
var pkey = $"Company:Id:{info.CompanyCode}:Pre:Id:{i}";
|
||||
var one = cache.GetData<WsdPrescriptionInfo>(pkey);
|
||||
if(one == null) {
|
||||
//从数据库获取处方信息
|
||||
one = getPrescriptionInfoFromDb(info.CompanyCode,i);
|
||||
//判断是否为
|
||||
//获取药品信息
|
||||
if(one != null) one.Drugs = getDrugInfoFromDb(one.Id);
|
||||
//存缓存
|
||||
if(one != null) cache.SetData(pkey,one);
|
||||
}
|
||||
if(one != null) {
|
||||
//处方日期要大于起始日期
|
||||
if(DateTime.TryParse(one.PrescriptionDatatime,out DateTime odt)) {
|
||||
if(odt < sd) {
|
||||
one = null;
|
||||
}
|
||||
}
|
||||
if(needNull != null && one == null) {
|
||||
one = new WsdPrescriptionInfo {
|
||||
Type = WsdPrescriptionType.NullOrder,Id = i,
|
||||
};
|
||||
}
|
||||
if(one != null) {
|
||||
result.Prescriptions.Add(one);
|
||||
else {
|
||||
result.Code = EnumCode.Exception;
|
||||
result.Msg = $"处方({i})中PrescriptionDatatime错误。";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(one != null) {
|
||||
result.Prescriptions.Add(one);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(result.Code != EnumCode.Exception) {
|
||||
result.Code = EnumCode.Success;
|
||||
result.Count = result.Prescriptions.Where(m => m.Type != WsdPrescriptionType.NullOrder).Count();
|
||||
result.Msg = "";
|
||||
result.MaxId = db.PrescriptionInfos.Max(m => m.Id).ToString();
|
||||
result.More = db.PrescriptionInfos.Max(m => m.Id) > (start + count);
|
||||
}
|
||||
//编码:json串 + 加密信息
|
||||
//return Json(result);
|
||||
var resStr = JsonConvert.SerializeObject(result);
|
||||
var mw = noDes == null ? DesHelper.GetHelper().Encrypty(cKey,resStr) : resStr;
|
||||
logWsdRequest(info,result,resStr,mw);
|
||||
return Content(mw);
|
||||
if(noDes == null) {
|
||||
var resStr = JsonConvert.SerializeObject(result);
|
||||
var mw = DesHelper.GetHelper().Encrypty(cKey,resStr);
|
||||
logWsdRequest(info,result,resStr,mw);
|
||||
return Content(mw);
|
||||
}
|
||||
else {
|
||||
return Json(result,JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 记录日志
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<h1>代煎药平台</h1>
|
||||
<hr />
|
||||
<ol class="toolBar">
|
||||
<li>版本1.0</li>
|
||||
<li>版本2.0</li>
|
||||
<li>@Ajax.ActionLink("接口说明","Index","InterFaceDoc",new AjaxOptions { UpdateTargetId = "main" })</li>
|
||||
<li>@Ajax.ActionLink("厂商列表","Index","Company",new AjaxOptions { UpdateTargetId = "main" })</li>
|
||||
<li>@Ajax.ActionLink("医疗机构处方列表","Index","HisInfo",new AjaxOptions { UpdateTargetId = "main" })</li>
|
||||
<li>@Ajax.ActionLink("医疗机构列表","Index","HospitalInfo",new AjaxOptions { UpdateTargetId = "main" })</li>
|
||||
|
|
138
WebSiteCode/Cmdjy/Cmdjy/Views/InterFaceDoc/Index.cshtml
Normal file
138
WebSiteCode/Cmdjy/Cmdjy/Views/InterFaceDoc/Index.cshtml
Normal file
|
@ -0,0 +1,138 @@
|
|||
|
||||
<style type="text/css">
|
||||
#ifd_l {
|
||||
display: block;
|
||||
width: 300px;
|
||||
float: left;
|
||||
border-right: 1px solid #000;
|
||||
}
|
||||
|
||||
#ifd_l ul {
|
||||
list-style: none;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#ifd_l ul li {
|
||||
padding: 3px 0px;
|
||||
}
|
||||
|
||||
#ifd_r {
|
||||
float: left;
|
||||
padding: 3px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$("#ifd_r > div").hide();
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$("#ifd_l input[type=button]").click(function () {
|
||||
$("#ifd_r > div").hide();
|
||||
var sid = $(this).attr("viewId");
|
||||
$("#ifd_r #" + sid).show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<fieldset>
|
||||
<legend>接口说明文档</legend>
|
||||
<div id="ifd_l">
|
||||
<ul>
|
||||
<li>API列表:</li>
|
||||
<li><input type="button" viewId="cfxx" value="处方信息" /></li>
|
||||
<li><input type="button" viewId="yyjglb" value="医院机构列表" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="ifd_r">
|
||||
<div id="cfxx">
|
||||
<div>接口地址:@Url.Action("GetData","WsdInterface")</div>
|
||||
<table>
|
||||
<caption>处方信息接口请求参数</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<th>可为空</th>
|
||||
<th>说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>CompanyCode</td>
|
||||
<td>否</td>
|
||||
<td>接口方代码。</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CompanyName</td>
|
||||
<td>是</td>
|
||||
<td>接口方名称</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>StartNo</td>
|
||||
<td>否</td>
|
||||
<td>开始的编号</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MaxCount</td>
|
||||
<td>否</td>
|
||||
<td>最大获取数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>StartDate</td>
|
||||
<td>是</td>
|
||||
<td>处方开始时间</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table>
|
||||
<caption>处方信息响应参数</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<th>可为空</th>
|
||||
<th>说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">暂缺</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="yyjglb">
|
||||
<div>接口地址:@Url.Action("HospitalList","HospitalInfo")</div>
|
||||
<table>
|
||||
<caption>医院机构列表请求参数</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<th>可为空</th>
|
||||
<th>说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">无参数</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table>
|
||||
<caption>处方信息响应参数</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<th>可为空</th>
|
||||
<th>说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">暂缺</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
$("#wsdMsg").hide();
|
||||
function wsdSucc(data) {
|
||||
if (!data.match("^\{(.+:.+,*){1,}\}$")) {
|
||||
$("#wsdMsg").show().text(data);
|
||||
function wsdSucc(data, status, xhr) {
|
||||
if (xhr.getResponseHeader("Content-Type").indexOf("application/json") >= 0) {
|
||||
$("#wsdMsg").show().text(JSON.stringify(data, null, 2));
|
||||
} else {
|
||||
$("#wsdMsg").show().text(JSON.stringify(JSON.parse(data), null, 2));
|
||||
$("#wsdMsg").show().text(data);
|
||||
}
|
||||
}
|
||||
function wsdBeg() {
|
||||
|
|
|
@ -21,5 +21,9 @@
|
|||
/// 最大本次获取的处方数量。根据客户网络和服务器配置情况自行调整
|
||||
/// </summary>
|
||||
public string MaxCount { get; set; }
|
||||
/// <summary>
|
||||
/// 查询开始时间
|
||||
/// </summary>
|
||||
public string StartDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user