ผู้เขียน หัวข้อ: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก  (อ่าน 10895 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

doramon

  • บุคคลทั่วไป
รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« เมื่อ: พฤษภาคม 14, 2009, 13:13:27 PM »
0
Unit Script;


function addzero(s:string;i:integer):string;
begin
  //result:=s;
  while length(s)<i do
  begin
    s:='0'+s;
  end;
  result:=s;
end;

function CheckPID(pid: string): boolean;
var
  i: integer;
  nMod, nValue, cv: integer;
  snmod: string;
begin
  pid := replacestr(pid, '-', '');
  result := false;
  if length(replacestr(pid, ' ', '')) <> 13 then
    exit;

  try

    cv := strtoint(copy(pid, 1, 1));
    nValue := cv * 13;

    for i := 2 to 12 do
    begin
      cv := strtoint(copy(pid, i, 1));
      nValue := nValue + (cv * (14 - i));

    end;

    nMod := 11 - (nValue mod 11);
    snmod := inttostr(nmod);
    snmod := copy(snmod, length(snmod), 1);
    result := copy(pid, 13, 1) = snmod;

  except
    result := false;

  end;

end;

function MakeFullCID(cid: string): string;
begin
  result := cid;
  if length(cid) = 17 then
    exit;
  result := '';
  if length(cid) <> 13 then
    exit;
  result := copy(cid, 1, 1) + '-' +
    copy(cid, 2, 4) + '-' +
    copy(cid, 6, 5) + '-' +
    copy(cid, 11, 2) + '-' +
    copy(cid, 13, 1);
end;



Procedure Main;
var
  i:integer;
  dbf:TDBF;
  tc:tclientdataset;
  tcid:tclientdataset;
begin

  dbf:=tdbf.create(nil);
  dbf.tablename:='c:\CSCDMEM.DBF';
  dbf.open;
  dbf.first;
  tc:=tclientdataset.create(nil);
  tcid:=tclientdataset.create(nil);
  while not dbf.eof do
  begin
    tc.data:=HoSxP_GetDataset('select * from patient where hn = "'+copy(dbf.fieldbyname('hn').asstring,3,7)+'"');
    if tc.recordcount>0 then
    begin
      showdebugtext('Update patient : '+tc.fieldbyname('hn').asstring);
      tc.edit;
      tc.fieldbyname('gov_chronic_id').asstring:=dbf.fieldbyname('memberno').asstring;
      tc.fieldbyname('pttype').asstring:= '40';
      if checkpid(dbf.fieldbyname('pid').asstring) then
      begin
        tc.fieldbyname('cid').asstring:=dbf.fieldbyname('pid').asstring;
        tcid.data:=HOSxP_GetDataset('select * from ptcardno where hn="'+copy(dbf.fieldbyname('hn').asstring,3,7)+'" and cardtype="01"');
        if tcid.recordcount>0 then
        begin
          tcid.edit;

        end else
        begin
          tcid.insert;
        end;

        tcid.fieldbyname('hn').asstring:=copy(dbf.fieldbyname('hn').asstring,3,7);
        tcid.fieldbyname('cardno').asstring:=makefullcid(dbf.fieldbyname('pid').asstring);
        tcid.fieldbyname('cardtype').asstring:='01';
        tcid.post;
        if tcid.changecount>0 then
         HOSxP_UpdateDelta(tcid.delta, 'select * from ptcardno where hn="'+copy(dbf.fieldbyname('hn').asstring,3,7)+'" and cardtype="01"');
      end;
      tc.post;

      if tc.changecount>0 then
      HOSxP_UpdateDelta(tc.delta,'select * from patient where hn = "'+copy(dbf.fieldbyname('hn').asstring,3,7)+'"');

    end;
    dbf.next;
  end;


  dbf.free;
  tc.free;
  showmessage('done.');
end;





end.

ออฟไลน์ udomchok

  • Hero Member
  • *****
  • กระทู้: 8,349
  • Respect: +589
    • ดูรายละเอียด
    • ร.พ.สมเด็จพระสังฆราช องค์ที่ 17
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #1 เมื่อ: พฤษภาคม 14, 2009, 22:01:26 PM »
0
ไม่รู้เหมือนกันหรือเปล่า เห็นมีใครเคยทำไว้ (จำไม่ได้) เอาเข้าไปเป็น user script ตั้งนานแล้ว แต่ไม่ได้ใช้ซะที
 :) :) :)

Unit Script;


function addzero(s:string;i:integer):string;
begin
  //result:=s;
  while length(s)<i do
  begin
    s:='0'+s;
  end;
  result:=s;
end;

function CheckPID(pid: string): boolean;
var
  i: integer;
  nMod, nValue, cv: integer;
  snmod: string;
begin
  pid := replacestr(pid, '-', '');
  result := false;
  if length(replacestr(pid, ' ', '')) <> 13 then
    exit;

  try

    cv := strtoint(copy(pid, 1, 1));
    nValue := cv * 13;

    for i := 2 to 12 do
    begin
      cv := strtoint(copy(pid, i, 1));
      nValue := nValue + (cv * (14 - i));

    end;

    nMod := 11 - (nValue mod 11);
    snmod := inttostr(nmod);
    snmod := copy(snmod, length(snmod), 1);
    result := copy(pid, 13, 1) = snmod;

  except
    result := false;

  end;

end;

function MakeFullCID(cid: string): string;
begin
  result := cid;
  if length(cid) = 17 then
    exit;
  result := '';
  if length(cid) <> 13 then
    exit;
  result := copy(cid, 1, 1) + '-' +
    copy(cid, 2, 4) + '-' +
    copy(cid, 6, 5) + '-' +
    copy(cid, 11, 2) + '-' +
    copy(cid, 13, 1);
end;



Procedure Main;
var
  i:integer;
  dbf:TDBF;
  tc:tclientdataset;
  tcid:tclientdataset;
begin

  dbf:=tdbf.create(nil);
  dbf.tablename:='C:\CSCD\DATA\CSCDMember.DBF';
  dbf.open;
  dbf.first;
  tc:=tclientdataset.create(nil);
  tcid:=tclientdataset.create(nil);
  while not dbf.eof do
  begin
    tc.data:=HoSxP_GetDataset('select * from patient where hn = "'+dbf.fieldbyname('hn').asstring+'"');
    if tc.recordcount>0 then
    begin
      showdebugtext('Update patient : '+tc.fieldbyname('hn').asstring);
      tc.edit;
      tc.fieldbyname('gov_chronic_id').asstring:=dbf.fieldbyname('memberno').asstring;
      tc.fieldbyname('pttype').asstring:= '24';
      if checkpid(dbf.fieldbyname('cspid').asstring) then
      begin
        tc.fieldbyname('cid').asstring:=dbf.fieldbyname('cspid').asstring;
        tcid.data:=HOSxP_GetDataset('select * from ptcardno where hn="'+dbf.fieldbyname('hn').asstring+'" and cardtype="01"');
        if tcid.recordcount>0 then
        begin
          tcid.edit;

        end else
        begin
          tcid.insert;
        end;

        tcid.fieldbyname('hn').asstring:=dbf.fieldbyname('hn').asstring;
        tcid.fieldbyname('cardno').asstring:=makefullcid(dbf.fieldbyname('cspid').asstring);
        tcid.fieldbyname('cardtype').asstring:='01';
        tcid.post;
        if tcid.changecount>0 then
         HOSxP_UpdateDelta(tcid.delta, 'select * from ptcardno where hn="'+dbf.fieldbyname('hn').asstring+'" and cardtype="01"');
      end;
      tc.post;

      if tc.changecount>0 then
      HOSxP_UpdateDelta(tc.delta,'select * from patient where hn = "'+dbf.fieldbyname('hn').asstring+'"');

    end;
    dbf.next;
  end;


  dbf.free;
  tc.free;
  showmessage('done.');
end;





end.
ทำด้วยหัวใจร.พ.สมเด็จพระสังฆราช องค์ที่ 17 อ.สองพี่น้อง จ.สุพรรณบุรี
อบรมโดย BMS Team เมื่อ พ.ย. 49 ขึ้นระบบห้องบัตรเมื่อ X'Mas 2007
2008 : X-Ray กายภาพบำบัด แพทย์แผนไทย กิจกรรมบำบัด OPD ตา
2009 : ทันตกรรม ห้องตรวจตา OPD (พยาบาลและห้องตรวจแพทย์บางห้อง)

ออฟไลน์ golf_win

  • Hero Member
  • *****
  • กระทู้: 3,481
  • Respect: +112
    • ดูรายละเอียด
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #2 เมื่อ: พฤษภาคม 15, 2009, 06:59:06 AM »
0
พี่โก้ครับรบกวนช่วยแปะตัว user script ตัวนี้ทีครับ อยากลองใช้ครับ
                                             รบกวนพี่โก้อีกแล้ว ;D ;D
                                                      ขอบคุณครับ
โรงพยาบาลเจ็ดเสมียน จังหวัดราชบุรี
Start 19-1-51    35 station
HOSxP  3.59.5.18 Activate License
Tel. 032-305096-7 ต่อ 118
Web. http://csmhos.thaiddns.com:8080
         http://csmhos.thaieasydns.com:8080

ออฟไลน์ udomchok

  • Hero Member
  • *****
  • กระทู้: 8,349
  • Respect: +589
    • ดูรายละเอียด
    • ร.พ.สมเด็จพระสังฆราช องค์ที่ 17
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #3 เมื่อ: พฤษภาคม 15, 2009, 15:40:42 PM »
0
พี่โก้ครับรบกวนช่วยแปะตัว user script ตัวนี้ทีครับ อยากลองใช้ครับ
                                             รบกวนพี่โก้อีกแล้ว ;D ;D
                                                      ขอบคุณครับ
ลองศึกษาวิธีทำจากกระทู้นี้ครับ http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=8817.msg50173#msg50173

เจอแล้วได้ file จากโปรแกรม อ. mn ทำมาให้แล้ว อยู่ที่ C:\Program Files\HOSxP\script
ทำด้วยหัวใจร.พ.สมเด็จพระสังฆราช องค์ที่ 17 อ.สองพี่น้อง จ.สุพรรณบุรี
อบรมโดย BMS Team เมื่อ พ.ย. 49 ขึ้นระบบห้องบัตรเมื่อ X'Mas 2007
2008 : X-Ray กายภาพบำบัด แพทย์แผนไทย กิจกรรมบำบัด OPD ตา
2009 : ทันตกรรม ห้องตรวจตา OPD (พยาบาลและห้องตรวจแพทย์บางห้อง)

doramon

  • บุคคลทั่วไป
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #4 เมื่อ: พฤษภาคม 15, 2009, 16:08:46 PM »
0
คำสั่งเหมือนกันครับพี่

แต่ว่า  ที่ระบบส่งกลับมาจะเป็น hn 9  หลัก 


ถ้า รพ เราใช้ hn 7 หลัก แล้ว  จะรับไม่ได้ครัับ

 ;D

ออฟไลน์ udomchok

  • Hero Member
  • *****
  • กระทู้: 8,349
  • Respect: +589
    • ดูรายละเอียด
    • ร.พ.สมเด็จพระสังฆราช องค์ที่ 17
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #5 เมื่อ: พฤษภาคม 15, 2009, 17:13:37 PM »
0
คำสั่งเหมือนกันครับพี่

แต่ว่า  ที่ระบบส่งกลับมาจะเป็น hn 9  หลัก 


ถ้า รพ เราใช้ hn 7 หลัก แล้ว  จะรับไม่ได้ครัับ

 ;D
อ้อ...พอดีเห็นว่ามีอยูี่ในโปรแกรมน่ะ แต่ไม่ได้ใช้ซะที
ทำด้วยหัวใจร.พ.สมเด็จพระสังฆราช องค์ที่ 17 อ.สองพี่น้อง จ.สุพรรณบุรี
อบรมโดย BMS Team เมื่อ พ.ย. 49 ขึ้นระบบห้องบัตรเมื่อ X'Mas 2007
2008 : X-Ray กายภาพบำบัด แพทย์แผนไทย กิจกรรมบำบัด OPD ตา
2009 : ทันตกรรม ห้องตรวจตา OPD (พยาบาลและห้องตรวจแพทย์บางห้อง)

