using Newtonsoft.Json.Linq;
using PTMedicalInsurance.Common;
using PTMedicalInsurance.Forms;
using PTMedicalInsurance.Helper;
using PTMedicalInsurance.Variables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PTMedicalInsurance.Business
{
class OtherQueryProcess : AbstractProcess
{
TradeEnum trade;
///
/// 构造函数
///
/// 交易
public OtherQueryProcess(TradeEnum trade)
{
this.trade = trade;
}
public override CallResult Process(JObject input)
{
this.OrginalInput = input;
switch (this.trade)
{
case TradeEnum.HistoryPrescriptionQuery:
QueryPatientPrescription();
break;
default:
break;
}
return Success();
}
private void QueryPatientPrescription()
{
dynamic input = new JObject();
input.psn_name = Global.pat.name;
input.certno = Global.pat.certNO ;
string errMsg = "";
try
{
JObject joRtn = invoker.invokeCenterService(trade, input);
if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
{
Global.writeLog("QueryPatientPrescription", input.ToString(), errMsg);
return;
}
JArray list = JArray.Parse(joRtn["mdtrtinfo"].Text());
if (list?.Count > 0)
{
PrescriptionForm form = new PrescriptionForm();
form.initList(list);
form.ShowDialog();
}
}
catch (Exception ex)
{
Global.writeLog("QueryPatientPrescription",input.ToString(),ex.Message);
}
}
}
}