找回密码
 欢迎注册
搜索
热搜: 活动 交友 discuz
查看: 1451|回复: 5

重要进展-论坛开始奉献开放式源代码

[复制链接]
发表于 2010-8-1 11:49:37 | 显示全部楼层 |阅读模式
本帖最后由 老包 于 2010-8-1 11:55 编辑

这是以论坛与BMKI Lab名义联合奉献的一些开放式源代码,旨在促进电子病历的信息开发,欢迎大家出注意,出智慧,出力量。

一般变量或症状的接口:

package intfc;
//Interface for the hos of general variable
/*Developed by Hanfei Bao, BMKI Lab and MIForum, China*/

public interface HostIntf {
  public String hasHost();
  }


******
package intfc;
//Interface for general variable, it's value and unit
/*Developed by Hanfei Bao, BMKI Lab and MIForum, China*/

public interface AttrDoubleIntf {
  public String hasVariable();
  public double hasValue();
  public String hasUnit();
}

*******
package intfc;
//Interface for general variable, it's value and unit
/*Developed by Hanfei Bao, BMKI Lab and MIForum, China*/

public interface AttrIntIntf {
  public String hasVariable();
  public int hasValue();
  public String hasUnit();
}

******
package intfc;
///Interface for general variable, it's value and unit
/*Developed by Hanfei Bao, BMKI Lab and MIForum, China*/

public interface AttrStringIntf {
  public String hasVariable();
  public String hasValue();
}

********
package intfc;
//Interface for the host of general variable
/*Developed by Hanfei Bao, BMKI Lab and MIForum, China*/

public interface HostIntf {
  public String hasHost();
  }
 楼主| 发表于 2010-8-1 11:52:13 | 显示全部楼层
本帖最后由 老包 于 2010-8-1 11:53 编辑

高血压接口及其演示程序:

BPLevelIntf2.java

package intfc;        
import java.util.*;

//Interface for Hypertension:the important BP values
//Units: mmHg and kPa
/*Developed by Hanfei Bao, BMKI Lab and MIForum, China*/

public interface BPLevelIntf2 {

        int BPVAluemmHg80 = 80;
    double BPVAluekPa10d7 = 10.7;        

        int BPVAluemmHg89 = 89;
    double BPVAluekPa11d9 = 11.9;        

        int BPVAluemmHg90 = 90;
    double BPVAluekPa12d0 = 12.0;        

        int BPVAluemmHg99 = 99;
    double BPVAluekPa13d2 = 13.2;        
   
        int BPVAluemmHg100 = 100;
    double BPVAluekPa13d4 = 13.4;        

        int BPVAluemmHg109 = 109;
    double BPVAluekPa14d6 = 14.6;        

        int BPVAluemmHg110 = 110;
    double BPVAluekPa14d7 = 14.7;        

        int BPVAluemmHg120 = 120;
    double BPVAluekPa16d0 = 16.0;        

    int BPVAluemmHg139 = 139;
    double BPVAluekPa18d6 = 18.6;        
   
        int BPVAluemmHg140 = 140;
    double BPVAluekPa18d7 = 18.7;        

        int BPVAluemmHg159 = 159;
    double BPVAluekPa21d2 = 21.2;        

        int BPVAluemmHg160 = 160;
    double BPVAluekPa21d4 = 21.4;        

        int BPVAluemmHg179 = 179;
    double BPVAluekPa23d9 = 23.9;           

        int BPVAluemmHg180 = 180;
    double BPVAluekPa24d0 = 24.0;         
}


****************
演示类:
HypertensionWorld3.java

package intfc;        

import java.util.*;

public class HypertensionWorld3 implements BPLevelIntf2{
    public static void main(String[] args)   {
         
            System.out.println("BPVAluemmHg120 =" +BPVAluemmHg120);
            System.out.println("BPVAluekPa16d0 =" +BPVAluekPa16d0);

            double ValOfDBP1 = 100.0;
            double ValOfDBP2 = 80.0;;            
            double ValOfSBP1 = 185.0;

            if(ValOfDBP1 >= BPVAluemmHg90)
                     System.out.println("ValOfDBP1 is not OK!");
        else
           System.out.println("ValOfDBP1 is OK!");
                    
            if(ValOfDBP2 >= BPVAluemmHg90)
                    System.out.println("ValOfDBP2 is not OK!");
       else
          System.out.println("ValOfDBP2 is OK!");         

            if(BPVAluemmHg180 >= BPVAluemmHg180)
                    System.out.println("The systolic bP is badly high !");
       else
          System.out.println("The systolic bP is  OK!");
                  
            }                  

   
}

****************
输出结果:

BPVAluemmHg120 =120
BPVAluekPa16d0 =16.0
ValOfDBP1 is not OK!
ValOfDBP2 is OK!
The systolic bP is badly high !
发表于 2010-8-1 16:19:56 | 显示全部楼层
谢谢包老!!!
 楼主| 发表于 2010-8-1 21:06:11 | 显示全部楼层
张琨, 你能否把你的手机号发到我的信箱里:
hanfeib@gmail.com
 楼主| 发表于 2010-8-16 17:29:35 | 显示全部楼层

开放代码草稿

本帖最后由 老包 于 2010-8-16 17:31 编辑

开放代码草稿:
时间信息的接口TimePointIntf.java, 抽象类TimeRelAbs.java和实现类realizeTimeRel.java及其输出结果,关于时间点的早,晚,时间差以及时间段早,晚和重叠等。




&&&&&&&&&&&&&&&&&&
TimePointIntf.java

package intfc;        
import java.util.*;

//developed by Hanfei Bao, BMKI lab and MiForum, China

public interface TimePointIntf {
   
   
    public String TimePointStr = null;
//a start or end time point of a period         
    public String StartTimePointStr = null;
    public String EndTimePointStr = null;   
    public String TestTimePointStr = null;
    public String DataRecordTimePointStr = null;   

    public int TimePointInt =0;
//a start or end time point of a period         
    public int StartTimePointInt =0;
    public int EndTimePointInt = 0;   
    public int TestTimePointInt = 0;
    public int DataRecordTimePointInt = 0;     
   
}




&&&&&&&&&&&&&&&&&&

TimeRelAbs.java

package intfc;        

import java.util.*;

// developed by Hanfei Bao, BMKI lab and MiForum, China

abstract class TimeRelAbs implements TimePointIntf  {
//period means a segment on the time axis
//time length or duration is a relative time segment
//time point has form YYYYMMDD(HHMMDD) representing YYYY-MM-DD(-HH-MM-DD)

        public int hasTimeLength(int TimePoint1,int TimePoint2){
            int TimeLength = TimePoint2 - TimePoint1;
            return TimeLength;
                 };
                public String TimePointEarlier(int TimePointA,int TimePointB){
                        if (TimePointA < TimePointB){
                        return "This TimePoint is earlier than that!";
                        }
                        else
                        return "This TimePoint is not earlier than That!";
                 };      
                public String TimePointlater(int TimePointA,int TimePointB){
                        if (TimePointA > TimePointB){
                                return "This TimePoint is later than that!";
                                }
                                else
                                return "This TimePoint is not later than that!";
                         };      
            public String TimePointSameAS(int TimePointA,int TimePointB){
                        if (TimePointA == TimePointB){
                                return "This TimePoint is same as that!";
                                }
                                else
                                return "This TimePoint is not same as that!";
                         };   
           public void TimePointDifference(int TimePointA,int TimePointB){
                                        int TPD = TimePointA - TimePointB;
                            if (TPD < 0){
                                System.out.println("TimePointA is "+Math.abs(TPD)+" earlier than TimePointB ");               
                                }
                                else if (TPD > 0){
                                        System.out.println("TimePointA is "+Math.abs(TPD)+" later than TimePointB ");
                                        }  
                                else if (TPD == 0){
                                        System.out.println("TimePointA is the same as TimePointB ");
                                }
                 }

           public void TimePeriodEarlier(int TimePointA1,int TimePointA2,int TimePointB1,int TimePointB2){
                        int STimePointOfPeriodA = TimePointA1;
                        int ETimePointOfPeriodA = TimePointA2;
                        int STimePointOfPeriodB = TimePointB1;
                        int ETimePointOfPeriodB = TimePointB2;        
                        int TimeLengthOfPeriodA = ETimePointOfPeriodA - STimePointOfPeriodA;
                        int TimeLengthOfPeriodB = ETimePointOfPeriodB - STimePointOfPeriodB;                        
            int TimeLengthOfPeriodBA = Math.abs(ETimePointOfPeriodB - STimePointOfPeriodA);
//Period ealier, later or overlapped?
            if (STimePointOfPeriodA < STimePointOfPeriodB){
                    System.out.println("PeriodA happens earlier than PeriodA");        
                    if (TimeLengthOfPeriodBA < (TimeLengthOfPeriodA+TimeLengthOfPeriodB) ){
                                System.out.println("and PeriodA is overlapped by PeriodB");
                    }
                                else if (TimeLengthOfPeriodBA > (TimeLengthOfPeriodA+TimeLengthOfPeriodB)){
                    System.out.println("and PeriodA isn't overlapped by PeriodB");        
                    }
                    else
                    System.out.println("PeriodB started when PeriodB ended.");
                }
//Period is in another perion?
            if (STimePointOfPeriodA < STimePointOfPeriodB && ETimePointOfPeriodA > ETimePointOfPeriodB){
                    System.out.println("PeriodB is in or covered by PeriodA.");        
            }
           }
         
}


&&&&&&&&&&&&&&&&&&&&

realizeTimeRel.java

package intfc;        


import java.util.*;
//developed by Hanfei Bao, BMKI lab and MiForum, China

public class realizeTimeRel extends TimeRelAbs{
    public static void main(String[] args)   {
            realizeTimeRel rTR = new realizeTimeRel();
//
            int TimePoint1 = 20100320;
            int TimePoint2 = 20100524;
            String whichEarlier = rTR.TimePointEarlier(TimePoint1,TimePoint2);
            System.out.println(whichEarlier );        
//
            int sTimePeriod1 = 20100119;
            int eTimePeriod1 = 20100621;              
            int sTimePeriod2 = 20100318;
            int eTimePeriod2 = 20100815;
        rTR.TimePeriodEarlier(sTimePeriod1,eTimePeriod1,sTimePeriod2,eTimePeriod2);
          }
    }

&&&&&&&&&&&&&&&&&&&&

output

This TimePoint is earlier than that!
PeriodA happens earlier than PeriodA
and PeriodA is overlapped by PeriodB
 楼主| 发表于 2010-8-23 10:31:17 | 显示全部楼层
本帖最后由 老包 于 2010-8-23 10:49 编辑

经反复思考,觉得上述开源码的开发是否加上论坛名义尚需经过认真讨论,等意见成熟后再定夺,这样似乎较为妥当。

在问题的探索阶段,以个人的名义较为方便。
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

快速回复 返回顶部 返回列表