關於取得讀卡機資料 |
答題得分者是:christie
|
sives1227
一般會員 ![]() ![]() 發表:24 回覆:19 積分:8 註冊:2007-10-12 發送簡訊給我 |
中央健保局裡面有提供讀卡機控制軟體(http://www.nhi.gov.tw/information/News_detail.asp?News_ID=702)
小弟因為寫專題需要將讀卡機裡面的資料讀出來(姓名、生日、.......),請問應該如何使用健保局所提供的程式呢 另帶一提,有好多文章都是關於這個的,但是我看好像也沒個所以然,所以在次提問 健保局所提供的程式是vb的,然後裡面有cshis.dll、CSINIT.dll、Reader.dll、SHA.dll 據說是要呼叫這個動態連結,我也不是很懂,請大大解答!! 謝謝
------
學問~學問~學著發問 編輯記錄
taishyang 重新編輯於 2007-11-28 18:33:39, 註解 將文章分類成[問題]‧
|
christie
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:30 回覆:299 積分:475 註冊:2005-03-25 發送簡訊給我 |
以瑛茂讀卡機為例
Drop a TClientSocket Name=ClientSocket, Port=1024 程式範例 . . . . [code delphi] procedure CVT_vHostToPc(lpbSrcStr,lpbDestStr:PChar;iLen,iMode:integer); StdCall; external 'fmtconv.dll' name 'CVT_vHostToPc'; procedure CVT_vPcToHost(lpbSrcStr,lpbDestStr:PChar;iLen,iMode:integer); StdCall; external 'fmtconv.dll' name 'CVT_vPcToHost'; var sSIG:String; sData,sDate,sRdoc,sTime: string; iSqno,iDgno:integer; . . . function TForm1.SendICData(sData: string): boolean; var sStr,sSend:string; pStr1,pStr2:pChar; iLen:Integer; begin try sSend := sData; pStr1 := PChar(sSend); iLen := StrLen(pStr1); pStr2 := StrAlloc(iLen); CVT_vPcToHost(pStr1,pStr2,StrLen(pStr1),1); sStr := pStr2; ClientSocket.Socket.SendText(sStr); except ShowMessage('傳送資料失敗!'); end; end; procedure TForm1.ClientSocketRead(Sender: TObject; Socket: TCustomWinSocket); label exitlbl; var sReceive,sStr,sSend: string; pStr1,pStr2:pChar; iLen: Integer; sFunCord,sErrCord: string; sFunCheck:string; begin try try sReceive := Socket.ReceiveText; sSIG:=Copy(sReceive,48,128); iLen := Length(sReceive); pStr1 := PChar(sReceive); iLen := StrLen(pStr1); pStr2 := StrAlloc(iLen); CVT_vHostToPc(pStr1,pStr2,StrLen(pStr1),2); sStr := pStr2; sStr := Copy(sStr,1,iLen); sFunCord := Copy(sStr,1,4); sErrCord := Copy(sStr,5,4); if CheckICErrCord(sErrCord) and ((sFunCord='1010') or (sFunCord='1020') or (sFunCord='1030') ) then begin sData:=sStr; if Not INSERTToRGFMAINData(sDate,sRdoc) then begin ShowMessage('掛號錯誤,請檢查'); end; end;//end if if (sFunCord='0040') then begin if FillICData(sStr) = True then <----- 取出卡片基本資料。 begin if Txt9.Text<>'' then begin if Txt9.Text='1' then sFunCheck:='30'; if Txt9.Text='2' then sFunCheck:='40'; if Txt9.Text='3' then sFunCheck:='20'; end; REGBitBtn.Enabled:=True; end; SendICData('00200000'); end;//end if if (sFunCord='0020') then begin FillPrData(sStr); end; GetMemo.Lines.Add(GetNowDateTime('5') ' ' '*** Receive: ' sStr ' --->L:' IntToStr(iLen)); GetMemo.Lines.Add('------------------------------------------------'); except // ShowMessage('轉換資料內碼失敗: ' pStr1); end; finally ShowICForm.Close; StrDispose(pStr2); if (step=1) or (step=2) then begin if (step=1) and (S2<>'') then begin step:=2; sSend:=S2; SendICData(sSend); goto exitlbl; end; if ((step=1) or (step=2)) and (S3<>'') then begin step:=3; sSend:=S3; SendICData(sSend); goto exitlbl; end; exitlbl: end; end; end; function TForm1.FillICData(sData: string):boolean; type Basic=record cardno :string[12]; //卡號 name :string[20]; //姓名 Idno :string[10]; //身分證號 birthday :string[7]; //生日 sSex:string[1]; //性別 sSdate:string[7]; //發卡日期 sCancel:string[1]; //卡片註銷註記 sSno:string[2]; //保險人代號 sSmrk:string[1]; //保險人身分 slmtdate:string[7]; //卡片有效日期 satimes:string[2]; //就醫可用次數 sbdBrthdt:string[7]; //新生兒出生日期 snum:string[1]; //新生兒胎數 end; var sBasic :Basic; begin try sBasic.Cardno := Copy(sData,9,12); sBasic.idno := Copy(sData,21,10); sBasic.birthday := Copy(sData,31,7); sBasic.sSex := Copy(sData,38,1); sBasic.sSdate := Copy(sData,39,7); sBasic.sCancel := Copy(sData,46,1); sBasic.sSno := Copy(sData,47,2); sBasic.sSmrk := Copy(sData,49,1); sBasic.slmtdate := Copy(sData,50,7); sBasic.satimes := Copy(sData,57,2); sBasic.sbdBrthdt := Copy(sData,59,7); sBasic.snum := Copy(sData,66,1); sBasic.name := Copy(sData,72,20); Txt1.Text := sBasic.Cardno; Txt2.Text := sBasic.name; Txt3.Text := sBasic.Idno; Edit1.Text := sBasic.Idno; Txt4.Text := sBasic.birthday; Txt5.Text := sBasic.sSex; Button1.Click; Txt6.Text := sBasic.sSdate; Txt7.Text := sBasic.sCancel; Txt8.Text := sBasic.sSno; Txt9.Text := sBasic.sSmrk; Txt10.Text := sBasic.slmtdate; Txt11.Text := sBasic.satimes; Txt12.Text := sBasic.sbdBrthdt; Txt13.Text := sBasic.snum; result := True; except showmessage('讀取IC卡資料錯誤。'); result:=false; end; end; [/code]
------
What do we live for if not to make life less difficult for each other?
編輯記錄
christie 重新編輯於 2007-11-28 18:07:29, 註解 無‧
|
sives1227
一般會員 ![]() ![]() 發表:24 回覆:19 積分:8 註冊:2007-10-12 發送簡訊給我 |
procedure CVT_vHostToPc(lpbSrcStr,lpbDestStr:PChar;iLen,iMode:integer);
StdCall; external 'fmtconv.dll' name 'CVT_vHostToPc'; procedure CVT_vPcToHost(lpbSrcStr,lpbDestStr:PChar;iLen,iMode:integer); StdCall; external 'fmtconv.dll' name 'CVT_vPcToHost'; 請問這二行各別是要做啥的
------
學問~學問~學著發問 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |