MCPcopy Create free account
hub / github.com/OpenDRG/DRG_Java / Base

Class Base

drg_group/qingdao_2023/Base.java:13–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11import java.util.stream.Stream;
12
13public final class Base {
14 public static Messages groupMessages=new Messages();
15 public static Map<String,String> DRG=getLines("DRG")
16 .collect(Collectors.toMap(x->x.substring(0,x.indexOf(" ")), x->x.substring(x.indexOf(" ")+1)));
17 public static String[] SS_VALID=getLines("SS_VALID").map(x->x.substring(0,x.indexOf(" "))).toArray(String[]::new);
18 public static Map<String,String> MCC=getLines("MCC")
19 .collect(Collectors.toMap(x->x.substring(0,x.indexOf(" ")), x->x.substring(x.indexOf(" ")+1)));
20 public static Map<String,String> CC=getLines("CC")
21 .collect(Collectors.toMap(x->x.substring(0,x.indexOf(" ")), x->x.substring(x.indexOf(" ")+1)));
22 public static Map<String,String> CCE=getLines("CCE")
23 .collect(Collectors.toMap(x->x.substring(0,x.indexOf(" ")), x->x.substring(x.indexOf(" ")+1)));
24
25 private static Stream<String> getLines(String dataFile){
26 InputStream inputStream =Base.class.getResourceAsStream(
27 "/"+Base.class.getPackage().getName().replace(".", "/")+"/DATA/"+dataFile+".dat");
28 BufferedReader br= new BufferedReader(new InputStreamReader(inputStream,StandardCharsets.UTF_8));
29 return br.lines();
30 }
31 public static boolean has_cc(String index,String mainZd,String[] otherZd){
32 String cce="";
33 if (Base.CCE.containsKey(mainZd)){
34 cce=Base.CCE.get(mainZd);
35 Base.groupMessages.putMessage(index,String.format("主诊断%s排除表%s",mainZd,cce));
36 }
37 for (String zd:otherZd){
38 if (Base.CC.containsKey(zd)){
39 String cc=Base.CC.get(zd);
40 Base.groupMessages.putMessage(index,String.format("诊断%s属于CC,排除表%s",zd,cc));
41 if (!cce.isEmpty() && cce.equals(cc)){
42 continue;
43 }else{
44 return true;
45 }
46 }
47 }
48 return false;
49 }
50 public static boolean has_mcc(String index,String mainZd,String[] otherZd){
51 String cce="";
52 if (Base.CCE.containsKey(mainZd)){
53 cce=Base.CCE.get(mainZd);
54 Base.groupMessages.putMessage(index,String.format("主诊断%s排除表%s",mainZd,cce));
55 }
56 for (String zd:otherZd){
57 if (Base.MCC.containsKey(zd)){
58 String mcc=Base.MCC.get(zd);
59 Base.groupMessages.putMessage(index,String.format("诊断%s属于CC,排除表%s",zd,mcc));
60 if (!cce.isEmpty() && cce.equals(mcc)){
61 continue;
62 }else{
63 return true;
64 }
65 }
66 }
67 return false;
68 }
69 public static boolean intersect(String[] a,String[] b){
70 if (a!=null && a.length>0 && b!=null && b.length>0){

Callers

nothing calls this directly

Calls 1

getLinesMethod · 0.95

Tested by

no test coverage detected