运行于手持智能设备上的临床医学智能辅助诊断系统的制作方法

文档序号:6554607阅读:508来源:国知局

专利名称::运行于手持智能设备上的临床医学智能辅助诊断系统的制作方法第一章
技术领域
本系统是临床医学和软件工程相结合的产物。具体说来,本系统首先组织各临床学科的专家进行讨论,组织材料,按照系统要求把个症状组织为层次结构,对给出疾病列表中的每种疾病进行打分,评出其出现的可能性。然后把这些信息用软件工程的方法整合在一起,形成一套系统软件,并发行于手持式智能段备上,供医生随时查询使用。第二章
背景技术
:涉及临床医学和软件工程●临床医学首先是临床医学只是,各种疾病的症状、病因、资料、诊断、用药;病原学知识;实验室检查知识;药品的药理、毒理、用法和剂量。●软件工程智能设备系统软件开发、源代码管理、版本控制、软件加密、智能升级、软件发行、培训、服务第三章
发明内容1、软件特点本项目通过PDA(掌上电脑)这种便捷的平台为医生提供一种方便的、功能强大的智能诊断工具。医生只需根据病人的主诉,用输入笔在PDA上输入症状,系统即可在瞬间把每种症状所对应的疾病列出来,同时列出这些症状对疾病贡献(百分比)。当输入一定数量的症状后,诊断结论建议即可给出(少量的疾病列表),最终结论由医生做出。对做出的结论可继续获得相应的治疗方法、相关药物。还可进一步获得有关病源学、药物、实验室结果方面的信息。另外,用户也可选择一组症状进行直接查询,系统将给出与这些症状有关的所有疾病列表。同时本系统还将是一本实用医学手册大全,在任何时候医生都可以随时查阅任意病症的相关信息发病症状、体征、实验室检查结果、治疗手段、相关药品、病源学的相关理论。另外,对于刚刚从事医疗工作的年轻人,他们刚刚走出校门,各方面的经验都非常欠缺。通过本系统的使用,可以帮助他们在短期内迅速获得有价值的信息。这对他们的成长是很有意义的。针对上述情况,本系统能在病情—病症—治疗之间迅速锁定相关信息、数据,协助医生迅速做出正确的结论,有效的避免误诊、漏诊(中国的误诊率高居不下的原因是传统医学依然没有真正利用现代高科技手段进行辅助而造成的)。同时也是一本翔实的医学文献、资料、数据大全,因此也是医生平时的好助手。2、系统功能特点●根据症状、体征及实验室结果,给出最有可能的一些诊断结论。●症状对疾病贡献(百分比)●可查询每一种疾病的一般知识、临床表现特点、鉴别诊断、诊断依据、主要的实验室检查及其结果意义、治疗用药、剂量及用法。●可查询每一种药物的适应症、用法、剂量、不良反应、注意事项及与其它药物的相互作用等。●可查询病原学的各种信息●可查询实验室结果的各种信息●上述几类信息若有关联的信息,相互之间可以交叉查询。●系统每月进行更新。●本系统是运行在PDA、智能手机等便携式掌上设备平台之上的。3、同类产品之比较目前国内尚无同类产品美国目前已有两家公司有类似产品,他们的主要功能是●根据用户输入的关键字,可以查到某种疾病,进而可以得到该疾病的临床表现、症状、治疗方法、实验室检查、用药●根据用户输入的关键字,可以查到实验室结果●基本上是一个专业医学字典。●由于都是刚刚投放市场,全是英文版。我们的特点●根据病人主诉,在症状体征逐步输入的过程中逐渐把相关的疾病罗列出来●病人叙述的症状越多,罗列的疾病越少●各症状对疾病的贡献以数字的形式给出(由相关专家讨论决定)●医生可根据罗列出的疾病,结合实验室检查、检验,最后作诊断结论●根据输入的关键字查询疾病、实验室结果、病原学、药品,进而得到相应的详细内容。在查询这一点上,和国外同类产品是相同的。但是我们增加了病原学、药品。●由于有药品的内容,产品将来将成为处方药的广告平台。(目标用户是临床医生)。●先做中文版,继而出英文版等外语版本。●网上数据更新、升级。4、软件原理本系统首先组织医学专家(著名医院的科主任、名流大学的教授、研究员)对疾病、药物、病原学、实验室结果进行论证,并以科学的逻辑关系把上述数据组织起来,然后通过软件的形式加以实现,并运行在PDA(掌上电脑、智能终端)上。便于系统迅速找到所需结果。通过本系统的使用,临床大夫可以养成良好的临床思维习惯,减少或避免漏诊和误诊。当在临床医生这一专业领域基本普及后,本系统将面向大众提供医疗咨询。普通人群可以通过本系统获得四方面的信息服务1)输入自我感觉的症状(可能的话可以输入在医院的实验室检查结果),可以获得对自身不适的大概认识(大概是什么病)。2)对医院已作出的诊断结论,可以获得该疾病的症状、治疗、用药、病原学、实验室结果,从而有效地避免医患之间的信息不对称。3)通过用药一节的内容可以获得药品的药效、毒理、计量、用法以及生产厂家的信息(甚至药品的价格),从而有效地避免医生乱开药。4)通过实验室检查一节可以获得该疾病所必须实施的检查,从而避免医生乱开检查项目。5)面向大众提供医疗信息咨询将不再局限于智能终端设备,而是将充分利用互联网、无线网络(尤其是3G网)。因此,本产品首先在后台维护一个庞大的数据,并以有效的结构组织起来。这个数据又分为台式机版本以及智能型设备版本。两个版本的结构、内容是一致的,但是各自适用于对应平台。台式机版本主要为维护(添加、删除、整理数据间关系)之用。智能型版本为最终发行版本,运行于用户的智能型设备上。数据分为症状、疾病、药物、病原学、实验室结果。其中●症状包括人类已知疾病表现出来的所有症状。为使系统运行便利,系统又为其追加了“顶级症状”属性。所谓“顶级症状”就是指那些容易被患者所感知、容易被检测出来、容易被医生所想到的症状,并且绝大多数可以不需要关联其他症状即可出现。而“非顶级症状”则需要在关联症状出现后才能发生。如此设置可以让系统在前几级界面显示的数据量少,方便使用。症状还拥有“编码”属性,采用国际标准统一编码。●疾病包括名称及属性信息。疾病属性包括一般情况、临床表现、诊断要点、鉴别诊断、治疗、实验室检查。其中治疗包含有药物的用法及剂量。●药物包括名称、适应症、禁忌症、不良反应。其中适应症里包含药物的用法及剂量。●病原学包括名称、一般性状、所致疾病类型、检测方法。●实验室结果包括名称、正常值范围、临床意义。●药厂这是广告内容。药物信息和药厂的产品是关联的,即通过药品名称可以查出药厂名称,进而得到药品的某种对应商品名。●症状间关系不同疾病对应不同症状,同一疾病的症状间是有前后、主次关系的。这使得我们可以从症状的关系中得出诊断结论。这实质上就是临床思维。如图1所示。如果病人出现黄疸,那么接下来就要判断是否有肝肿大;若有肝肿大,则要判断肝肿大的程度;若为轻度或中度,则要判断有无发热腹痛或肝压病;若无腹痛或肝压病,则要判断有无胆囊肿大;若无胆囊肿大,则要判断有无皮肤色素沉着;若无皮肤色素沉着,则要判断有无水肿或腹水;至此,所谓的临床思维中的症状判断就已结束。系统可以给出诊断结论。至于是何种结论,在下一组数据设置里给出。可以看出,症状间的关系是一种典型的多叉树结构。因此系统数据里将包含大量的这种多叉树关系,进而对它的操作将大量涉及递归运算。5、运行流程图.运行分为PDA本机运行操作以及升级。升级流程图见图2本机运行分为诊断和查询诊断流程图见图3说明进入该画面,系统列出所有症状供用户选择;当用户选择某症状后,系统列出两类信息与该症状有关的疾病以及出现该症状后患者还会出现的症状;继续选择,到某一定程度,系统将只列出疾病,预示着以上症状的发生,患者所患的疾病只能是这几种了。提醒医生从中作选择并下结论。其中有些疾病医生可能想不到,而系统给列出来,这就避免了漏诊。诊断结论医生可以进一步根据实验室结果、鉴别诊断、临床表现、诊断要点等作诊断结论。同时系统对所选择的症状,对其中某疾病的贡献给出百分比数字,有效地减少了误诊。关联信息在疾病一般情况里可以关联查看相应的病原学内容;诊断要点里可以查到实验室结果相应项目的内容。鉴别诊断里可以关联到其他疾病的内容;治疗可以关联查出对应药物的内容,如剂量、用法。查询流程分几部分●根据症状直接查寻疾病说明症状列表中选择一组症状,点击查寻按钮后系统自动把所有包含这些症状的疾病列出来。见图4。●疾病信息查询说明在疾病查询界面,用户输入关键字,如肝炎,这可以查询疾病名称包含该关键字的所有疾病,进而可以得到某疾病的相关信息。可以模糊查询。关联信息和诊断操作里的关联方法、内容是一样的。见图5。●药物查询说明查询原理同上,根据生产厂可以关联出广告。见图6。●病原学查询说明查询原理同上。●实验室结果查询查询原理同上。见图7。6、举例运行运行流程见图8。第四章具体实施例方式根据上述系统原理及数据结构,系统实现方法分为台式机版本数据生成、智能型版本数据生成、智能设备上用户程序开发、安装程序以及发行程序五个部分。●台式机版本数据这是系统数据的源头。专家论证后的结果首先在这个模块里维护进系统中,后序的功能模块才能开始工作。由于是运行于台式机上的,台式机上的成熟商业软件也可加以充分利用。主要是后台数据的保存以及前台数据的操作。本系统后台数据利用现成的商业软件如Caché、Oracle、SyBase或MSSQLServer。目前采用MSSQLServer,主要是为智能终端设备准备数据。未来若通过互联网、3G网络提供医疗信息咨询时,将优先考虑大型商业数据库(Caché、Oracle、SyBase)。●台式机版本数据的前台操作界面采用主流开发工具进行,如Delphi、MSVisualC++、Powerbuilder、Java等。考虑到未来网络的发展,本系统目前使用MSVisualStudio.Net进行开发。●智能型版本数据生成智能型设备由于CPU及操作系统的不同,运行其中的数据库系统不尽相同,因此本模块主要是完成从台式机数据库到各种不同智能型设备数据库的自动转换。这样就把基本数据的准备和发行的目标数据分离开来。两部分工作因此可以同步分头进行。智能型版本数据生成有两条技术路线数据同步以及网络数据传输。数据同步依据数据库系统的数据同步原理,由系统使用的数据库系统自动进行同步。同步成功后,智能设备上的数据将和台式机的数据在结构和内容上保持一致。这个技术路线适合于MSSQLServer和MSSQLServerCE之间的数据同步。网络数据传输适用于那些不具备自动同步的系统。通过台式机和智能设备之间的网络传输来传递数据的结构和数据。●我们使用网络数据传输,因为这种方式可以灵活控制传输的数据的多少。●智能设备用户程序包括运行程序、安装程序、发行程序。●运行程序运行程序在智能设备上调用后台数据库,根据用户的操作显示相关信息。采用MSVisualStudio.Net进行开发。包括诊断模块、疾病模块、药物模块、病原学模块、实验室检查模块。●4装程序智能设备上的程序是通过在台式机上运行安装程序,由它来把程序及数据文件传递到智能设备上的。安装程序应具备判断智能设备类型的功能。另外系统的升级也是通过安装程序进行的。为方便系统的升级,升级功能将提供单独的安装程序。●发行程序系统的发行有几种可能用户自己安装,这可以使用安装程序进行;统一安装后连带智能设备一同提供给用户。可以单个处理也可批量处理。单个处理实际上可以由安装程序完成,发行量小时可以。发行量大时必须使用批量方式。通过和智能设备厂家合作,在参加安装智能设备操作系统时把本系统作为操作系统的一个组成部分一并安装。1、台式机版本数据的具体实现步骤及系统关键结构、核心代码台式机版本数据的生成分为后台数据及前端程序两部分,两者通过网络相连接。后台数据运行在中央服务器上,通过MSSQLServer进行管理。如图9所示这种结构是一种分布式结构,可是实现多人同时协同工作每个人在各自工作站上运行数据管理程序,数据集中在服务器上保存。后台数据库结构如下IFEXISTS(SELECTnameFROMmaster.dbo.sysdatabasesWHEREname=N’PDA’)DROPDATABASE[PDA]CREATEDATABASE[PDA]ON(NAME=N’PDA_Data’,FILENAME=N’c:\ProgramFiles\MicrosoftSQLServer\MSSQL\daya\PDA_Data.MDF’,SIZE=2.FILEGROWTH=10%)LOGON(NAME=N’PDA_Log’,FILENAME=N’c:\ProgramFiles\MiccrosoftSQLServer\MSSQL\data\PDA_Log.LDF’,SIZE=3,FILEGROWTH=10%)COLLATEChinese_PRC_CI_ASexecsp_dboptionN’PDA’,N’autoclose’,N’false’execsp_dboptionN’PDA’,N’bulkcopy’,N’false’execsp_dboptionNP’DA’,N’N’trunc.log’,N’false’execsp_dboptionN’PDA’,N’tompagedetection’,N’true’execsp_dboptionN’PDA’,N’readonly’,N’false’execsp_dboptionN’PDA’,N’dbouse’,N’false’execsp_dboptionN’PDA’,N’single’,N’false’execsp_dboptionN’PDA’,N’autoshrink’,N’false’execsp_dboptionN’PDA’,N’ANSInulldefault’,N’false’execsp_dboptionN’PDA’,N’recursivetriggers’,N’false’execsp_dboptionN’PDA’,N’ANSInulls’,N’false’exec3p_dboptionN’PDA’,N’concatnullyieldsnull’,N’false’execsp_dboptionN’PDA’,N’cursorcloseoncommit’,N’false’execsp_dboptionN’PDA’,N’defaulttolocalcursor’,N’false’execsp_dboptionN’PDA’,N’quotedidentifier’,N’false’execsp_dboptionN’PDA’,N’ANSlwamingd’,N’false’execsp_dboptionN’PDA’,N’autocreatestatistics’,N’true’execsp_dboptionN’PDA’,N’autoupdatestatistics’,N’true’if((@@microsoftversion/power(2,24)=8)and(@@microsoftversion&0xffff>=724))or((@@microsoftversion/power(2,24)=7)and(@@microsoftversion&oxffff>=1082)))execsp_dboptionNPDA’,N’dbchaining’,N’false’use[PDA]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[VIEW1]’)andOBJECTPROPERTY(id,N’IsView’)=1)dropview[dbo].[VIEW1]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_advertisement]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_advertisement]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_char_index]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_char_index]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_developer]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_developer]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_diagnosis]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_diagnosis]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_disease]’)andOBJECTPROPERTY(id.N’IsUserTable’)=1)droptable[dbo].[tb_disease]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_disease_basic]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_disease_basic]ifexisrs(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_disease_symptom]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_disease_symptom]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_eighth_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_eighth_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_fifth_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_fifth_child]ifexists(select*fromdbo.syobjectswhereid=object_id(N’[dbo].[tb_first_child]’)andOBJECTPROPERTY(idN’IsUserTable’)=1)droptable[dbo].[tb_first_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_flag_table]’)audOBJECTPROPERTY(id,N’IsUserTabIe’)=1)droptabIe[dbo].[tb_flag_table]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_fourth_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_fourth_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_medication]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_medication]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_medication_detail]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_medication_detail]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_nineth_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_nineth_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_physic]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_physic]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_root]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_root]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_second_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_second_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_seventh_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_seventh_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_sixth_child]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_sixth_child]ifexists(seleclt*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_symptom]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_symptom]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_symptom_contribute]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_symptom_contribute]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_symptom_vs_disease]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_symptom_vs_disease]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_tenth_child]’)andOBJECTPROPERTY(idN’IsUserTable’)=1)droptable[dbo].[tb_tenth_child]ifexists(select*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_third_child]’)andOBJECTPROPERTY(idN’IsUserTable’)=1)droptable[dbo].[tb_third_child]ifexists(delect*fromdbo.sysobjectswhereid=object_id(N’[dbo].[tb_treatment]’)andOBJECTPROPERTY(id,N’IsUserTable’)=1)droptable[dbo].[tb_treatment]CREATETABLE[dbo].[tb_advertisement]([f_id][int]NULL,[f_advertisement][varchar](2000)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//广告表,用于保存广告内容CREATETABLE[dbo].[tb_char_index]([f_char][char](4)COLLATEChinese_PRC_CI_ASNULL,[f_index][char](1)COLLATEChinese_PRC_CI_ASNULL)ON[PRIMARY]//汉字编码表,用于产生拼音码CREATETABLE[dbo].[tb_developer]([f_developer_id][int]NOTNULL,[f_name][varchar](20)COLLATEChinese_PRC_CI_ASNOTNULL,[f_org][varchar](50)COLLATEChinese_PRC_CI_ASNULL,[f_resume][varchar](255)COLLATEChinese_PRC_CI_ASNULL)ON[PRIMARY]//系统开发人员列表CREATETABLE[dbo].[tb_diagnosis]([f_id][int]IDENTITY(1,1)NOTNULL,[f_disease_id][int]NULL,[f_diagnosis][varchar](2000)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//诊断表,存储某疾病的诊断信息,其中f_disease_id对应某疾病的编码,f_diagnosis对应诊断内容CREATETABLE[dbo].[tb_disease]([f_disease_id][int]NOTNULL,[f_disease_name][varchar](200)COLLATEChinese_PRC_CI_ASNOTNULL,[varcbar](6)COLLATEChinese_PRC_CI_ASNULL)ON[PRIMARY]//疾病表,储存疾病名称以及编码,f_spell是拼音码,用于快速查找某疾病CREATETABLE[dbo].[tb_disease_basic]([f_id][int]IDENTITY(1,1)NOTNULL,[f_disease_id][int]NOTNULL,[f_disease_basic][varchar](2000)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//疾病基本信息,其中f_disease_id对应某疾病的编码,f_disease_basic对应基本信息CREATETABLE[dbo].[tb_disesse_symptom]([f_id][int]IDENTITY(1,1)NOTNULL,[f_disease_id][int]NULL,[f_disease_symptom][varchar](2000)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//疾病的详细症状,,其中f_disease_id对应某疾病的编码,f_disease_symptom对应症状CREATETABLE[dbo].[tb_eighth_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMAARY]//第八层症状关系表CREATETABLE[dbo].[tb_fifth_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第五层症状关系表CREATETABLE[dbo].[tb_first_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第三层症状关系表CREATETABLE[dbo].[tb_flag_table]([f_node_id][int]NOTNULL,[f_disease_id][int]NOTNULL,[f_symptom_id][int]NOTNULL,[f_end_node_flag][int]NOTNULL,[f_developer_id][int]NOTNULL)ON[PRIMARY]//标志表用以记录各层次节点的编号、疾病的编号、症状的编号、末端节点的编号、开发人员的编号,以保证各类信息编号的唯一性CREATETABLE[dbo].[tb_fourth_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第四层症状关系表CREATETABLE[dbo].[tb_medication]([f_medication_id][int]IDENTITY(1,1)NOTNULL,[f_medication_name][varchar](200)COLLATEChinese_PRC_CI_ASNULL)ON[PRIMARY]//药品表,记录药品的名称CREATETABLE[dbo].[tb_medication_detail]([f_medication_id][int]NULL,[f_medication_detail][varchar](255)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//药品详细内容表,记录药品的详细内容CREATETABLE[dbo].[tb_nineth_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第九层症状关系表CREATETABLE[dbo].[tb_physic]([f_id][int]IDENTITY(1,1)NOTNULL,[f_disease_id][int]NULL,[f_physic][varchar](2000)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//疾病病因表CREATETABLE[dbo].[tb_root]([f_root_id][int]NULL,[f_node_flag][int]NOTNULL)ON[PRIMARY]//第顶层症状关系表CREATETABLE[dbo].[tb_second_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第二层症状关系表CREATETABLE[dbo].[tb_seventh_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_ag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第七层症状关系表CREATETABLE[dbo].[tb_sixth_child]([f_parant_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第六层症状关系表CREATETABLE[dbo].[tb_symptom]([f_symptom_id][int]NOTNULL,[f_symptom_name][varhar](200)COLLATEChinese_PRC_CI_ASNOTNULL,[f_spell][varchar](6)COLLATEChinese_PRC_CI_ASNULL,[f_root_flag][char](1)COLLATEChinese_PRC_CI_ASNULL)ON[PRIMARY]//症状表,记录单个症状CREATETABLE[dbo].[tb_symptom_contribute]([f_node_flag][int]NULL,[f_disease_id][int]NULL,[f_contribute][int]NULL)ON[PRIMARY]//症状对疾病的贡献CREATETABLE[dbo].[tb_symptom_vs_disease]([f_node_flag][int]NOTNULL,[f_Disease_id][int]NULL,[f_symptom_id][int]NULL)ON[PRIMARY]//症状疾病间的关系CREATETABLE[dbo].[tb_tenth_child]([f_parent_id][int]NOTNULL,[f_me_id][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第十层症状关系表CREATETABLE[dbo].[tb_third_child]([f_parent_id][int]NOTNULL,[f_me_ind][int]NOTNULL,[f_node_flag][int]NOTNULL,[f_parent_node][int]NOTNULL)ON[PRIMARY]//第三层症状关系表CREATETABLE[dbo].[tb_treatment]([f_id][int]IDENTITY(1,1)NOTNULL,[f_disease_id][int]NULL,[f_treatment][varchar](2000)COLLATEChinese_PRC_CI_ASNOTNULL)ON[PRIMARY]//疾病的治疗方法表2、各表之间的关系及操作代码和界面2.1、程序初始化,数据库连接程序开始运行时首先做必要的初始化工作,完成数据库的连接设置。代码如下privatevoidSymptom_RelationShip_Load(objectsender,System.EventArgse){Stringpda_ini;StreamReadersr=newStreamReader(″pda.ini″);pda_ini=sr.ReadLine();sr.Close();cnn=newSystem.Data.SqlClient.SqlConnection();cnn.ConnectionString=pda_ini;cnn.Open();cmd=newSystem.Data.SqlClient.SqlCommand(″selectf_symptom_id,f_symptom_namefromtb_symptom″,cnn);dtr=cmd.ExecuteReader();total_Symptom_Number=0;while(dtr.Read()==true)total_Symptom_Number++;dtr.Close();Total_Symptom_Id_lis=newstring[total_Symptom_Number];Totsl_Symptom_Name_lis=newstring[total_Symptom_Number];dtr=cmd.ExecuteReader();inti=0;while(dtr.Read()==true){Total_symptom_Id_lis[i]=dtr.GetValue(0).ToString();Total_Symptom_Name_lis[i]=dtr.GetValue(1).ToString();i++;}dtr.Close();sqlConnectionl.ConnectionString=pda_ini;data_Set_Symptom.Clear();sqlDataAdapter1.Fill(data_Set_Symptom,″tb_symptom″);dataSet_Symptom_Right.Clear();sqlDataAdapter2.Fill(dataSet_Symptom_Right,″tb_symptom″);}2.2症状表及症状之间的关系,如图10所示系统首先维护症状表,包括症状名称、是否是根节点以及拼音码。根节点的意义前面已经阐述,拼音码用于以后快速在软件中查找定位某症状。图11为操作界面。在下方输入框中输入症状,点击保存即可输入新症状。位于其上的输入框为更新框,选中的症状可以在此更新。在左侧输入框输入拼音,可以快速找到某症状,如输入h,系统将显示所有名称第一个汉字的拼音包含h的症状。保存症状的代码如下privatevoidbutton2_Click(objectsender,System.EventArgse)if(textBox1.Text==″″)return;StringSymptom_id;cmd.CommandText=″select*fromtb_symptomwheref_symptom_name=_+textBox1.Text+″_;dtr=cmd.ExecuteReader();if(dtr.Read()=true)dtr.Close();MessageBox.Show(″系统已经包括该症状″);textBox1.Text=″″;return;elsedtr.Close();cmd.CommandText=″selectf_symptom_idfromtb_flag_table″;dtr=cmd.ExecuteReader();dtr.Read();Symptom_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″updatetb_flag_tablesetf_symptom_id=f_symptom_id+1″;cmd.ExecuteNonQuery();cmd.CommandText=″insertintotb_symptom(f_symptom_id,f_symptom_name)values(_+Symptom_id+_,_+textBox1.Text+_)″;cmd.ExecuteNonQuery();cmd.Dispose();data_Set_Symptom.Clear();sqlDataAdapter_symptom.Fill(data_Set_Symptom,″tb_symptom″);dataGrid_Symptom.SetDataBinding(data_Set_Symptom,″tb_symptom″);textBox1.Text=″″;textBox1.Focus();更新症状的代码如下privatevoidbutton1_Click_1(objectsender,System.EventArgse){if(selected_symptom_id==″″){MessageBox.Show(″请先选择某一症状″);return;}cmd.CommandText=″updatetb_symptomsetf_symptom_name=_+textBox2.Text+_wheref_symptom_id=_+selected_symptom_id+″_;cmd.ExecuteNonQuery();data_Set_Symptom.Clear();sqlDataAdapter_symptom.Fill(data_Set_Symptom,″tb_symptom″);dataGrid_Symptom.SetDataBinding(data_Set_Symptom,″tb_symptom″);selected_symptom_id=″″;textBox2.Text=″″;}拼音码的产生代码如下(使用MicrosoftVisualBasic6.0)症状的顶级节点属性操作界面见图12,操作代码是privatevoidbuttonl_Click(objectsender,System.EventArgse){stringsymptom_name,symptom_id;inti;for(i=0;i<checkedListBox1.Items.Count;i++){symptom_name=checkedListBox1.Items[i].ToString();cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+symptom_name+″_;dtr=cmd.ExecuteReader();dtr.Read();symptom_id=dtr.GetValue(0).ToString();dtr.Close();if(checkedListBox1.GetItemChecked(i))cmd.CommandText=″updatetb_symptomsetf_root_flag=′R′wheref_symptom_id=_+symptom_id+″_;elsecmd.CommandText=″updatetb_symptomsetf_root_flag=′C′wheref_symptom_id=_+symptom_id+″_;cmd.ExecuteNonQuery();}MessageBox.Show(″OK″);}症状间关系的维护界面见图13。左右两侧为系统所有症状列表,点击选择左侧列表,被选中的症状作为顶级症状,显示在中部的关系图中。若该顶级症状的下级关系已经存在则显示在中部,不然作为中部关系图的根节点显示,等待下级关系的输入。如图13所示,关系图是典型的树状结构。在中部点击选中某一节点,然后在右侧列表中双击某症状,则该症状将作为选中节点的子症状添加到树状结构图中。在中部下方的输入框可以输入拼音码,以便快速找到某症状。“保存”、“删除”对操作结果做保存或删除操作。点击左侧列表,系统后台的操作代码如下PrivateSubFormal_PY_Click()Dimconn_strconn_str=″Provider=MSDASQL.1;Password=1234;PersistSecurityInfo=True;UserID=sa;DataSource=PDA;InitialCatalog=PDA″DimcnnAsADODB.ConnectionDimcontent,Sqlstr,iDimrec_PYAsADODB.RecordsetDimrec_ItemAsADODB.RecordsetDimrec_testAsADODB.RecordsetDimnumberAsInteger,equip_name,equip_style,equip_IDDimmanufacturer,Tyle_ID,Response,tmp_char,ch,num,PY_IndexSetcnn=NewADODB.Connectioncnn.Openconn_strSqlstr=″select*FROMtb_symptom″Setrec_Item=NewADODB.Recordsetrec_Item.CursorType=adOpenKeysetrec_Item.LockType=adLockOptimisticrec_Item.OpenSqlstr,cnn,adOpenDynamic,adLockPessimisticDoUntilrec_Item.EOFtmp_char=rec_Item(″f_symptom_name″)PY_Index=″″Fori=1ToLen(tmp_char)ch=Mid(tmp_char,i,1)num=Asc(ch)Ifnum>0ThenIfch<>″*″Andch<>″(″Andch<>″)″Andch<>″+″Andch<>″-″AndNotIsNumeric(ch)Andch<>″/″Andch<>″.″ThenPY_Index=PY_Index+chEndIfElseIfch<>″(″Andch<>″)″ThenSqlstr=″select*FROMtb_Char_Indexwheref_Char=’″&ch&″’″Setrec_PY=NewADODB.Recordsetrec_PY.CursorType=adOpenKeysetrec_PY.LockType=adLockOptimisticrec_PY.OpenSqlstr,cnn,adOpenDynamic,adLockPessimisticIfNotrec_PY.EOFThenPY_Index=PY_Index+rec_PY(″f_Index″)EndIfEndIfNextIfLen(PY_Index)>6Thenrec_Item!f_Spell=UCase(Left(PY_Index,6))Elserec_Item!f_Spell=UCase(PY_Index)EndIfrec_Item.MoveNextLooprec_Item.MoveFirstrec_Item.UpdateResponse=MsgBox(″生成完毕,退出?″,vbYesNo)IfResponse=vbYesThenSetrec_Item=NothingSetrec_PY=NothingUnloadMeElseSetrec_Item=NothingSetrec_PY=NothingEndIfEndSubprivatevoiddataGrid_Left_Click(objectsender,System.EventArgse){Stringparent_id,root_node_flag;System.Windows.Forms.DataGridCellselectedCell=dataGrid_Left.CurrentCell;objectselectedItem=dataGrid_Left[selectedCell.RowNumber,0];StringcellValue=Convert.ToString(selectedItem);Relationship_Tree.TopNode.Nodes.Clear();TreeNodenewNode=newTreeNode(cellValue);Relationship_Tree.TopNode.Nodes.Add(newNode);selectedItem=dataGrid_Left[selectedCell.RowNumber,1];parent_id=Convert.ToString(selectedItem);cmd.CommandText=″selectf_node_flagfromtb_rootwheref_root_id=’″+parent_id+″’″;dtr=cmd.ExecuteReader();if(dtr.Read()==true)//therehadbeenaddedbefore{root_node_flag=dtr.GetValue(0).ToString();dtr.Close();Recursion_Add_Node(newNode,parent_id,root_node_flag,1);}elsedtr.Close();Relationship_Tree.ExpandAll();}privatevoidRecursion_Add_Node(TreeNodeparent_node,stringparent_id,stringparent_flag,intlevel){String[]me_id;String[]me_name;String[]me_node_flag;inttotal_me,i;switch(level){case1cmd.CommandText=″selectf_me_id,f_node_flagfromtb_first_childwheref_parent_node=_+parent_flag+″_;break;case2cmd.CommandText=″selectf_me_id,f_node_flagfromtb_second_childwheref_parent_node=_+parent_flag+″_;break;case3cmd.CommandText=″selectf_me_id,f_node_flagfromtb_third_childwheref_parent_node=_+parent_flag+″_;break;case4cmd.CommandText=″selectf_me_id,f_node_flagfromtb_fourth_childwheref_parent_node=_+parent_flag+″_;break;case5cmd.CommandText=″selectf_me_id,f_node_flagfromtb_fifth_childwheref_parent_node=_+parent_flag+″_;break;case6cmd.CommandText=″selectf_me_id,f_node_flagfromtb_sixth_childwheref_parent_node=_+parent_flag+″_;break;case7cmd.CommandText=″selectf_me_id,f_node_flagfromtb_seventh_childwheref_parent_node=_+parent_flag+″_;break;case8cmd.CommandText=″selectf_me_id,f_node_flagfromtb_eighth_childwheref_parent_node=_+parent_flag+″_;break;case9cmd.CommandText=″selectf_me_id,f_node_flagfromtb_nineth_childwheref_parent_node=_+parent_flag+″_;break;case10cmd.CommandText=″selectf_me_id,f_node_flagfromtb_tenth_childwheref_parent_node=_+parent_flag+″_;break;defaultreturn;}dtr=cmd.ExecuteReader();total_me=0;while(dtr.Read()==true)total_me++;if(total_me==0){dtr.Close();return;//nochild}else{me_id=newstring[total_me];me_name=newstring[total_me];me_node_flag=newstring[total_me];dtr.Close();dtr=cmd.ExecuteReader();i=0;while(dtr.Read()==true){me_id[i]=dtr.GetValue(0).ToStrig();me_node_flag[i]=dtr.GetValue(1).ToString();i++;}dtr.Close();for(i=0;i<total_me;i++){cmd.CommandText=″selectf_symptom_namefromtb_symptomwheref_symptom_id=_+me_id[i]+″_;dtr=cmd.ExecuteReader();dtr.Read();me_name[i]=dtr.GetValue(0).ToString();dtr.Close();}for(i=0;i<total_me;i++){parent_node.Nodes.Add(newTreeNode(me_name[i]));}i=0;foreach(TreeNodetninparent_node.Nodes){Recursion_Add_Node(tn,me_id[i],me_node_flag[i],level+1);i++;}}}双击右侧列表,后台代码如下privatevoiddataGrid_Right_DoubleClick(objectsender,System.EventArgse){System.Windows.Forms.DataGridCellselectedCell=dataGrid_Right.CurrentCell;objectselectedItem=dataGrid_Right[selectedCell.RowNumber,0];StringcellValue=Convert.ToString(selectedItem);TreeNodenewNode=newTreeNode(cellValue);Relationship_Tree.SelectedNode.Nodes.Add(newNode);}保存按钮的后台操作代码是privatevoidbutton1_Click(objectsender,System.EventArgse){MessageBoxButtonsbuttons=MessageBoxButtons.YesNo;DialogResultresult;Stringroot_node_flag,root_name,parent_id;result=MessageBox.Show(this,″上述信息设置正确吗?″,″系统提示″,buttons,MessageBoxlcon.Question,MessageBoxDefaultButton.Buttonl);if(result==DialogResult.No)return;Relationship_Tree.ExpandAll();root_name=Relationship_Tree.TopNode.FirstNode.Text;dtr.Close();cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+root_name+″_;dtr=cmd.ExecuteReader();dtr.Read();parent_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_node_flagfromtb_rootwheref_root_id=_+parent_id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()!=true){dtr.Close();cmd.CommandText=″selectf_node_idfromtb_flag_table″;dtr=cmd.ExecuteReader();dtr.Read();root_node_flag=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″updatetb_flag_tablesetf_node_id=f_node_id+1″;cmd.ExecuteNonQuery();cmd.CommandText=″insertintotb_root(f_root_id,f_node_flag)values(_+parent_id+_,_+root_node_flag+_)″;cmd.ExecuteNonQuery();Save_Symptom_RelationShip_recursion(Relationship_Tree.TopNode.FirstNode,parent_id,root_node_flag,1);}else{rootnode_flag=dtr.GetValue(0).ToString();dtr.Close();Save_Symptom_RelationShip_recursion(Relationship_Tree.TopNode.FirstNode,parent_id,root_node_flag,1);}}privatevoidSave_Symptom_RelationShip_recursion(TreeNodemy_node,stringparent_id,stringroot_node_flag,intlevel){stringme_node_flag,me_id;foreach(TreeNodetninmy_node.Nodes){cmd.CommandText=″selectf_node_idfromtb_flag_table″;dtr=cmd.ExecuteReader();dtr.Read();me_node_flag=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″updatetb_flag_tablesetf_node_id=f_node_id+1″;cmd.ExecuteNonQuery();cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+tn.Text+″_;dtr=cmd.ExecuteReader();dtr.Read();me_id=dtr.GetValue(0).ToString();dtr.Close();Write2DataBase(parent_id,me_id,root_node_flag,me_node_flag,level);Save_Symptom_RelationShip_recursion(tn,me_id,me_node_flag,level+1);}}删除按钮的代码如下privatevoidbutton2_Click(objectsender,System.EventArgse){MessageBoxButtonsbuttons=MessageBoxButtons.YesNo;DialogResultresult;Stringroot_node_flag,root_name,parent_id;result=MessageBox.Show(this,″确实要全部删除这些对应关系吗?″,″系统提示″,buttons,MessageBoxIcon.Question,MessageBoxDefaultButton.Buttonl);if(result==DialogResult.No)return;root_name=Relationship_Tree.TopNode.FirstNode.Text;dtr.Close();cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+root_name+″_;dtr=cmd.ExecuteReader();dtr.Read();parent_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_node_flagfromtb_rootwheref_root_id=_+parent_id+″_;dtr=cmd.ExecuteReader();dtr.Read();root_node_flag=dtr.GetValue(0).ToString();dtr.Close();Delete_All_Nodes_recursion(Relationship_Tree.TopNode.FirstNode,parent_id,root_node_flag,1);Relationship_Tree.TopNode.Nodes.Clear();Relationship_Tree.ExpandAll();}privatevoidDelete_All_Nodes_recursion(TreeNodemy_node,stringparent_id,stringroot_node_flag,intlevel){stringme_node_flag,me_id;foreach(TreeNodetninmy_node.Nodes){cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+tn.Text+″_;dtr=cmd.ExecuteReader();dtr.Read();me_id=dtr.GetValue(0).ToString();dtr.Close();switch(level){case1cmd.CommandText=″selectf_node_flagfromtb_first_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case2cmd.CommandText=″selectf_node_flagfromtb_second_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case3cmd.CommandText=″selectf_node_flagfromtb_third_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case4cmd.CommandText=″selectf_node_flagfromtb_fourth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case5cmd.CommandText=″selectf_node_flagfromtb_fifth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case6cmd.CommandText=″selectf_node_flagfromtb_sixth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case7cmd.CommandText=″selectf_node_flagfromtb_seventh_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case8cmd.CommandText=″selectf_node_flagfromtb_eighth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case9cmd.CommandText=″selectf_node_flagfromtb_nineth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case10cmd.CommandText=″selectf_node_flagfromtb_tenth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;defaultreturn;}dtr=cmd.ExecuteReader();dtr.Read();me_node_flag=dtr.GetValue(0).ToString();dtr.Close();Delete_All_Nodes_recursion(tn,me_id,me_node_flag,level+1);switch(level){case1cmd.CommandText=″deletefromtb_first_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id″_;break;case2cmd.CommandText=″deletefromtb_second_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case3cmd.CommandText=″deletefromtb_third_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case4cmd.CommandText=″deletefromtb_fourth_childwheref_parentnode=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case5cmd.CommandText=″deletefromtb_fifth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case6cmd.CommandText=″deletefromtb_sixth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case7cmd.CommandText=″deletefromtb_seventh_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case8cmd.CommandText=″deletefromtb_eighth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case9cmd.CommandText=″deletefromtb_nineth_childwheref_parent_node=_+rootnode_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;case10cmd.CommandText=″deletefromtb_tenth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+_andf_me_id=_+me_id+″_;break;defaultreturn;}cmd.ExecuteNonQuery();}}两个拼音码输入框对应的后台代码是privatevoidtextBox1_TextChanged(objectsender,System.EventArgse){data_Set_Symptom.Clear();sqlDataAdapterl.SelectCommand.CommandText=″SELECTf_symptom_nameAS症状名称,f_symptom_idAS症状编码FROMtb_symptomwheref_spelllike_+textBox1.Text+″%′ORDERBYf_symptom_name″;sqlDataAdapterl.Fill(data_Set_Symptom,″tb_symptom″);}privatevoidtextBox2_TextChanged(objectsender,System.EventArgse){dataSet_Symptom_Right.Clear();sqlDataAdapter2.SelectCommand.CommandText=″SELECTf_symptom_nameAS症状名称,f_symptom_idAS症状编码FROMtb_symptomwheref_spelllike_+textBox2.Text+″%′ORDERBYf_symptom_name″;sqlDataAdapter2.Fill(dataSet_Symptom_Right,″tb_symptom″);}2.3、症状与疾病的关系,如图14所示。在上一节把症状间的关系维护好,根据症状的层次关系,到它们树状关系的末端,实际上就可以确定是哪些疾病了即通过确定一定的症状后可以做出诊断结论,这和实际的临床诊断是一致的。因为本系统的症状间关系是经过专家论证的,因此通过本系统的使用可以令使用者在面对具体症状时可以知道下一步该如何进行,进而养成良好的临床思维习惯,而不至于胡思乱想,无处下手。症状和疾病的对应关系就在这里设置,同时设置的还有疾病出现的可能性(百分比)。窗口分为四个部分,从左至右,分别是症状列表、症状间关系图、症状所对应疾病以及所有疾病列表。点击左侧症状列表,该症状作为顶级症状,它所包含的症状间关系以树型方式列在中间。双击树形结构的末端节点(只能、必须是末端节点),表示选中该节点,然后从最右侧疾病列表中找到所对应的疾病,双击,及可添加进来。添加进来的疾病列在疾病列表左侧的列表框中。该列表框的下方是该疾病出现百分比的输入框,可以直接输入。完成输入后按下“保存”按钮,数据即被保存。另外两个输入框适用于拼音码输入的。点击左侧症状列表所对应的代码是privatevoiddataGridl_Click(objectsender,System.EventArgse){Stringparent_id,root_node_flag;System.Windows.Forms.DataGridCellselectedCell=dataGrid_Symptom.CurrentCell;objectselectedItem=dataGrid_Symptom[selectedCell.RowNumber,0];StringcellValue=Convert.ToString(selectedltem);global_node_amount=0;TreeNodenewNode=newTreeNode(cellValue);Symptom_Disease_Tree.TopNode.Nodes.Clear();Symptom_Disease_Tree.TopNode.Nodes.Add(newNode);cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+cellValue+″_;dtr=cmd.ExecuteReader();dtr.Read();parent_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_node_flagfromtb_rootwheref_root_id=_+parent_id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()!=true){dtr.Close();return;}root_node_flag=dtr.GetValue(0).ToString();dtr.Close();Global_Node[global_node_amount]=newNode;Global_Node_Flag[global_node_amount]=root_node_flag;global_node_amount++;Generate_Tree_List_recursion(newNode,parent_id,root_node_flag,1);Symptom_Disease_Tree.TopNode.ExpandAll();}privatevoidGenerate_Tree_List_recursion(TreeNodemy_node,stringparent_id,stringroot_node_flag,intlevel){string[]me_id;sgtring[]me_name;string[]me_node_flag;TreeNode[]child_node;inti,total_me;switch(level){case1cmd.CommandText=″select*fromtb_first_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case2cmd.CommandText=″select*fromtb_second_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case3cmd.CommandText=″select*fromtb_third_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case4cmd.CommandText=″select*fromtb_fourth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case5cmd.CommandText=″select*fromtb_fifth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case6cmd.CommandText=″select*fromtb_sixth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case7cmd.CommandText=″select*fromtb_seventh_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case8cmd.CommandText=″select*fromtb_eighth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case9cmd.CommandText=″select*fromtb_nineth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;case10cmd.CommandText=″select*fromtb_tenth_childwheref_parent_node=_+root_node_flag+_andf_parent_id=_+parent_id+″_;break;defaultreturn;}dtr=cmd.ExecuteReader();i=0;while(dtr.Read()==true)i++;dtr.Close();if(i==0)return;//nomorechildnodetotal_me=i;me_id=newstring[total_me];me_name=newstring[total_me];me_node_flag=newstring[total_me];child_node=newTreeNode[total_me];dtr=cmd.ExecuteReader();i=0;while(dtr.Read()==true){me_id[i]=dtr.GetValue(1).ToString();me_node_flag[i]=dtr.GetValue(2).ToString();i++;}dtr.Close();for(i=0;i<total_me;i++){cmd.CommandText=″selectf_symptom_namefromtb_symptomwheref_symptom_id=_+me_id[i]+″_;dtr=cmd.ExecuteReader();dtr.Read();me_name[i]=dtr.GetValue(0).ToString();dtr.Close();}for(i=0;i<total_me;i++){child_node[i]=newTreeNode(me_name[i]);Global_Node[global_node_amount]=child_node[i];Global_Node_Flag[global_node_amount]=me_node_flag[i];global_node_amount++;my_node.Nodes.Add(child_node[i]);}for(i=0;i<total_me;i++){Generate_Tree_List_recursion(child_node[i],me_id[i],me_node_flag[i],level+1);}}双击树形结构的末端节点对应的代码是privatevoidSymptom_Disease_Tree_DoubleClick(objectsender,System.EyentArgse){inti,total_disease;string[]disease_id;listBox1.Items.Clear();TreeNodemy_node=Symptom_Disease_Tree.SelectedNode;i=0;while(Global_Node[i]!=my_node&&i<global_node_amount)i++;if(i==global_node_amount)return;cmd.CommandText=″selectf_disease_idfromtb_symptom_vs_diseasewheref_node_flag=_+Global_Node_Flag[i]+″_;dtr=cmd.ExecuteReader();i=0;while(dtr.Read()==true)i++;dtr.Close();total_disease=i;disease_id=newstring[i];dtr=cmd.ExecuteReader();i=0;while(dtr.Read()==true){disease_id[i]=dtr.GetValue(0).ToString();i++;}dtr.Close();for(i=0;i<total_disease;i++){cmd.CommandText=″selectf_disease_namefromtb_diseasewheref_disease_id=_+disease_id[i]+″_;dtr=cmd.ExecuteReader();if(dtr.Read()==true)listBox1.Items.Add(dtr.GetValue(0).ToString());dtr.Close();}}双击右侧疾病列表对应的代码是privatevoiddataGrid2_DoubleClick(objectsender,System.EventArgse){inti;TreeNodemy_node=Symptom_Disease_Tree.SelectedNode;if(my_node==null)retum;i=0;while(my_node!=Global_Node[i]&&i<global_node_amount)i++;if(i==global_node_amount){MessageBox.Show(″系统提示″,″所选节点不对,请重新选择!″);return;}System.Windows.Forms.DataGridCellselectedCell=dataGrid2.CurrentCell;objectselectedItem=dataGrid2[selectedCell.RowNumber,0];StringcellValue=Convert.ToString(selectedItem);listBox1.Items.Add(cellValue);}疾病百分比输入框输入时对应代码是privatevoidtextBox3_TextChanged(objectsender,System.EventArgse){if(textBox3.Text==″″)contribute[listBox1.SelectedIndex]=0;elsecontribute[listBox1.SelectedIndex]=Convert.ToInt32(textBox3.Text);}保存按钮对应的代码是privatevoidbuttonl_Click(objectsendef,System.EventArgse){inti,cur_pos;stringdisease_id,disease_name;TreeNodemy_node=Symptom_Disease_Tree.SelectedNode;i=0;while(Global_Node[i]!=my_node&&i<global_node_amount)i++;if(i==global_node_amount)return;cur_pos=i;cmd.CommandText=″deletefromtb_symptom_vs_diseasewheref_node_flag=_+Global_Node_Flag[cur_pos]+″_;cmd.ExecuteNonQuery();for(i=0;i<listBox1.Items.Count;i++){disease_name=listBox1.Items[i]ToString();cmd.CommandText=″selectf_disease_idfromtb_diseasewheref_disease_name=_+disease_name+″_;dtr=cmd.ExecuteReader();dtr.Read();disease_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″insertintotb_symptom_vs_disease(f_disease_id,f_node_flag,f_symptom_id)values(_+disease_id+_,_+Global_Node_Flag[cur_pos]+_′0′)″;cmd.ExecuteNonQuery();if(contribute[i]>0){cmd.CommandText=″deletefromtb_symptom_contributewheref_node_flag=_+Global_Node_Flag[cur_pos].ToString()+_andf_diseaseid=_+disease_id+″_;cmd.ExecuteNonQuery();cmd.CommandText=″insertintotb_symptom_contribute(f_disease_id,f_node_flag,f_contribute)values(_+disease_id+_,_+Global_Node_Flag[cur_pos]+_,_+contribute[i].ToString()+_)″;cmd.ExecuteNonQuery();textBox3.Text=″″;}}}其中Contribute变量用于记录各疾病的百分比数值。2.4、疾病信息维护疾病信息维护包括疾病名称以及疾病详细信息维护。疾病名称维护和症状名称维护类似,原理是一样的,只不过在后台操作的是疾病名称表,前端显示的也是疾病名称表。如图15所示(疾病对应拼音码的产生和症状是一样的)后台代码是privatevoidbutton2_Click(objectsender,System.EventArgse){if(textBox1.Text==″″)return;StringDisease_id;cmd.CommandText=″select*fromtb_diseasewheref_disease_name=_+textBox1.Text+″_;dtr=cmd.ExecuteReader();if(dtr.Read()==true){dtr.Close();MessageBox.Show(″系统已经包括该疾病″);textBox1.Text=″″;return;}elsedtr.Close();cmd.CommandText=″selectf_disease_idfromtb_flag_table″;dtr=cmd.ExecuteReader();dtr.Read();Disease_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″updatetb_flag_tablesetf_disease_id=f_diseasr_id+1″;cmd.ExecuteNonQuery();cmd.CommandText=″insertintotb_disease(f_disease_id,f_disease_name)values(_+Disease_id+_,_+textBox1.Text+_)″;cmd.ExecuteNonQuery();cmd.Dispose();dataSet_DiSease.Clear();sqlDataAdapterl.Fill(dataSet_DiSease,″tb_disease″);dataGrid_Disease.SetDataBinding(dataSet_DiSease,″tb_disease″);textBox1.Text=″″;textBox1.Focus();}privatevoiddataGrid_Disease_DoubleClick(objectsender,System.EventArgse){System.Windows.Forms.DataGriddatagrid=(System.Windows.Forms.DataGrid)sender;System.Windows.Forms.DataGridCellselectedCell=datagrid.CurrentCell;objectselectedItem=datagrid[selectedCell.RowNumber,1];MessageBoxButtonsbuttons=MessageBoxButtons.YesNo;DialogResultresult;result=MessageBox.Show(this,″确实要删除″+datagrid[selectedCell.RowNumber,0]+″吗?″,″系统提示″,buttons,MessageBoxlcon.Question,MessageBoxDefaultButton.Buttonl,MessageBoxOptions.RightAlign);if(result==DialogResult.No)return;StringcellValue=Convert.ToString(selectedItem);cmd.CommandText=″deletefromtb_Diseasewheref_Disease_id=_+cellValue+″_;cmd.ExecuteNonQuery();cmd.Dispose();dataSet_DiSease.Clear();sqlDataAdapterl.Fill(dataSet_DiSease,″tb_disease″);dataGrid_Disease.SetDataBinding(dataSet_DiSease,″tb_disease″);}privatevoiddataGrid_Disease_Click(objectsender,System.EventArgse){System.Windows.Forms.DataGriddatagrid=(System.Windows.Forms.DataGrid)sender;System.Windows.Forms.DataGridCellselectedCell=datagrid.CurrentCell;objectselectedItem=datagrid[selectedCell.RowNumber,1];selected_disease_id=Convert.ToString(selectedItem);selectedItem=datagrid[selectedCell.RowNumber,0];textBox2.Text=Convert.ToString(selectedItem);}privatevoidbuttonl_Click_1(objectsender,System.EventArgse){if(selected_disease_id==″″){MessageBox.Show(″请先选择某一疾病″);return;}cmd.CommandText=″updatetb_diseasesetf_disease_name=_+textBox2.Text+_wheref_disease_id=_+selected_disease_id+″_;cmd.ExecuteNonQuery();dataSet_DiSease.Clear();sqlDataAdapterl.Fill(dataSet_DiSease,″tb_disease″);dataGrid_Disease.SetDataBinding(dataSet_DiSease,″tb_disease″);selected_disease_id=″″;}privatevoidtextBox3_TextChanged(objectsender,System.EventArgse){dataSet_DiSease.Clear();sqlDataAdapterl.SelectCommand.CommandText=″SELECTf_disease_nameAS疾病名称,f_disease_idAS编码FROMtb_diseasewheref_spelllike_+textBox3.Text+″%′ORDERBYf_disease_name″;sqlDataAdapterl.Fill(dataSet_DiSease,″tb_disease″);}2.5、疾病详细信息,如图16所示。分为基本知识、病因、诊断、症状、治疗,其中治疗信息里包含有药物用法和剂量。后台代码是2.6、系统开发团队,界面如图17所示,详细记录系统开发团队的情况。2.7、药品、实验室检查、广告信息维护这三类信息只需要在资料收集完整后输入系统即可,程序操作原理都是一致的,不再详细描述。这里只给出结构及关系,如图18所示。3、智能型版本数据生成实际上是一段运行中智能型设备上的程序。通过网络连接到台式机,下载数据,同时生成智能型设备数据。目前本系统以MsSQLServerCE(但不限于)作为智能型设备的数据引擎。代码如下privatevoidbutton_Delete_Click(objectsender,System.EventArgse){if(radio_basic.Checked==true){cmd.CommandText=″deletefromtb_disease_basicwheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}if(radio_Physis.Checked==true){cmd.CommandText=″deletefromtb_physicwheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}if(radio_Symptom.Checked==true){cmd.CommandText=″deletefromtb_disease_symptomwheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}if(radio_Diagnosis.Checked==true){cmd.CommandText=″deletefromtb_diagnosiswheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}if(radio_Treatment.Checked==true){cmd.CommandText=″deletefromtb_treatmentwheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}radio_basic.Checked=true;cmd.CommandText=″selectf_disease_basic,f_idfromtb_disease_basicwheref_disease_id=_+Global_Disease_Id+″_;dtr=cmd.ExecuteReader();listBox1.Items.Clear();dtr.Read();textBox1.Text=dtr.GetValue(0).ToString();listBox1.Items.Add(dtr.GetValue(0).ToString());Global_Detail_Id=dtr.GetValue(1).ToString();while(dtr.Read()==true)listBox1.Items.Add(dtr.GetValue(0).ToString());dtr.Close();}privatevoidbutton_Save_Click(objectsender,System.EventArgse){if(textBox1.Text==″″)return;Stringstr=textBox1.Text;if(radio_basic.Checked==true){cmd.CommandText=″selectf_idfromtb_disease_basicwheref_disease_id=_+Global_Detail_Id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()==true){dtr.Close();cmd.CommandText=″updatetb_disease_basicsetf_disease_basic=_+str+_wheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}else{dtr.Close();cmd.CommandText=″insertintotb_disease_basic(f_disease_id,f_disease_basic)values(_+Global_Disease_Id+_,_+str+_)″;cmd.ExecuteNonQuery();}dtr.Close();}if(radio_Physis.Checked==true){cmd.CommandText=″selectf_idfromtb_physicwheref_id=_+Global_Detail_Id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()==true){dtr.Close();cmd.CommandText=″updatetb_physicsetf_physic=_+str+_wheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}else{dtr.Close();cmd.CommandText=″insertintotb_physic(f_disease_id,f_physic)values(_+Global_Disease_Id+_,_+str+_)″;cmd.ExecuteNonQuery();}dtr.Close();}if(radio_Symptom.Checked==true){cmd.CommandText=″selectf_idfromtb_disease_symptomwheref_id=_+Global_Detail_Id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()==true){dtr.Close();cmd.CommandText=″updatetb_disease_symptomsetf_disease_symptom=_+str+_wheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}else{dtr.Close();cmd.CommandText=″insertintotb_disease_symptom(f_disease_id,f_disease_symptom)values(_+Global_Disease_Id+_,_+str+_)″;cmd.ExecuteNonQuery();}dtr.Close();}if(radio_Diagnosis.Checked==true){cmd.CommandText=″selectf_idfromtb_diagnosiswheref_id=_+Global_Detail_Id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()==true){dtr.Close();cmd.CommandText==″updatetb_diagnosissetf_diagnosis=_+str+_wheref_id=_+Global_Detsail_Id+″_;cmd.ExecuteNonQuery();}else{dtr.Close();cmd.CommandText=″insertintotb_diagnosis(f_disease_id,f_diagnosis)values(_+Global_Disease_Id+_,_+str+_)″;cmd.ExecuteNonQuery();}dtr.Close();}if(radio_Treatment.Checked==true){cmd.CommandText=″selectf_idfromtb_treatmentwheref_id=_+Global_Detail_Id+″″;dtr=cmd.ExecuteReader();if(dtr.Read()==true){dtr.Close();cmd.CommandText=″updatetb_treatmentsetf_treatment==_+str+_wheref_id=_+Global_Detail_Id+″_;cmd.ExecuteNonQuery();}else{dtr.Close();cmd.CommandText=″insertintotb_treatment(f_disease_id,f_treatment)values(_+Global_Disease_Id+_,_+str+_)″;cmd.ExecuteNonQuery();}dtr.Close();}radio_basic.Checked=true;cmd.CommandText=″selectf_disease_basic,f_idfromtb_disease_basicwheref_disease_id=_+Global_Disease_Id+″_;dtr=cmd.ExecuteReader();listBox1.Items.Clear();dtr.Read();textBox1.Text=dtr.GetValue(0).ToString();listBox1.Items.Add(dtr.GetValue(0).ToString());Global_Detail_Id=dtr.GetValue(1).ToString();while(dtr.Read()==ue)listBox1.Items.Add(dtr.GetValue(0).ToString());dtr.Close();}privatevoidlistBox1_SelectedIndexChanged(objectsender,System.EventArgse){stringdetail_name;detail_name=listBox1.Items[listBox1.SelectedIndex].ToString();if(radio_basic.Checked==true){cmd.CommandText=″selectf_idfromtb_disease_basicwheref_disease_basic=_+detail_name+″_;}if(radio_Physis.Checked==true){cmd.CommandText=″selectf_idfromtb_physicwheref_physic=_+detail_name+″_;}if(radio_Symptom.Checked==true){cmd.CommandText=″selectf_idfromtb_diagnosiswheref_diagnosis=_+detail_name+″_;}if(radio_Diagnosis.Checked==true){cmd.CommandText=″selectf_idfromtb_disease_symptomwheref_diseasesymptom=_+detail_name+″_;}if(radio_Treatment.Checked==true){cmd.CommandText=″selectf_idfromtb_treatmentwheref_treatment=_+detail_name+″_;}dtr=cmd.ExecuteReader();dtr.Read();Global_Disease_Id=dtr.GetValue(0).ToString();dtr.Close();}privatevoidbuttonl_Click(objectsender,System.EventArgse){System.Data.SqlClient.SqlConnectioncnn;System.Data.SqlClient.SqlCommandcmd;System.Data.SqlClient.SqlDataReaderdtr;System.Dara.SqlServerCe.SqlCeConnectioncecnn;System.Data.SqlServerCe.SqlCeCommandcecmd;System.Data.SqlServerCe.SqlCeEnginedbEngine;Stringremote_cnnstr,local_cnnstr,strFile,cmd_str;StreamReadersr=newStreamReader(@″\programfiles\TransferData2PDA\pda.ini″);remote_cnnstr=sr.ReadLine();sr.Close();strFile=@″\programfiles\TransferData2PDA\pda.SDF″;local_canstr=″DataSource=″+@″\programfiles\TransferData2PDA\pda.SDF″;if(File.Exists(strFile))File.Delete(strFile);dbEngine=newSqlCeEngine();dbEngine.LocalConneotionString=local_cnnstr;try{dbEngine.CreateDatabase();}catch(SqlCeExceptionexSQL){MessageBox.Show(″Unabletocreatedatabaseat″+strFile+″Reason;″+exSQL.Errors.Message);}finally{dbEngine.Dispose();}cnn=newSqlConnection();cnn.ConnectionString=remote_cnnstr;cnn.Open();cmd=newSqlCommand(″″,cnn);cecnn=newSqlCeConnection();cecnn.ConnectionString=local_cnnstr;cecnn.Open();cecmd=newSqlCeCommand(″″,cecnn);cecmd.CommandText=″CREATETABLEtb_advertisement(f_idint,f_advertisementnvarchar(255))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_disease(f_disease_idint,f_disease_namenvarchar(200),f_spellnvarchar(6))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_disease_basic(f_idint,f_disease_idint,f_disease_basicnvarchar(255))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_physic(f_idint,f_disease_idint,f_physicnvarchar(255))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_diagnosis(f_idint,f_disease_idint,f_diagnosisnvarchar(255))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_disease_symptom(f_idint,f_disease_idint,f_disease_symptomnvarchar(255))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_treatment(f_idint,f_disease_idint,f_treatmentnvarchar(255))″;cecmd.ExecuteNonQuery();ceemd.CommandText=″CREATETABLEtb_root(f_root_idint,f_node_flagint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_symptom(f_symptom_idint,f_symptom_namenvarchar(200),f_spellnvarchar(50),f_root_flagnchar(1))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_symptom_vs_disease(f_node_flagint,f_Disease_idint,f_symptom_idint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_developer(f_developer_idint,f_namenvarchar(20),f_orgnvarchar(50),f_resumenvarchar(255))″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_first_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_second_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_third_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_fourth_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_fifth_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_sixth_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_seventh_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_eighth_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_nineth_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cecmd.CommandText=″CREATETABLEtb_tenth_child(f_parent_idint,f_me_idint,f_node_flagint,f_parent_nodeint)″;cecmd.ExecuteNonQuery();cmd.CommandText=″select*fromtb_symptom″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmdstr=″insertintotb_symptom(f_symptom_id,f_symptom_name,f_spell,f_root_flag)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_disease″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_disease(f_disease_id,f_disease_name,f_spell)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_symptom_vs_disease″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_srt=″insertintotb_symptom_vs_disease(f_node_flag,f_Disease_id,f_symptom_id)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_diagnosis″;dtr=cmd.ExecuteReader();while(dtr.Read()==true){cmd_str=″insertintotb_diagnosis(f_id,f_disease_id,f_diagnosis)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_disease_basic″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_disease_basic(f_id,f_disease_id,f_disease_basic)″;cmdstr+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_disease_symptom″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_disease_symptom(f_id,f_disease_id,f_disease_symptom)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_physic″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_physic(f_id,f_disease_id,f_physic)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_treatment″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_treatment(f_id,f_discase_id,f_treatment)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_root″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_root(f_root_id,f_node_flag)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_)″;ceemd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_developer″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_developer(f_developer_id,f_name,f_org,f_resume)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_first_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_first_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_second_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_second_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_third_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_third_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_fourth_child″;dtr=cmd.ExecuteReader();while(dtrRead()){cmd_str=″insertintotb_fourth_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_fifth_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_fifth_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_sixth_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_sixth_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_seventh_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_seventh_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmdstr+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_eighth_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_eighth_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_nineth_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_nineth_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();cmd.CommandText=″select*fromtb_tenth_child″;dtr=cmd.ExecuteReader();while(dtr.Read()){cmd_str=″insertintotb_tenth_child(f_parent_id,f_me_id,f_node_flag,f_parent_node)″;cmd_str+=″values(_+dtr.GetValue(0).ToString()+_,_+dtr.GetValue(1).ToString()+_,_+dtr.GetValue(2).ToString()+_,_+dtr.GetValue(3).ToString()+_)″;cecmd.CommandText=cmd_str;;cecmd.ExecuteNonQuery();}dtr.Close();MessageBox.Show(″Allsuccess!″);cecmd.Dispose();cnn.Close();cecnn.Close();}4、能设备用户运行程序智能设备上运行的程序为本系统最终发行给用户的程序,也就是用户使用的软件。正式发行时会随着目标设备的不同以及系统发行的不同版本而有所不同,因此在本文档中将不给出主程序界面图形示例,仅就原理以及核心代码做详细说明。在智能设备(如PDA、智能手机)上运行的数据库系统(目前使用MSSQLServerCE,但不限于)同时只能有一个数据库联接,因此必须十分小心管理数据库的联接。在打开不同窗口时,需先把已存在的数据库联接断开,然后才能使用新的联接。如下列代码所示privatevoidmenuItem5_Click(objectsender,System.EventArgse){cnn.Close();cnn.Dispose();cmd.Dispose();Medicationmy=newMedication();my.Show();}privatevoidmenuItem7_Click(objectsender,System.EventArgse){cnn.Close();cnn.Dispose();cmd.Dispose();Pathogenymy=newPathogeny();my.Show();}privatevoidmenuItem6_Click(objectsender,System.EventArgse){cnn.Close();cnn.Dispose();cmd.Dispose();Laboratorymy=newLaboratory();my.Show();}同时在任何使用数据库之前,需判断数据库的联接是否有效,若无效需重新联接。如下所示if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″selectf_disease_idfromtb_diseasewheref_disease_name=_+Disease_Name+″_,cnn);}elsecmd.CommandText=″selectf_disease_idfromtb_diseasewheref_disease_name=_+Disease_Name+″_;4.1智能诊断模块系统包括智能诊断模块、疾病模块、药品模块、病原学模块、实验室检查模块、系统说明模块。系统启动后缺省进入智能诊断模块。为此,系统首先定义一些全局变量,做初始化操作,然后等待用户的操作输入。代码如下privateSystem.Data.SqlServerCe.SqlCeConnectioncnn;privateSystem.Data.SqlServerCe.SqlCeCommandcmd;privateSystem.Data.SqlServerCe.SqlCeDataReaderdtr;privateStringlocal_cnnstr;privateintCurrent_Level,Total_Level;privateNavigation_Indicator[]navigation_indicator;privateboolIf_Disease_List;privatestringSelected_Parent_Name;privatestringSelected_Parent_Id;privatestringSelected_Parent_Node_Flag;privatestringSelecting_Node_Flag;privatestring[]CLicked_Name_List;privateintTimer_Indicator;privatevoidForm1_Load(objectsender,System.EventArgse){local_cnnstr=″DataSource=″+@″\programfiles\SmartDoctor\pda.SDF″;cnn=newSqlCeConnection();cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″selectf_symptom_namefromtb_symptomwheref_root_flag=′R′″,cnn);dtr=emd.ExecuteReader();while(dtr.Read()){listBox_Symptom.Items.Add(dtr.GetValue(0).ToString());}dtr.Close();navigation_indicator=newNavigation_Indicator[11];CLicked_Name_List=newstring[11];Current_Level=0;Total_Level=0;for(inti=0;i<11;i++){navigation_indicator[i].me_id=0;navigation_indicator[i].node_flag=0;nayigation_indicator[i].parent_id=0;navigation_indicator[i].parent_node=0;CLicked_Name_List[i]=″″;}If_Disease_List=false;Timer_Indicator=0;}其中listBox_Symptom组件用于显示所有顶级症状,用户可以鼠标点击某个症状,或者在上方的输入框中输入拼音码,快速在众多症状中筛选所需症状。当用户选中某一症状后,系统立即列出该顶级症状对应的一级子节点症状,同时列出所有包含该顶级症状的疾病。这实际上对应医生在诊断时,病人说出一个症状,医生应当立即想到下一个(或几个)应当出现的症状,并且联想出疾病来。在选择过程中有疾病列出,或选择的最后阶段只列出疾病。无论那种情况,只要点击选择疾病,系统自动跳转到显示该疾病的窗口界面。后台代码是privatevoidlistBox_Symptom_SelectedIndexChanged(objectsender,System.EventArgse){if(Total_Level>10)return;//therarenomoredatatobeprocessedif(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″″,cnn);}ListBoxobj=(ListBox)sender;stringcur_symptom_name=obj.SelectedItem.ToString();stringme_id,me_node_flag;if(Total_Level==0){cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+cur_symptom_name+″_;dtr=cmd.ExecuteReader();dtr.Read();me_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_node_flagfromtb_rootwheref_root_id=_+me_id+″_;dtr=cmd.ExecuteReader();if(dtr.Read()){me_node_flag=dtr.GetValue(0).ToString());dtr.Close();FontmyFont=newFont(″宋体″,12,System.Drawing.FontStyle.Regular);listBox_Symptom.Font=myFont;List_All_Children_recursion(me_node_flag,1);navigation_indicator[Current_Level].me_id=Convert.ToInt32(me_id);navigation_indicator[Current_Level].node_flag=Convert.ToInt32(me_node_flag);CLicked_Name_List[Current_Level]=cur_symptom_name;Current_Level++;Total_Level++;Selected_Parent_Name=cur_symptom_name;Selected_Parent_Id=me_id;Selected_Parent_Node_Flag=me_node_flag;Selecting_Node_Flag=me_node_flag;listBox_Disease.Items.Clear();List_All_Diseases_For_This_Node(me_node_flag,Current_Level-1);listBox_Symptom.Size=newSize(240,134);listBox_Disease.Visible=true;}}else{if(!If_Disease_List)//listsymptom{cmd.CommandText=″selectf_symptom_idfromtb_symptomwheref_symptom_name=_+cur_symptom_name+″_;dtr=cmd.ExecuteReader();dtr.Read();me_id=dtr.GetValue(0).ToString();dtr.Close();Set_Cmd_Text_recursion(navigation_indicator[Current_Level-1].me_id,navigation_indicator[Current_Level-1].node_flag,me_id,Current_Level);dtr=cmd.ExecuteReader();if(dtr.Read()){me_node_flag=dtr.GetValue(0).ToString();dtr.Close();List_All_Children_recursion(me_node_flag,Current_Level+1);navigation_indicator[Current_Level].me_id=Convert.ToInt32(me_id);navigation_indicator[Current_Level].node_flag=Convert.ToInt32(me_node_flag);CLicked_Name_List[Current_Level]=cur_symptom_name;if(Current_Level==Total_Level)Total_Level++;Current_Level++;me_node_flag=me_node_flag;listBox_Disease.Items.Clear();List_All_Diseases_For_This_Node(me_node_flag,Current_Level-1);}}else//thislistcontentarealldisease{cnn.Close();cnn.Dispose();cmd.Dispose();Selected_Diseasemy_disease=newSelected_Disease(cur_symptom_name);my_disease.Show();}}}privatevoidList_All_Children_recursion(stringparent_node,intlevel){string[]me_id;inti,total_me;if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″″cnn);}switch(level){case1cmd.CommandText=″selectf_me_id,f_node_flagfromtb_first_childwheref_parent_node=_+parent_node+″_;break;case2cmd.CommandText=″selectf_me_id,f_node_flagfromtb_second_childwheref_parentnode=_+parent_node+″_;break;case3cmd.CommandText=″selectf_me_id,f_node_flagfromtb_third_childwheref_parent_node=_+parent_node+″_;break;case4cmd.CommandText=″selectf_me_id,f_node_flagfromtb_fourth_childwheref_parent_node=_+parent_node+″_;break;case5cmd.CommandText=″selectf_me_id,f_node_flagfromtb_fifth_childwheref_parent_node=_+parent_node+″_;break;case6cmd.CommandText=″selectf_me_id,f_node_flagfromtb_sixth_childwheref_parent_node=_+parent_node+″_;break;case7cmd.CommandText=″selectf_me_id,f_node_flagfromtb_seventh_childwheref_parent_node=_+parent_node+″_;break;case8cmd.CommandText=″selectf_me_id,f_node_flagfromtb_eighth_childwheref_parent_node=_+parent_node+″_;break;case9cmd.CommandText=″selectf_me_id,f_node_flagfromtb_nineth_childwheref_parent_node=_+parent_node+″_;break;case10cmd.CommandText=″selectf_me_id,f_node_flagfromtb_tenth_childwheref_parent_node=_+parent_node+″_;break;defaultcmd.CommandText=″selectf_me_id,f_node_flagfromtb_first_childwheref_parent_node=-1_;break;//forcetoreturnnull,indicatetherwillbedisease}dtr=cmd.ExecuteReader();total_me=0;while(dtr.Read())total_me++;dtr.Close();if(total_me>0)//thefollowinglistaresymptoms{me_id=newstring[total_me];dtr=cmd.ExecuteReader();for(i=0;i<total_me;i++){dtr.Read();me_id[i]=dtr.GetValue(0).ToString();}dtr.Close();listBox_Symptom.Items.Clear();for(i=0;i<total_me;i++){cmd.CommandText=″selectf_symptom_namefromtb_symptomwheref_symptom_id=_+me_id[i]+″_;dtr=cmd.ExecuteReader();dtr.Read();listBox_Symptom.Items.Add(dtr.GetValue(0).ToString());dtr.Close();}}else//listarediseases{If_Disease_List=true;cmd.CommandText=″selecta.f_disease_namefromtb_diseasea,tb_symptom_vs_diseasebwherea.f_disease_id=b.f_disease_idandb.f_node_flag=_+parent_node+″_;dtr=cmd.ExecuteReader();listBox_Symptom.Items.Clear();while(dtr.Read()){listBox_Symptom.Items.Add(dtr.GetValue(0).ToString());}dtr.Close();listBox_Symptom.Size=newSize(240,232);listBox_Disease.Visible=false;}}privatevoidSet_Cmd_Text_recursion(intparent_id,intparent_node,stringme_id,intlevel){if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″″,cnn);}switch(level){case1cmd.CommandText=″selectf_node_flagfromtb_first_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case2cmd.CommandText=″selectf_node_flagfromtb_second_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case3cmd.CommandText=″selectf_node_flagfromtb_third_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case4cmd.CommandText=″selectf_node_flagfromtb_fourth_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case5cmd.CommandText=″selectf_node_flagfromtb_fifth_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case6cmd.CommandText=″selectf_node_flagfromtb_sixth_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case7cmd.CommandText=″selectf_node_flagfromtb_seventh_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″″;break;case8cmd.CommandText=″selectf_node_flagfromtb_eighth_childwheref_parent_id=_+parent_id.ToString()+_andf_parentnode=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case9cmd.CommandText=″selectf_node_flagfromtb_nineth_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;case10cmd.CommandText=″selectf_node_flagfromtb_tenth_childwheref_parent_id=_+parent_id.ToString()+_andf_parent_node=_+parent_node.ToString()+_andf_me_id=_+me_id+″_;break;defaultcmd.CommandText=″selectf_node_flagfromtb_first_childwheref_parent_node=-1_;break;//forcetoreturnnull,indicatetherwillbedisease}}privatevoidList_All_Diseases_For_This_Node(stringnode_flag,intlevel){string[]my_child_node;inti,my_child_total_nodes;switch(level){case0cmd.CommandText=″selectc.f_disease_namefromtb_roota,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_diseaise_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case1cmd.CommandText=″selectc.f_disease_namefromtb_first_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case2cmd.CommandText=″selectc.f_disease_namefromtb_second_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_nodeflag=_+node_flag+″_;break;case3cmd.CommandText=″selectc.f_disease_namefromtb_third_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case4cmd.CommandText=″selectc.f_disease_namefromtb_fourth_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case5cmd.CommandText=″selectc.f_disease_namefromtb_fifth_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case6cmd.CommandText=″selectc.f_disease_namefromtb_sixth_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case7cmd.CommandText=″selectc.f_disease_namefromtb_seventh_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case8cmd.CommandText=″selectc.f_disease_namefromtb_eighth_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;case9cmd.CommandText=″selectc.f_disease_namefromtb_nineth_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.fnode_flag=_+node_flag+″_;break;case10cmd.CommandText=″selectc.f_disease_namefromtb_tenth_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_disease_idanda.f_node_flag=_+node_flag+″_;break;defaultcmd.CommandText=″selectc.f_disease_namefromtb_first_childa,tb_symptom_vs_diseaseb,tb_diseasecwherea.f_node_flag=b.f_node_flagandb.f_disease_id=c.f_diseasre_idanda.f_node_flag=_+node_flag+″_;break;//forcetoreturnnull,indicatetherwillbedisease}dtr=cmd.ExecuteReader();while(dtr.Read())listBox_Disease.Items.Add(dtr.GetValue(0).ToString());dtr.Close();switch(level+1){case1cmd.CommandText=″selectf_node_flagfromtb_first_childwheref_parent_node=_+node_flag+″_;break;case2cmd.CommandText=″selectf_node_flagfromtb_second_childwheref_parent_node=_+node_flag+″_;break;case3cmd.CommandText=″selectf_node_flagfromtb_third_childwheref_parent_node=_+node_flag+″_;break;case4cmd.CommandText=″selectf_node_flagfromtb_fourth_childwheref_parent_node=_+node_flag+″_;break;case5cmd.CommandText=″selectf_node_flagfromtb_fifth_childwheref_parent_node=_+node_flag+″_;break;case6cmd.CommandText=″selectf_node_flagfromtb_sixth_childwheref_parent_node=_+node_flag+″_;break;case7cmd.CommandText=″selectf_node_flagfromtb_seventh_childwheref_parent_node=_+node_flag+″_;break;case8cmd.CommandText=″selectf_node_flagfromtb_eighth_childwheref_parent_node=_+node_flag+″_;break;case9cmd.CommandText=″selectf_node_flagfromtb_nineth_childwheref_parent_node=_+node_flag+″_;break;case10cmd.CommandText=″selectf_node_flagfromtb_tenth_childwheref_parent_node=_+node_flag+″_;break;defaultcmd.CommandText=″selectf_node_flag_fromtb_first_childwheref_parent_node=-1_;break;//forcetoreturnnull,indicatetherwillbedisease}dtr=cmd.ExecuteReader();my_child_total_nodes=0;while(dtr.Read())my_child_total_nodes++;dtr.Close();if(my_child_total_nodes==0)return;my_child_node=newstring[my_child_total_nodes];dtr=cmd.ExecuteReader();i=0;while(dtr.Read()){my_child_node[i]=dtr.GetValue(0).ToString();i++;}dtr.Close();for(i=0;i<my_child_total_nodes;i++)List_All_Diseases_For_This_Node(my_child_node[i],level+1);}输入拼音码后,系统的后台动作对应代码如下(以后涉及拼音码的的操作均类似,不再一一列出)privatevoidtextBox_Spell_TextChanged(objectsender,System.EventArgse){if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();}if(Total_Level==0){cmd.CommandText=″selectf_symptom_namefromtb_symptomwheref_root_flag=′R′andf_spelllike_+textBox_Spell.Text+″%′orf_symptom_namelike_+textBox_Spell.Text+″%_;dtr=cmd.ExecuteReader();listBox_Symptom.Items.Clear();while(dtr.Read()){listBox_Symptom.Items.Add(dtr.GetValue(0).ToString());}dtr.Close();}}当次级症状出现后,若医生还不能确定诊断结论,他可以继续选择症状,系统继续显示下一级症状,疾病列表的内容因症状的增多而减少。当医生选择到最后一级症状时,系统将只列对应疾病,这些疾病出现的百分比一并列出。在选择的过程中,医生随时可以退回到上一级或返回本级以及直接退回到顶级症状,代码如下privatevoidtoolBar1_ButtonClick(objectsender,System.Windows.Forms.ToolBarButtonClickEventArgse){stringgrand_node_flag;FontmyFont;inti;if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″″,cnn);}switch(toolBarl.Buttons.IndexOf(e.Button)){case0://returntothetopmostlevelif(Current_Level==0){Current_Level=0;Total_Level=0;If_Disease_List=false;myFont=newFont(″宋体″,9,System.Drawing.FontStyle.Regular);listBox_Symptom.Font=myFont;Selected_Parent_Name=″″;Selected_Parent_Id=″″;Selected_Parent_Node_Flag=″″;statusBarl.Text=″″;for(i=0;i<Current_Level;i++)CLicked_Name_List[i]=″″;listBox_Disease.Items.Ciear();listBox_Symptom.Size=newSize(240,232);listBox_Disease.Visible=false;break;}cmd.CommandText=″selectf_symptom_namefromtb_symptom″;dtr=cmd.ExecuteReade();listBox_Symptom.Items.Clear();while(dtr.Read()){listBox_Symptom.Items.Add(dtr.GetValue(0).ToString());}dtr.Close();If_Disease_List=fatse;Current_Level=0;Total_Level=0;myFont=newFont(″宋体″,9,System.Drawing.FontStyle.Regular);listBox_Symptom.Font=myFont;Selected_Parent_Name=″″;Selected_Parent_Id=″_;Selected_Parent_Node_Flag=″″;statusBarl.Text=″″;for(i=0;i<Current_Level;i++)CLicked_Name_List[i]=″″;listBox_Disease.Items.Clear();listBox_Symptom.Size=newSize(240,232);listBox_Disease.Visible=false;break;case1://returntoformerlevelIf_Disease_List=false;if(Current_Level==0){Current_Level=0;Total_Level=0;myFont=newFont(″宋体″,9,System.Drawing.FontStyle.Regular);listBox_Symptom.Font=myFont;Selected_Parent_Name=″″;Selected_Parent_Id=″″;Selected_Parent_Node_Flag=″″;statusBarl.Text=″″;for(i=0;i<Current_Level;i++)CLicked_Name_List[i]=″″;listBox_Disease.Items.Clear();listBox_Symptom.Size=newSize(240,232);listBox_Disease.Visible=false;break;}elseif(Current_Level<=1)//directlyreturntotopmostlevel{cmd.CommandText=″selectf_symptom_namefromtb_symptom″;dtr=cmd.ExecuteReader();listBox_Symptom.Items.Clear();while(dtr.Read()){listBox_Symptom.Items.Add(dtr.GetValue(0).ToString());}dtrClose();Current_Level=0;Total_Level=0;listBox_Disease.Items.Clear();listBox_Symptom.Size=newSize(240,232);listBox_Disease.Visible=false;}else{grand_node_fiag=Convert.ToString(navigation_indicator[Current_Level-2].node_flag);List_All_Children_recursion(grand_node_flag,Current_Level-1);Current_Level--;listBox_Disease.Items.Clear();List_All_Diseases_For_This_Node(navigation_indicator[Current_Level].node_flag.ToString(),Current_Level);listBox_Symptom.Size=newSize(240,134);listBox_Disease.Visible=true;}break;case2://gotonextlevelif(Current_Level<Total_Level){grand_node_fiag=Convert.ToString(navigation_indicator[Current_Level].node_flag);List_All_Children_recursion(grand_node_fiag,Current_Level+1);Current_Level++;listBox_Disease.Items.Clear();List_All_Diseases_For_This_Node(nayigation_indicator[Current_Level].node_flag.ToString(),Current_Level);}break;case3cnn.Close();cnn.Dispose();cmd.Dispose();View_Search_Routormy_routor=newView_Search_Routor(Selected_Parent_Name,Selected_Parent_Id,Selected_Parent_Node_Flag,Selecting_Node_Flag);my_routor.Show();break;}}在选择的过程中,系统在下方状态条上随时显示用户所选择的症状列表,从顶级到当前级别滚动显示。代码如下privatevoidtimerl_Tick(objectsender,System.EventArgse){stringtmp_str;intstrLength;tmp_str=″″;for(inti=0;i<Current_Level;i++)tmp_str=″*″+CLieked_Name_List[i];strLength=tmp_str.Length;if(Timer_Indicator>strLength)Timer_Indicator=0;statusBarl.Text=tnp_str.Substring(Timer_Indicator);Timer_Indicator++;}若用户选择某疾病,则系统自动进入该疾病信息显示窗口,在该窗口系统缺省显示该疾病的基本信息,然后根据用户选择显示该疾病的病因、诊断方法、症状以及治疗方法。代码如下privatevoidSelected_Disease_Load(objectsender,System.EventArgse){stringdisease_id;local_cnnstr=″DataSource=″+@″\programfiles\SmartDoctor\pda.SDF″;cnn=newSqlCeConnection();cnn.ConnectionString=local_cnnstr;cnn.Open();try{cmd=newSqlCeCommand(″selectf_disease_idfromtb_diseasewheref_disease_name=_+Disease_Name+″_,cnn);}catch(SqlCeExceptionexSQL){MessageBox.Show(exSQL.Errors.Message);}dtr=cmd.ExecuteReader();dtr.Read();disease_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_disease_basicfromtb_disease_basicwheref_disease_id=_+disease_id+″_;dtr=cmd.ExecuteReader();textBox1.Text=″″;while(dtr.Read())textBox1.Text+=textBox1.Text+dtr.GetValue(0).ToString();dtr.Close();comboBox1.SelectedIndex=0;labell.Text=Disease_Name;}privatevoidcomboBox1_SelectedIndexChanged(objectsender,System.EventArgse){stringdisease_id;if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″selectf_disease_idfromtb_diseasewheref_disease_name=_+Disease_Name+″_,cnn);}elsecmd.CommandText=″selectf_disease_idfromtb_diseasewheref_disease_name=_+Disease_Name+″_;dtr=cmd.ExecuteReader();dtr.Read();disease_id=dtr.GetValue(0).ToString();dtr.Close();switch(comboBox1.SelectedIndex){case0cmd.CommandText=″selectf_disease_basicfromtb_disease_basicwheref_disease_id=_+disease_id+″_;break;case1cmd.CommandText=″selectf_physicfromtb_physicwheref_disease_id=_+disease_id+″_;break;case2cmd.CommandText=″selectf_diagnosisfromtb_diagnosiswheref_disease_id=_+disease_id+″_;break;case3cmd.CommandText=″selectf_disease_symptomfromtb_disease_symptomwheref_disease_id=_+disease_id+″_;break;case4cmd.CommandText=″selectf_treatmentfromtb_treatmentwheref_disease_id=_+disease_id+″_;break;defaultreturn;}dtr=cmd.ExecuteReader();textBox1.Text=″″;while(dtr.Read())textBox1.Text+=textBox1.Text+dtr.GetValue(0).ToString();dtr.Close();}对于选择到末端症状节所列出的疾病以及百分比,用户可以修改这些信息。用户可以修改百分比的具体数值,也可以删除某疾病。这样就把用户(医生)自己的医疗实践经验集成进来,体现了系统的自学习功能。如果用户用心维护这些数据,最终运行于该用户智能设备上的系统将完全体现该用户的医疗技术水平,并且按照他的实践经验具备相当的确定性结果。后台自学习的代码如下4.2疾病模块系统可以根据用户在系统菜单的选择而直接进入疾病信息窗口。在这里所有的疾病都可查看,而不像上节所讲的只能查看所选定的疾病。为快速找到某个疾病,用户可以在上方的拼音码输入框里输入拼音码来快速查找。同样的,系统缺省显示该疾病的基本信息,然后根据用户选择显示该疾病的病因、诊断方法、症状以及治疗方法。代码如下privatevoidDisease_System_Load(objectsender,System.EventArgse){stringdisease_name,disease_id;local_cnnstr=″DataSource=″+@″\programfiles\SmartDoctor\pda.SDF″;cnn=newSqlCeConnection();cnn.ConnectionString=local_cnnstr;cnn.Open();try{cmd=newSqlCeCommand(″selectf_disease_namefromtb_diseaseorderbyf_disease_name″,cnn);}catch(SqlCeExceptionexSQL){MessageBox.Show(exSQL.Errors.Message);}comboBox_Disease.Items.Clear();dtr=cmd.ExecuteReader();while(dtr.Read())comboBox_Disease.Items.Add(dtr.GetValue(0).ToString());dtr.Close();comboBox_Disease.SelectedIndex=0;disease_name=comboBox_Disease.Items.ToString();cmd.CommandText=″selectf_disease_idfromtb_diseasewheref_disease_name=_+disease_name+″_;dtr=cmd.ExecuteReader();dtr.Read();disease_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_disease_basicfromtb_disease_basicwheref_disease_id=_+disease_id+″_;dtr=cmd.ExecuteReader();if(dtr.Read())textBox2.Text=dtr.GetValue(0).ToString();dtr.Close();comboBox2.SelectedIndex=0;}privatevoidtextBox1_TextChanged(objectsender,System.EventArgse){stringdisease_name,disease_id;if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″selectf_disease_namefromtb_diseasewheref_spelllike_+textBox1.Text+″%′orf_disease_namelike_+textBox1.Text+″%_,cnn);}elsecmd.CommandText=″selectf_disease_namefromtb_diseasewheref_spelllike_+textBox1.Text+″%′orf_disease_namelike_+textBox1.Text+″%_;dtr=cmd.ExecuteReader();comboBox_Disease.Items.Clear();while(dtr.Read())comboBox_Disease.Items.Add(dtr.GetValue(0).ToString());dtr.Close();if(comboBox_Disease.Items.Count>0){comboBox_Disease.SelectedIndex=0;disease_name=comboBox_Disease.Items.ToString();cmd.CommandText=″selectf_disease_idfromtb_diseasewheref_disease_name=_+disease_name+″_;dtr=cmd.ExecuteReader();dtr.Read();disease_id=dtr.GetValue(0).ToString();dtr.Close();cmd.CommandText=″selectf_disease_basicfromtb_disease_basicwheref_disease_id=_+disease_id+″_;dtr=cmd.ExecuteReader();if(dtr.Read())textBox2.Text=dtr.GetValue(0).ToString();dtr.Close();}}privatevoidDisease_System_Closed(objectsender,System.EventArgse){cnn.Close();cnn.Dispose();cmd.Dispose();}privatevoidDisease_System_LostFocus(objectsender,System.EventArgse){cnn.Close();cnn.Dispose();cmd.Dispose();}privatevoidtextBox1_LostFocus(objectsender,System.EventArhse){inputPanel1.Enabled=false;}privatevoidtextBox1_GotFocus(objectsender,System.EventArgse){inputPanel1.Enabled=true;}privatevoidcomboBox2_SelectedIndexChanged(objectsender,System.EventArgse){stringdisease_name,disease_id;disease_name=comboBox_Disease.Items[comboBox_Disease.SelectedIndex].ToString();if(cnn.State==ConnectionState.Closed){cnn.ConnectionString=local_cnnstr;cnn.Open();cmd=newSqlCeCommand(″selectf_disease_idfromtb_diseasewheref_disease_name=_+disease_name+″_cnn);}elsecmd.CommandText=″selectf_disease_idfromtb_diseasewheref_disease_name=_+disease_name+″_;dtr=cmd.ExecuteReader();dtr.Read();disease_id=dtr.GetValue(0).ToString();dtr.Close();switch(comboBox2.SelectedIndex){case0cmd.CommandText=″selectf_disease_basicfromtb_disease_basicwheref_disease_id=_+disease_id+″_;break;case1cmd.CommandText=″selectf_physicfromtb_physicwheref_disease_id=_+disease_id+″_;break;case2cmd.CommandText=″selectf_diagnosisfromtb_diagnosiswheref_disease_id=_+disease_id+″_;break;case3cmd.CommandText=″selectf_disease_symptomfromtb_disease_symptomwheref_disease_id=_+disease_id+″_;break;case4cmd.CommandText=″selectf_treatmentfromtb_treatmentwheref_disease_id=_+disease_id+″_;break;defaultreturn;}dtr=cmd.ExecuteReader();textBox2.Text=″″;while(dtr.Read())textBox2.Text+=textBox2.Text+dtr.GetValue(0).ToStrinh();dtr.Close();}4.3药品、病原学、实验室检查、广告这几类信息和疾病的处理方法是一样的,所不同的只是后台数据库表的不同,代码是非常类似的。这里是列出它们分别对应的数据库表●药品tb_medication,tb_medication_detail●病原学tb_physic●实验室检查tb_laboratory●广告tb_advertisement5系统说明对应系统菜单“关于系统”,详细列出参与本系统开发的医学专家,同时就产品版权问题做声明。代码如下privatevoidAbout_Load(objectsender,System.EventArgse){local_cnnstr=″DataSource=″+@″\programfiles\SmartDoctor\pda.SDF″;cnn=newSqlCeConnection();cnn.ConnectionString=local_cnnstr;cnn.Open();try{cmd=newSqlCeCommand(″select*fromtb_developer″,cnn);}catch(SqlCeExceptionexSQL){MessageBox.Show(exSQL.Errors.Message);}dtr=cmd.ExecuteReader();while(dtr.Read()){textBox1.Text+=dtr.GetValue(1).ToString()+″\x0d″+″\x0a″;textBox1.Text+=dtr.GetValue(2).ToString()+″\x0d″+″\x0a″;textBox1.Text+=dtr.GetValue(3).ToString()+″\x0d″+″\x0a″;}dtr.Close();}privatevoidAbout_Closing(objectsender,System.ComponentModel.CancelEventArgse){cnn.Close();cmd.Dispose();}privatevoidAbout_LostFocus(objectsender,System.EventArgse){cnn.Close();cmd.Dispose();}4.5安装程序、发行程序采用标准软件工程方法,不属于产品的一部分,任何一种产品都采用相同的方式进行,在此不再赘述。6升级程序系统升级分为两个部分系统程序的升级和数据的升级。用户在升级时升级程序会自动提示用户升级的形式。●系统程序升级这是系统功能、用户界面、使用(操作)方式的升级。用户只下在升级模块,运行它即可。●数据升级医学是门不断发展的科学,疾病的病因、治疗、诊断、药品、实验室检查等会不断的发展,因此本系统后台数据也要不断升级以反映这种变化。在数据升级时系统会充分考虑用户(医生)自己对数据的修改(系统的自学习功能),这些数据是指那些疾病出现的百分比以及在症状树型关系末端节点所对应的疾病。升级一开始系统就提示用户选择是完全覆盖现有数据还是保留现有数据。若保留现有数据,则系统遇到这些数据时将不作修改。若选择覆盖,则用升级数据替换现有数据,同时把用户修改的数据以文本文件的形式保存以备参考。程序运行流程如图19所示。权利要求1.本系统是一种运行于手持智能设备的临床医学智能辅助诊断系统软件,根据患者症状间的层次关系查询得到对应的症状列表,同时给出疾病出现的可能性(百分比)。还把症状、疾病、病原学、实验室检查、药物、药厂建立了交叉对应关系,相互之间都有关联。2.根据权利要求1所述的软件系统,症状间的关系将以层次型的树状关系给出。当患者主述或检查出某症状后,系统能自动给出该症状关联的下一级症状,从而提示医生作进一步检查或判断。3.根据权利要求1所述的软件系统,当经过几级的症状判断或检查后,系统给出疾病列表,提示医生在这些疾病中选择,从而做出最终诊断结论。(本系统不作诊断结论)。4.根据权利要求1所述的软件系统,疾病列出后还要列出该疾病出现的可能性,以百分比的数值形式给出。表征患者出现这些症状时某中疾病出现的可能性,辅助医生作最后的诊断结论。5.根据权利要求1所述的软件,本系统建立症状、疾病、病原学、实验室检查、药物、药厂之间的交叉对应关系。即从症状可以查出疾病信息;从疾病可以查出症状、病原学、药物、药厂、实验室检查的信息;从病原学可以查出症状、疾病、药物、药厂信息;从药物可以查出疾病、病原学、药厂信息;从药厂可以查出药物信息;6.根据权利要求1所述的软件,本系统运行于手持智能设备上,这些设备包括但不限于PDA、智能手机等。全文摘要本系统是一种运行于手持智能设备的临床医学智能辅助诊断系统软件针对大量的漏诊和误诊现象,本系统以症状为线索,以层次型的树状关系给出症状间的关系。根据某症状系统能自动给出该症状关联的下一级症状,从而提示医生作进一步检查或判断。当经过儿级的症状判断或检查后,系统给出疾病列表,提示医生在这些疾病中选择,从而做出最终诊断结论。疾病列出后还要列出该疾病出现的可能性,以百分比的数值形式给出。表征患者出现这些症状时某中疾病出现的可能性,辅助医生作最后的诊断结论。针对海量医学知识,本系统把症状、疾病、病原学、实验室检查、药品有效地组织在一起,相互可以交叉查询,方便医生查询任意信息。通过药品和药厂的交叉联接关系,本系统成为一个药品尤其是处方药的广告平台。文档编号G06Q90/00GK101023884SQ20061000816公开日2007年8月29日申请日期2006年2月23日优先权日2006年2月23日发明者曾争,冯金辉申请人:曾争,冯金辉
网友询问留言 已有0条留言
  • 还没有人留言评论。精彩留言会获得点赞!
1