16 changed files with 325 additions and 50 deletions
-
BINapp.db
-
4src/main/java/a8k/controler/extapi/pagecontrol/ExtApiTabConfig.java
-
84src/main/java/a8k/dbservice/A8kProjIdCardDBService.java
-
9src/main/java/a8k/dbservice/type/A8kProjIdCardDBIterm.java
-
18src/main/java/a8k/olddbservice/LanguageDictIterm.java
-
30src/main/java/a8k/service/LanguageDictService.java
-
13src/main/java/a8k/type/projecttype/A8kFnType.java
-
16src/main/java/a8k/type/projecttype/A8kOptType.java
-
10src/main/java/a8k/type/projecttype/A8kPiecewiseFnFormula.java
-
57src/main/java/a8k/type/projecttype/A8kResultUnit.java
-
16src/main/java/a8k/type/projecttype/IndependentVariableType.java
-
7src/main/java/a8k/type/projecttype/SampleType.java
-
10src/main/java/a8k/type/projecttype/a8kidcard/A8kFnFormula.java
-
45src/main/java/a8k/type/projecttype/a8kidcard/A8kIdCardFn.java
-
42src/main/java/a8k/type/projecttype/a8kidcard/A8kIdCardInfo.java
-
14src/main/java/a8k/type/projecttype/a8kidcard/A8kIdCardProjectFormula.java
@ -0,0 +1,84 @@ |
|||
package a8k.dbservice; |
|||
|
|||
import a8k.dbservice.type.A8kProjIdCardDBIterm; |
|||
import a8k.dbservice.type.AppSetting; |
|||
import a8k.dbservice.type.appsetting.AppSettingName; |
|||
import a8k.dbservice.type.appsetting.AppSettingTab; |
|||
import a8k.dbservice.type.appsetting.AppSettingType; |
|||
import a8k.type.projecttype.a8kidcard.A8kIdCardInfo; |
|||
import a8k.utils.ZEnumHelper; |
|||
import a8k.utils.ZSqliteJdbcHelper; |
|||
import com.fasterxml.jackson.core.JsonProcessingException; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
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.sql.SQLException; |
|||
import java.util.List; |
|||
|
|||
@Component |
|||
public class A8kProjIdCardDBService { |
|||
private static final Logger logger = LoggerFactory.getLogger(A8kProjIdCardDBService.class); |
|||
private static final String tableName = "zapp_a8k_idcards"; |
|||
|
|||
|
|||
@Resource |
|||
JdbcTemplate jdbcTemplate; |
|||
|
|||
@PostConstruct |
|||
void init() { |
|||
if (!ZSqliteJdbcHelper.isTableExist(jdbcTemplate, tableName)) { |
|||
createTable(); |
|||
} |
|||
} |
|||
|
|||
// private AppSetting rowMapper(ResultSet rs, int rowNum) throws SQLException |
|||
|
|||
private A8kProjIdCardDBIterm rowMapper(ResultSet rs, int rowNum) throws SQLException { |
|||
A8kProjIdCardDBIterm obj = new A8kProjIdCardDBIterm(); |
|||
obj.id = rs.getInt("id"); |
|||
obj.lotid = rs.getString("lotid"); |
|||
try { |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
obj.idcardinfo = objectMapper.readValue(rs.getString("idcardinfo"), A8kIdCardInfo.class); |
|||
} catch (JsonProcessingException e) { |
|||
logger.error(e.toString()); |
|||
} |
|||
|
|||
|
|||
return obj; |
|||
} |
|||
|
|||
private void createTable() { |
|||
jdbcTemplate.execute("create table " + tableName + " ('id' integer," |
|||
+ " 'lotid' text," |
|||
+ " 'idcardinfo' text," |
|||
+ " PRIMARY KEY ('id' DESC));"); |
|||
} |
|||
|
|||
public void addIdCard(A8kProjIdCardDBIterm idcard) { |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
|
|||
try { |
|||
jdbcTemplate.update("insert into " + tableName + "(lotid, idcardinfo) values(?, ?);",// |
|||
idcard.lotid, objectMapper.writeValueAsString(idcard.idcardinfo)); |
|||
} catch (JsonProcessingException e) { |
|||
logger.error(e.toString()); |
|||
} |
|||
} |
|||
|
|||
public List<A8kProjIdCardDBIterm> getAllIdCards() { |
|||
return jdbcTemplate.query("select * from " + tableName + ";", this::rowMapper); |
|||
} |
|||
|
|||
public A8kProjIdCardDBIterm getIdCardByLotId(String lotid) { |
|||
return jdbcTemplate.queryForObject("select * from " + tableName + " where lotid = ?;", this::rowMapper, lotid); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
package a8k.dbservice.type; |
|||
|
|||
import a8k.type.projecttype.a8kidcard.A8kIdCardInfo; |
|||
|
|||
public class A8kProjIdCardDBIterm { |
|||
public int id; |
|||
public String lotid; |
|||
public A8kIdCardInfo idcardinfo; |
|||
} |
@ -1,18 +0,0 @@ |
|||
package a8k.olddbservice; |
|||
|
|||
import com.iflytop.uf.UfActiveRecord; |
|||
import com.iflytop.uf.UfActiveRecordField; |
|||
|
|||
public class LanguageDictIterm extends UfActiveRecord { |
|||
|
|||
@UfActiveRecordField |
|||
public String key; |
|||
@UfActiveRecordField |
|||
public String country; |
|||
@UfActiveRecordField |
|||
public String value; |
|||
// get table name |
|||
public static String getTableName() { |
|||
return String.format("%sTable", LanguageDictIterm.class.getSimpleName()); |
|||
} |
|||
} |
@ -1,30 +0,0 @@ |
|||
package a8k.service; |
|||
|
|||
import a8k.type.appret.AppRet; |
|||
import a8k.olddbservice.LanguageDictIterm; |
|||
import com.iflytop.uf.UfActiveRecord; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Component |
|||
public class LanguageDictService { |
|||
|
|||
List<LanguageDictIterm> dbGetLanguageDict() { |
|||
return UfActiveRecord.find(LanguageDictIterm.class); |
|||
} |
|||
|
|||
List<LanguageDictIterm> dbGetLanguageDict(String country) { |
|||
return UfActiveRecord.find(LanguageDictIterm.class, Map.of("country", country)); |
|||
} |
|||
|
|||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|||
// PUBLIC |
|||
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|||
|
|||
public AppRet<List<LanguageDictIterm>> getLanguageDict(String country) { |
|||
return AppRet.success(dbGetLanguageDict(country)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
package a8k.type.projecttype; |
|||
|
|||
public enum A8kFnType { |
|||
NotSet(0), //未设置 |
|||
NormalFn(1),//正常函数 |
|||
PiecewiseFn(2),//分段函数 |
|||
; |
|||
final int val; |
|||
|
|||
A8kFnType(int val) { |
|||
this.val = val; |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
package a8k.type.projecttype; |
|||
|
|||
public enum A8kOptType { |
|||
Auto(0), |
|||
FOpt(1), |
|||
TOpt(2), |
|||
FAndTOpt(3), |
|||
; |
|||
|
|||
public final int code; |
|||
static final int max = 4; |
|||
|
|||
A8kOptType(int code) { |
|||
this.code = code; |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
package a8k.type.projecttype; |
|||
|
|||
public class A8kPiecewiseFnFormula { |
|||
Double A; |
|||
Double B; |
|||
Double C; |
|||
Double D; |
|||
Double lowLimit; |
|||
Double upLimit; |
|||
} |
@ -0,0 +1,57 @@ |
|||
package a8k.type.projecttype; |
|||
|
|||
public enum A8kResultUnit { |
|||
Original(0, "original"), |
|||
illegalUint(1, "illegalityUint"), |
|||
pgPml(2, "pg/mL"), |
|||
ngPml(3, "ng/mL"), |
|||
ugPml(4, "ug/mL"), |
|||
mgPml(5, "mg/mL"), |
|||
pgPl(6, "pg/L"), |
|||
ngPl(7, "ng/L"), |
|||
ugPl(8, "ug/L"), |
|||
mgPl(9, "mg/L"), |
|||
gPl(10, "g/L"), |
|||
ngPdl(11, "ng/dL"), |
|||
ugPdl(12, "ug/dL"), |
|||
mgPdl(13, "mg/dL"), |
|||
gPdl(14, "g/dL"), |
|||
pmolPl(15, "pmol/L"), |
|||
nmolPl(16, "nmol/L"), |
|||
umolPl(17, "umol/L"), |
|||
mmolPl(18, "mmol/L"), |
|||
uiuPml(19, "uIU/mL"), |
|||
miuPml(20, "mIU/mL"), |
|||
iuPml(21, "IU/mL"), |
|||
uuPml(22, "uU/mL"), |
|||
muPml(23, "mU/mL"), |
|||
uPml(24, "U/mL"), |
|||
muPl(25, "mU/L"), |
|||
uPl(26, "U/L"), |
|||
kiuPl(27, "kIU/L"), |
|||
kuPl(28, "kU/L"), |
|||
percent(29, "%"), |
|||
mmolPmol(30, "mmol/mol"), |
|||
milPul(31, "mil/uL"), |
|||
mmP1h(32, "mm/1h"), |
|||
ul(33, "/uL"), |
|||
ukatPl(34, "ukat/L"), |
|||
nkatPl(35, "nkat/L"), |
|||
mptPl(36, "mpt/L"), |
|||
tptPl(37, "tpt/L"), |
|||
gptPl(38, "gpt/L"), |
|||
pfuPml(39, "PFU/mL"), |
|||
cfuPml(40, "CFU/mL"), |
|||
sPco(41, "S/CO"), |
|||
coi(42, "COI"), |
|||
index(43, "Index"); |
|||
|
|||
|
|||
public final int val; |
|||
public final String unitstr; |
|||
|
|||
A8kResultUnit(int val, String unitstr) { |
|||
this.val = val; |
|||
this.unitstr = unitstr; |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
package a8k.type.projecttype; |
|||
|
|||
public enum IndependentVariableType { |
|||
Ratio(1),// T/C |
|||
ATR(2), // H/C |
|||
AntiRatio(3), // T/H |
|||
RFRatio(4),// R/C |
|||
RTRatio(4),// T/R |
|||
; |
|||
|
|||
int val = 0; |
|||
IndependentVariableType(int val) { |
|||
this.val = val; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,7 @@ |
|||
package a8k.type.projecttype; |
|||
|
|||
public enum SampleType { |
|||
WholeBlood, //全血 |
|||
Serum, //血清 |
|||
; |
|||
} |
@ -0,0 +1,10 @@ |
|||
package a8k.type.projecttype.a8kidcard; |
|||
|
|||
public class A8kFnFormula { |
|||
public Double A; |
|||
public Double B; |
|||
public Double C; |
|||
public Double D; |
|||
public Double lowLimit; |
|||
public Double upLimit; |
|||
} |
@ -0,0 +1,45 @@ |
|||
package a8k.type.projecttype.a8kidcard; |
|||
|
|||
import a8k.type.projecttype.A8kResultUnit; |
|||
import a8k.type.projecttype.IndependentVariableType; |
|||
|
|||
public class A8kIdCardFn { |
|||
|
|||
// 非分段函数 |
|||
public IndependentVariableType fnX; // 函数未知数是 |
|||
public Double fnXMin; // 函数未知数下限闻值 |
|||
public Double fnXMax; // 函数未知数上限闻值 |
|||
|
|||
//血清函数系数 |
|||
public A8kFnFormula serumFn; |
|||
//全血函数系数 |
|||
public A8kFnFormula bloodFn; |
|||
|
|||
// 分段函数 |
|||
public Integer pwFnJudeX; // 分界判断数据来源 |
|||
public Double pwFnJudeThres; // 分界判断数据值 |
|||
public Double pwFnLCX; // 低浓度未知数 |
|||
public Double pwFnHCX; // 高浓度未知数 |
|||
public Double pwFnXMin; // 函数未知数下限闻值 |
|||
public Double pwFnXMax; // 函数未知数上限闻值 |
|||
|
|||
public A8kFnFormula serumLCFn; |
|||
public A8kFnFormula serumHCFn; |
|||
|
|||
public A8kFnFormula bloodLCFn; |
|||
public A8kFnFormula bloodHCFn; |
|||
|
|||
// 结果 |
|||
public A8kResultUnit ret1Unit; // 单位 |
|||
public A8kResultUnit ret2Unit; // 单位 |
|||
public A8kResultUnit ret3Unit; // 单位 |
|||
|
|||
// |
|||
public Double resultToUint2FnA; // 结果转换为单位2的函数A result2 = A * result1 + B |
|||
public Double resultToUint2FnB; // 结果转换为单位2的函数B |
|||
|
|||
// |
|||
public Double resultToUint3FnA; // 结果转换为单位3的函数A result3 = A * result1 + B |
|||
public Double resultToUint3FnB; // 结果转换为单位3的函数B |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package a8k.type.projecttype.a8kidcard; |
|||
|
|||
import a8k.type.projecttype.A8kOptType; |
|||
import a8k.type.projecttype.SampleType; |
|||
|
|||
public class A8kIdCardInfo { |
|||
public String projectName; // 项目名称 |
|||
public String lotName; // 批次名称 |
|||
public String expiryDate; // 有效日期 |
|||
public Integer projectCode; // 项目名称代码 |
|||
public Integer palteCode; // 板条条码代码 |
|||
|
|||
public Integer updateChipVersion; // 更新芯片版本号 |
|||
public Double QCPeakMinVal; // 质控峰最小值 |
|||
public Double QCPeakMaxVal; // 质控峰最大值 设置值x10最大不超过250000 |
|||
public A8kOptType optType; // 光学类型 光学类型(0=自动;1=F光学;2=T光学;3=F/T光学;其他=无效;) |
|||
public Integer optFixedGainSetting; // 光学固定增益设置 |
|||
public Integer optAreaPeakCount; // 光学面积峰个数 |
|||
public Integer calculationDirection; // 计算方向 |
|||
public SampleType sampleType; // 样本类型 |
|||
public Integer equipmentManufacturer; // 设备厂商 |
|||
public Integer tOptIlluminationTime; // T光学持续光照时间 |
|||
public Integer incMultiInstruDataMerge; // 是否包含多款仪器数据合并 |
|||
public Integer multiInstruDataMerge; // 多款仪器数据合并 |
|||
public Integer wBloodSampleVol; // 全血样本量 |
|||
public Integer serumSampleVol; // 血清/血浆样本量 |
|||
public Integer tubeMixingCount; // 试管混匀次数 |
|||
public Integer bufferBottleSize; // 缓冲液瓶大小 |
|||
public Integer bufferBottleCapacity; // 缓冲液瓶容量 |
|||
public Integer buffLiquidAspirMixingCnt; // 缓冲液吸吐混匀次数 |
|||
public Integer buffLiquidAspirMixingVol; // 缓冲液吐混混匀量 |
|||
public Integer buffLiquidReactionTime; // 缓冲液反应时间 |
|||
public Integer reactionPlateReactionTime; // 反应板反应时间 |
|||
public Integer reactionPlateDropletVol; // 反应板滴样量 |
|||
public Integer resultDecimalPlaces; // 结果小数点位数 |
|||
public Integer scanningRange; // 扫描范围 |
|||
|
|||
|
|||
public A8kIdCardProjectFormula projFormula; |
|||
|
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package a8k.type.projecttype.a8kidcard; |
|||
|
|||
public class A8kIdCardProjectFormula { |
|||
// 项目头部信息 |
|||
public Integer pjNum; // 当前项目是几联卡项目,val = 1,2,3 |
|||
public Integer pj1CurveType; // 项目1 结果曲线是否为分段函数, 1=非分段函数,2=分段函数 |
|||
public Integer pj2CurveType; // 项目2 结果曲线是否为分段函数 |
|||
public Integer pj3CurveType; // 项目3 结果曲线是否为分段函数 |
|||
|
|||
public A8kIdCardFn pj1FnInfo; |
|||
public A8kIdCardFn pj2FnInfo; |
|||
public A8kIdCardFn pj3FnInfo; |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue