18 changed files with 326 additions and 110 deletions
-
6src/main/java/a8k/app/constant/ActionOvertimeConstant.java
-
84src/main/java/a8k/app/dao/AppStatePersistenceDao.java
-
28src/main/java/a8k/app/dao/type/db/ReactionReport.java
-
8src/main/java/a8k/app/optalgo/A8kOptCurveAnalyzer.java
-
10src/main/java/a8k/app/optalgo/A8kPeakAnalyzer.java
-
20src/main/java/a8k/app/service/data/ProjInfoMgrService.java
-
4src/main/java/a8k/app/service/data/ReactionRecordMgrService.java
-
68src/main/java/a8k/app/service/mainctrl/AppConsumablesScanService.java
-
22src/main/java/a8k/app/service/mainctrl/AppDeviceInitCtrlService.java
-
91src/main/java/a8k/app/service/statemgr/ConsumablesMgrService.java
-
1src/main/java/a8k/app/service/statemgr/GStateMgrService.java
-
12src/main/java/a8k/app/service/statemgr/consumables_mgr/ReactionPlateContainerStateMgr.java
-
8src/main/java/a8k/app/service/statemgr/consumables_mgr/TipStateMgr.java
-
52src/main/java/a8k/app/type/SimpleReactionReport.java
-
5src/main/java/a8k/app/type/a8k/opt/A8kOptPeak.java
-
5src/main/java/a8k/app/utils/ZSqliteJdbcHelper.java
-
9src/main/java/a8k/extui/page/extsetting/db/ReactionRecordMgrDebugPage.java
-
3src/main/java/a8k/extui/page/optalgotest/OptAlgoTestPage.java
@ -1,29 +1,109 @@ |
|||
package a8k.app.dao; |
|||
|
|||
import a8k.app.dao.type.db.KeyVal; |
|||
import a8k.app.type.a8k.ConsumableGroup; |
|||
import a8k.app.type.a8k.container.LarBottleContainer; |
|||
import a8k.app.type.a8k.container.ReactionPlateContainer; |
|||
import a8k.app.type.a8k.pos.TipGroupPos; |
|||
import a8k.app.utils.ZJsonHelper; |
|||
import a8k.app.utils.ZSqlite; |
|||
import jakarta.annotation.PostConstruct; |
|||
import jakarta.annotation.Resource; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
@Slf4j |
|||
@RequiredArgsConstructor |
|||
public class AppStatePersistenceDao extends ZSqlite<KeyVal> { |
|||
@Resource |
|||
JdbcTemplate jdbcTemplate; |
|||
|
|||
@PostConstruct |
|||
void init() { |
|||
init(jdbcTemplate, "zapp_state_persistence_dao", KeyVal.class, false); |
|||
init(jdbcTemplate, "zapp_state_persistence", KeyVal.class, false); |
|||
} |
|||
|
|||
void storage(String key, String val) { |
|||
|
|||
public void setTipGroupNum(TipGroupPos pos, Integer num) { |
|||
if (pos == null || num == null) { |
|||
log.error("pos or num is null, pos: {}, num: {}", pos, num); |
|||
return; |
|||
} |
|||
String key = pos.name() + "/tipNum"; |
|||
String val = String.valueOf(num); |
|||
storage(key, val); |
|||
} |
|||
|
|||
public Integer getTipGroupNum(TipGroupPos pos) { |
|||
if (pos == null) { |
|||
log.error("pos is null"); |
|||
return 0; |
|||
} |
|||
String key = pos.name() + "/tipNum"; |
|||
KeyVal keyVal = get(key); |
|||
if (keyVal == null || keyVal.val == null) { |
|||
log.warn("No value found for key: {}", key); |
|||
return 0; |
|||
} |
|||
try { |
|||
return Integer.valueOf(keyVal.val); |
|||
} catch (NumberFormatException e) { |
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
public void syncReactionPlateContainerState(ConsumableGroup group, ReactionPlateContainer reactionPlateContainer) { |
|||
if (group == null || reactionPlateContainer == null) { |
|||
log.error("group or reactionPlateContainer is null, group: {}, reactionPlateContainer: {}", group, reactionPlateContainer); |
|||
return; |
|||
} |
|||
String key = group.name() + "/reactionPlateContainer"; |
|||
String val = ZJsonHelper.objectToJson(reactionPlateContainer); |
|||
storage(key, val); |
|||
} |
|||
|
|||
public ReactionPlateContainer getReactionPlateContainer(ConsumableGroup group) { |
|||
if (group == null) { |
|||
return null; |
|||
} |
|||
String key = group.name() + "/reactionPlateContainer"; |
|||
KeyVal keyVal = get(key); |
|||
if (keyVal == null || keyVal.val == null) { |
|||
return null; |
|||
} |
|||
try { |
|||
return ZJsonHelper.objectFromJson(keyVal.val, ReactionPlateContainer.class); |
|||
} catch (Exception e) { |
|||
log.error("Failed to parse ReactionPlateContainer from JSON: {}", keyVal.val, e); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
private void storage(String key, String val) { |
|||
if (key == null || val == null) { |
|||
log.error("key or val is null, key: {}, val: {}", key, val); |
|||
return; |
|||
} |
|||
KeyVal keyVal = get(key); |
|||
if (keyVal == null) { |
|||
keyVal = new KeyVal(); |
|||
keyVal.key = key; |
|||
keyVal.val = val; |
|||
add(keyVal); |
|||
} else { |
|||
keyVal.val = val; |
|||
update(keyVal); |
|||
} |
|||
} |
|||
|
|||
private KeyVal get(String key) { |
|||
if (key == null) { |
|||
log.error("key is null"); |
|||
return null; |
|||
} |
|||
return queryOne("select * from " + tableName + " where key = ?", key); |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
package a8k.app.type; |
|||
|
|||
import a8k.app.dao.type.db.ReactionReport; |
|||
import a8k.app.type.a8k.BloodType; |
|||
|
|||
import java.util.Date; |
|||
|
|||
public class SimpleReactionReport { |
|||
public int id = 0; |
|||
|
|||
public Date creatDate = new Date(); |
|||
|
|||
public BloodType sampleBloodType = BloodType.WHOLE_BLOOD; //血液类型 |
|||
public String sampleUserid = ""; //用户输入的样本ID,不做逻辑,只做展示 |
|||
public Boolean sampleIsEmergency = false; // 是否急诊 |
|||
|
|||
//项目信息 |
|||
public String projName = ""; // 项目名称 |
|||
public String projShortName = ""; // 项目名称 |
|||
public String lotId = ""; // 批次名称 |
|||
public Integer projId = 0; // 项目名称代码 |
|||
|
|||
public String result0; |
|||
public String result1; |
|||
public String result2; |
|||
|
|||
public SimpleReactionReport(ReactionReport report) { |
|||
this.id = report.id; |
|||
this.creatDate = report.creatDate; |
|||
this.sampleBloodType = report.sampleBloodType; |
|||
this.sampleUserid = report.sampleUserid; |
|||
this.sampleIsEmergency = report.sampleIsEmergency; |
|||
|
|||
this.projName = report.projName; |
|||
this.projShortName = report.projShortName; |
|||
this.lotId = report.lotId; |
|||
this.projId = report.projId; |
|||
|
|||
if (report.results.size() == 1) { |
|||
this.result0 = report.results.get(0).toBriefString(); |
|||
} |
|||
if (report.results.size() == 2) { |
|||
this.result0 = report.results.get(0).toBriefString(); |
|||
this.result1 = report.results.get(1).toBriefString(); |
|||
} |
|||
if (report.results.size() == 3) { |
|||
this.result0 = report.results.get(0).toBriefString(); |
|||
this.result1 = report.results.get(1).toBriefString(); |
|||
this.result2 = report.results.get(2).toBriefString(); |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue