Browse Source

update

tags/v0
zhaohe 10 months ago
parent
commit
0a99667318
  1. BIN
      app.db
  2. 36
      src/main/java/a8k/controler/extapi/pagecontrol/ExtApiTabConfig.java
  3. 54
      src/main/java/a8k/dbservice/ReactionRecordDBService.java
  4. 57
      src/main/java/a8k/dbservice/type/ReactionResultRecord.java
  5. 40
      src/main/java/a8k/service/appdata/AppReactionResultMgrService.java
  6. 2
      src/main/java/a8k/service/appdata/AppSampleMgrService.java
  7. 10
      src/main/java/a8k/type/reaction_result_type/ReactionResultStatus.java
  8. 10
      src/main/java/a8k/utils/ZSqliteJdbcHelper.java

BIN
app.db

36
src/main/java/a8k/controler/extapi/pagecontrol/ExtApiTabConfig.java

@ -12,36 +12,38 @@ public enum ExtApiTabConfig {
AppSettingsMgr("应用数据.设备配置管理", true), //OK
AppProjectItemMgrService("应用数据.ID卡状态管理", true), //OK
AppProjInfoMgrService("应用数据.项目信息管理", true), //OK
AppReactionResultMgrService("应用数据.反应结果管理", true), //OK
AppSampleMgrService("应用数据.样本管理", true), //OK
ActionReactorService("基础组件.单步调试", true),//OK
AppFrontEndEventRouter("基础组件.前端事件路由", true),
UtilsProjectColorAllocer("基础组件.项目颜色分配", true),
Hbot2DCodeScanPos("参数.Hbot二维码扫描坐标参数", true),
ActionReactorService("底层调试.单步调试", true),//OK
Hbot2DCodeScanPos("参数.Hbot二维码扫描坐标参数", false),
//底层硬件
A8kPipetteCtrlModule("A8kPipetteCtrlModule", true),
A8kPipetteCtrlModule("A8kPipetteCtrlModule", false),
SampleTransportParam("参数.样本出入料&扫描参数", true),
PosParam("PosParam", true),
TimeParam("TimeParam", true),
DeviceStatus("DeviceStatus", true),
SampleTransportParam("参数.样本出入料&扫描参数", false),
PosParam("PosParam", false),
TimeParam("TimeParam", false),
DeviceStatus("DeviceStatus", false),
HardwareCommonCtrl("HardwareCommonCtrl", true),
ReactionPlatesTransmitCtrl("ReactionPlatesTransmitCtrl", true),
HbotControlService("HbotControlService", true),
SamplesPreProcesCtrl("硬件控制.样本预处理模块", true),
SampleTransportCtrl("硬件控制.样本搬运与扫描", true),
ConsumablesScanCtrlService("硬件控制.耗材扫描", true),
HardwareCommonCtrl("HardwareCommonCtrl", false),
ReactionPlatesTransmitCtrl("ReactionPlatesTransmitCtrl", false),
HbotControlService("HbotControlService", false),
SamplesPreProcesCtrl("硬件控制.样本预处理模块", false),
SampleTransportCtrl("硬件控制.样本搬运与扫描", false),
ConsumablesScanCtrlService("硬件控制.耗材扫描", false),
PositionCalibration("PositionCalibration", true),
CodeDebugParam("CodeDebugParam", true),
TestScript("TestScript", true),
PositionCalibration("PositionCalibration", false),
CodeDebugParam("CodeDebugParam", false),
TestScript("TestScript", false),
DebugParam("DebugParam", true),
DebugParam("DebugParam", false),
Max("max", false);

54
src/main/java/a8k/dbservice/ReactionRecordDBService.java

@ -0,0 +1,54 @@
package a8k.dbservice;
import a8k.dbservice.type.ReactionResultRecord;
import a8k.utils.ZSqliteJdbcHelper;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.util.List;
@Component
public class ReactionRecordDBService {
private static final Logger logger = LoggerFactory.getLogger(ReactionRecordDBService.class);
private static final String tableName = "zapp_a8k_reaction_record";
private static Class<?> tClass = ReactionResultRecord.class;
@Resource
JdbcTemplate jdbcTemplate;
@PostConstruct
void init() {
if (!ZSqliteJdbcHelper.isTableExist(jdbcTemplate, tableName)) {
ZSqliteJdbcHelper.createTable(jdbcTemplate, tableName, tClass);
}
}
@SneakyThrows public ReactionResultRecord rowMapper(ResultSet rs, int rowNum) {
return (ReactionResultRecord) ZSqliteJdbcHelper.rowMapper(rs, tClass);
}
public List<ReactionResultRecord> getAll() {
return jdbcTemplate.query("select * from " + tableName, this::rowMapper);
}
public void add(ReactionResultRecord record) {
ZSqliteJdbcHelper.addObj(jdbcTemplate, tableName, tClass, record);
}
public void update(ReactionResultRecord record) {
ZSqliteJdbcHelper.updateObj(jdbcTemplate, tableName, tClass, record);
}
public void delete(int recordid) {
jdbcTemplate.update("delete from " + tableName + " where id = ?", recordid);
}
}

57
src/main/java/a8k/dbservice/type/ReactionResultRecord.java

@ -0,0 +1,57 @@
package a8k.dbservice.type;
import a8k.type.reaction_result_type.ReactionResultStatus;
import a8k.type.type.BloodType;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* 单个项目的反应记录
*
* 一个样本
* 多个项目
* 一个项目
* 多个结果
* 多个结果
* 多个结果
* 多个项目
* 一个项目
* 多个结果
* 多个结果
* 多个结果
*
*
*/
public class ReactionResultRecord {
public int id = 0;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date date = new Date();
//样本信息
public BloodType sampleBloodType = BloodType.WHOLE_BLOOD; //血液类型
public String sampleBarcode = ""; //用于请求用户信息的条码ID
public String sampleUserid = ""; //用户输入的样本ID不做逻辑只做展示
//项目信息
public String projName = ""; // 项目名称
public String lotId = ""; // 批次名称
public Integer projIndex = 0; // 项目名称代码
@JsonFormat(pattern = "yyyy-MM-dd")
public Date expiryDate; // 有效日期
//上下文信息
public String operator; // 操作员
public String appVersion;//上层应用版本
public String mcuVersion; // MCU软件版本
public String sn; // 仪器序列号
public ReactionResultStatus subProjResultStatus1 = ReactionResultStatus.DISABLED; //子项目1 结果状态
public ReactionResultStatus subProjResultStatus2 = ReactionResultStatus.DISABLED; //子项目2 结果状态
public ReactionResultStatus subProjResultStatus3 = ReactionResultStatus.DISABLED; //子项目3 结果状态
public String subProjResult1; //子项目1 结果
public String subProjResult2; //子项目2 结果
public String subProjResult3; //子项目3 结果
}

40
src/main/java/a8k/service/appdata/AppReactionResultMgrService.java

@ -1,4 +1,44 @@
package a8k.service.appdata;
import a8k.controler.extapi.pagecontrol.ExtApiTabConfig;
import a8k.controler.extapi.utils.ExtApiFn;
import a8k.controler.extapi.utils.ExtApiTab;
import a8k.dbservice.ReactionRecordDBService;
import a8k.dbservice.type.ReactionResultRecord;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@ExtApiTab(cfg = ExtApiTabConfig.AppReactionResultMgrService)
public class AppReactionResultMgrService {
@Resource
ReactionRecordDBService reactionRecordDBService;
@PostConstruct
public void init() {
}
@ExtApiFn(name = "获取所有样本记录")
public List<ReactionResultRecord> getAllRecords() {
return reactionRecordDBService.getAll();
}
@ExtApiFn(name = "添加测试记录")
public void addRecord() {
ReactionResultRecord record = new ReactionResultRecord();
reactionRecordDBService.add(record);
}
@ExtApiFn(name = "删除所有测试记录")
public void deleteAllRecords() {
List<ReactionResultRecord> records = reactionRecordDBService.getAll();
for (ReactionResultRecord record : records) {
reactionRecordDBService.delete(record.id);
}
}
}

2
src/main/java/a8k/service/appdata/AppSampleMgrService.java

@ -16,7 +16,7 @@ import java.util.Date;
import java.util.List;
@Component
@ExtApiTab(cfg = ExtApiTabConfig.AppSettingsMgr)
@ExtApiTab(cfg = ExtApiTabConfig.AppSampleMgrService)
public class AppSampleMgrService {
@Resource

10
src/main/java/a8k/type/reaction_result_type/ReactionResultStatus.java

@ -0,0 +1,10 @@
package a8k.type.reaction_result_type;
public enum ReactionResultStatus {
//
DISABLED, // 未启用
SUCCESS,// 成功
ERROR,// 结果异常
ERROR_RESULT_OUT_OF_RANGE,// 结果超出范围
ERROR_DEPENDENT_VAR_OUT_OF_RANGE,// 依赖变量超出范围
}

10
src/main/java/a8k/utils/ZSqliteJdbcHelper.java

@ -65,7 +65,10 @@ public class ZSqliteJdbcHelper {
} else if (field.getType().equals(String.class)) {
field.set(obj, rs.getString(field.getName()));
} else if (field.getType().equals(Date.class)) {
field.set(obj, new Date(rs.getLong(field.getName())));
if (rs.getString(field.getName()) == null || rs.getString(field.getName()).isEmpty())
field.set(obj, null);
else
field.set(obj, new Date(rs.getLong(field.getName())));
} else if (field.getType().isEnum()) {
Method methodValueOf = null;
try {
@ -108,7 +111,10 @@ public class ZSqliteJdbcHelper {
Date date = (Date) field.get(obj);
// 按照 yyyy-MM-dd HH:mm:ss 存储
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
args.add(date.getTime());
if (date == null)
args.add("");
else
args.add(date.getTime());
} else if (field.getType().isEnum()) {
args.add(field.get(obj).toString());
} else {

Loading…
Cancel
Save