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

Method group_csv

drg_group/suzhou_2023/GroupProxy.java:163–180  ·  view source on GitHub ↗
(Path filename,List<String> cols)

Source from the content-addressed store, hash-verified

161 System.out.println("group time "+(d2.getTime() - d1.getTime()));
162 }
163 public void group_csv(Path filename,List<String> cols){
164 Date d1= new Date();
165 List<String> result=read_csv(filename,cols)
166 .parallel()
167 .map(x->group_record(new MedicalRecord(x)).toCsv())
168 // .filter(x->x.record.remark!=null&&!x.record.remark.isEmpty()&&!x.drg.equals(x.record.remark))
169 .collect(Collectors.toList());
170 Date d2= new Date();
171 System.out.println("record count "+result.size());
172 System.out.println("group time "+(d2.getTime() - d1.getTime()));
173 result.add(0, "\uFEFF"+"Index,gender,age,ageDay,weight,dept,inHospitalTime,leavingType,zdList,ssList,remark,status,messages,mdc,adrg,drg");
174 try{
175 Files.write(Paths.get(filename.toString().replace(".csv", "_java_result.csv")),result,StandardCharsets.UTF_8,StandardOpenOption.CREATE_NEW);
176 }catch(IOException e) {
177 System.out.println(String.format("文件写入失败%s", Paths.get(filename.toString().replace(".csv", "_result.csv"))));
178 e.printStackTrace();
179 }
180 }
181 public static Stream<Object> read_csv(Path filename,List<String> cols){
182 try {
183 List<String> headers=Arrays.asList(Files.lines(filename).findFirst().get().replace( "\uFEFF", "").split(",",-1));

Callers 1

mainMethod · 0.95

Calls 4

read_csvMethod · 0.95
group_recordMethod · 0.95
toCsvMethod · 0.45
toStringMethod · 0.45

Tested by 1

mainMethod · 0.76