ออฟไลน์ วีระวัฒน์ (เอก)

  • Hero Member
  • *****
  • กระทู้: 1,368
  • ให้ก้าวไปข้างหน้าก่อนผู้อืนอย่างน้อย 1 ก้าวเสมอ
  • Respect: +7
    • ดูรายละเอียด
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #6 เมื่อ: พฤษภาคม 17, 2009, 07:30:55 AM »
0
อ.อ๊อด เขียน script เพิ่มเติม นำเข้าในในตาราง pttypeno ด้วยนะครับ เนื่องจากเอาใว้ตรวจสอบว่า สิทธิเบิกตรง dateexp หมดอายุแล้ว หรือถูกยกเลิกแล้ว เช่น นำเข้าจาก ตาราง cscdmember โดยนำเข้าดังนี้
ตาราง cscdmember---------->pttypeno
          cspid                           pttypeno
          hcode                         hospmain
          hcode                         hospsub
          hn                              hn
          dateexp                     expiredate
          lastupd                       begindate
     
รพ.จอมทอง เชียงใหม่ ขนาด 120 เตียง  เริ่มใช้ HOSxP 1 ต.ค 2557 ขึ้นระบบโดย BMS
วีระวัฒน์ ใจอินผล  081-9609614 AIS  Email weerawatjaiinpol@gmail.com  Facebook วีระวัฒน์ ใจอินผล
Server: Xeon 4 core 2.27 GHz, CentOS 7.1 , RAM : 32 GB , HD SAS :300 GBx4 R5, MySQL MariaDB 10.0.20 64 bit

doramon

  • บุคคลทั่วไป
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #7 เมื่อ: พฤษภาคม 17, 2009, 10:32:07 AM »
0
อ.อ๊อด เขียน script เพิ่มเติม นำเข้าในในตาราง pttypeno ด้วยนะครับ เนื่องจากเอาใว้ตรวจสอบว่า สิทธิเบิกตรง dateexp หมดอายุแล้ว หรือถูกยกเลิกแล้ว เช่น นำเข้าจาก ตาราง cscdmember โดยนำเข้าดังนี้
ตาราง cscdmember---------->pttypeno
          cspid                           pttypeno
          hcode                         hospmain
          hcode                         hospsub
          hn                              hn
          dateexp                     expiredate
          lastupd                       begindate
     

่จะทดสอบดูครับ

แต่ว่า script ที่ให้ไปนี้ก็เปลียนสิทธิ์ตรง จุดส่งตรวจ อยู่แล้วครับว่า สิทธิ์็หลัก เปลียนแปลงอะไร


ออฟไลน์ udomchok

  • Hero Member
  • *****
  • กระทู้: 8,349
  • Respect: +589
    • ดูรายละเอียด
    • ร.พ.สมเด็จพระสังฆราช องค์ที่ 17
Re: รับข้อมูล สิทธิ์เบิกจ่ายตรง HN 7 หลัก
« ตอบกลับ #8 เมื่อ: พฤษภาคม 17, 2009, 12:30:26 PM »
0
อ.อ๊อด เขียน script เพิ่มเติม นำเข้าในในตาราง pttypeno ด้วยนะครับ เนื่องจากเอาใว้ตรวจสอบว่า สิทธิเบิกตรง dateexp หมดอายุแล้ว หรือถูกยกเลิกแล้ว เช่น นำเข้าจาก ตาราง cscdmember โดยนำเข้าดังนี้
ตาราง cscdmember---------->pttypeno
          cspid                           pttypeno
          hcode                         hospmain
          hcode                         hospsub
          hn                              hn
          dateexp                     expiredate
          lastupd                       begindate
     
begindate น่าจะใช้ dateeff นะครับ
เพราะ lastupd เป็นวันที่ปรับปรุงข้อมูล ผมลองดูในแฟ้มตอบรับล่าสุด (งวดต้นเดือน พ.ค. 52) พบว่า
lastupd = 03/05/52
dateeff = 05/05/52
ดังนั้น ถ้าเราให้ begindate = lastupd แปลว่าผู้ป่วยจะเริ่มใช้สิทธิได้ตั้งแต่ 03/05/52 ทั้ง ๆ ที่ สกส. ให้ใช้สิทธิได้ 05/05/52
ทำด้วยหัวใจร.พ.สมเด็จพระสังฆราช องค์ที่ 17 อ.สองพี่น้อง จ.สุพรรณบุรี
อบรมโดย BMS Team เมื่อ พ.ย. 49 ขึ้นระบบห้องบัตรเมื่อ X'Mas 2007
2008 : X-Ray กายภาพบำบัด แพทย์แผนไทย กิจกรรมบำบัด OPD ตา
2009 : ทันตกรรม ห้องตรวจตา OPD (พยาบาลและห้องตรวจแพทย์บางห้อง)