Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-hmhj
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangweidong
patzn-cloud-service-hmhj
Commits
5974521d
Commit
5974521d
authored
Jul 14, 2021
by
ghxdhr
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
7aae38b4
c250e915
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
453 additions
and
75 deletions
+453
-75
EntrustSampleController.java
...service/lims/hmhj/controller/EntrustSampleController.java
+5
-0
EntrustSampleItemController.java
...ice/lims/hmhj/controller/EntrustSampleItemController.java
+6
-0
EntrustSampleItemMapper.java
...oud/service/lims/hmhj/mapper/EntrustSampleItemMapper.java
+2
-0
EntrustSampleMapper.java
...n/cloud/service/lims/hmhj/mapper/EntrustSampleMapper.java
+3
-0
IEntrustSampleItemService.java
.../service/lims/hmhj/service/IEntrustSampleItemService.java
+2
-1
IEntrustSampleService.java
...loud/service/lims/hmhj/service/IEntrustSampleService.java
+12
-0
EntrustReportServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustReportServiceImpl.java
+9
-4
EntrustSampleItemServiceImpl.java
.../lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
+94
-18
EntrustSamplePrepareServiceImpl.java
...ms/hmhj/service/impl/EntrustSamplePrepareServiceImpl.java
+4
-0
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+171
-5
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+31
-21
EntrustMapper.xml
src/main/resources/mapper/hmhj/EntrustMapper.xml
+3
-3
EntrustSampleItemIndexMapper.xml
...in/resources/mapper/hmhj/EntrustSampleItemIndexMapper.xml
+1
-0
EntrustSampleItemMapper.xml
src/main/resources/mapper/hmhj/EntrustSampleItemMapper.xml
+40
-11
EntrustSampleMapper.xml
src/main/resources/mapper/hmhj/EntrustSampleMapper.xml
+64
-12
20210714新增检测项目字段.sql
...test/java/resources/db_sql/hmhj/v147/20210714新增检测项目字段.sql
+6
-0
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/controller/EntrustSampleController.java
View file @
5974521d
...
@@ -214,6 +214,11 @@ public class EntrustSampleController extends ServiceController {
...
@@ -214,6 +214,11 @@ public class EntrustSampleController extends ServiceController {
return
success
(
entrustSampleService
.
obtainMakeInfo
(
ids
,
getAccount
()));
return
success
(
entrustSampleService
.
obtainMakeInfo
(
ids
,
getAccount
()));
}
}
@ApiOperation
(
"获取制备时的列表信息"
)
@PostMapping
(
"/get_make_info"
)
public
RestResult
<
List
<
EntrustSampleVO
>>
getMakeInfoList
(
EntrustSampleVO
entrustSampleVO
)
{
return
success
(
entrustSampleService
.
getMakeInfoList
(
entrustSampleVO
,
getAccount
()));
}
@ApiOperation
(
"样品接收分页列表"
)
@ApiOperation
(
"样品接收分页列表"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/controller/EntrustSampleItemController.java
View file @
5974521d
...
@@ -487,6 +487,12 @@ public class EntrustSampleItemController extends ServiceController {
...
@@ -487,6 +487,12 @@ public class EntrustSampleItemController extends ServiceController {
return
success
(
entrustSampleItemService
.
getListBySampleId
(
sampleId
));
return
success
(
entrustSampleItemService
.
getListBySampleId
(
sampleId
));
}
}
@ApiOperation
(
"样品下检测项目列表"
)
@PostMapping
(
"/list_by_sample_ids"
)
public
RestResult
<
List
<
EntrustSampleItemVO
>>
getListBySampleIds
(
@RequestParam
(
"sampleIds"
)
Long
[]
sampleIds
)
{
return
success
(
entrustSampleItemService
.
listBySampleIds
(
sampleIds
));
}
@ApiOperation
(
"数据录入提交"
)
@ApiOperation
(
"数据录入提交"
)
@PostMapping
(
"/submit_test"
)
@PostMapping
(
"/submit_test"
)
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/mapper/EntrustSampleItemMapper.java
View file @
5974521d
...
@@ -58,4 +58,6 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
...
@@ -58,4 +58,6 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
List
<
LmsUserRelGroupVO
>
selectAllPersonWorkload
(
RowBounds
rowBounds
,
@Param
(
"rel"
)
LmsUserRelGroup
lmsUserRelGroup
);
List
<
LmsUserRelGroupVO
>
selectAllPersonWorkload
(
RowBounds
rowBounds
,
@Param
(
"rel"
)
LmsUserRelGroup
lmsUserRelGroup
);
List
<
EntrustSampleCalcResultVO
>
selectSampleCalcResult
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
List
<
EntrustSampleCalcResultVO
>
selectSampleCalcResult
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
boolean
updateItemJudgeByEntrustId
(
@Param
(
"entrustId"
)
Long
entrustId
);
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/mapper/EntrustSampleMapper.java
View file @
5974521d
...
@@ -28,6 +28,8 @@ public interface EntrustSampleMapper extends BatchMapper<EntrustSample> {
...
@@ -28,6 +28,8 @@ public interface EntrustSampleMapper extends BatchMapper<EntrustSample> {
List
<
EntrustSampleVO
>
selectVOList
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
List
<
EntrustSampleVO
>
selectVOList
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
List
<
EntrustSampleVO
>
selectListWithRelation
(
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
List
<
EntrustSampleVO
>
selectMinStatusByEntrustIds
(
@Param
(
"entrustIds"
)
List
<
Long
>
entrustIds
);
List
<
EntrustSampleVO
>
selectMinStatusByEntrustIds
(
@Param
(
"entrustIds"
)
List
<
Long
>
entrustIds
);
List
<
EntrustSampleVO
>
selectTestResultQuery
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
List
<
EntrustSampleVO
>
selectTestResultQuery
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
...
@@ -37,4 +39,5 @@ public interface EntrustSampleMapper extends BatchMapper<EntrustSample> {
...
@@ -37,4 +39,5 @@ public interface EntrustSampleMapper extends BatchMapper<EntrustSample> {
List
<
ElectrolyteRatioStatsVO
>
selectElectrolyteRatioStats
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
List
<
ElectrolyteRatioStatsVO
>
selectElectrolyteRatioStats
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
List
<
PMakeFeStatsVO
>
selectPMakeFeStats
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
List
<
PMakeFeStatsVO
>
selectPMakeFeStats
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleItemService.java
View file @
5974521d
...
@@ -78,7 +78,6 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
...
@@ -78,7 +78,6 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
public
boolean
isAllocatedByEntrustId
(
Long
entrustId
);
public
boolean
isAllocatedByEntrustId
(
Long
entrustId
);
Page
<
LmsUserRelGroupVO
>
pageGroupUser
(
Page
<
LmsUserRelGroupVO
>
page
,
LmsUserRelGroup
soilExperiment
);
Page
<
LmsUserRelGroupVO
>
pageGroupUser
(
Page
<
LmsUserRelGroupVO
>
page
,
LmsUserRelGroup
soilExperiment
);
List
<
TesterWorkloadStatsVO
>
getTesterWorkloadStatusQuery
(
QueryDTO
queryDTO
);
List
<
TesterWorkloadStatsVO
>
getTesterWorkloadStatusQuery
(
QueryDTO
queryDTO
);
...
@@ -88,4 +87,6 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
...
@@ -88,4 +87,6 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
List
<
EntrustSampleCalcResultVO
>
getSampleCalcResult
(
QueryDTO
queryDTO
);
List
<
EntrustSampleCalcResultVO
>
getSampleCalcResult
(
QueryDTO
queryDTO
);
Boolean
notWriteToReport
(
List
<
Long
>
ids
);
Boolean
notWriteToReport
(
List
<
Long
>
ids
);
boolean
updateItemComposeJudgeByEntrustId
(
Long
entrustId
);
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleService.java
View file @
5974521d
...
@@ -76,6 +76,10 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
...
@@ -76,6 +76,10 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
List
<
EntrustSample
>
getByEntrustId
(
Long
entrustId
);
List
<
EntrustSample
>
getByEntrustId
(
Long
entrustId
);
List
<
EntrustSampleVO
>
getVOListByEntrustId
(
Long
entrustId
);
List
<
EntrustSampleVO
>
getVOListByIds
(
List
<
Long
>
sampleIdList
);
List
<
Long
>
getIdsByEntrustId
(
Long
entrustId
);
List
<
Long
>
getIdsByEntrustId
(
Long
entrustId
);
boolean
updateSample
(
EntrustSample
entrustSample
,
String
source
,
Account
account
);
boolean
updateSample
(
EntrustSample
entrustSample
,
String
source
,
Account
account
);
...
@@ -85,4 +89,12 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
...
@@ -85,4 +89,12 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
boolean
scanReceive
(
String
sampleCode
,
Account
account
);
boolean
scanReceive
(
String
sampleCode
,
Account
account
);
boolean
makeSingleReport
(
Long
sampleId
,
Long
[]
itemIds
,
Long
templateId
,
Account
account
);
boolean
makeSingleReport
(
Long
sampleId
,
Long
[]
itemIds
,
Long
templateId
,
Account
account
);
List
<
EntrustSampleVO
>
getMakeInfoList
(
EntrustSampleVO
entrustSampleVO
,
Account
account
);
boolean
updateSampleCodeByEntrustId
(
Long
entrustId
,
int
level
);
boolean
updateSampleCodeByIds
(
List
<
Long
>
sampleIdsList
,
int
level
);
List
<
EntrustSampleVO
>
selectListWithRelation
(
EntrustSampleVO
entrustSampleVO
);
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustReportServiceImpl.java
View file @
5974521d
...
@@ -14,10 +14,7 @@ import com.patzn.cloud.service.hmhj.entity.Entrust;
...
@@ -14,10 +14,7 @@ import com.patzn.cloud.service.hmhj.entity.Entrust;
import
com.patzn.cloud.service.hmhj.entity.EntrustReport
;
import
com.patzn.cloud.service.hmhj.entity.EntrustReport
;
import
com.patzn.cloud.service.hmhj.entity.EntrustReportRelSample
;
import
com.patzn.cloud.service.hmhj.entity.EntrustReportRelSample
;
import
com.patzn.cloud.service.hmhj.entity.EntrustSample
;
import
com.patzn.cloud.service.hmhj.entity.EntrustSample
;
import
com.patzn.cloud.service.hmhj.enums.EntrustFlowEnum
;
import
com.patzn.cloud.service.hmhj.enums.*
;
import
com.patzn.cloud.service.hmhj.enums.EntrustReportStatusEnum
;
import
com.patzn.cloud.service.hmhj.enums.EntrustSampleItemStatusEnum
;
import
com.patzn.cloud.service.hmhj.enums.EntrustSampleStatusEnum
;
import
com.patzn.cloud.service.lims.hmhj.common.LabreOfficeUtil
;
import
com.patzn.cloud.service.lims.hmhj.common.LabreOfficeUtil
;
import
com.patzn.cloud.service.lims.hmhj.mapper.EntrustReportMapper
;
import
com.patzn.cloud.service.lims.hmhj.mapper.EntrustReportMapper
;
import
com.patzn.cloud.service.lims.hmhj.service.*
;
import
com.patzn.cloud.service.lims.hmhj.service.*
;
...
@@ -206,6 +203,14 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
...
@@ -206,6 +203,14 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
entrustService
.
submitToNextNode
(
entrust
,
account
);
entrustService
.
submitToNextNode
(
entrust
,
account
);
}
else
{
}
else
{
String
remark
=
(
fromFlowStatus
.
getValue
()
<
toFlowStatus
.
getValue
()
?
"提交至"
:
"驳回至"
)
+
toFlowStatus
.
getDisplay
();
String
remark
=
(
fromFlowStatus
.
getValue
()
<
toFlowStatus
.
getValue
()
?
"提交至"
:
"驳回至"
)
+
toFlowStatus
.
getDisplay
();
// 若提交至 -> 质量判定,那么需要更改委托状态
if
(
toFlowStatus
==
EntrustFlowEnum
.
QUALITY_JUDGE
){
entrust
.
setStatus
(
EntrustStatusEnum
.
QUALITY_CHECK
);
entrustService
.
updateById
(
entrust
);
// 更改样品编码显示形式,由三级变为一级
entrustSampleService
.
updateSampleCodeByEntrustId
(
entrust
.
getId
(),
1
);
}
entrustRecordService
.
record
(
new
Long
[]{
entrust
.
getId
()},
fromFlowStatus
.
getDisplay
(),
toFlowStatus
.
getDisplay
(),
0
,
account
,
remark
);
entrustRecordService
.
record
(
new
Long
[]{
entrust
.
getId
()},
fromFlowStatus
.
getDisplay
(),
toFlowStatus
.
getDisplay
(),
0
,
account
,
remark
);
}
}
return
true
;
return
true
;
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
View file @
5974521d
This diff is collapsed.
Click to expand it.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSamplePrepareServiceImpl.java
View file @
5974521d
...
@@ -173,6 +173,10 @@ public class EntrustSamplePrepareServiceImpl extends BaseServiceImpl<EntrustSamp
...
@@ -173,6 +173,10 @@ public class EntrustSamplePrepareServiceImpl extends BaseServiceImpl<EntrustSamp
saveBatch
(
savePrepare
);
saveBatch
(
savePrepare
);
// 根据样品IDS更新样品编号
// 样品制备 -> 样品接收 相当于从二级编码 变为 三级编码
entrustSampleService
.
updateSampleCodeByIds
(
sampleIdsList
,
3
);
List
<
EntrustSample
>
checkMakeList
=
entrustSampleService
.
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrust
.
getId
()).
eq
(
"status"
,
EntrustSampleStatusEnum
.
DRAFT
));
List
<
EntrustSample
>
checkMakeList
=
entrustSampleService
.
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrust
.
getId
()).
eq
(
"status"
,
EntrustSampleStatusEnum
.
DRAFT
));
if
(
CollectionUtils
.
isEmpty
(
checkMakeList
))
{
if
(
CollectionUtils
.
isEmpty
(
checkMakeList
))
{
// String flowStatus = entrust.getFlowStatus();
// String flowStatus = entrust.getFlowStatus();
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
5974521d
...
@@ -409,9 +409,37 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -409,9 +409,37 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
itemStatus
=
EntrustSampleItemStatusEnum
.
END
;
itemStatus
=
EntrustSampleItemStatusEnum
.
END
;
}
}
// 哪一级别
int
whichLevel
=
1
;
int
nextFlowVal
=
nextFlowStatus
.
getValue
().
intValue
();
// 用数字代码写的少,小于3,草稿和委托评审,对于编码级别不变
// 在等于4,用于二级编码
// 在大于4,小于14,用三级编码,若三级编码不存在,用二级编码
// 在大于等于14,用一级编码
if
(
nextFlowVal
==
4
)
{
whichLevel
=
2
;
}
else
if
(
nextFlowVal
>
4
&&
nextFlowVal
<
14
)
{
whichLevel
=
3
;
}
if
(
null
!=
sampleStatus
)
{
if
(
null
!=
sampleStatus
)
{
updateSample
.
setStatus
(
sampleStatus
);
updateSample
.
setStatus
(
sampleStatus
);
update
(
updateSample
,
Condition
.
create
().
eq
(
"entrust_id"
,
entrust
.
getId
()));
for
(
EntrustSample
sample
:
sampleList
)
{
String
firstCode
=
sample
.
getFirstCode
(),
secondCode
=
sample
.
getSecondCode
(),
thirdCode
=
sample
.
getThirdCode
();
String
sampleCode
=
firstCode
;
if
(
2
==
whichLevel
)
{
sampleCode
=
StringUtils
.
isNotBlank
(
secondCode
)
?
secondCode
:
firstCode
;
}
else
if
(
3
==
whichLevel
)
{
sampleCode
=
StringUtils
.
isNotBlank
(
thirdCode
)
?
thirdCode
:
(
StringUtils
.
isNotBlank
(
secondCode
)
?
secondCode
:
firstCode
);
}
sample
.
setCode
(
sampleCode
);
sample
.
setStatus
(
sampleStatus
).
setProgress
(
sampleStatus
);
}
// update(updateSample, Condition.create().eq("entrust_id", entrust.getId()));
// 批量更新样品编号和状态
updateBatchById
(
sampleList
);
}
}
if
(
null
!=
itemStatus
)
{
if
(
null
!=
itemStatus
)
{
updateItem
.
setStatus
(
itemStatus
);
updateItem
.
setStatus
(
itemStatus
);
...
@@ -538,6 +566,26 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -538,6 +566,26 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
@Override
@Override
public
List
<
EntrustSampleVO
>
getVOListByEntrustId
(
Long
entrustId
){
if
(
null
==
entrustId
){
return
null
;
}
EntrustSampleVO
vo
=
new
EntrustSampleVO
();
vo
.
setEntrustId
(
entrustId
);
return
selectListWithRelation
(
vo
);
}
@Override
public
List
<
EntrustSampleVO
>
getVOListByIds
(
List
<
Long
>
sampleIdList
){
if
(
CollectionUtils
.
isEmpty
(
sampleIdList
)){
return
null
;
}
EntrustSampleVO
vo
=
new
EntrustSampleVO
();
vo
.
setIds
(
sampleIdList
);
return
selectListWithRelation
(
vo
);
}
@Override
public
List
<
Long
>
getIdsByEntrustId
(
Long
entrustId
)
{
public
List
<
Long
>
getIdsByEntrustId
(
Long
entrustId
)
{
List
<
EntrustSample
>
list
=
getByEntrustId
(
entrustId
);
List
<
EntrustSample
>
list
=
getByEntrustId
(
entrustId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
...
@@ -623,6 +671,87 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -623,6 +671,87 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
return
list
;
return
list
;
}
}
public
List
<
EntrustSampleVO
>
getMakeInfoList
(
EntrustSampleVO
entrustSampleVO
,
Account
account
)
{
String
makeType
=
entrustSampleVO
.
getMakeType
();
// 默认全部
boolean
bySample
=
true
,
sySample
=
true
;
if
(
StringUtils
.
isNotBlank
(
makeType
))
{
if
(
"备样"
.
equals
(
makeType
))
{
bySample
=
true
;
sySample
=
false
;
}
else
{
bySample
=
false
;
sySample
=
true
;
}
}
List
<
Long
>
sampleIdList
=
entrustSampleVO
.
getIds
();
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleIdList
),
"请选择要制备的样品"
);
List
<
EntrustSample
>
sampleList
=
getBatchIds
(
sampleIdList
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"请选择要制备的样品"
);
List
<
EntrustSampleItem
>
itemList
=
entrustSampleItemService
.
list
(
Condition
.
create
().
in
(
"entrust_sample_id"
,
sampleIdList
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
itemList
),
"所选择的样品不含检测项目,无法制备"
);
//
Set
<
Long
>
setSampleIds
=
itemList
.
stream
().
map
(
EntrustSampleItem:
:
getEntrustSampleId
).
collect
(
Collectors
.
toSet
());
if
(
sampleIdList
.
size
()
!=
setSampleIds
.
size
())
{
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
itemList
),
"所选择的样品有不含检测项目的,请确认"
);
}
Map
<
Long
,
Map
<
Long
,
String
>>
sampleGroupMap
=
new
HashMap
<>();
for
(
EntrustSampleItem
item
:
itemList
)
{
if
(
sampleGroupMap
.
containsKey
(
item
.
getEntrustSampleId
()))
{
Map
<
Long
,
String
>
groupMap
=
sampleGroupMap
.
get
(
item
.
getEntrustSampleId
());
groupMap
.
put
(
item
.
getGroupId
(),
item
.
getGroupName
());
sampleGroupMap
.
put
(
item
.
getEntrustSampleId
(),
groupMap
);
}
else
{
Map
<
Long
,
String
>
groupMap
=
new
HashMap
<>();
groupMap
.
put
(
item
.
getGroupId
(),
item
.
getGroupName
());
sampleGroupMap
.
put
(
item
.
getEntrustSampleId
(),
groupMap
);
}
}
List
<
EntrustSampleVO
>
list
=
new
ArrayList
<>();
for
(
EntrustSample
sample
:
sampleList
)
{
Map
<
Long
,
String
>
groupMap
=
sampleGroupMap
.
get
(
sample
.
getId
());
if
(
null
==
groupMap
)
{
continue
;
}
if
(
sySample
)
{
for
(
Map
.
Entry
<
Long
,
String
>
g
:
groupMap
.
entrySet
())
{
EntrustSampleVO
sampleVO
=
sample
.
convert
(
EntrustSampleVO
.
class
);
sampleVO
.
setId
(
null
);
sampleVO
.
setGroupId
(
g
.
getKey
());
sampleVO
.
setGroupName
(
g
.
getValue
());
sampleVO
.
setMakeType
(
"送检样"
);
Set
<
String
>
itemNameSet
=
new
HashSet
<>();
for
(
EntrustSampleItem
item
:
itemList
)
{
if
(
item
.
getEntrustSampleId
().
equals
(
sample
.
getId
())
&&
item
.
getGroupId
().
equals
(
g
.
getKey
()))
{
itemNameSet
.
add
(
item
.
getName
());
}
}
sampleVO
.
setItemNames
(
StringHandleUtils
.
join
(
itemNameSet
));
sampleVO
.
setEntrustSampleId
(
sample
.
getId
());
list
.
add
(
sampleVO
);
}
}
//备样
if
(
bySample
)
{
EntrustSampleVO
sampleVO
=
sample
.
convert
(
EntrustSampleVO
.
class
);
sampleVO
.
setMakeType
(
"备样"
);
list
.
add
(
sampleVO
);
}
}
return
list
;
}
@Override
@Override
public
Page
<
EntrustSampleVO
>
pageSampleReceive
(
Page
<
EntrustSampleVO
>
page
,
EntrustSampleVO
entrustSample
)
{
public
Page
<
EntrustSampleVO
>
pageSampleReceive
(
Page
<
EntrustSampleVO
>
page
,
EntrustSampleVO
entrustSample
)
{
return
page
.
setRecords
(
baseMapper
.
selectSampleReceiveList
(
page
,
entrustSample
));
return
page
.
setRecords
(
baseMapper
.
selectSampleReceiveList
(
page
,
entrustSample
));
...
@@ -1560,13 +1689,49 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -1560,13 +1689,49 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sampleCode
),
"请扫描二维码"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sampleCode
),
"请扫描二维码"
);
String
[]
codeArray
=
sampleCode
.
split
(
"~"
);
String
[]
codeArray
=
sampleCode
.
split
(
"~"
);
RestAssert
.
fail
(
codeArray
.
length
!=
3
,
"样品编号有误!"
);
RestAssert
.
fail
(
codeArray
.
length
!=
3
,
"样品编号有误!"
);
Long
groupId
=
Long
.
parseLong
(
codeArray
[
1
]);
Long
sampleId
=
Long
.
parseLong
(
codeArray
[
2
]);
// 样品编号ID,根据当前提供的样品编号和组号获取
// 样品编号ID,根据当前提供的样品编号和组号获取
EntrustSample
sample
=
getOne
(
Condition
.
create
().
setSqlSelect
(
"id"
).
eq
(
"code
"
,
codeArray
[
0
]).
last
(
"LIMIT 1"
));
// EntrustSample sample = getOne(Condition.create().setSqlSelect("id").eq("id
", codeArray[0]).last("LIMIT 1"));
List
<
EntrustSamplePrepare
>
prepareList
=
entrustSamplePrepareService
.
list
(
Condition
.
create
().
eq
(
"entrust_sample_id"
,
sample
.
getId
()).
eq
(
"group_id"
,
Long
.
parseLong
(
codeArray
[
1
])
));
List
<
EntrustSamplePrepare
>
prepareList
=
entrustSamplePrepareService
.
list
(
Condition
.
create
().
eq
(
"entrust_sample_id"
,
sample
Id
).
eq
(
"group_id"
,
groupId
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
prepareList
),
"暂未查询到样品下的接收信息!"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
prepareList
),
"暂未查询到样品下的接收信息!"
);
Long
[]
sampleIds
=
prepareList
.
stream
().
map
(
EntrustSamplePrepare:
:
getEntrustSample
Id
).
toArray
(
size
->
new
Long
[
size
]);
Long
[]
prepareIds
=
prepareList
.
stream
().
map
(
EntrustSamplePrepare:
:
get
Id
).
toArray
(
size
->
new
Long
[
size
]);
return
entrustSamplePrepareService
.
submitSampleReceive
(
sampl
eIds
,
"扫码接收"
,
account
);
return
entrustSamplePrepareService
.
submitSampleReceive
(
prepar
eIds
,
"扫码接收"
,
account
);
}
}
@Override
public
boolean
updateSampleCodeByEntrustId
(
Long
entrustId
,
int
level
)
{
if
(
null
==
entrustId
||
0
==
entrustId
.
longValue
())
{
return
false
;
}
// 根据级别更新样品编号
String
fromFiled
=
"first_code"
;
if
(
3
==
level
)
{
fromFiled
=
" COALESCE(third_code,COALESCE(second_code,first_code)) "
;
}
else
if
(
2
==
level
)
{
fromFiled
=
" COALESCE(second_code,first_code) "
;
}
return
baseMapper
.
updateForSet
(
String
.
format
(
"code=%s"
,
fromFiled
),
new
EntityWrapper
<
EntrustSample
>().
eq
(
"entrust_id"
,
entrustId
))
>
0
;
}
@Override
public
boolean
updateSampleCodeByIds
(
List
<
Long
>
sampleIdsList
,
int
level
)
{
if
(
CollectionUtils
.
isEmpty
(
sampleIdsList
))
{
return
false
;
}
// 根据级别更新样品编号
String
fromFiled
=
"first_code"
;
if
(
3
==
level
)
{
fromFiled
=
" COALESCE(third_code,COALESCE(second_code,first_code)) "
;
}
else
if
(
2
==
level
)
{
fromFiled
=
" COALESCE(second_code,first_code) "
;
}
return
baseMapper
.
updateForSet
(
String
.
format
(
"code=%s"
,
fromFiled
),
new
EntityWrapper
<
EntrustSample
>().
in
(
"id"
,
sampleIdsList
))
>
0
;
}
@Override
public
List
<
EntrustSampleVO
>
selectListWithRelation
(
EntrustSampleVO
entrustSampleVO
){
return
baseMapper
.
selectListWithRelation
(
entrustSampleVO
);
}
}
}
\ No newline at end of file
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
5974521d
...
@@ -358,6 +358,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -358,6 +358,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
e
.
setProgress
(
EntrustStatusEnum
.
MAKE
);
e
.
setProgress
(
EntrustStatusEnum
.
MAKE
);
e
.
setFlowStatus
(
EntrustFlowEnum
.
MAKE
.
getName
());
e
.
setFlowStatus
(
EntrustFlowEnum
.
MAKE
.
getName
());
updateById
(
e
);
updateById
(
e
);
entrustSampleService
.
updateSampleCodeByEntrustId
(
e
.
getId
(),
2
);
entrustRecordService
.
record
(
new
Long
[]{
e
.
getId
()},
EntrustStatusEnum
.
CHECK
.
getDisplay
(),
EntrustStatusEnum
.
MAKE
.
getDisplay
(),
0
,
account
,
"提交至样品待制备"
);
entrustRecordService
.
record
(
new
Long
[]{
e
.
getId
()},
EntrustStatusEnum
.
CHECK
.
getDisplay
(),
EntrustStatusEnum
.
MAKE
.
getDisplay
(),
0
,
account
,
"提交至样品待制备"
);
}
}
}
}
...
@@ -385,6 +386,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -385,6 +386,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
e
.
setFlowStatus
(
EntrustFlowEnum
.
MAKE
.
getName
());
e
.
setFlowStatus
(
EntrustFlowEnum
.
MAKE
.
getName
());
updateById
(
e
);
updateById
(
e
);
entrustRecordService
.
record
(
new
Long
[]{
e
.
getId
()},
EntrustStatusEnum
.
DRAFT
.
getDisplay
(),
EntrustStatusEnum
.
MAKE
.
getDisplay
(),
0
,
account
,
"委托登记提交至样品待制备"
);
entrustRecordService
.
record
(
new
Long
[]{
e
.
getId
()},
EntrustStatusEnum
.
DRAFT
.
getDisplay
(),
EntrustStatusEnum
.
MAKE
.
getDisplay
(),
0
,
account
,
"委托登记提交至样品待制备"
);
// 此处需要批量更新样品编码,根据级别更新
entrustSampleService
.
updateSampleCodeByEntrustId
(
e
.
getId
(),
1
);
}
}
}
}
...
@@ -455,6 +458,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -455,6 +458,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustSampleItemService
.
saveBatch
(
saveItemList
);
entrustSampleItemService
.
saveBatch
(
saveItemList
);
}
}
}
}
entrustSampleItemService
.
updateItemComposeJudgeByEntrustId
(
entrust
.
getId
());
executor1
.
execute
(
new
Runnable
()
{
executor1
.
execute
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -653,9 +659,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -653,9 +659,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
@Override
public
Page
<
EntrustVO
>
pageEntrustByItemHis
(
Page
<
EntrustVO
>
page
,
EntrustVO
entrust
)
{
public
Page
<
EntrustVO
>
pageEntrustByItemHis
(
Page
<
EntrustVO
>
page
,
EntrustVO
entrust
)
{
if
(
CollectionUtils
.
isEmpty
(
entrust
.
getItemStatusEnumList
()))
{
if
(
CollectionUtils
.
isEmpty
(
entrust
.
getItemStatusEnumList
()))
{
return
page
;
return
page
;
}
}
return
page
.
setRecords
(
baseMapper
.
selectEntrustVOHisList
(
page
,
entrust
));
return
page
.
setRecords
(
baseMapper
.
selectEntrustVOHisList
(
page
,
entrust
));
}
}
...
@@ -1079,6 +1085,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -1079,6 +1085,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if
(
entrustSampleItemList
.
size
()
>
0
)
{
if
(
entrustSampleItemList
.
size
()
>
0
)
{
entrustSampleItemService
.
saveBatch
(
entrustSampleItemList
);
entrustSampleItemService
.
saveBatch
(
entrustSampleItemList
);
}
}
// 更新检测项目判定字段
for
(
Long
entrustId
:
ids
)
{
entrustSampleItemService
.
updateItemComposeJudgeByEntrustId
(
entrustId
);
}
// 操作记录
// 操作记录
entrustRecordService
.
record
(
ids
,
EntrustStatusEnum
.
DRAFT
.
getDisplay
(),
EntrustStatusEnum
.
DRAFT
.
getDisplay
(),
0
,
account
,
"复制初始化委托"
);
entrustRecordService
.
record
(
ids
,
EntrustStatusEnum
.
DRAFT
.
getDisplay
(),
EntrustStatusEnum
.
DRAFT
.
getDisplay
(),
0
,
account
,
"复制初始化委托"
);
...
@@ -1218,7 +1228,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -1218,7 +1228,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
/* 导出检测委托书 */
/* 导出检测委托书 */
@Override
@Override
public
Boolean
exportEntrust
(
List
<
Long
>
ids
,
HttpServletResponse
response
)
{
public
Boolean
exportEntrust
(
List
<
Long
>
ids
,
HttpServletResponse
response
)
{
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
ids
),
"请选择至少一个委托"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
ids
),
"请选择至少一个委托"
);
ByteArrayOutputStream
baos
=
getEntrustBaos
();
ByteArrayOutputStream
baos
=
getEntrustBaos
();
List
<
File
>
files
=
null
;
List
<
File
>
files
=
null
;
try
{
try
{
...
@@ -1263,16 +1273,16 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -1263,16 +1273,16 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
private
ByteArrayOutputStream
getEntrustBaos
()
{
private
ByteArrayOutputStream
getEntrustBaos
()
{
InputStream
inputStream
=
this
.
getClass
().
getClassLoader
().
getResourceAsStream
(
"\\templates.\\word.\\entrust.\\EntrustExportTemplate.docx"
);
InputStream
inputStream
=
this
.
getClass
().
getClassLoader
().
getResourceAsStream
(
"\\templates.\\word.\\entrust.\\EntrustExportTemplate.docx"
);
RestAssert
.
fail
(
null
==
inputStream
,
"委托检测书模板获取失败"
);
RestAssert
.
fail
(
null
==
inputStream
,
"委托检测书模板获取失败"
);
byte
[]
buffer
=
new
byte
[
1024
];
byte
[]
buffer
=
new
byte
[
1024
];
int
len
;
int
len
;
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
try
{
try
{
while
((
len
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
while
((
len
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
baos
.
write
(
buffer
,
0
,
len
);
baos
.
write
(
buffer
,
0
,
len
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
logger
.
error
(
"读取inputStream异常:{}"
,
e
);
logger
.
error
(
"读取inputStream异常:{}"
,
e
);
}
finally
{
}
finally
{
IoUtils
.
close
(
inputStream
);
IoUtils
.
close
(
inputStream
);
}
}
...
@@ -1309,14 +1319,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -1309,14 +1319,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
currItems
=
items
.
stream
()
currItems
=
items
.
stream
()
.
filter
(
i
->
currIds
.
contains
(
i
.
getEntrustSampleId
()))
.
filter
(
i
->
currIds
.
contains
(
i
.
getEntrustSampleId
()))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
dataMap
.
put
(
"sample"
,
samples
.
get
(
0
));
dataMap
.
put
(
"sample"
,
samples
.
get
(
0
));
}
else
{
}
else
{
dataMap
.
put
(
"sample"
,
new
EntrustSample
());
dataMap
.
put
(
"sample"
,
new
EntrustSample
());
}
}
/* 委托 */
/* 委托 */
entrustVO
.
setSampleQuantityTotal
(
Long
.
parseLong
(
String
.
valueOf
(
samples
.
size
())));
entrustVO
.
setSampleQuantityTotal
(
Long
.
parseLong
(
String
.
valueOf
(
samples
.
size
())));
entrustVO
.
setCodes
(
ListToStringUtils
.
listToString
(
codes
,
"、"
,
gangCode
));
entrustVO
.
setCodes
(
ListToStringUtils
.
listToString
(
codes
,
"、"
,
gangCode
));
dataMap
.
put
(
"entrust"
,
entrustVO
);
dataMap
.
put
(
"entrust"
,
entrustVO
);
/* 项目名 */
/* 项目名 */
Set
<
String
>
itemNames
=
currItems
.
stream
().
filter
(
i
->
StringUtils
.
isNotEmpty
(
i
.
getName
()))
Set
<
String
>
itemNames
=
currItems
.
stream
().
filter
(
i
->
StringUtils
.
isNotEmpty
(
i
.
getName
()))
.
map
(
i
->
i
.
getName
()).
collect
(
Collectors
.
toSet
());
.
map
(
i
->
i
.
getName
()).
collect
(
Collectors
.
toSet
());
...
@@ -1325,17 +1335,17 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -1325,17 +1335,17 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
.
filter
(
i
->
StringUtils
.
isNotEmpty
(
i
.
getStandard
()))
.
filter
(
i
->
StringUtils
.
isNotEmpty
(
i
.
getStandard
()))
.
map
(
i
->
i
.
getStandard
()).
collect
(
Collectors
.
toSet
());
.
map
(
i
->
i
.
getStandard
()).
collect
(
Collectors
.
toSet
());
dataMap
.
put
(
"itemNames"
,
ListToStringUtils
.
listToString
(
itemNames
,
"、"
,
gangCode
));
dataMap
.
put
(
"itemNames"
,
ListToStringUtils
.
listToString
(
itemNames
,
"、"
,
gangCode
));
dataMap
.
put
(
"standards"
,
ListToStringUtils
.
listToString
(
standards
,
"、"
,
gangCode
));
dataMap
.
put
(
"standards"
,
ListToStringUtils
.
listToString
(
standards
,
"、"
,
gangCode
));
/* 委托时间和样品接收时间 */
/* 委托时间和样品接收时间 */
dataMap
.
put
(
"entrustTimeStr"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDay
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"entrustTimeStr"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDay
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"entrustTimeStrCn"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayChinese
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"entrustTimeStrCn"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayChinese
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"entrustTimeStrPoint"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayPoint
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"entrustTimeStrPoint"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayPoint
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStr"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDay
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStr"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDay
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStrCn"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayChinese
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStrCn"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayChinese
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStrPoint"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayPoint
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStrPoint"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayPoint
(
entrust
.
getReceiveTime
()),
gangCode
));
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
new
ByteArrayInputStream
(
baos
.
toByteArray
())).
setDefaultValue
(
"/"
).
render
(
dataMap
);
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
new
ByteArrayInputStream
(
baos
.
toByteArray
())).
setDefaultValue
(
"/"
).
render
(
dataMap
);
String
filePath
=
filePathPrefix
+
entrust
.
getCode
()
+
"检测委托书.docx"
;
String
filePath
=
filePathPrefix
+
entrust
.
getCode
()
+
"检测委托书.docx"
;
...
@@ -1357,7 +1367,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -1357,7 +1367,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustAnnexService
.
save
(
annex
);
entrustAnnexService
.
save
(
annex
);
files
.
add
(
file
);
files
.
add
(
file
);
IoUtils
.
close
(
fos
,
template
.
getXWPFDocument
());
IoUtils
.
close
(
fos
,
template
.
getXWPFDocument
());
}
}
return
files
;
return
files
;
}
}
...
...
src/main/resources/mapper/hmhj/EntrustMapper.xml
View file @
5974521d
...
@@ -61,13 +61,13 @@
...
@@ -61,13 +61,13 @@
<!--查询委托历史数据-->
<!--查询委托历史数据-->
<select
id=
"selectEntrustVOHisList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustVO"
>
<select
id=
"selectEntrustVOHisList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustVO"
>
SELECT * FROM entrust e WHERE e.deleted = 0
SELECT * FROM entrust e WHERE e.deleted = 0
<if
test=
"null
!=
vo.itemStatusEnumList"
>
<if
test=
"null
!=
vo.itemStatusEnumList"
>
AND exists (
AND exists (
select 1 from entrust_sample s,entrust_sample_item i where s.deleted = 0 and i.deleted = 0
select 1 from entrust_sample s,entrust_sample_item i where s.deleted = 0 and i.deleted = 0
and s.id = i.entrust_sample_id and e.id = s.entrust_id
and s.id = i.entrust_sample_id and e.id = s.entrust_id
and i.status IN
and i.status IN
<foreach
collection=
"vo.itemStatusEnumList"
i
ndex=
"itemStats"
item=
"id
"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"vo.itemStatusEnumList"
i
tem=
"item
"
open=
"("
separator=
","
close=
")"
>
#{item
Stats
}
#{item}
</foreach>
</foreach>
)
)
</if>
</if>
...
...
src/main/resources/mapper/hmhj/EntrustSampleItemIndexMapper.xml
View file @
5974521d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
ii.*,
ii.*,
i.name "item_name",
i.name "item_name",
i.id "item_id",
i.id "item_id",
i.compose_judge "item_compose_judge",
s.id "sample_id",
s.id "sample_id",
s.code "sample_code",
s.code "sample_code",
s.entrust_id
s.entrust_id
...
...
src/main/resources/mapper/hmhj/EntrustSampleItemMapper.xml
View file @
5974521d
...
@@ -92,8 +92,8 @@
...
@@ -92,8 +92,8 @@
</if>
</if>
)
)
SELECT i.*,s.name AS "sampleName",e.test_side "testSide",
COALESCE(s.third_code,s.code)
AS "sampleCode",l.record_id,r.object_key AS "recordObjectKey",
SELECT i.*,s.name AS "sampleName",e.test_side "testSide",
s.code
AS "sampleCode",l.record_id,r.object_key AS "recordObjectKey",
s.compliance_test,s.sample_from,sample_shape,s.second_code,s.third_code,i.in_report
s.compliance_test,s.sample_from,sample_shape,s.
first_code,s.
second_code,s.third_code,i.in_report
FROM i
FROM i
JOIN entrust_sample s ON i.entrust_sample_id = s.id
JOIN entrust_sample s ON i.entrust_sample_id = s.id
LEFT JOIN ( SELECT id,item_id,record_id FROM item_rel_original_record WHERE deleted = 0 ) l ON i.id = l.item_id
LEFT JOIN ( SELECT id,item_id,record_id FROM item_rel_original_record WHERE deleted = 0 ) l ON i.id = l.item_id
...
@@ -176,7 +176,9 @@
...
@@ -176,7 +176,9 @@
<select
id=
"selectVOListBySampleIds"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO"
>
<select
id=
"selectVOListBySampleIds"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO"
>
SELECT i.id,i.name,i.agreed_value,i.test_value,i.entrust_sample_id,i.standard,s.code AS "sampleCode"
SELECT
i.*,s.code AS "sampleCode",s.sample_shape ,s.sample_quantity, s.standard,
s.sample_from, s.product_code,s.name_code
FROM
FROM
entrust_sample_item i
entrust_sample_item i
JOIN entrust_sample s ON i.entrust_sample_id = s.ID
JOIN entrust_sample s ON i.entrust_sample_id = s.ID
...
@@ -213,16 +215,12 @@
...
@@ -213,16 +215,12 @@
ORDER BY s.code , i.name
ORDER BY s.code , i.name
</select>
</select>
<select
id=
"selectByItemDeviate"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO"
>
<select
id=
"selectByItemDeviate"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO"
>
SELECT i.id,i.name,i.agreed_value,i.test_value,i.standard,COALESCE(s.third_code,s.code) AS "sampleCode",
SELECT i.id,i.name,i.agreed_value,i.test_value,i.standard,
COALESCE(s.third_code,COALESCE(s.second_code,s.first_code)) AS "sampleCode",
i.group_name,i.standard,s.name AS "sampleName",e.client,e.code AS "entrustCode",
i.group_name,i.standard,s.name AS "sampleName",e.client,e.code AS "entrustCode",
d.method_code,d.reason,d.method_desc,d.applyer,d.apply_time , d.checker ,d.check_time,d.back_reason,r.object_key
d.method_code,d.reason,d.method_desc,d.applyer,d.apply_time , d.checker ,d.check_time,d.back_reason,r.object_key
AS "recordObjectKey"
AS "recordObjectKey"
FROM
FROM
entrust_sample_item i
entrust_sample_item i
JOIN entrust_sample s ON i.entrust_sample_id = s.ID
JOIN entrust_sample s ON i.entrust_sample_id = s.ID
...
@@ -491,4 +489,35 @@
...
@@ -491,4 +489,35 @@
</if>
</if>
GROUP BY ug.user_id,ug.group_id,ug.realname
GROUP BY ug.user_id,ug.group_id,ug.realname
</select>
</select>
<!--更新委托下检测项目的组合判定状态-->
<update
id=
"updateItemJudgeByEntrustId"
>
update entrust_sample_item i
set compose_judge = spi.compose_judge
from (
SELECT
distinct
s.entrust_id,
s.id "sample_id",
gp.grading_standard_id,
gi.grading_product_id,
gi.NAME "item_name",
gi.compose_judge
FROM
entrust_sample s
JOIN grading_standard gs ON gs.ID = s.product_standard_id
JOIN grading_product gp ON gp.grading_standard_id = gs.ID
join grading_item gi on gi.grading_product_id = gp.id
WHERE
s.deleted = 0
AND gs.deleted = 0
AND gp.deleted = 0
AND gi.deleted = 0
AND gs.compose_judge = 1
) as spi
where i.deleted = 0
and spi.item_name = i.name
and spi.sample_id = i.entrust_sample_id
and spi.entrust_id = #{entrustId}
</update>
</mapper>
</mapper>
src/main/resources/mapper/hmhj/EntrustSampleMapper.xml
View file @
5974521d
...
@@ -5,8 +5,9 @@
...
@@ -5,8 +5,9 @@
<select
id=
"selectSampleReceiveList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
<select
id=
"selectSampleReceiveList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
SELECT
SELECT
p.id, p.entrust_sample_id,COALESCE(s.third_code,s.code) "code",s.name,s.product_code,s.product_basis_name,s.compose_judge,s.product_standard_id,s.name_code,
p.id, p.entrust_sample_id,s.code "code",s.name,s.product_code,s.product_basis_name,s.compose_judge,s.product_standard_id,s.name_code,
s.compliance_test,p.group_id,p.group_name,p.make_type,p.make_quantity,p.store_way,p.store_location,p.maker,p.make_time
s.compliance_test,p.group_id,p.group_name,p.make_type,p.make_quantity,p.store_way,p.store_location,p.maker,p.make_time,
s.first_code,s.second_code,s.third_code
FROM
FROM
entrust_sample_prepare
entrust_sample_prepare
P JOIN entrust_sample s ON P.entrust_sample_id = s.ID
P JOIN entrust_sample s ON P.entrust_sample_id = s.ID
...
@@ -15,18 +16,17 @@
...
@@ -15,18 +16,17 @@
AND p.entrust_sample_id = #{vo.entrustSampleId}
AND p.entrust_sample_id = #{vo.entrustSampleId}
</if>
</if>
<if
test=
"null!=vo.prepareStatus"
>
AND p.status = #{vo.prepareStatus}
</if>
<if
test=
"null!=vo.prepareStatus"
>
<if
test=
"null!=vo.prepareNotStatus"
>
AND p.status = #{vo.prepareStatus}
AND p.status != #{vo.prepareNotStatus}
</if>
</if>
<if
test=
"null!=vo.prepareNotStatus"
>
AND p.status != #{vo.prepareNotStatus}
</if>
<if
test=
"null!=vo.entrustId"
>
<if
test=
"null!=vo.entrustId"
>
AND s.entrust_id = #{vo.entrustId}
AND s.entrust_id = #{vo.entrustId}
</if>
</if>
</select>
</select>
<select
id=
"selectVOList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
<select
id=
"selectVOList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
...
@@ -77,6 +77,58 @@
...
@@ -77,6 +77,58 @@
order by s.order_by asc, s.code ,s.ctime desc
order by s.order_by asc, s.code ,s.ctime desc
</select>
</select>
<!--查询带关联信息的样品列表-->
<select
id=
"selectListWithRelation"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
SELECT
s.*,
g.name "standard_name",g.code "standard_code",g.compose_judge "standard_compose_judge"
FROM entrust_sample s
LEFT JOIN grading_standard g on g.id = s.product_standard_id
WHERE deleted = 0
<if
test=
"null != vo.entrustId"
>
AND s.entrust_id = #{vo.entrustId}
</if>
<if
test=
"null != vo.status"
>
AND s.status = #{vo.status}
</if>
<if
test=
"null != vo.code"
>
AND s.code LIKE CONCAT('%',#{vo.code},'%')
</if>
<if
test=
"null != vo.notStatus"
>
AND s.status != #{vo.notStatus}
</if>
<if
test=
"null != vo.itemStatus"
>
AND exists (
select 1 from entrust_sample_item i where i.deleted = 0
and i.entrust_sample_id = s.id
and i.status = #{vo.itemStatus}
)
</if>
<if
test=
"null != vo.itemStatusList"
>
AND exists (
select 1 from entrust_sample_item i where i.deleted = 0
and i.entrust_sample_id = s.id
and i.status IN
<foreach
collection=
"vo.itemStatusList"
index=
"index"
item=
"itemStatus"
open=
"("
separator=
","
close=
")"
>
#{itemStatus}
</foreach>
)
</if>
<if
test=
"null!=vo.ids"
>
AND s.id IN
<foreach
collection=
"vo.ids"
index=
"index"
item=
"sampleId"
open=
"("
separator=
","
close=
")"
>
#{sampleId}
</foreach>
</if>
order by s.order_by asc, s.code ,s.ctime desc
</select>
<select
id=
"selectMinStatusByEntrustIds"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
<select
id=
"selectMinStatusByEntrustIds"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
WITH summary AS (
WITH summary AS (
...
...
src/test/java/resources/db_sql/hmhj/v147/20210714新增检测项目字段.sql
0 → 100644
View file @
5974521d
ALTER
TABLE
"public"
.
"qualification"
ALTER
TABLE
"public"
.
"qualification"
ADD
COLUMN
"instrument_item_name"
varchar
(
120
)
COLLATE
"pg_catalog"
.
"default"
;
COMMENT
ON
COLUMN
"public"
.
"qualification"
.
"instrument_item_name"
IS
'仪器中项目名称'
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment