1039 lines
44 KiB
C#
1039 lines
44 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.Services;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
using System.Data.OleDb;
|
|||
|
|
using System.Data;
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Security.Cryptography;
|
|||
|
|
using System.IO;
|
|||
|
|
using Newtonsoft.Json.Linq;
|
|||
|
|
using System.Web.Script.Serialization;
|
|||
|
|
using log4net;
|
|||
|
|
|
|||
|
|
namespace TiJianFuWu
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// PAJK 的摘要说明
|
|||
|
|
/// </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 PAJK : System.Web.Services.WebService
|
|||
|
|
{
|
|||
|
|
private static SqlConnection connection;
|
|||
|
|
string yzm = "0";
|
|||
|
|
object yzm1 = "0";
|
|||
|
|
private const string SError = "Error";
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 1.预约申请
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="data">3DES加密后的预约JSON数据</param>
|
|||
|
|
/// <returns>status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602</returns>
|
|||
|
|
/// <returns>hospitalOrderId=医疗机构订单ID</returns>
|
|||
|
|
/// <returns>orderState=预约订单状态:预约已确认:01 预约待确认:02</returns>
|
|||
|
|
[WebMethod]
|
|||
|
|
public string yysq(string sign, string timestamp, string data)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//var log = log4net.LogManager.GetLogger(this.GetType());
|
|||
|
|
var log = log4net.LogManager.GetLogger(SError);
|
|||
|
|
log.Info(data);
|
|||
|
|
|
|||
|
|
if (JianQuan(sign, timestamp) == false)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "401", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//EAS.Loggers.ILogger log = new EAS.Loggers.TextLogger();
|
|||
|
|
//使用3des解密
|
|||
|
|
//var data3des = Decrypt3Des1(data, "pOju50umByKqfGFAqrknUKmM");
|
|||
|
|
var data3des = Decrypt3Des1(data, "D4c631fEanBeA1dMdrsCjdte");
|
|||
|
|
|
|||
|
|
//将解密字符串转换成Json对象
|
|||
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(data3des);
|
|||
|
|
|
|||
|
|
//医疗机构订单ID
|
|||
|
|
string hospitalOrderId = Guid.NewGuid().ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
//体检平台订单ID
|
|||
|
|
string orderId = jo["orderId"].ToString();
|
|||
|
|
|
|||
|
|
string sql = "select * from pa_yysq where orderId='"+ orderId + "'";
|
|||
|
|
DataTable dtMd = GetDataSet(sql);
|
|||
|
|
if(dtMd.Rows.Count>0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200", hospitalOrderId = hospitalOrderId, orderState = "01" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//客户姓名
|
|||
|
|
string customerName = jo["customerName"].ToString();
|
|||
|
|
if (string.IsNullOrEmpty(customerName))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
var log1 = log4net.LogManager.GetLogger(SError);
|
|||
|
|
log1.Info(customerName);
|
|||
|
|
|
|||
|
|
//客户证件类型--身份证:1,护照:2,军人证:3,港澳通行证 / 回乡证或台胞证:6
|
|||
|
|
string customerIdentityType = jo["customerIdentityType"].ToString();
|
|||
|
|
|
|||
|
|
//客户证件号
|
|||
|
|
string customerIdentityNo = jo["customerIdentityNo"].ToString();
|
|||
|
|
if (string.IsNullOrEmpty(customerIdentityNo))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//客户性别 男:M,女:F
|
|||
|
|
string customerGender = jo["customerGender"].ToString();
|
|||
|
|
|
|||
|
|
//客户出生日期 yyyyMMdd
|
|||
|
|
string customerBirthday = jo["customerBirthday"].ToString();
|
|||
|
|
|
|||
|
|
//生理状态:男:01 未婚女:02 已婚女:03
|
|||
|
|
string medicalStatus = jo["medicalStatus"].ToString();
|
|||
|
|
|
|||
|
|
//门店ID
|
|||
|
|
string hospitalSubId = jo["hospitalSubId"].ToString();
|
|||
|
|
|
|||
|
|
//套餐ID
|
|||
|
|
string medicalPackage = jo["medicalPackage"].ToString();
|
|||
|
|
|
|||
|
|
//预约时间 yyyyMMddHHmmss
|
|||
|
|
string appointmentTime = jo["appointmentTime"].ToString();
|
|||
|
|
if (string.IsNullOrEmpty(appointmentTime))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string aa = appointmentTime.Substring(0, 8);
|
|||
|
|
//var time = DateTime.Parse(Request["Pusinessdate"].ToString());
|
|||
|
|
DateTime dtAppointmentTime = Convert.ToDateTime(DateTime.ParseExact(aa, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
|
|||
|
|
//是否授权查看体检报告:是:Y 否:N
|
|||
|
|
string hasAuthorized = jo["hasAuthorized"].ToString();
|
|||
|
|
|
|||
|
|
//手机号码,11位
|
|||
|
|
string phone = jo["phone"].ToString();
|
|||
|
|
|
|||
|
|
//套餐展示名称
|
|||
|
|
string packageDisplayName = jo["packageDisplayName"].ToString();
|
|||
|
|
|
|||
|
|
//所属公司名称
|
|||
|
|
string companyName = jo["companyName"].ToString();
|
|||
|
|
|
|||
|
|
//是否VIP预约:否:N 是:Y
|
|||
|
|
string isVip = jo["isVip"].ToString();
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
* 验证是否可以预约
|
|||
|
|
*/
|
|||
|
|
/// canOrder 是否可预约:可预约: 1 不可预约: 0
|
|||
|
|
/// provideVipData 是否提供VIP预约数据:提供:1 不提供:0
|
|||
|
|
/// vipMaxNum VIP最大可体检人数
|
|||
|
|
/// vipOrderNum VIP已预约人数
|
|||
|
|
/// maxNum 最大可体检人数(包括vip和非vip)
|
|||
|
|
/// orderNum 已预约人数(包括vip和非vip)
|
|||
|
|
/// status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602
|
|||
|
|
|
|||
|
|
sql = "select * from pa_yyrs where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
DataTable dt1 = GetDataSet(sql);
|
|||
|
|
if (dt1.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
sql = @"INSERT INTO pa_yyrs
|
|||
|
|
(yyrq
|
|||
|
|
,maxNum
|
|||
|
|
,orderNum
|
|||
|
|
,vipMaxNum
|
|||
|
|
,vipOrderNum
|
|||
|
|
,canOrder
|
|||
|
|
,provideVipData
|
|||
|
|
) VALUES ('{0}',{1},{2},{3},{4},{5},{6})";
|
|||
|
|
|
|||
|
|
sql = string.Format(sql, dtAppointmentTime
|
|||
|
|
, 150
|
|||
|
|
, 1
|
|||
|
|
, 50
|
|||
|
|
, isVip == "Y" ? 1 : 0
|
|||
|
|
, (int)dtAppointmentTime.DayOfWeek == 1 ? 0 : 1
|
|||
|
|
, (int)dtAppointmentTime.DayOfWeek == 1 ? 0 : 1);
|
|||
|
|
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd1 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue1 = cmd1.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue1 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId, orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (dt1.Rows[0]["canOrder"].ToString() == "0")
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "600", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isVip == "Y")
|
|||
|
|
{
|
|||
|
|
if (dt1.Rows[0]["provideVipData"].ToString() == "0")
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "600", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (Convert.ToInt32(dt1.Rows[0]["vipMaxNum"]) == Convert.ToInt32(dt1.Rows[0]["vipOrderNum"]))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "601", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = "update pa_yyrs set vipOrderNum=vipOrderNum+1,orderNum=orderNum+1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd2 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue2 = cmd2.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue2 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId, orderState = "02" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (Convert.ToInt32(dt1.Rows[0]["maxNum"]) == Convert.ToInt32(dt1.Rows[0]["orderNum"]))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "601", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = "update pa_yyrs set orderNum=orderNum+1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd3 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue3 = cmd3.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue3 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId, orderState = "02" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
sql = @"INSERT INTO pa_yysq
|
|||
|
|
(hospitalOrderId
|
|||
|
|
,orderId
|
|||
|
|
,customerName
|
|||
|
|
,customerIdentityType
|
|||
|
|
,customerIdentityNo
|
|||
|
|
,customerGender
|
|||
|
|
,customerBirthday
|
|||
|
|
,medicalStatus
|
|||
|
|
,hospitalSubId
|
|||
|
|
,medicalPackage
|
|||
|
|
,appointmentTime
|
|||
|
|
,hasAuthorized
|
|||
|
|
,phone
|
|||
|
|
,packageDisplayName
|
|||
|
|
,companyName
|
|||
|
|
,isVip
|
|||
|
|
,tm
|
|||
|
|
,orderState,status,tjrq)
|
|||
|
|
VALUES
|
|||
|
|
('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}',{18},'{19}')";
|
|||
|
|
|
|||
|
|
//填充SQL语句
|
|||
|
|
sql = string.Format(sql, hospitalOrderId
|
|||
|
|
, orderId
|
|||
|
|
, customerName
|
|||
|
|
, customerIdentityType
|
|||
|
|
, customerIdentityNo
|
|||
|
|
, customerGender
|
|||
|
|
, customerBirthday
|
|||
|
|
, medicalStatus
|
|||
|
|
, hospitalSubId
|
|||
|
|
, medicalPackage
|
|||
|
|
, appointmentTime
|
|||
|
|
, hasAuthorized
|
|||
|
|
, phone
|
|||
|
|
, packageDisplayName
|
|||
|
|
, companyName
|
|||
|
|
, isVip
|
|||
|
|
, ""
|
|||
|
|
, "01"
|
|||
|
|
, "200", DateTime.Now.ToString("yyyyMMdd HH:mm:ss"));
|
|||
|
|
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue = cmd.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue != -1)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200", hospitalOrderId = hospitalOrderId, orderState = "01" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "602", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ext)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = yzm, orderState = yzm1 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 1.预约申请2
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="data">3DES加密后的预约JSON数据</param>
|
|||
|
|
/// <returns>status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602</returns>
|
|||
|
|
/// <returns>hospitalOrderId=医疗机构订单ID</returns>
|
|||
|
|
/// <returns>orderState=预约订单状态:预约已确认:01 预约待确认:02</returns>
|
|||
|
|
[WebMethod]
|
|||
|
|
public string yysq2(string data)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//var log = log4net.LogManager.GetLogger(this.GetType());
|
|||
|
|
var log = log4net.LogManager.GetLogger(SError);
|
|||
|
|
log.Info(data);
|
|||
|
|
|
|||
|
|
//EAS.Loggers.ILogger log = new EAS.Loggers.TextLogger();
|
|||
|
|
//使用3des解密
|
|||
|
|
//var data3des = Decrypt3Des1(data, "pOju50umByKqfGFAqrknUKmM");
|
|||
|
|
var data3des = Decrypt3Des1(data, "D4c631fEanBeA1dMdrsCjdte");
|
|||
|
|
|
|||
|
|
//将解密字符串转换成Json对象
|
|||
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(data3des);
|
|||
|
|
|
|||
|
|
//医疗机构订单ID
|
|||
|
|
string hospitalOrderId = Guid.NewGuid().ToString();
|
|||
|
|
//yzm = hospitalOrderId;
|
|||
|
|
|
|||
|
|
//体检平台订单ID
|
|||
|
|
string orderId = jo["orderId"].ToString();
|
|||
|
|
|
|||
|
|
string sql = "select * from pa_yysq where orderId='" + orderId + "'";
|
|||
|
|
DataTable dtMd = GetDataSet(sql);
|
|||
|
|
if (dtMd.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200", hospitalOrderId = hospitalOrderId, orderState = "01" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//客户姓名
|
|||
|
|
string customerName = jo["customerName"].ToString();
|
|||
|
|
if (string.IsNullOrEmpty(customerName))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
var log1 = log4net.LogManager.GetLogger(SError);
|
|||
|
|
log1.Info(customerName);
|
|||
|
|
|
|||
|
|
//客户证件类型--身份证:1,护照:2,军人证:3,港澳通行证 / 回乡证或台胞证:6
|
|||
|
|
string customerIdentityType = jo["customerIdentityType"].ToString();
|
|||
|
|
|
|||
|
|
//客户证件号
|
|||
|
|
string customerIdentityNo = jo["customerIdentityNo"].ToString();
|
|||
|
|
if (string.IsNullOrEmpty(customerIdentityNo))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//客户性别 男:M,女:F
|
|||
|
|
string customerGender = jo["customerGender"].ToString();
|
|||
|
|
|
|||
|
|
//客户出生日期 yyyyMMdd
|
|||
|
|
string customerBirthday = jo["customerBirthday"].ToString();
|
|||
|
|
|
|||
|
|
//生理状态:男:01 未婚女:02 已婚女:03
|
|||
|
|
string medicalStatus = jo["medicalStatus"].ToString();
|
|||
|
|
|
|||
|
|
//门店ID
|
|||
|
|
string hospitalSubId = jo["hospitalSubId"].ToString();
|
|||
|
|
|
|||
|
|
//套餐ID
|
|||
|
|
string medicalPackage = jo["medicalPackage"].ToString();
|
|||
|
|
|
|||
|
|
//预约时间 yyyyMMddHHmmss
|
|||
|
|
string appointmentTime = jo["appointmentTime"].ToString();
|
|||
|
|
if (string.IsNullOrEmpty(appointmentTime))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string aa = appointmentTime.Substring(0, 8);
|
|||
|
|
//var time = DateTime.Parse(Request["Pusinessdate"].ToString());
|
|||
|
|
DateTime dtAppointmentTime = Convert.ToDateTime(DateTime.ParseExact(aa, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
|
|||
|
|
//是否授权查看体检报告:是:Y 否:N
|
|||
|
|
string hasAuthorized = jo["hasAuthorized"].ToString();
|
|||
|
|
|
|||
|
|
//手机号码,11位
|
|||
|
|
string phone = jo["phone"].ToString();
|
|||
|
|
|
|||
|
|
//套餐展示名称
|
|||
|
|
string packageDisplayName = jo["packageDisplayName"].ToString();
|
|||
|
|
|
|||
|
|
//所属公司名称
|
|||
|
|
string companyName = jo["companyName"].ToString();
|
|||
|
|
|
|||
|
|
//是否VIP预约:否:N 是:Y
|
|||
|
|
string isVip = jo["isVip"].ToString();
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
* 验证是否可以预约
|
|||
|
|
*/
|
|||
|
|
/// canOrder 是否可预约:可预约: 1 不可预约: 0
|
|||
|
|
/// provideVipData 是否提供VIP预约数据:提供:1 不提供:0
|
|||
|
|
/// vipMaxNum VIP最大可体检人数
|
|||
|
|
/// vipOrderNum VIP已预约人数
|
|||
|
|
/// maxNum 最大可体检人数(包括vip和非vip)
|
|||
|
|
/// orderNum 已预约人数(包括vip和非vip)
|
|||
|
|
/// status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602
|
|||
|
|
|
|||
|
|
sql = "select * from pa_yyrs where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
DataTable dt1 = GetDataSet(sql);
|
|||
|
|
if (dt1.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
sql = @"INSERT INTO pa_yyrs
|
|||
|
|
(yyrq
|
|||
|
|
,maxNum
|
|||
|
|
,orderNum
|
|||
|
|
,vipMaxNum
|
|||
|
|
,vipOrderNum
|
|||
|
|
,canOrder
|
|||
|
|
,provideVipData
|
|||
|
|
) VALUES ('{0}',{1},{2},{3},{4},{5},{6})";
|
|||
|
|
|
|||
|
|
sql = string.Format(sql, dtAppointmentTime
|
|||
|
|
, 150
|
|||
|
|
, 1
|
|||
|
|
, 50
|
|||
|
|
, isVip == "Y" ? 1 : 0
|
|||
|
|
, (int)dtAppointmentTime.DayOfWeek == 1 ? 0 : 1
|
|||
|
|
, (int)dtAppointmentTime.DayOfWeek == 1 ? 0 : 1);
|
|||
|
|
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd1 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue1 = cmd1.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue1 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId, orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (dt1.Rows[0]["canOrder"].ToString() == "0")
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "600", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isVip == "Y")
|
|||
|
|
{
|
|||
|
|
if (dt1.Rows[0]["provideVipData"].ToString() == "0")
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "600", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (Convert.ToInt32(dt1.Rows[0]["vipMaxNum"]) == Convert.ToInt32(dt1.Rows[0]["vipOrderNum"]))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "601", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = "update pa_yyrs set vipOrderNum=vipOrderNum+1,orderNum=orderNum+1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd2 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue2 = cmd2.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue2 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId, orderState = "02" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (Convert.ToInt32(dt1.Rows[0]["maxNum"]) == Convert.ToInt32(dt1.Rows[0]["orderNum"]))
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "601", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = "update pa_yyrs set orderNum=orderNum+1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd3 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue3 = cmd3.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue3 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId, orderState = "02" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
sql = @"INSERT INTO pa_yysq
|
|||
|
|
(hospitalOrderId
|
|||
|
|
,orderId
|
|||
|
|
,customerName
|
|||
|
|
,customerIdentityType
|
|||
|
|
,customerIdentityNo
|
|||
|
|
,customerGender
|
|||
|
|
,customerBirthday
|
|||
|
|
,medicalStatus
|
|||
|
|
,hospitalSubId
|
|||
|
|
,medicalPackage
|
|||
|
|
,appointmentTime
|
|||
|
|
,hasAuthorized
|
|||
|
|
,phone
|
|||
|
|
,packageDisplayName
|
|||
|
|
,companyName
|
|||
|
|
,isVip
|
|||
|
|
,tm
|
|||
|
|
,orderState,status,tjrq)
|
|||
|
|
VALUES
|
|||
|
|
('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}',{18},'{19}')";
|
|||
|
|
|
|||
|
|
//填充SQL语句
|
|||
|
|
sql = string.Format(sql, hospitalOrderId
|
|||
|
|
, orderId
|
|||
|
|
, customerName
|
|||
|
|
, customerIdentityType
|
|||
|
|
, customerIdentityNo
|
|||
|
|
, customerGender
|
|||
|
|
, customerBirthday
|
|||
|
|
, medicalStatus
|
|||
|
|
, hospitalSubId
|
|||
|
|
, medicalPackage
|
|||
|
|
, appointmentTime
|
|||
|
|
, hasAuthorized
|
|||
|
|
, phone
|
|||
|
|
, packageDisplayName
|
|||
|
|
, companyName
|
|||
|
|
, isVip
|
|||
|
|
, ""
|
|||
|
|
, "01"
|
|||
|
|
, "200", DateTime.Now.ToString("yyyyMMdd HH:mm:ss"));
|
|||
|
|
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue = cmd.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue != -1)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200", hospitalOrderId = hospitalOrderId, orderState = "01" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "602", hospitalOrderId = "", orderState = "02" });
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ext)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = yzm, orderState = yzm1 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 2.取消预约
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="hospitalOrderId">医疗机构订单ID</param>
|
|||
|
|
/// <param name="orderId">体检平台订单ID</param>
|
|||
|
|
/// <returns>status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602</returns>
|
|||
|
|
[WebMethod]
|
|||
|
|
public string qxyy(string sign, string timestamp, string hospitalOrderId, string orderId)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (JianQuan(sign, timestamp) == false)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "401" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//DateTime dtAppointmentTime = Convert.ToDateTime(DateTime.ParseExact(aa, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
string sql = "select * from pa_yysq where hospitalOrderId='{0}' and orderId='{1}'";
|
|||
|
|
sql = string.Format(sql, hospitalOrderId, orderId);
|
|||
|
|
DataTable dt1 = GetDataSet(sql);
|
|||
|
|
|
|||
|
|
if (dt1.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string aa = dt1.Rows[0]["appointmentTime"].ToString().Substring(0, 8);
|
|||
|
|
string isVIP = dt1.Rows[0]["isVip"].ToString();
|
|||
|
|
DateTime dtAppointmentTime = Convert.ToDateTime(DateTime.ParseExact(aa, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
|
|||
|
|
sql = "select * from pa_yyrs where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
DataTable dt2 = GetDataSet(sql);
|
|||
|
|
if (dt2.Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
if (isVIP == "Y")
|
|||
|
|
{
|
|||
|
|
sql = "update pa_yyrs set vipOrderNum=vipOrderNum-1,orderNum=orderNum-1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sql = "update pa_yyrs set orderNum=orderNum-1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd2 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue2 = cmd2.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue2 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = @"delete from pa_yysq where hospitalOrderId='{0}' and orderId='{1}'";
|
|||
|
|
sql = string.Format(sql, hospitalOrderId, orderId);
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd = new SqlCommand(sql, Connection);
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue = cmd.ExecuteNonQuery();
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue != 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200" });
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ext)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 3.客户申请改期
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="hospitalOrderId">医疗机构订单ID</param>
|
|||
|
|
/// <param name="orderId">体检平台订单ID</param>
|
|||
|
|
/// <param name="appointmentTime">预约时间</param>
|
|||
|
|
/// <returns>status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602</returns>
|
|||
|
|
/// <returns>hospitalOrderId=医疗机构订单ID</returns>
|
|||
|
|
[WebMethod]
|
|||
|
|
public string khsqgq(string sign, string timestamp, string hospitalOrderId, string orderId, string appointmentTime)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (JianQuan(sign, timestamp) == false)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "401", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string bb = appointmentTime.Substring(0, 8);
|
|||
|
|
DateTime dt = Convert.ToDateTime(DateTime.ParseExact(bb, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
if ((int)dt.DayOfWeek == 1)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "601", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string sql = "select * from pa_yysq where hospitalOrderId='{0}' and orderId='{1}'";
|
|||
|
|
sql = string.Format(sql, hospitalOrderId, orderId);
|
|||
|
|
DataTable dt1 = GetDataSet(sql);
|
|||
|
|
|
|||
|
|
if (dt1.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//释放预约
|
|||
|
|
string aa = dt1.Rows[0]["appointmentTime"].ToString().Substring(0, 8);
|
|||
|
|
string isVIP = dt1.Rows[0]["isVip"].ToString();
|
|||
|
|
DateTime dtAppointmentTime = Convert.ToDateTime(DateTime.ParseExact(aa, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
|
|||
|
|
sql = "select * from pa_yyrs where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
DataTable dt2 = GetDataSet(sql);
|
|||
|
|
if (dt2.Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
if (isVIP == "Y")
|
|||
|
|
{
|
|||
|
|
sql = "update pa_yyrs set vipOrderNum=vipOrderNum-1,orderNum=orderNum-1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sql = "update pa_yyrs set orderNum=orderNum-1 where yyrq='" + dtAppointmentTime + "'";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd2 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue2 = cmd2.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue2 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//新的预约日期 填充预约
|
|||
|
|
sql = "select * from pa_yyrs where yyrq='" + dt + "'";
|
|||
|
|
DataTable dt3 = GetDataSet(sql);
|
|||
|
|
if (dt3.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
sql = @"INSERT INTO pa_yyrs
|
|||
|
|
(yyrq
|
|||
|
|
,maxNum
|
|||
|
|
,orderNum
|
|||
|
|
,vipMaxNum
|
|||
|
|
,vipOrderNum
|
|||
|
|
,canOrder
|
|||
|
|
,provideVipData
|
|||
|
|
) VALUES ('{0}',{1},{2},{3},{4},{5},{6})";
|
|||
|
|
|
|||
|
|
sql = string.Format(sql, dt
|
|||
|
|
, 150
|
|||
|
|
, 1
|
|||
|
|
, 50
|
|||
|
|
, isVIP == "Y" ? 1 : 0
|
|||
|
|
, (int)dtAppointmentTime.DayOfWeek == 1 ? 0 : 1
|
|||
|
|
,(int)dtAppointmentTime.DayOfWeek == 1 ? 0 : 1);
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd1 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue1 = cmd1.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue1 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (isVIP == "Y")
|
|||
|
|
{
|
|||
|
|
sql = "update pa_yyrs set vipOrderNum=vipOrderNum+1,orderNum=orderNum+1 where yyrq='" + dt + "'";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sql = "update pa_yyrs set orderNum=orderNum+1 where yyrq='" + dt + "'";
|
|||
|
|
}
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd3 = new SqlCommand(sql, Connection);
|
|||
|
|
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue3 = cmd3.ExecuteNonQuery();
|
|||
|
|
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue3 < 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = @"update pa_yysq set appointmentTime='{0}',tjrq='{3}' where hospitalOrderId='{1}' and orderId='{2}'";
|
|||
|
|
sql = string.Format(sql, appointmentTime, hospitalOrderId, orderId, DateTime.Now.ToString("yyyyMMdd HH:mm:ss"));
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd = new SqlCommand(sql, Connection);
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue = cmd.ExecuteNonQuery();
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue != 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ext)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", hospitalOrderId = hospitalOrderId });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 4.客户授权查看影像报告
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="hospitalOrderId">医疗机构订单ID</param>
|
|||
|
|
/// <param name="orderId">体检平台订单ID</param>
|
|||
|
|
/// <returns>status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602</returns>
|
|||
|
|
[WebMethod]
|
|||
|
|
public string khsqckyxbg(string sign, string timestamp, string hospitalOrderId, string orderId)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (JianQuan(sign, timestamp) == false)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "401" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string sql = "select * from pa_yysq where hospitalOrderId='{0}' and orderId='{1}'";
|
|||
|
|
sql = string.Format(sql, hospitalOrderId, orderId);
|
|||
|
|
DataTable dt1 = GetDataSet(sql);
|
|||
|
|
|
|||
|
|
if (dt1.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sql = @"update pa_yysq set hasAuthorized='Y' where hospitalOrderId='{0}' and orderId='{1}'";
|
|||
|
|
sql = string.Format(sql, hospitalOrderId, orderId);
|
|||
|
|
//创建SqlCommand对象
|
|||
|
|
SqlCommand cmd = new SqlCommand(sql, Connection);
|
|||
|
|
//执行SQL语句
|
|||
|
|
int returnvalue = cmd.ExecuteNonQuery();
|
|||
|
|
//判断SQL语句是否执行成功
|
|||
|
|
if (returnvalue != 0)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200" });
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "400" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ext)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 5.体检预约可用人数
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="startDate">起始时间</param>
|
|||
|
|
/// <param name="endDate">结束时间</param>
|
|||
|
|
/// <param name="hospitalSubId">机构门店ID</param>
|
|||
|
|
/// <returns>status=状态码:正常:200,参数异常400,权限异常: 401未知错误: 500不能预约: 600预约人数已满: 601其他无法预约情况: 602</returns>
|
|||
|
|
/// <returns>results=
|
|||
|
|
/// date 具体每一天的日期
|
|||
|
|
/// canOrder 是否可预约:可预约: 1 不可预约: 0
|
|||
|
|
/// provideVipData 是否提供VIP预约数据:提供:1 不提供:0
|
|||
|
|
/// vipMaxNum VIP最大可体检人数
|
|||
|
|
/// vipOrderNum VIP已预约人数
|
|||
|
|
/// maxNum 最大可体检人数(包括vip和非vip)
|
|||
|
|
/// orderNum 已预约人数(包括vip和非vip)</returns>
|
|||
|
|
[WebMethod]
|
|||
|
|
public string tjyykyrs(string sign, string timestamp, string startDate, string endDate, string hospitalSubId)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (JianQuan(sign, timestamp) == false)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "401", results = "" });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DateTime dt1 = Convert.ToDateTime(DateTime.ParseExact(startDate, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
DateTime dt2 = Convert.ToDateTime(DateTime.ParseExact(endDate, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces).ToString("yyyy-MM-dd"));
|
|||
|
|
|
|||
|
|
string sql = "select * from pa_yyrs where yyrq between '" + dt1 + "' and '" + dt2 + "'";
|
|||
|
|
DataTable dtSet = GetDataSet(sql);
|
|||
|
|
|
|||
|
|
//DateTime dt1 = Convert.ToDateTime(Convert.ToDateTime(startDate).ToShortDateString());
|
|||
|
|
//DateTime dt2 = Convert.ToDateTime(Convert.ToDateTime(endDate).ToShortDateString());
|
|||
|
|
TimeSpan sp = dt2.Subtract(dt1);
|
|||
|
|
int count = sp.Days + 1;
|
|||
|
|
results[] re = new results[count];
|
|||
|
|
int compNum = 999;
|
|||
|
|
|
|||
|
|
DateTime dt = dt1.AddDays(-1);
|
|||
|
|
|
|||
|
|
for (int i = 0; i < count; i++)
|
|||
|
|
{
|
|||
|
|
dt = dt.AddDays(1);
|
|||
|
|
if (dtSet.Rows.Count != 0)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow dr in dtSet.Rows)
|
|||
|
|
{
|
|||
|
|
compNum = DateTime.Compare(dt, Convert.ToDateTime(dr["yyrq"]));
|
|||
|
|
if (compNum == 0)
|
|||
|
|
{
|
|||
|
|
re[i] = new results { date = dt.ToString("yyyyMMdd"), canOrder = Convert.ToInt32(dr["canOrder"]), provideVipData = Convert.ToInt32(dr["provideVipData"]), vipMaxNum = Convert.ToInt32(dr["vipMaxNum"]), vipOrderNum = Convert.ToInt32(dr["vipOrderNum"]), maxNum = Convert.ToInt32(dr["maxNum"]), orderNum = Convert.ToInt32(dr["orderNum"]) };
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (compNum != 0)
|
|||
|
|
{
|
|||
|
|
int xq = (int)dt.DayOfWeek;
|
|||
|
|
if (xq == 1)
|
|||
|
|
{
|
|||
|
|
re[i] = new results { date = dt.ToString("yyyyMMdd"), canOrder = 0, provideVipData = 0, vipMaxNum = 50, vipOrderNum = 0, maxNum = 110, orderNum = 0 };
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
re[i] = new results { date = dt.ToString("yyyyMMdd"), canOrder = 1, provideVipData = 1, vipMaxNum = 50, vipOrderNum = 0, maxNum = 110, orderNum = 0 };
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
compNum = 999;
|
|||
|
|
}
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "200", results = re });
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(new { status = "500", results = "" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class results
|
|||
|
|
{
|
|||
|
|
public string date { get; set; }
|
|||
|
|
public int canOrder { get; set; }
|
|||
|
|
public int provideVipData { get; set; }
|
|||
|
|
public int vipMaxNum { get; set; }
|
|||
|
|
public int vipOrderNum { get; set; }
|
|||
|
|
public int maxNum { get; set; }
|
|||
|
|
public int orderNum { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static bool JianQuan(string sign, string timestamp)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(sign))
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(timestamp))
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
DateTime dt1 = DateTime.ParseExact(timestamp, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
|
|||
|
|
DateTime dt2 = DateTime.Now;
|
|||
|
|
TimeSpan timeSpan = dt2 - dt1;
|
|||
|
|
if (timeSpan.TotalMinutes > 10)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string yzm = GenerateMD5("tianrui0871338ce2bddd34fd02a0c383d0b73a" + timestamp);
|
|||
|
|
if (yzm.ToLower() != sign.ToLower())
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static string GenerateMD5(string txt)
|
|||
|
|
{
|
|||
|
|
using (MD5 mi = MD5.Create())
|
|||
|
|
{
|
|||
|
|
byte[] buffer = Encoding.Default.GetBytes(txt);
|
|||
|
|
//开始加密
|
|||
|
|
byte[] newBuffer = mi.ComputeHash(buffer);
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
for (int i = 0; i < newBuffer.Length; i++)
|
|||
|
|
{
|
|||
|
|
sb.Append(newBuffer[i].ToString("x2"));
|
|||
|
|
}
|
|||
|
|
return sb.ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static string Decrypt3Des1(string aStrString, string aStrKey, CipherMode mode = CipherMode.ECB, string iv = "")
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var des = new TripleDESCryptoServiceProvider
|
|||
|
|
{
|
|||
|
|
Key = Encoding.UTF8.GetBytes(aStrKey),
|
|||
|
|
Mode = mode,
|
|||
|
|
Padding = PaddingMode.PKCS7
|
|||
|
|
};
|
|||
|
|
if (mode == CipherMode.CBC)
|
|||
|
|
{
|
|||
|
|
des.IV = Encoding.UTF8.GetBytes(iv);
|
|||
|
|
}
|
|||
|
|
var desDecrypt = des.CreateDecryptor();
|
|||
|
|
var result = "";
|
|||
|
|
byte[] buffer = Convert.FromBase64String(aStrString);
|
|||
|
|
result = Encoding.UTF8.GetString(desDecrypt.TransformFinalBlock(buffer, 0, buffer.Length));
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return string.Empty;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public static SqlConnection Connection
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
string con = "";
|
|||
|
|
//System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
|
|||
|
|
//con = cm.AppSettings.Settings["zbbodycheck"].Value;
|
|||
|
|
con = System.Configuration.ConfigurationManager.ConnectionStrings["tjconn"].ConnectionString;
|
|||
|
|
if (connection == null)
|
|||
|
|
{
|
|||
|
|
connection = new SqlConnection(con);
|
|||
|
|
connection.Open();
|
|||
|
|
}
|
|||
|
|
else if (connection.State == System.Data.ConnectionState.Closed)
|
|||
|
|
{
|
|||
|
|
connection.Open();
|
|||
|
|
}
|
|||
|
|
else if (connection.State == System.Data.ConnectionState.Broken)
|
|||
|
|
{
|
|||
|
|
connection.Close();
|
|||
|
|
connection.Open();
|
|||
|
|
}
|
|||
|
|
return connection;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static DataTable GetDataSet(string safeSql)
|
|||
|
|
{
|
|||
|
|
DataSet ds = new DataSet();
|
|||
|
|
SqlCommand cmd = new SqlCommand(safeSql, Connection);
|
|||
|
|
SqlDataAdapter da = new SqlDataAdapter(cmd);
|
|||
|
|
da.Fill(ds);
|
|||
|
|
return ds.Tables[0];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|