1 Star 0 Fork 0

JiangXiaoDong / NeikongClient

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
check2_form.pas 47.56 KB
一键复制 编辑 原始数据 按行查看 历史
JiangXiaoDong 提交于 2021-10-07 11:36 . init
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447
unit check2_form;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ComCtrls, fpjson, jsonparser, intf, nkTitleBar, BCButton, BCLabel;
type
{ TfrmCheck_2 }
TfrmCheck_2 = class(TForm)
BCButton1: TBCButton;
BCLabel1: TBCLabel;
Label1: TLabel;
Label2: TLabel;
Label7: TLabel;
Label8: TLabel;
ls: TListView;
Memo1: TMemo;
nkTitleBar1: TnkTitleBar;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
Panel8: TPanel;
procedure BCLabel1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
FKind: TnkImportKind;
public
procedure Log(AText:string);
property Kind:TnkImportKind read FKind write FKind;//分析类型
procedure do_Check_2(Sender:TObject);//进行职工基本医疗保险参保登记风险
procedure do_check_21(Sender:TObject);//职工医疗保险补缴业务风险
procedure do_check_3(Sender:TObject);//居民医疗保险参保登记办理风险
procedure do_check_31(sender:TObject);//居民参保人员重复信息合并风险
procedure do_check_4(sender:TObject);//职工医疗保险转出办理风险
procedure do_check_6(sender:TObject);//学生居民医疗保险参保登记办理风险
procedure do_check_7(sender:TObject);//居民慢性病办理风险
procedure do_check_8(sender:TObject);//职工慢性病办理风险
procedure do_check_9(sender:TObject);//城乡居民高血压、糖尿病办理风险
procedure do_check_71(sender:TObject);//死亡居民享受慢病待遇风险
procedure do_check_81(sender:TObject);//死亡职工享受慢病待遇风险
procedure do_check_91(sender:TObject);//死亡居民享受两病待遇风险
procedure FillList(ATablename,AShorKind:string);//填充列表
end;
var
frmCheck_2: TfrmCheck_2;
implementation
{$R *.frm}
uses
datamodule;
{ TfrmCheck_2 }
procedure TfrmCheck_2.FormShow(Sender: TObject);
begin
if FKind = TikZhigong then
begin
Label1.Caption:='职工基本医疗保险参保登记风险分析';
BCButton1.OnClick:=@do_check_2;
FillList('zhigong','职工基本医疗保险参保登记风险');
end
else
if FKind = TikBujiao then
begin
Label1.Caption:='职工医疗保险补缴业务风险分析';
BCButton1.OnClick:=@do_check_21;
FillList('bujiao','职工医疗保险补缴业务风险');
end
else
if FKind= TikJumin then
begin
Label1.Caption:='居民医疗保险参保登记办理风险分析';
BCButton1.OnClick:=@do_check_3;
FillList('jumin','居民医疗保险参保登记办理风险');
end
else
if FKind = TikHebing then
begin
Label1.Caption:='居民参保人员重复信息合并风险分析';
BCButton1.OnClick:=@do_check_31;
FillList('jumin','居民参保人员重复信息合并风险');
end
else
if FKind = TikZhuanchu then
begin
Label1.Caption:='职工医疗保险转出办理风险分析';
BCButton1.OnClick:=@do_check_4;
FillList('zhuanchu','职工医疗保险转出办理风险');
end
else
if FKind = TikXuesheng then
begin
Label1.Caption:='学生居民医疗保险参保登记办理风险分析';
BCButton1.OnClick:=@do_check_6;
FillList('xuesheng','学生居民医疗保险参保登记办理风险');
end
else
if FKind = tikManxingbing then
begin
Label1.Caption:='居民慢性病办理风险分析';
BCButton1.OnClick:=@do_check_7;
FillList('manxingbing','居民慢性病办理风险');
end
else
if FKind = tikZhigongManxingbing then
begin
Label1.Caption:='职工慢性病办理风险分析';
BCButton1.OnClick:=@do_check_8;
FillList('zhigongmanxingbing','职工慢性病办理风险');
end
else
if FKind = tikGaoxueya then
begin
Label1.Caption:='城乡居民高血压、糖尿病办理风险分析';
BCButton1.OnClick:=@do_check_9;
FillList('gaoxueya','城乡居民高血压、糖尿病办理风险');
end
else
if FKind = tikSiwangjuminmanbing then
begin
Label1.Caption:='死亡居民享受慢病待遇风险分析';
BCButton1.OnClick:=@do_check_71;
FillList('manxingbing','死亡居民享受慢病待遇风险');
end
else
if FKind = tikSiwangzhigongmanbing then
begin
Label1.Caption:='死亡职工享受慢病待遇风险分析';
BCButton1.OnClick:=@do_check_81;
FillList('zhigongmanxingbing','死亡职工享受慢病待遇风险');
end
else
if FKind = tikSiwangliangbing then
begin
Label1.Caption:='死亡居民享受两病待遇风险分析';
BCButton1.OnClick:=@do_check_91;
FillList('gaoxueya','死亡居民享受两病待遇风险');
end;
end;
procedure TfrmCheck_2.BCLabel1Click(Sender: TObject);
begin
Close;
end;
procedure TfrmCheck_2.Log(AText: string);
begin
Memo1.Lines.Add(AText);
Memo1.Update;
Application.ProcessMessages;
end;
procedure TfrmCheck_2.do_Check_2(Sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='职工基本医疗保险参保登记风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from zhigong where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
//检查统一信用号码c4长度和校验码
if (Trim(FieldByName('c4').AsString)='') then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c3').AsString+':社会保障号码缺失');
mR.AddWarning(FieldByName('c4').AsString,'0');//'社会保障号码缺失为空');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c4').AsString,0);
mR.AddDetail(FieldByName('c4').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//社会保障号码c4不为空,但长度不正确的记录
if length(Trim(FieldByName('c4').AsString))<>18 then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c3').AsString+':社会保障号码长度不足18位');
mR.AddWarning(FieldByName('c4').AsString,'1');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c4').AsString,1);
mR.AddDetail(FieldByName('c4').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//计算校验码
if dm.CheckIDCardNumber(Trim(FieldByName('c4').AsString))=False then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c3').AsString+':社会保障号码校验码错误');
mR.AddWarning(FieldByName('c4').AsString,'2');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c4').AsString,2);
mR.AddDetail(FieldByName('c4').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'职工基本医疗保险参保登记风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_21(Sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='职工医疗保险补缴业务风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from bujiao where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
//检查统一信用号码c0长度和校验码
if (Trim(FieldByName('c0').AsString)='') then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码缺失');
mR.AddWarning(FieldByName('c0').AsString,'0');//'社会保障号码缺失为空');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//社会保障号码c0不为空,但长度不正确的记录
if length(Trim(FieldByName('c0').AsString))<>18 then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码长度不足18位');
mR.AddWarning(FieldByName('c0').AsString,'1');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,1);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//计算校验码
if dm.CheckIDCardNumber(Trim(FieldByName('c0').AsString))=False then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码校验码错误');
mR.AddWarning(FieldByName('c0').AsString,'2');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,2);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'职工医疗保险补缴业务风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_3(Sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='居民医疗保险参保登记办理风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from jumin where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
//检查统一信用号码c0长度和校验码
if (Trim(FieldByName('c0').AsString)='') then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码缺失');
mR.AddWarning(FieldByName('c0').AsString,'0');//'社会保障号码缺失为空');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//社会保障号码c0不为空,但长度不正确的记录
if length(Trim(FieldByName('c0').AsString))<>18 then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码长度不足18位');
mR.AddWarning(FieldByName('c0').AsString,'1');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,1);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//计算校验码
if dm.CheckIDCardNumber(Trim(FieldByName('c0').AsString))=False then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码校验码错误');
mR.AddWarning(FieldByName('c0').AsString,'2');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,2);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'居民医疗保险参保登记办理风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_31(sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='居民参保人员重复信息合并风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
// Sql.Add('SELECT * FROM jumin WHERE cyear=:cyear and cmonth=:cmonth and c0 IN (SELECT c0 FROM jumin GROUP BY c0 HAVING COUNT(c0)>1)');
Sql.Add('SELECT * FROM jumin WHERE cyear=:cyear and cmonth=:cmonth and c0 IN (SELECT c0 FROM jumin where cyear=:cyear2 and cmonth=:cmonth2 GROUP BY c0 HAVING COUNT(c0)>1)');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Params.ParamByName('cyear2').AsInteger:=mYear;
Params.ParamByName('cmonth2').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c0').AsString+':社会保障号码重复');
mR.AddWarning(FieldByName('c0').AsString,'0');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'居民参保人员重复信息合并风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_4(sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='职工医疗保险转出办理风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from zhuanchu where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
//检查统一信用号码c0长度和校验码
if (Trim(FieldByName('c5').AsString)='') then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c4').AsString+':社会保障号码缺失');
mR.AddWarning(FieldByName('c5').AsString,'0');//'社会保障号码缺失为空');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c5').AsString,0);
mR.AddDetail(FieldByName('c5').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//社会保障号码c0不为空,但长度不正确的记录
if length(Trim(FieldByName('c5').AsString))<>18 then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c4').AsString+':社会保障号码长度不足18位');
mR.AddWarning(FieldByName('c5').AsString,'1');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c5').AsString,1);
mR.AddDetail(FieldByName('c5').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//计算校验码
if dm.CheckIDCardNumber(Trim(FieldByName('c5').AsString))=False then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c4').AsString+':社会保障号码校验码错误');
mR.AddWarning(FieldByName('c5').AsString,'2');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c5').AsString,2);
mR.AddDetail(FieldByName('c5').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'职工医疗保险转出办理风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_6(sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='学生居民医疗保险参保登记办理风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from xuesheng where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
//检查统一信用号码c0长度和校验码
if (Trim(FieldByName('c0').AsString)='') then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码缺失');
mR.AddWarning(FieldByName('c0').AsString,'0');//'社会保障号码缺失为空');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//社会保障号码c0不为空,但长度不正确的记录
if length(Trim(FieldByName('c0').AsString))<>18 then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码长度不足18位');
mR.AddWarning(FieldByName('c0').AsString,'1');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,1);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
//计算校验码
if dm.CheckIDCardNumber(Trim(FieldByName('c0').AsString))=False then
begin
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+':社会保障号码校验码错误');
mR.AddWarning(FieldByName('c0').AsString,'2');//'代码长度不足18位');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,2);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'学生居民医疗保险参保登记办理风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_7(sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
mObj:TnkManbingBianma;
mNum:integer;
begin
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
//先再比对疾病编码,再比对医院编码等级
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
//填充慢病编码医院级别对照对象
mObj:=TnkManbingBianma.Create(nil);
dm.FillManbingBianma('manbingbianma','yiyuanbianma',mObj);
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='居民慢性病办理风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from manxingbing where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
mNum:=mObj.Check(FieldByName('c19').AsString,FieldByName('c15').AsString);
if mNum=1 then
begin
//疾病编码不在目录
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c2').AsString+'疾病编码不在目录');
mR.AddWarning(FieldByName('c0').AsString,'1');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
if mNum=2 then
begin
//医院编码不合规
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c2').AsString+'医院编码不合规');
mR.AddWarning(FieldByName('c0').AsString,'2');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'居民慢性病办理风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
mObj.Free;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_8(sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
mObj:TnkManbingBianma;
mNum:integer;
begin
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
//先再比对疾病编码,再比对医院编码等级
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
//填充慢病编码医院级别对照对象
mObj:=TnkManbingBianma.Create(nil);
dm.FillManbingBianma('zhigongmanbingbianma','yiyuanbianma',mObj);
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='职工慢性病办理风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('select * from zhigongmanxingbing where cyear=:cyear and cmonth=:cmonth');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
mNum:=mObj.Check(FieldByName('c19').AsString,FieldByName('c15').AsString);
if mNum=1 then
begin
//疾病编码不在目录
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c2').AsString+'疾病编码不在目录');
mR.AddWarning(FieldByName('c0').AsString,'1');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end
else
if mNum=2 then
begin
//医院编码不合规
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c2').AsString+'医院编码不合规');
mR.AddWarning(FieldByName('c0').AsString,'2');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
end;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'职工慢性病办理风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
mObj.Free;
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_9(sender: TObject);
var
mCount,mTotal:integer;
mR:TnkReport;
mJson:TJsonObject;
i:integer;
mDelete:boolean;
mChecked:boolean;
mYear,mMonth:integer;
begin
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
//先再比对疾病编码,再比对医院编码等级
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='城乡居民高血压、糖尿病办理风险';
with dm.pubqryWork do
begin
Close;
Sql.Clear;
Sql.Add('SELECT * FROM gaoxueya WHERE cyear=:cyear and cmonth=:cmonth and TRIM(c6) not in (select trim(c2) as c2 from yiyuanbianma where trim(c3)=:c31 or trim(c3)=:c32)');
Params.ParamByName('c31').AsString:='1';
Params.ParamByName('c32').AsString:='2';
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
mTotal:=RecordCount;
First;
while not Eof do
begin
//医院名称不在目录
mR.WarningCount:=mR.WarningCount+1;
Log('发现风险点,姓名'+FieldByName('c1').AsString+'备案医院不在目录');
mR.AddWarning(FieldByName('c0').AsString,'1');
mJson:=TJsonObject.Create;
mJson.Add(FieldByName('c0').AsString,0);
mR.AddDetail(FieldByName('c0').AsString,StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
Next;
end;
//检查完毕
Log('本次风险点数量:'+inttostr(mR.WarningCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'城乡居民高血压、糖尿病办理风险');
dm.SaveAnalLog(Label1.Caption, 0, 0, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
end;
//查询出所有两病医院名称不符合医院级别的数据
Log('----分析完毕----');
BCButton1.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_71(sender: TObject);
var
mChecked:boolean;
i:integer;
mYear,mMonth:integer;
mR:TnkReport;
mSiwangDate,mHuaboDate:TDate;
mSiwangDate2:TDate;
mDelete:boolean;
mJson:TJsonObject;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
ls.Enabled:=False;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析死亡居民享受慢病待遇风险……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('==========================');
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='死亡居民享受慢病待遇风险分析';
with dm.pubqryWork do
begin
Sql.Clear;
Sql.Add('select * from manxingbing where cyear=:cyear and cmonth=:cmonth and c1 in (select c2 from siwang)');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
if RecordCount = 0 then
begin
Log('没有发现对死亡人居民享受慢病待遇数据。');
end
else
begin
Log('发现'+inttostr(RecordCount)+'条死亡人员享受待遇数据,正在继续分析……');
First;
while not Eof do
begin
Dm.GetSiwangDate(FieldByName('c1').AsString, mSiwangDate);
Log('发现风险! '+FieldByName('c1').AsString+'死亡');
mR.WarningCount:=mR.WarningCount+1;
mR.AddWarning(FieldByName('c1').AsString,FormatDatetime('yyyy-mm-dd',mSiwangDate));
//添加详细信息
mJson:=TJsonObject.Create;
mJson.Add('id', inttostr(FieldByName('id').AsInteger));
mJson.Add('a0', FormatDatetime('yyyy-mm-dd', mSiwangDate));
mJson.Add('c0', FieldByName('c0').AsString);
mJson.Add('c1', FieldByName('c1').AsString);
mJson.Add('c2', FieldByName('c2').AsString);
mJson.Add('c3', FieldByName('c3').AsString);
mJson.Add('c4', FieldByName('c4').AsString);
mJson.Add('c5', FieldByName('c5').AsString);
mJson.Add('c6', FieldByName('c6').AsString);
mJson.Add('c8', FieldByName('c8').AsString);
mJson.Add('c9', FieldByName('c9').AsString);
mJson.Add('c10', FieldByName('c10').AsString);
mJson.Add('c11', FieldByName('c11').AsString);
mJson.Add('c12', FieldByName('c12').AsString);
mJson.Add('c13', FieldByName('c13').AsString);
mJson.Add('c14', FieldByName('c14').AsString);
mR.AddDetail(FieldByName('c0').AsString, StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
Next;
end;
end;
end;
Log('本月风险点数量:'+inttostr(mR.WarningCount));//+' 提示点数量:'+inttostr(mR.TipsCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'死亡居民享受慢病待遇风险',True);
dm.SaveAnalLog(Label1.Caption, mYear, mMonth, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
ls.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_81(sender: TObject);
var
mChecked:boolean;
i:integer;
mYear,mMonth:integer;
mR:TnkReport;
mSiwangDate,mHuaboDate:TDate;
mSiwangDate2:TDate;
mDelete:boolean;
mJson:TJsonObject;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
ls.Enabled:=False;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析死亡职工享受慢病待遇风险……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('==========================');
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='死亡职工享受慢病待遇风险分析';
with dm.pubqryWork do
begin
Sql.Clear;
Sql.Add('select * from zhigongmanxingbing where cyear=:cyear and cmonth=:cmonth and c1 in (select c2 from siwang)');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
if RecordCount = 0 then
begin
Log('没有发现对死亡职工享受慢病待遇数据。');
end
else
begin
Log('发现'+inttostr(RecordCount)+'条死亡人员享受待遇数据,正在继续分析……');
First;
while not Eof do
begin
Dm.GetSiwangDate(FieldByName('c1').AsString, mSiwangDate);
Log('发现风险! '+FieldByName('c1').AsString+'死亡');
mR.WarningCount:=mR.WarningCount+1;
mR.AddWarning(FieldByName('c1').AsString,FormatDatetime('yyyy-mm-dd',mSiwangDate));
//添加详细信息
mJson:=TJsonObject.Create;
mJson.Add('id', inttostr(FieldByName('id').AsInteger));
mJson.Add('a0', FormatDatetime('yyyy-mm-dd', mSiwangDate));
mJson.Add('c0', FieldByName('c0').AsString);
mJson.Add('c1', FieldByName('c1').AsString);
mJson.Add('c2', FieldByName('c2').AsString);
mJson.Add('c3', FieldByName('c3').AsString);
mJson.Add('c4', FieldByName('c4').AsString);
mJson.Add('c5', FieldByName('c5').AsString);
mJson.Add('c6', FieldByName('c6').AsString);
mJson.Add('c8', FieldByName('c8').AsString);
mJson.Add('c9', FieldByName('c9').AsString);
mJson.Add('c10', FieldByName('c10').AsString);
mJson.Add('c11', FieldByName('c11').AsString);
mJson.Add('c12', FieldByName('c12').AsString);
mJson.Add('c13', FieldByName('c13').AsString);
mJson.Add('c14', FieldByName('c14').AsString);
mR.AddDetail(FieldByName('c0').AsString, StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free;
Next;
end;
end;
end;
Log('本月风险点数量:'+inttostr(mR.WarningCount));//+' 提示点数量:'+inttostr(mR.TipsCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'死亡职工享受慢病待遇风险',True);
dm.SaveAnalLog(Label1.Caption, mYear, mMonth, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
ls.Enabled:=True;
end;
procedure TfrmCheck_2.do_check_91(sender: TObject);
var
mChecked:boolean;
i:integer;
mYear,mMonth:integer;
mR:TnkReport;
mSiwangDate,mHuaboDate:TDate;
mSiwangDate2:TDate;
mDelete:boolean;
mJson:TJsonObject;
begin
//先检查有没有Checked项目
mchecked:=False;
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
mchecked:=True;
break;
end;
end;
if mchecked=False then
begin
MessageDlg('请选择要分析的月份!',mtWarning,[mbOK],0);
Exit;
end;
ls.Enabled:=False;
BCButton1.Enabled:=False;
Memo1.Lines.Clear;
Log('开始分析死亡居民享受两病待遇风险……');
for i:=0 to ls.Items.Count-1 do
begin
if ls.Items.Item[i].Checked then
begin
Log('==========================');
Log('分析'+ls.Items.Item[i].Caption+'数据……');
mYear:=strtoint(ls.Items.Item[i].SubItems.Strings[0]);
mMonth:=strtoint(ls.Items.Item[i].SubItems.Strings[1]);
mDelete:=Trim(ls.Items.Item[i].SubItems.Strings[2])='1';
mR:=TnkReport.Create(Self);
mR.CYear:=mYear;
mR.CMonth:=mMonth;
mR.TipsCount:=0;
mR.WarningCount:=0;
mR.Title:='死亡居民享受两病待遇风险分析';
with dm.pubqryWork do
begin
Sql.Clear;
Sql.Add('select * from gaoxueya where cyear=:cyear and cmonth=:cmonth and c0 in (select c2 from siwang)');
Params.ParamByName('cyear').AsInteger:=mYear;
Params.ParamByName('cmonth').AsInteger:=mMonth;
Open;
if RecordCount = 0 then
begin
Log('没有发现对死亡居民享受两病待遇数据。');
end
else
begin
Log('发现'+inttostr(RecordCount)+'条死亡人员享受待遇数据,正在继续分析……');
First;
while not Eof do
begin
Dm.GetSiwangDate(FieldByName('c0').AsString, mSiwangDate);
Log('发现风险! '+FieldByName('c0').AsString+'死亡');
mR.WarningCount:=mR.WarningCount+1;
mR.AddWarning(FieldByName('c0').AsString,FormatDatetime('yyyy-mm-dd',mSiwangDate));
//添加详细信息
{ mJson:=TJsonObject.Create;
mJson.Add('id', inttostr(FieldByName('id').AsInteger));
mJson.Add('a0', FormatDatetime('yyyy-mm-dd', mSiwangDate));
mJson.Add('c0', FieldByName('c0').AsString);
mJson.Add('c1', FieldByName('c1').AsString);
mJson.Add('c2', FieldByName('c2').AsString);
mJson.Add('c3', FieldByName('c3').AsString);
mJson.Add('c4', FieldByName('c4').AsString);
mJson.Add('c5', FieldByName('c5').AsString);
mJson.Add('c6', FieldByName('c6').AsString);
mJson.Add('c8', FieldByName('c8').AsString);
mJson.Add('c9', FieldByName('c9').AsString);
mJson.Add('c10', FieldByName('c10').AsString);
mJson.Add('c11', FieldByName('c11').AsString);
mJson.Add('c12', FieldByName('c12').AsString);
mJson.Add('c13', FieldByName('c13').AsString);
mJson.Add('c14', FieldByName('c14').AsString);
mR.AddDetail(FieldByName('c0').AsString, StringReplace(mJson.AsJSON,'\','',[rfReplaceAll]));
mJson.Free; }
Next;
end;
end;
end;
Log('本月风险点数量:'+inttostr(mR.WarningCount));//+' 提示点数量:'+inttostr(mR.TipsCount));
//保存分析结果
dm.SaveFx(mR,mDelete,'死亡居民享受两病待遇风险',True);
dm.SaveAnalLog(Label1.Caption, mYear, mMonth, mR.WarningCount, mR.TipsCount);
dm.UpdateAnalCount;
mR.Free;
end;
end;
Log('----分析完毕----');
BCButton1.Enabled:=True;
ls.Enabled:=True;
end;
procedure TfrmCheck_2.FillList(ATablename, AShorKind: string);
var
mReports:string;
begin
//填充待分析月份列表
//获取以分析月份列表,组合成字符串
with dm.pubqryWork do
begin
Sql.Clear;
Sql.Add('select distinct cyear,cmonth from fxmaster where shortkind=:shortkind');
Params.ParamByName('shortkind').AsString:=AShorKind;
Open;
First;
mReports:='';
while not Eof do
begin
mReports:=mReports+inttostr(FieldByName('cyear').AsInteger)+inttostr(FieldByName('cmonth').AsInteger)+';';
Next;
end;
end;
//获取划拨数据的月份列表
ls.Items.BeginUpdate;
ls.Items.Clear;
with dm.pubqryWork do
begin
Sql.Clear;
Sql.Add('select distinct cyear, cmonth from '+ATableName+' order by cyear desc, cmonth desc');
Open;
First;
while not Eof do
begin
with ls.Items.Add do
begin
Caption:=inttostr(FieldByName('cyear').AsInteger)+'年'+inttostr(FieldByName('cmonth').AsInteger)+'月';
SubItems.Add(inttostr(FieldByName('cyear').AsInteger));
SubItems.Add(inttostr(FieldByName('cmonth').AsInteger));
if Pos(SubItems.Strings[0]+SubItems.Strings[1], mReports) > 0 then
begin
SubItems.Add('1');
ImageIndex:=1;
Checked:=False;
end
else
begin
SubItems.Add('0');
ImageIndex:=0;
Checked:=True;
end;
end;
Next;
end;
end;
ls.Items.EndUpdate;
end;
end.
Pascal
1
https://gitee.com/1817813144/neikong-client.git
git@gitee.com:1817813144/neikong-client.git
1817813144
neikong-client
NeikongClient
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891