摘 要: 文章詳細(xì)介紹了系統(tǒng)的設(shè)計(jì)、開(kāi)發(fā)過(guò)程,在醫(yī)院急診分診系統(tǒng)設(shè)計(jì)中,前臺(tái)利用PoweBuilder工具,后臺(tái)為后關(guān)系型數(shù)據(jù)庫(kù)Caché。系統(tǒng)通過(guò)前端PB程序定時(shí)調(diào)用His生產(chǎn)庫(kù)上的Web Service以獲取患者掛號(hào)信息,采取調(diào)用Caché庫(kù)中的類(lèi)方法和傳統(tǒng)SQL語(yǔ)句及PB自帶的數(shù)據(jù)窗口工具相結(jié)合來(lái)實(shí)現(xiàn)信息的查詢(xún)、保存、刪除等操作。系統(tǒng)的應(yīng)用加強(qiáng)了急診管理,該軟件為臨床提供了及時(shí)的動(dòng)態(tài)信息反饋和分析功能。
關(guān)鍵詞: Caché; Web Service; 分診; 數(shù)據(jù)窗口
中圖分類(lèi)號(hào):TP311 文獻(xiàn)標(biāo)志碼:A 文章編號(hào):1006-8228(2018)06-49-04
Design and application of PB and Caché database in the emergency triage system
Yao Wei
(Equipment & Information Department, People's Hospital of YangZhong City, Zhenjiang, Jiangsu 212200, China)
Abstract: This paper introduces the process of system design and development in detail. In the design of hospital emergency triage system, the front-end uses PoweBuilder tools and the background is relational database Caché. The system periodically calls Web Service on the His production database via the front-end PB program to obtain patient registration information. By calling the class in the Caché database and combining with the traditional SQL statements and the PB's DataWindow tools, the operations of information query, save and deletion are realized. The application of the system strengthens the emergency management, and the software provides the clinic with timely and dynamic information feedback and analysis functions.
Key words: Caché; Web Service; triage; DataWindow
0 引言
由于我院急診預(yù)檢存在一些問(wèn)題,如分診人員不足、信息不全、手工登記速度慢、錯(cuò)誤率高,分診過(guò)程隨意性強(qiáng)或憑經(jīng)驗(yàn)分診,缺乏一套有效的、科學(xué)的分診系統(tǒng);管理部門(mén)大量的、繁瑣的統(tǒng)計(jì)報(bào)表全靠手工完成,工作效率低下。因此,2017年起,由我院信息科和急診科人員共同開(kāi)發(fā)了一套適合我院急診流程的分診管理的軟件系統(tǒng),該系統(tǒng)目前已正式應(yīng)用于臨床,提高了分診的準(zhǔn)確率及工作效率,減輕了工作人員壓力[4]。
1 開(kāi)發(fā)環(huán)境簡(jiǎn)介
系統(tǒng)設(shè)計(jì)采用CS架構(gòu),系統(tǒng)基于Caché數(shù)據(jù)庫(kù)環(huán)境,同時(shí)主HIS生產(chǎn)庫(kù)也是Caché數(shù)據(jù)庫(kù),開(kāi)發(fā)平臺(tái)為Windows采用PowerBuilder軟件開(kāi)發(fā)。Caché數(shù)據(jù)庫(kù)是美國(guó)Intersystems公司產(chǎn)品,后關(guān)系型數(shù)據(jù)庫(kù)中的領(lǐng)頭羊。Caché數(shù)據(jù)庫(kù)對(duì)大多數(shù)國(guó)內(nèi)IT人員來(lái)說(shuō),還是比較陌生,然而在國(guó)外特別是國(guó)外的醫(yī)療領(lǐng)域中,Caché數(shù)據(jù)庫(kù)所占的比例是最大的,被醫(yī)療界公認(rèn)為首選數(shù)據(jù)庫(kù)。官方數(shù)據(jù)顯示,Caché數(shù)據(jù)庫(kù)的數(shù)據(jù)查詢(xún)速度約為其他數(shù)據(jù)庫(kù)的7~20倍,并方便的支持關(guān)系型數(shù)據(jù)庫(kù)和對(duì)象型數(shù)據(jù)庫(kù)[1]。
2 開(kāi)發(fā)過(guò)程介紹
2.1 急診患者掛號(hào)信息查詢(xún)
首先在生產(chǎn)庫(kù)上建立WebService[2]:http://10.10.50.3/dthealth/web/DHCEmpatient.MyService.CLS代碼如下:
Class DHCEmpatient.MyService Extends %SOAP
.WebService [ProcedureBlock]
{ Parameter SERVICENAME="MyService";
Method GetPatientList(inPut As %String) As
%FileCharacterStream [WebMethod]
{ q ##class(DHCEmpatient.EmpatientWeb).Emplist(inPut)
}
}
// DHCEmpatient.EmpatientWeb.Emplist()類(lèi)方法,入?yún)榫驮\日期,部分代碼如下
Class DHCEmpatient.EmpatientWeb Extends
(%Persistent, %XML.Adaptor)
{ ClassMethod Emplist(PatDate As %String) As
%GlobalCharacterStream [WebMethod]
{ //日期格式轉(zhuǎn)化
if PatDate["-" set PatDate=$zdh(PatDate,3)
if PatDate["/" set stDate=$zdh(stDate,4)
S retStr=##class(%GlobalCharacterStream).%New()
d retStr.Rewind()
d retStr.Write("
set paadmrowid=""
//就診日期為索引遍歷查詢(xún)
for set paadmrowid=$o(^PAADMi("AdmDateCurr",
PatDate,paadmrowid)) quit:paadmrowid="" do
patinfo=##class(web.DHCNurIpComm).NurPatInfo
(paadmrowid)
.set PatName=$p(patinfo,"^",1) //姓名
.set Sex=$p(patinfo,"^",2) //性別
//面向?qū)ο髮?shí)例賦值
.S myobj=##class(DHCEmpatient
.TOResultPatList).%New()
.s myobj.PatName=PatName
.s myobj.Sex=Sex
.S xml=##class(%GlobalCharacterStream).%New()
.S ret=myobj.XMLExportToStream(.Xml,"HIS")
.q:ret=0
.d retStr.CopyFrom(Xml)
d retStr.Write("
")
q retStr
}
其次在PB環(huán)境中引入Pbdom90.pbd及Pbsoapclient90.pbd兩文件,并在PB中通過(guò)WebService Proxy Wizard向?qū)陆╳eb service代理對(duì)象并引用生產(chǎn)庫(kù)上http:// 10.10.50.3/dthealth/web/DHCEmpatient.MyService.CLS,完成后進(jìn)行編譯,命名為empmyservicesoap。與此同時(shí)建立一自定義類(lèi)名為n_cst_pbwsfunction,方法名為uf_getempinfobydate,入?yún)閎ydate日期格式,點(diǎn)擊圖1上查找按鈕后,系統(tǒng)將根據(jù)日期調(diào)取出掛急診號(hào)別患者的基本信息及掛號(hào)信息(如圖1),執(zhí)行的具體過(guò)程如下。
⑴ 日期為入?yún)⑿畔魅氲絚sf_function. uf_
getempinfobydate類(lèi)方法中,獲取到XML信息并保存在ls_tempxml變量中。
⑵ 清空本地磁盤(pán)目錄下d:\emermis\patientlist.xml文件,并將XML固定格式串寫(xiě)到文件中,同時(shí)因每次寫(xiě)入到文件中字節(jié)大小有限制最大為32765,則將ls_tempxml變量分多次循環(huán)寫(xiě)入到patientlist.xml文件中。
⑶ 對(duì)文件patientlist.xml進(jìn)行解析,并通過(guò)循環(huán)寫(xiě)入到數(shù)據(jù)窗口中。
⑷ 可對(duì)此數(shù)據(jù)窗口記錄按掛號(hào)時(shí)間或就診卡號(hào)排序,以便快速定位到需分診患者。
⑸ 主要代碼如下:
//調(diào)用生產(chǎn)庫(kù)WEBSERVICE,獲取XML串
n_cst_pbwsfunction lcsf_function
lcsf_function=create n_cst_pbwsfunction
ls_regdate=string(date(em_date.text),"yyyy-mm-dd")
ls_tempxml=lcsf_function.uf_getempinfobydate
(ls_regdate)
ll_FLength=Len(ls_tempxml)
li_FileNum=FileOpen("d:\emermis\patientlist.xml",
StreamMode!, Write!, LockWrite!, Replace?。?/p>
FileWrite(li_FileNum, "")
FILECLOSE(li_FileNum)
li_FileNum=FileOpen("d:\emermis\patientlist.xml",StreamMode!,
Write!, LockWrite!)
FileWrite(li_FileNum, '<?xml version="1.0" encoding=
"gb2312" standalone="no"?>')
("%"_:docAd_"%")
}
//計(jì)算寫(xiě)入次數(shù),每次向文件中寫(xiě)32765個(gè)字節(jié)
if ll_FLength > 32765 then
if mod(ll_FLength,32765)=0 then
loops=ll_FLength/32765
else
loops=ll_FLength/32765+1
end if
else
loops=1
end if
//進(jìn)行循環(huán)寫(xiě)入
for i=1 to loops
ls_tmp=left(ls_tempxml,32765)
FileWrite(li_FileNum,ls_tmp)
ls_tempxml=right(ls_tempxml,len(ls_tempxml)-32765)
next
FILECLOSE(li_FileNum)
//解析XML串文件中,并讀取信息到數(shù)據(jù)窗口
pbdom_builder builder
pbdom_document doc
pbdom_element root, children[],node_element,
sub_elements[]
pbdom_attribute node_attribute[]
builder=create pbdom_builder
doc=builder.BuildFromFile("d:\emermis\patientlist.xml")
if doc.HasRootElement() then
root=doc.GetRootElement()
root.GetChildElements(children)
for ll_i=1 to UpperBound(children)
node_element=children[ll_i]
ls_nodename=node_element.GetQualifiedName()
li_insert_row=dw_1.insertrow(0)
node_element.GetChildElements(sub_elements)
for ll_j=1 to UpperBound(sub_elements)
ls_name=sub_elements[ll_j].getName()
ls_text=sub_elements[ll_j].getText()
Choose case ls_name
case "Admdate"
dw_1.setitem(li_insert_row,"admdate",date(ls_text))
case "RegNo"
dw_1.setitem(li_insert_row,"RegNo",trim(ls_text))
case "PatName"
dw_1.setitem(li_insert_row,"PatName",trim(ls_text))
2.2 分診界面-圖2執(zhí)行的具體代碼功能
⑴ 調(diào)用Caché數(shù)據(jù)庫(kù)中web.EmPatientList類(lèi),方法名為PadmExist,患者就診ID作為入?yún)?,判斷是否在分診系統(tǒng)表中已登記,并根據(jù)結(jié)果進(jìn)入下一步操作。
⑵ 調(diào)用Caché數(shù)據(jù)庫(kù)中User.EmPatientList類(lèi),方法名為Update對(duì)分診信息保存,其中入?yún)榛颊呋拘畔⒓胺衷\信息等,每個(gè)字段信息并以”^”分隔連接成一個(gè)字符串。此功能用主要采用Caché數(shù)據(jù)庫(kù)環(huán)境中COM方式的實(shí)現(xiàn), 同時(shí)在PB中引用CacheObject.dll,定義工廠(chǎng)對(duì)象及連接數(shù)據(jù)代碼[5]:
factoryObject=Create OLEObject
rsobject=Create OLEObject
factoryObject.ConnectToNewObject("CacheObject.factory")
conmark=factoryObject.Connect("cn_iptcp:10.10.50.66
[1972]:DHC-APP")
//判斷是否在分診系統(tǒng)表中已登記
rsobject=factoryObject.static("web.EmPatientList")
rtncode=rsobject. PaAdmExist (string(li_adm))
if rtncode=1 then
messagebox("提示","已登記此患者的分診記錄,請(qǐng)不要
重復(fù)登記!"+" "+string(li_adm))
return
end if
//分診信息保存
rsobject=factoryObject.static("User.EmPatientList")
ls_result= rsobject.Update(str)
if integer(ls_result)>0 then
messagebox("提示","數(shù)據(jù)保存成功!")
else
messagebox("提示","數(shù)據(jù)保存失?。?+ ls_result)
end if
其中判斷是否已分診類(lèi)方法在Cache庫(kù)中代碼如下:
ClassMethod PaAdmExist(paadm As %String) As %Integer
{ set Ret=0
if $d(^User.EmPatientListI("IndexEmPaAdmId",
paadm)) set Ret=1
q Ret
}
其中分診信息保存類(lèi)方法在Cache庫(kù)中部分代碼如下:
ClassMethod Update(argInput As %String,
argSeparate As %String) As %String
{ New (argInput,argSeparate)
Set return=0
Quit:argInput="" return
If ($g(argSeparate)="") {
Set argSeparate="^"
}
//開(kāi)始更新數(shù)據(jù)記錄
Set ID=$p(argInput,argSeparate,1)
If (ID="") {
Set obj=##class(User.EmPatientList).%New()
} Else {
Set obj=##class(User.EmPatientList).%OpenId(ID)
}
Quit:'$IsObject(obj) return
//解析入?yún)rgInput
Set xEmPatDate=$p(argInput,argSeparate,2)
Set xEmPatTime=$p(argInput,argSeparate,3)
Set xEmPatId=$p(argInput,argSeparate,4)
Set xEmPatName=$p(argInput,argSeparate,5)
……
//給對(duì)象賦值
Set obj.EmPatDate=$zdh(xEmPatDate,3)
Set obj.EmPatTime=$zth(xEmPatTime)
Set obj.EmPatId=xEmPatId
Set obj.EmPatName=xEmPatName
Set obj.EmUpdateDate=+$h
Set obj.EmUpdateTime=$p($h,",",2)
……
//判斷Save是否成功
Set sc=obj.%Save()
If $SYSTEM.Status.IsError(sc) {
Do $System.OBJ.DisplayError(sc)
Set return=-1
} Else {
Set return=obj.%Id()
}
Do obj.%Close()
Quit return
}
2.3 搶救登記界面
此功能(如圖3)主要是由急診護(hù)士對(duì)患者搶救過(guò)程中的措施、輔助檢查結(jié)果、參與搶救醫(yī)護(hù)人員等信息進(jìn)行登記,并將模糊查詢(xún)集成在同一界面[6]。此保存信息功能主要采用傳統(tǒng)的SQL語(yǔ)句及數(shù)據(jù)窗口一起實(shí)現(xiàn),部分主要代碼如下[3]:
update dhc_yzempatient set savepeople=:ls_all,
SaveMethod=:ls_allmark,OtherSaveMethod=:ls_other,result=:ls_result,dirtime=:ls_dirtime,dirloc=:ls_dirloc,empmark="02搶救患者"where id=:ll_rowid;
if sqlca.sqlcode=0 then
commit using sqlca;
messagebox("提示","數(shù)據(jù)保存成功!")
else
rollback using sqlca;
messagebox("提示","數(shù)據(jù)保存失??!"+" "+sqlca
.sqlerrtext,stopsign!)
end if
圖2 患者分診信息
圖3 搶救患者登記
3 結(jié)束語(yǔ)
本文著重介紹了系統(tǒng)的開(kāi)發(fā)過(guò)程,通過(guò)調(diào)用生產(chǎn)庫(kù)WebService獲取患者就診信息,并解析XML串信息顯示到數(shù)據(jù)窗口,在分診過(guò)程中調(diào)用Caché數(shù)據(jù)庫(kù)中的類(lèi)方法,判斷是否已分診并保存分診信息記錄,而在搶救記錄界面利用PB自帶的數(shù)據(jù)窗口及傳統(tǒng)的SQL語(yǔ)句進(jìn)行信息查詢(xún)及保存,將PB中數(shù)據(jù)窗口的簡(jiǎn)潔、直觀(guān)優(yōu)點(diǎn)與Caché庫(kù)中類(lèi)方法高效的執(zhí)行效率結(jié)合在一起進(jìn)行初步嘗試,為后續(xù)的各類(lèi)統(tǒng)計(jì)報(bào)表的編制打下了基礎(chǔ)。
本系統(tǒng)的開(kāi)發(fā)具有以下優(yōu)勢(shì)。
⑴ 提高急診工作效率:改變了煩瑣的手工登記,全面正確記錄急診患者的各種信息,節(jié)省時(shí)間。
⑵ 提高信息準(zhǔn)確率及患者滿(mǎn)意度:建立了規(guī)范的評(píng)估系統(tǒng),提高護(hù)理人員分診的準(zhǔn)確率,及時(shí)篩選出符合條件的危重癥患者,確?;颊吣軌蚣皶r(shí)進(jìn)入綠色通道就診,提高患者的滿(mǎn)意度。
⑶ 加強(qiáng)科內(nèi)管理:該軟件提供及時(shí)的動(dòng)態(tài)信息和統(tǒng)計(jì)分析功能,使急診的動(dòng)態(tài)變化一目了然。
同時(shí),基于患者生命體征及癥狀等信息智能化分診評(píng)級(jí)仍然有許多不完善的地方,需要信息人員與臨床醫(yī)護(hù)人員更多交流,進(jìn)一步的研究和開(kāi)發(fā),最終能夠更好的提高急診科工作效率及成功救治率。
參考文獻(xiàn)(References):
[1] 雷舜東,吳幫華,黃?,摚钣衩?,張紅.Caché數(shù)據(jù)庫(kù)在醫(yī)院
信息系統(tǒng)中的優(yōu)勢(shì)[J].實(shí)用醫(yī)院臨床雜志,2012.1:162-165
[2] 宗寧.Caché數(shù)據(jù)庫(kù)中Web Service的開(kāi)發(fā)與應(yīng)用[J].電腦編
程技巧與維護(hù),2010.22:43-44
[3] 李成亮,姚偉.Caché數(shù)據(jù)庫(kù)CS架構(gòu)數(shù)據(jù)交互的研究與分析[J].
計(jì)算機(jī)時(shí)代,2017.8:20-23
[4] 金靜芬,許杰,沈國(guó)麗.急診分診管理程序的軟件開(kāi)發(fā)與應(yīng)用
研究[J].護(hù)理與康復(fù),2007.4:219-220
[5] 李成亮,姚偉.Caché數(shù)據(jù)庫(kù)簡(jiǎn)單模糊查詢(xún)的研究與分析[J].
計(jì)算機(jī)時(shí)代,2017.1:51-54
[6] 周璋,胡菲.急診分診系統(tǒng)的應(yīng)用進(jìn)展[J].實(shí)用臨床護(hù)理學(xué)電
子雜志,2017.2(14):197-198