新增异常信息打印,修改接口

This commit is contained in:
Elliott
2024-04-16 11:54:06 +08:00
parent a1f96e12be
commit fc8e7ad795
6 changed files with 73 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
package com.joju.datamanager.common.exception;
public class ExceptionDUtil {
/**
* 返回异常的详细信息
* @param e
* @return
*/
public static String getDetailExceptionMsg(Exception e){
StringBuffer exceptionMessage = new StringBuffer();
StackTraceElement[] stackTraceElementes = e.getStackTrace();
int length = stackTraceElementes.length;
StackTraceElement ste;
//只要最顶上的错误栈
for(int i=0;i<length;i++){
ste = stackTraceElementes[i];
exceptionMessage.append(ste.getClassName()+":"+ste.getLineNumber()+"\r\n");
//break;
}
String result = e.toString()+"\r\n"+exceptionMessage.toString();
return result;
}
}

View File

@@ -44,7 +44,6 @@ public class HisViewSearchController {
return ResultUtil.failureMsg("未获取到数据");
}
/**
* his历史就诊记录查询
*
@@ -62,8 +61,6 @@ public class HisViewSearchController {
}
return ResultUtil.failureMsg("未获取到数据");
}
/**
* 获取今天的遗嘱开单信息
*
@@ -80,4 +77,11 @@ public class HisViewSearchController {
return ResultUtil.failureMsg("获取失败!");
}
@GetMapping("/getMedicalPrescriptionByCardNo")
@EleganceLog(description = "根据卡号获取未缴费的遗嘱开单信息")
public Result getMedicalPrescriptionByCardNo(String cardNo) {
List<MedicalPrescription> medicalPrescriptions = hisViewSearchService.getMedicalPrescriptionByCardNo(cardNo);
return ResultUtil.successData(medicalPrescriptions);
}
}

View File

@@ -41,8 +41,6 @@ public class IntelligentGuidanceController {
public Result getSymptomByBodyAreaType(String bodyAreaType) {
List<IntelligentGuidanceCategory> intelligentGuidanceCategoryList = intelligentGuidanceCategoryService.getSymptomByBodyAreaType(bodyAreaType);
Map<String, List<IntelligentGuidanceCategory>> listMap = intelligentGuidanceCategoryList.stream().collect(Collectors.groupingBy(IntelligentGuidanceCategory::getBodyArea));
String bodyArea = listMap.keySet().iterator().next();
JSONObject result = JSONUtil.createObj().put("bodyArea", bodyArea).put("categoryList", intelligentGuidanceCategoryList);

View File

@@ -27,7 +27,6 @@ public class LineUpToCallNumbersController {
@Autowired
CallNumbersService callNumbersService;
@GetMapping("/getCallNumberByIdentity")
@EleganceLog(description = "排队叫号获取线上数据")
public Result getCallNumberByIdentity(String identity) {
@@ -38,7 +37,6 @@ public class LineUpToCallNumbersController {
}
return ResultUtil.failureMsg("获取失败");
}
@GetMapping("/getCallNumber")
@EleganceLog(description = "排队叫号获取本地测试数据")
public Result getCallNumber(String identity) {

View File

@@ -18,4 +18,6 @@ public interface HisViewSearchService {
List<PatientList> getHistoricalVisits(String patientName, String idcard);
List<MedicalPrescription> getMedicalPrescription();
List<MedicalPrescription> getMedicalPrescriptionByCardNo(String cardNo);
}

View File

@@ -158,5 +158,42 @@ public class HisViewSearchServiceImpl implements HisViewSearchService {
return medicalPrescriptions;
}
@Override
public List<MedicalPrescription> getMedicalPrescriptionByCardNo(String cardNo) {
log.info("拼接数据");
// String URL = "jdbc:sqlserver:thin:@//168.168.0.10:1433/THIS4";
String URL = "jdbc:sqlserver://168.168.0.10:1433;databaseName=THIS4";
String USER = "joju";
String PASSWORD = "Joju@123";
List<MedicalPrescription> medicalPrescriptions = null;
// 1.加载驱动程序
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// 2.获得数据库链接
log.info("开始链接数据库");
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
log.info("打印链接状态:" + conn);
// 3.通过数据库的连接操作数据库实现增删改查使用Statement类
// SELECT * FROM HIS_WJFHZCFXX WHERE lrrq BETWEEN '2024-04-02 00:00:00' AND '2024-04-03 00:00:00 '
String sql = " SELECT * FROM HIS_WJFHZCFXX WHERE cardno = '" + cardNo + "'";
log.info("打印sql" + sql);
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery(sql);
log.info("返回结果是:" + rs);
BeanListHandler<MedicalPrescription> medicalPrescriptionBeanListHandler = new BeanListHandler<>(MedicalPrescription.class);
medicalPrescriptions = medicalPrescriptionBeanListHandler.handle(rs);
log.info("list is " + medicalPrescriptions);
// 关闭资源【多谢指正】
rs.close();
statement.close();
conn.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return medicalPrescriptions;
}
}