@ -22,6 +22,7 @@ import java.awt.image.BufferedImage;
import java.io.File ;
import java.text.SimpleDateFormat ;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.List ;
import java.util.stream.Collectors ;
@ -31,13 +32,22 @@ import java.util.stream.Collectors;
* /
@Controller
public class WebController {
/ *
index 处 理 状 态 2 未 找 到 文 件 夹 , 匹 配 路 径 falg + ( 病 案 号 or 住 院 号 ) , 不 能 处 理 状 态 改 为 6
index2 处 理 状 态 6 , 匹 配 路 径 ( 病 案 号 or 住 院 号 ) , 不 能 处 理 状 态 改 为 7
index3 处 理 状 态 7 , 匹 配 路 径 ( like 病 案 号 ) , 不 能 处 理 状 态 改 为 8
index4 处 理 状 态 8 , 匹 配 路 径 ( not in 已 完 成 的 路 径 ) , 不 能 处 理 状 态 改 为 9
其 他 状 态 2 改 为 index 条 件 重 复 操 作 , 状 态 9 需 要 人 工 联 众 去 下 载 上 传
* /
@Autowired
private DataQuery dataQuery ;
@RequestMapping ( "/index" )
public String index ( Model model ) {
ArrayList < XiamenZhongHospConfirm > list = new ArrayList < > ( ) ;
List < CardInfo > cardInfos = dataQuery . queryNotFoundDirCardInfo ( ) ;
List < CardInfo > cardInfos = dataQuery . query FailedL1 CardInfo( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
for ( CardInfo cardInfo : cardInfos ) {
String flag = cardInfo . getPat_path ( ) . substring ( 0 , 2 ) ;
@ -72,6 +82,130 @@ public class WebController {
return "index" ;
}
@RequestMapping ( "/index2" )
public String index2 ( Model model ) {
List < XiamenZhongHospConfirm > list = new ArrayList < > ( ) ;
List < CardInfo > cardInfos = dataQuery . queryFailedL2CardInfo ( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
for ( CardInfo cardInfo : cardInfos ) {
List < CardInfoPath > cardInfoPaths = dataQuery . queryPath ( cardInfo . getPatno ( ) , cardInfo . getGestno ( ) ) ;
if ( CollectionUtils . isEmpty ( cardInfoPaths ) ) {
dataQuery . updateBatchState ( cardInfo , 7 ) ;
continue ;
}
List < String > firstPageFilePaths = new ArrayList < > ( ) ;
List < String > firstPageFileNames = findFirstPageFileName ( cardInfo ) ;
for ( CardInfoPath cardInfoPath : cardInfoPaths ) {
for ( String firstPageFileName : firstPageFileNames ) {
String firstPageFilePath = cardInfoPath . getPath ( ) + File . separator + firstPageFileName ;
if ( new File ( firstPageFilePath ) . exists ( ) ) {
firstPageFilePaths . add ( firstPageFilePath ) ;
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm ( ) ;
hospConfirm . setId ( cardInfo . getId ( ) ) ;
hospConfirm . setPatname ( cardInfo . getPatname ( ) ) ;
hospConfirm . setPatno ( cardInfo . getPatno ( ) ) ;
hospConfirm . setGestno ( cardInfo . getGestno ( ) ) ;
hospConfirm . setOutdate ( sdf . format ( cardInfo . getOutdate ( ) ) ) ;
hospConfirm . setPaths ( firstPageFilePaths ) ;
list . add ( hospConfirm ) ;
}
if ( ! list . isEmpty ( ) ) {
list = Collections . singletonList ( list . get ( 0 ) ) ;
}
model . addAttribute ( "confirms" , list ) ;
return "index2" ;
}
@RequestMapping ( "/index3" )
public String index3 ( Model model ) {
List < XiamenZhongHospConfirm > list = new ArrayList < > ( ) ;
List < CardInfo > cardInfos = dataQuery . queryFailedL3CardInfo ( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
for ( CardInfo cardInfo : cardInfos ) {
String flag = cardInfo . getPat_path ( ) . substring ( 0 , 2 ) ;
List < CardInfoPath > cardInfoPaths = dataQuery . queryPath ( flag , cardInfo . getPatno ( ) , cardInfo . getGestno ( ) ) ;
if ( CollectionUtils . isEmpty ( cardInfoPaths ) ) {
dataQuery . updateBatchState ( cardInfo , 8 ) ;
continue ;
}
List < String > firstPageFilePaths = new ArrayList < > ( ) ;
List < String > firstPageFileNames = findFirstPageFileName ( cardInfo ) ;
for ( CardInfoPath cardInfoPath : cardInfoPaths ) {
for ( String firstPageFileName : firstPageFileNames ) {
String firstPageFilePath = cardInfoPath . getPath ( ) + File . separator + firstPageFileName ;
if ( new File ( firstPageFilePath ) . exists ( ) ) {
firstPageFilePaths . add ( firstPageFilePath ) ;
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm ( ) ;
hospConfirm . setId ( cardInfo . getId ( ) ) ;
hospConfirm . setPatname ( cardInfo . getPatname ( ) ) ;
hospConfirm . setPatno ( cardInfo . getPatno ( ) ) ;
hospConfirm . setGestno ( cardInfo . getGestno ( ) ) ;
hospConfirm . setOutdate ( sdf . format ( cardInfo . getOutdate ( ) ) ) ;
hospConfirm . setPaths ( firstPageFilePaths ) ;
list . add ( hospConfirm ) ;
}
if ( ! list . isEmpty ( ) ) {
list = Collections . singletonList ( list . get ( 0 ) ) ;
}
model . addAttribute ( "confirms" , list ) ;
return "index3" ;
}
@RequestMapping ( "/index4" )
public String index4 ( Model model ) {
List < XiamenZhongHospConfirm > list = new ArrayList < > ( ) ;
List < CardInfo > cardInfos = dataQuery . queryFailedL4CardInfo ( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
for ( CardInfo cardInfo : cardInfos ) {
List < CardInfoPath > cardInfoPaths = dataQuery . queryNotUsedPath ( ) ;
if ( CollectionUtils . isEmpty ( cardInfoPaths ) ) {
dataQuery . updateBatchState ( cardInfo , 9 ) ;
continue ;
}
List < String > firstPageFilePaths = new ArrayList < > ( ) ;
List < String > firstPageFileNames = findFirstPageFileName ( cardInfo ) ;
for ( CardInfoPath cardInfoPath : cardInfoPaths ) {
for ( String firstPageFileName : firstPageFileNames ) {
String firstPageFilePath = cardInfoPath . getPath ( ) + File . separator + firstPageFileName ;
if ( new File ( firstPageFilePath ) . exists ( ) ) {
firstPageFilePaths . add ( firstPageFilePath ) ;
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm ( ) ;
hospConfirm . setId ( cardInfo . getId ( ) ) ;
hospConfirm . setPatname ( cardInfo . getPatname ( ) ) ;
hospConfirm . setPatno ( cardInfo . getPatno ( ) ) ;
hospConfirm . setGestno ( cardInfo . getGestno ( ) ) ;
hospConfirm . setOutdate ( sdf . format ( cardInfo . getOutdate ( ) ) ) ;
hospConfirm . setPaths ( firstPageFilePaths ) ;
list . add ( hospConfirm ) ;
}
if ( ! list . isEmpty ( ) ) {
list = Collections . singletonList ( list . get ( 0 ) ) ;
}
model . addAttribute ( "confirms" , list ) ;
return "index4" ;
}
private List < String > findFirstPageFileName ( CardInfo cardInfo ) {
List < Picture > pictures = dataQuery . getPictures ( cardInfo . getId ( ) ) ;
List < Picture > firstPageFiles = pictures . stream ( )
@ -127,4 +261,31 @@ public class WebController {
dataQuery . updateBatchState ( cardInfo , 6 ) ;
return "success" ;
}
@GetMapping ( "/notconfirmPath2" )
@ResponseBody
public String notconfirmPath2 ( @RequestParam ( "id" ) String id ) {
CardInfo cardInfo = new CardInfo ( ) ;
cardInfo . setId ( id ) ;
dataQuery . updateBatchState ( cardInfo , 7 ) ;
return "success" ;
}
@GetMapping ( "/notconfirmPath3" )
@ResponseBody
public String notconfirmPath3 ( @RequestParam ( "id" ) String id ) {
CardInfo cardInfo = new CardInfo ( ) ;
cardInfo . setId ( id ) ;
dataQuery . updateBatchState ( cardInfo , 8 ) ;
return "success" ;
}
@GetMapping ( "/notconfirmPath4" )
@ResponseBody
public String notconfirmPath4 ( @RequestParam ( "id" ) String id ) {
CardInfo cardInfo = new CardInfo ( ) ;
cardInfo . setId ( id ) ;
dataQuery . updateBatchState ( cardInfo , 9 ) ;
return "success" ;
}
}