交叉配血功能,临床发血功能开发

This commit is contained in:
jiangs 2026-08-14 10:14:35 +08:00
parent ebfc24a73c
commit 19ed34db34
33 changed files with 791 additions and 43 deletions

View File

@ -0,0 +1,4 @@
package com.czblood.bus.mapper;
public interface XkBackoutDetailMapper {
}

View File

@ -0,0 +1,4 @@
package com.czblood.bus.mapper;
public interface XkBackoutMainMapper {
}

View File

@ -6,4 +6,5 @@ import java.util.List;
public interface XkOutDetailMapper {
List<XkOutDetail> queryListByBillNo(String billNo);
void insert(XkOutDetail xkOutDetail);
}

View File

@ -5,4 +5,6 @@ import org.apache.ibatis.annotations.Param;
public interface XkOutMainMapper {
XkOutMain queryOne(@Param("billNo") String billNo);
void insert(XkOutMain xkOutMain);
}

View File

@ -0,0 +1,23 @@
package com.czblood.bus.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class XkBackoutDetail {
private String bill_no;
private Integer sid;
private String blood_no;
private BigDecimal price;
private String Reason_Type;
private String reason;
private BigDecimal Temperature;
private String Pack_Full;
private String cancle_flag;
private String product_no;
}

View File

@ -0,0 +1,36 @@
package com.czblood.bus.pojo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("血液退库主表")
public class XkBackoutMain {
private String billNo;
private String org_type;
private String hos_id;
private String back_org;
private String handle_person;
private BigDecimal total_money;
private Date back_date;
private String send_flag;
private String check_flag;
private String out_flag;
private String input_person;
private Date input_date;
private String audit_person;
private Date audit_date;
private String bill_cancle_flag;
private String check_person;
private Date check_date;
private String check_result;
private String return_remark;
private String remark;
}

View File

@ -49,7 +49,7 @@ public class XkBloodInfo {
private String blood_bag_no;
@ApiModelProperty("血袋生成批号")
private String blood_bag_batch;
@ApiModelProperty("血液状态,1.在库,4.出库")
@ApiModelProperty("血液状态,1.在库,4.出库,2报废")
private String blood_status;
@ApiModelProperty("特殊处理")
private String special_deal;

View File

@ -0,0 +1,21 @@
package com.czblood.bus.pojo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("血液报废详情表")
public class XkDiscardDetail {
private String bill_no;
private Integer sid;
private String blood_no;
private BigDecimal price;
private String reason;
private String product_no;
}

View File

@ -0,0 +1,29 @@
package com.czblood.bus.pojo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("报废血液主表")
public class XkDiscardMain {
private String bill_no;
private String handle_person;
private BigDecimal total_money;
private Date discard_date;
private String input_person;
private Date input_date;
private String audit_person;
private Date audit_date;
private String remark;
private String ratify_person;
private String ratify_attitude;
private String discard_approach;
private String discard_method;
}

View File

@ -219,7 +219,7 @@ public class BloodBankUtil {
List<XkMatchDetail> xkMatchDetailList = xkMatchDetailMapper.queryListByBillNo(billNo);
if(xkMatchDetailList.isEmpty()) return new Result("0","校验通过");
List<XkMatchDetail> collect = xkMatchDetailList.stream().filter(xkMatchDetail -> xkMatchDetail.getMatch_medic().equals(userId)).collect(Collectors.toList());
if(collect.size() > 0){
if(collect.isEmpty()){
return new Result("-1","当前交叉配血单[" + billNo + "]是由【" +
getUserInfo(userId).getNickName() + "】登记,您没有权限操作!");
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.XkBackoutDetailMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.XkBackoutMainMapper">
</mapper>

View File

@ -74,7 +74,8 @@
<if test="Sub_Blood != null">Sub_Blood = #{Sub_Blood},</if>
<if test="bz1 != null">bz1 = #{bz1},</if>
<if test="plt_test != null">plt_test = #{plt_test},</if>
where bill_no = #{billNo}
bill_no = #{bill_no}
where bill_no = #{bill_no}
</update>
<delete id="delete">
delete from xk_check_bloodtype where bill_no = #{billNo}

View File

@ -2,6 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.XkOutDetailMapper">
<insert id="insert">
insert into xk_out_detail (
<if test="blood_no != null">blood_no,</if>
<if test="price != null">price,</if>
<if test="special_deal != null">special_deal,</if>
<if test="have_reaction != null">have_reaction,</if>
<if test="finish_sign != null">finish_sign,</if>
<if test="accept_flag != null">accept_flag,</if>
<if test="exp1 != null">exp1,</if>
<if test="exp2 != null">exp2,</if>
<if test="exp3 != null">exp3,</if>
<if test="remark != null">remark,</if>
<if test="accept_dept != null">accept_dept,</if>
<if test="product_no != null">product_no,</if>
bill_no,sid
)values (
<if test="blood_no != null">#{blood_no},</if>
<if test="price != null">#{price},</if>
<if test="special_deal != null">#{special_deal},</if>
<if test="have_reaction != null">#{have_reaction},</if>
<if test="finish_sign != null">#{finish_sign},</if>
<if test="accept_flag != null">#{accept_flag},</if>
<if test="exp1 != null">#{exp1},</if>
<if test="exp2 != null">#{exp2},</if>
<if test="exp3 != null">#{exp3},</if>
<if test="remark != null">#{remark},</if>
<if test="accept_dept != null">#{accept_dept},</if>
<if test="product_no != null">#{product_no},</if>
#{bill_no},#{sid} )
</insert>
<select id="queryListByBillNo" resultType="com.czblood.bus.pojo.XkOutDetail">
select * from xk_out_detail where bill_no = #{billNo}
</select>

View File

@ -2,6 +2,61 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czblood.bus.mapper.XkOutMainMapper">
<insert id="insert">
insert into xk_out_main (
<if test="total_money != null">total_money,</if>
<if test="take_person != null">take_person,</if>
<if test="handle_person != null">handle_person,</if>
<if test="apply_no != null">apply_no,</if>
<if test="patient_name != null">patient_name,</if>
<if test="beinhos_id != null">beinhos_id,</if>
<if test="dept_id != null">dept_id,</if>
<if test="check_no != null">check_no,</if>
<if test="bill_sort != null">bill_sort,</if>
<if test="notify_time != null">notify_time,</if>
<if test="is_free_account != null">is_free_account,</if>
<if test="input_person != null">input_person,</if>
<if test="input_date != null">input_date,</if>
<if test="check_sign != null">check_sign,</if>
<if test="check_person != null">check_person,</if>
<if test="check_date != null">check_date,</if>
<if test="audit_person != null">audit_person,</if>
<if test="remark != null">remark,</if>
<if test="exp1 != null">exp1,</if>
<if test="exp2 != null">exp2,</if>
<if test="last_modified != null">last_modified,</if>
<if test="all_recycle_sign != null">all_recycle_sign,</if>
<if test="receive_person != null">receive_person,</if>
<if test="receive_id != null">receive_id,</if>
bill_no, hos_id,occur_date
)values (
<if test="total_money != null">#{total_money},</if>
<if test="take_person != null">#{take_person},</if>
<if test="handle_person != null">#{handle_person},</if>
<if test="apply_no != null">#{apply_no},</if>
<if test="patient_name != null">#{patient_name},</if>
<if test="beinhos_id != null">#{beinhos_id},</if>
<if test="dept_id != null">#{dept_id},</if>
<if test="check_no != null">#{check_no},</if>
<if test="bill_sort != null">#{bill_sort},</if>
<if test="notify_time != null">#{notify_time},</if>
<if test="is_free_account != null">#{is_free_account},</if>
<if test="input_person != null">#{input_person},</if>
<if test="input_date != null">#{input_date},</if>
<if test="check_sign != null">#{check_sign},</if>
<if test="check_person != null">#{check_person},</if>
<if test="check_date != null">#{check_date},</if>
<if test="audit_person != null">#{audit_person},</if>
<if test="remark != null">#{remark},</if>
<if test="exp1 != null">#{exp1},</if>
<if test="exp2 != null">#{exp2},</if>
<if test="last_modified != null">#{last_modified},</if>
<if test="all_recycle_sign != null">#{all_recycle_sign},</if>
<if test="receive_person != null">#{receive_person},</if>
<if test="receive_id != null">#{receive_id},</if>
#{bill_no}, #{hos_id}, #{occur_date}
)
</insert>
<select id="queryOne" resultType="com.czblood.bus.pojo.XkOutMain">
select * from xk_out_main where bill_no = #{billNo}

View File

@ -1,11 +1,14 @@
package com.czblood.busBloodbank.controller;
import com.czblood.busBloodbank.pojo.VO.BloodOutInfoVO;
import com.czblood.busBloodbank.service.BloodOutService;
import com.czblood.common.core.controller.BaseController;
import com.czblood.common.core.domain.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -14,15 +17,35 @@ import javax.annotation.Resource;
@Api(tags = "血液出库")
@RestController
@RequestMapping("/bus/bloodbank/bloodOut")
public class BloodOutController {
public class BloodOutController extends BaseController {
@Resource
private BloodOutService bloodOutService;
@ApiOperation("查询发血数据")
@ApiOperation("查询申请单数据")
@GetMapping("/queryOne")
public Result queryOne(String applyNo){
return bloodOutService.queryOne(applyNo);
}
@ApiOperation("查询待处理申请单数据")
@GetMapping("/queryWaitInfo")
public Result queryWaitInfo(){
return bloodOutService.queryWaitInfo();
}
@ApiOperation("获取发血数据")
@GetMapping("/getBloodInfoOut")
public Result getBloodInfoOut(String bloodNo,String productNo,String applyNo){
return bloodOutService.getBloodInfoOut(bloodNo, productNo, applyNo);
}
@ApiOperation("保存数据")
@PostMapping("/saveData")
public Result saveData(BloodOutInfoVO bloodOutInfoVO){
bloodOutInfoVO.setUserId(getUsername());
return bloodOutService.saveData(bloodOutInfoVO);
}
}

View File

@ -23,7 +23,7 @@ public class MatchBloodController extends BaseController {
@Resource
MatchBloodService matchBloodService;
@ApiOperation("获取单条数据")
@ApiOperation("获取申请单数据")
@GetMapping("/queryOne")
public Result queryOne(String billNo){
return matchBloodService.queryOne(billNo);
@ -93,6 +93,12 @@ public class MatchBloodController extends BaseController {
return matchBloodService.checkBloodMatched(bloodNo, productNo, billNo);
}
@ApiOperation("查询单条数据")
@GetMapping("/queryApplyInfo")
public Result queryApplyInfo(String billNo,String applyNo){
return matchBloodService.queryApplyInfo(billNo,applyNo);
}

View File

@ -1,5 +1,21 @@
package com.czblood.busBloodbank.mapper;
import com.czblood.bus.pojo.XkBackoutDetail;
import com.czblood.bus.pojo.XkDiscardMain;
import com.czblood.bus.pojo.XkMatchMain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface BloodOutMapper {
int queryApplyBloodTypeCount(String billNo);
List<Map<String,Object>> queryApplyInfo(String billNo);
List<Map<String,Object>> queryWaitInfo();
List<XkBackoutDetail> queryBloodBackOutCount(@Param("bloodNo") String bloodNo, @Param("productNo") String productNo);
List<Map<String,Object>> queryBloodOutInfoCount(@Param("bloodNo") String bloodNo, @Param("productNo") String productNo);
List<XkDiscardMain> queryDiscardCount(@Param("bloodNo") String bloodNo, @Param("productNo") String productNo);
List<Map<String,Object>> queryMatchBloodInfo(@Param("bloodNo") String bloodNo, @Param("productNo") String productNo, @Param("applyNo") String applyNo);
XkMatchMain queryXkMatchMain(String applyNo);
}

View File

@ -31,4 +31,5 @@ public interface MatchBloodMapper {
List<Map<String,Object>> querySearchBloodLastMatchDate();
List<Map<String,Object>> queryMatchBloodList(MatchBloodListQueryVO matchBloodListQueryVO);
List<Map<String,Object>> queryBloodMatchOthers(@Param("billNo") String billNo, @Param("bloodNo") String bloodNo, @Param("productNo") String productNo);
List<Map<String,Object>> queryMatchDetailInfo(String billNo);
}

View File

@ -0,0 +1,17 @@
package com.czblood.busBloodbank.pojo.DTO;
import com.czblood.bus.pojo.XkTransfuseApplyBloodbreed;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BloodOutDTO {
List<Map<String,Object>> applyInfoList;
List<XkTransfuseApplyBloodbreed> xkTransfuseApplyBloodbreedList;
}

View File

@ -0,0 +1,20 @@
package com.czblood.busBloodbank.pojo.DTO;
import com.czblood.bus.pojo.XkBloodInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BloodOutInfoDTO {
private XkBloodInfo xkBloodInfo;
@ApiModelProperty("配血方法")
private String match_method;
@ApiModelProperty("复核配血方法")
private String check_method;
@ApiModelProperty("配血结果")
private String result;
}

View File

@ -14,4 +14,5 @@ import java.util.Map;
public class MatchBloodDTO {
private List<Map<String,Object>> matchMainInfoList;
private List<XkTransfuseApplyBloodbreed> xkTransfuseApplyBloodbreedList;
private List<Map<String,Object>> matchDetailInfoList;
}

View File

@ -0,0 +1,20 @@
package com.czblood.busBloodbank.pojo.VO;
import com.czblood.bus.pojo.XkOutDetail;
import com.czblood.bus.pojo.XkOutMain;
import com.czblood.bus.pojo.XkTransfuseApply;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BloodOutInfoVO {
private XkOutMain xkOutMain;
private List<XkOutDetail> xkOutDetailList;
private XkTransfuseApply xkTransfuseApply;
private String userId;
}

View File

@ -15,4 +15,6 @@ public class MatchBloodListQueryVO {
private String applyNo;
private String beinhos_id;
private String bloodNo;
private String patientName;
private String status;
}

View File

@ -1,7 +1,11 @@
package com.czblood.busBloodbank.service;
import com.czblood.busBloodbank.pojo.VO.BloodOutInfoVO;
import com.czblood.common.core.domain.Result;
public interface BloodOutService {
Result queryOne(String applyNo);
Result queryWaitInfo();
Result getBloodInfoOut(String bloodNo, String productNo,String applyNo);
Result saveData(BloodOutInfoVO bloodOutInfoVO);
}

View File

@ -16,4 +16,5 @@ public interface MatchBloodService {
Result queryLisResult(String billNo);
Result queryMatchBloodList(MatchBloodListQueryVO matchBloodListQueryVO);
Result checkBloodMatched(String bloodNo, String productNo, String billNo);
Result queryApplyInfo(String billNo,String applyNo);
}

View File

@ -1,13 +1,22 @@
package com.czblood.busBloodbank.service.impl;
import com.czblood.bus.mapper.XkTransfuseApplyMapper;
import com.czblood.bus.pojo.XkTransfuseApply;
import com.czblood.bus.mapper.*;
import com.czblood.bus.pojo.*;
import com.czblood.bus.pojo.xtwh.XkBloodBreed;
import com.czblood.bus.utils.BloodBankUtil;
import com.czblood.busBloodbank.mapper.BloodOutMapper;
import com.czblood.busBloodbank.pojo.DTO.BloodOutDTO;
import com.czblood.busBloodbank.pojo.DTO.BloodOutInfoDTO;
import com.czblood.busBloodbank.pojo.VO.BloodOutInfoVO;
import com.czblood.busBloodbank.service.BloodOutService;
import com.czblood.busBloodbank.utils.MatchBloodUtil;
import com.czblood.common.core.domain.Result;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class BloodOutServiceImpl implements BloodOutService {
@ -16,6 +25,22 @@ public class BloodOutServiceImpl implements BloodOutService {
BloodOutMapper bloodOutMapper;
@Resource
XkTransfuseApplyMapper xkTransfuseApplyMapper;
@Resource
XkTransfuseApplyBloodbreedMapper xkTransfuseApplyBloodbreedMapper;
@Resource
MatchBloodUtil matchBloodUtil;
@Resource
XkBloodInfoMapper xkBloodInfoMapper;
@Resource
BloodBankUtil bloodBankUtil;
@Resource
XkBloodBreedMapper xkBloodBreedMapper;
@Resource
XkOutMainMapper xkOutMainMapper;
@Resource
XkMatchMainMapper xkMatchMainMapper;
@Override
public Result queryOne(String applyNo) {
@ -24,24 +49,90 @@ public class BloodOutServiceImpl implements BloodOutService {
String operationType = xkTransfuseApply.getOperation_type();
if(operationType.equals("Z")) return new Result("-1","该申请单为自体血申请单,无法在这操作!");
if(!operationType.equals("S")) return new Result("-1","该申请单为输血治疗申请单,无法在这操作!");
String billSort = xkTransfuseApply.getBill_sort();
String billStatus = xkTransfuseApply.getBill_stasus();
switch (billSort){
case "N":
return new Result("-1","该申请单尚未审核,不能进行发血!");
case "A":
if(billStatus.equals("B")) {
return new Result("-1","该申请单尚未复核血型,请先复核血型!");
}else if(billStatus.equals("N")){
return new Result("-1","该申请单未通过审核,不能进行发血操作!");
}else if(billStatus.equals("D")){
return new Result("-1","该申请单已经发血!");
}else if(billStatus.equals("Z")){
return new Result("-1","该申请单已经作废!");
}
return new Result("0","操作成功");
Result result = checkBloodValid(xkTransfuseApply);
if(!result.getCode().equals("0")) return result;
//返回数据
List<Map<String, Object>> mapList = bloodOutMapper.queryApplyInfo(applyNo);
List<XkTransfuseApplyBloodbreed> xkTransfuseApplyBloodbreedList = xkTransfuseApplyBloodbreedMapper.queryOne(applyNo);
BloodOutDTO bloodOutDTO = new BloodOutDTO();
bloodOutDTO.setApplyInfoList(mapList);
bloodOutDTO.setXkTransfuseApplyBloodbreedList(xkTransfuseApplyBloodbreedList);
return new Result("0","操作成功",bloodOutDTO);
}
@Override
public Result queryWaitInfo() {
List<Map<String, Object>> queryWaitInfoList = bloodOutMapper.queryWaitInfo();
return new Result("0","操作成功",queryWaitInfoList);
}
@Override
public Result getBloodInfoOut(String bloodNo, String productNo,String applyNo) {
Result result = matchBloodUtil.checkAboCheckAbnor(bloodNo, productNo);
if(!result.getCode().equals("0")) return result;
XkBloodInfo xkBloodInfo = xkBloodInfoMapper.queryOne(bloodNo, productNo);
if(xkBloodInfo == null) return new Result("-1","该血液不存在,请检查!");
Date validDate = xkBloodInfo.getValid_date();
Date currentTimeDate = bloodBankUtil.getCurrentTimeDate();
if(currentTimeDate.compareTo(validDate) > 0) return new Result("-1","该血液已过期!");
String bloodSort = xkBloodInfo.getBlood_sort();
if(bloodSort.equals("Z")) return new Result("-1","该血液为自体血,不可在这操作!");
String bloodStatus = xkBloodInfo.getBlood_status();
if(bloodStatus.equals("4")) return new Result("-1","该血液已发血!");
if(bloodStatus.equals("2")) return new Result("-1","该血液已作废!");
BloodOutInfoDTO bloodOutInfoDTO = new BloodOutInfoDTO();
result = checkMatcheBlood(xkBloodInfo, applyNo,bloodOutInfoDTO);
if(!result.getCode().equals("0")) return result;
// if(bloodStatus.equals("4") || bloodStatus.equals("2")) {
//// result = checkOnOut(bloodNo, productNo);
//// if(!result.getCode().equals("0")) return result;
//
// }else if(bloodStatus.equals("1")){
//
// }
result = matchBloodUtil.checkBloodExistOut(bloodNo, productNo, applyNo);
if(!result.getCode().equals("0")) return result;
//返回数据
bloodOutInfoDTO.setXkBloodInfo(xkBloodInfo);
return new Result("0","操作成功",bloodOutInfoDTO);
}
@Override
public Result saveData(BloodOutInfoVO bloodOutInfoVO) {
XkOutMain xkOutMain = bloodOutInfoVO.getXkOutMain();
String billNo = BloodBankUtil.isBank(xkOutMain.getBill_no());
String applyNo = xkOutMain.getApply_no();
List<XkOutDetail> xkOutDetailList = bloodOutInfoVO.getXkOutDetailList();
if(xkOutDetailList.isEmpty()) return new Result("-1","出库血液为空,请选择出库血液!");
boolean bModify = false;
if(!billNo.equals("")) bModify = true;
String matchNo = "";
String checkNo = "";
Date currentTimeDate = bloodBankUtil.getCurrentTimeDate();
XkMatchMain xkMatchMain = bloodOutMapper.queryXkMatchMain(applyNo);
if(xkMatchMain != null) {
matchNo = BloodBankUtil.isBank(xkMatchMain.getBill_no());
checkNo = BloodBankUtil.isBank(xkMatchMain.getCheck_no());
}
xkOutMain.setMatch_no(matchNo);
xkOutMain.setCheck_no(checkNo);
xkOutMain.setExp2("Y"); //通知取血护士
xkOutMain.setNotify_time(currentTimeDate);
if(!bModify){
//新增
String newBillNo = bloodBankUtil.produceBillNo("FXD");
}else{
//修改
Result result = bloodBankUtil.checkOperatorModify("LCFX", billNo, bModify, bloodOutInfoVO.getUserId());
if(!result.getCode().equals("0")) return result;
XkOutMain xkOutMainDB = xkOutMainMapper.queryOne(billNo);
String checkSign = xkOutMainDB.getCheck_sign();
if(checkSign.equals("Y")) return new Result("-1","该单据已经通过审核,不能作修改!");
}
//返回数据 TODO
return null;
}
@ -92,7 +183,7 @@ public class BloodOutServiceImpl implements BloodOutService {
case "B":
return new Result("-1","该申请单尚未复核血型,请先复核血型!");
case "D":
//TODO 这里还有个函数没写
//这里还有个函数,Pb程序注释掉了!
break;
case "Z":
return new Result("-1","该申请单已经作废!");
@ -100,11 +191,64 @@ public class BloodOutServiceImpl implements BloodOutService {
return new Result("-1","该申请单为补单,若要按正常流程,请先复核血型、配血后再发血,否则按紧急流程!");
case "W":
return new Result("-1","该申请单已经补录,若要追加发血,请先复核血型、配血后再发血!");
//TODO 这里还有个C,S状态没有写,要看下
}
}
return new Result("0","操作成功");
}
/**
* 判断血液是否已经出库
* @return
*/
public Result checkOnOut(String bloodNo,String productNo){
List<XkBackoutDetail> xkBackoutDetailList = bloodOutMapper.queryBloodBackOutCount(bloodNo, productNo);
String msg = "";
if(xkBackoutDetailList.size()>0){
String bloodNo1 = xkBackoutDetailList.get(0).getBlood_no();
String billNo = xkBackoutDetailList.get(0).getBill_no();
msg = "血液【" + bloodNo1 + "】,已经退回血站!~r~n退血单号为【" + billNo + "】,请检查!";
}
List<Map<String,Object>> bloodOutList = bloodOutMapper.queryBloodOutInfoCount(bloodNo, productNo);
if(!bloodOutList.isEmpty()){
msg = "血液【" + bloodNo + "】,已经发给【" + BloodBankUtil.isBank(bloodOutList.get(0).get("dept_name")) + "】的病患【"
+ BloodBankUtil.isBank(bloodOutList.get(0).get("patient_name")) + "】!~r~n血液出库单号为【"
+ BloodBankUtil.isBank(bloodOutList.get(0).get("bill_no"))
+ "】~r~n申请单号为【" + BloodBankUtil.isBank(bloodOutList.get(0).get("apply_no"))
+ "】,请检查!";
}
List<XkDiscardMain> xkDiscardMainList = bloodOutMapper.queryDiscardCount(bloodNo, productNo);
if(!xkDiscardMainList.isEmpty()){
msg = "血液【" + bloodNo + "】,已经报废!~r~n报废单号为【" + xkDiscardMainList.get(0).getBill_no() + "】,请检查!";
}
if(!msg.isEmpty()){
return new Result("-1",msg);
}else{
return new Result("0","操作成功");
}
}
public Result checkMatcheBlood(XkBloodInfo xkBloodInfo,String applyNo,BloodOutInfoDTO bloodOutInfoDTO){
String bloodBreed = xkBloodInfo.getBlood_breed();
XkBloodBreed xkBloodBreed = xkBloodBreedMapper.queryOne(bloodBreed);
String isMatch = xkBloodBreed.getIs_match();
if(isMatch.equals("Y")){
//所选择的血液需要进行配血
List<Map<String,Object>> matchBloodList = bloodOutMapper.queryMatchBloodInfo(xkBloodInfo.getBlood_no(), xkBloodInfo.getProduct_no(), applyNo);
if(matchBloodList.isEmpty()) return new Result("-1","该血液尚未配血,或者所配的血液不是给该病患,请检查!");
String canSend = BloodBankUtil.isBank(matchBloodList.get(0).get("can_send"));
String result = BloodBankUtil.isBank(matchBloodList.get(0).get("result"));
if(canSend.equals("") || canSend.equals("N")) return new Result("-1","该血液的配血结果为:"+result+",不能发血!");
bloodOutInfoDTO.setCheck_method(BloodBankUtil.isBank(matchBloodList.get(0).get("check_method")));
bloodOutInfoDTO.setMatch_method(BloodBankUtil.isBank(matchBloodList.get(0).get("match_method")));
bloodOutInfoDTO.setResult(result);
}else{
//所选择的血液不需要进行配血
bloodOutInfoDTO.setCheck_method("");
bloodOutInfoDTO.setMatch_method("");
bloodOutInfoDTO.setResult("");
}
return new Result("0","检验通过!");
}
}

View File

@ -310,4 +310,16 @@ public class MatchBloodServiceImpl implements MatchBloodService {
}
return new Result("0","校验通过!");
}
@Override
public Result queryApplyInfo(String billNo,String applyNo) {
List<Map<String, Object>> matchMainInfoList = matchBloodMapper.queryMatchMainInfo(applyNo);
List<Map<String, Object>> matchDetailInfoList = matchBloodMapper.queryMatchDetailInfo(billNo);
List<XkTransfuseApplyBloodbreed> xkTransfuseApplyBloodbreedList = xkTransfuseApplyBloodbreedMapper.queryOne(applyNo);
MatchBloodDTO matchBloodDTO = new MatchBloodDTO();
matchBloodDTO.setMatchMainInfoList(matchMainInfoList);
matchBloodDTO.setMatchDetailInfoList(matchDetailInfoList);
matchBloodDTO.setXkTransfuseApplyBloodbreedList(xkTransfuseApplyBloodbreedList);
return new Result("0","查询成功!",matchBloodDTO);
}
}

View File

@ -1,9 +1,41 @@
package com.czblood.busBloodbank.utils;
import com.czblood.bus.mapper.XkOutDetailMapper;
import com.czblood.bus.mapper.XkOutMainMapper;
import com.czblood.bus.mapper.XkTransfuseApplyMapper;
import com.czblood.bus.pojo.XkOutDetail;
import com.czblood.bus.pojo.XkOutMain;
import com.czblood.bus.pojo.XkTransfuseApply;
import com.czblood.busBloodbank.pojo.VO.BloodOutInfoVO;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Component
public class BloodOutUtil {
@Resource
private XkOutDetailMapper xkOutDetailMapper;
@Resource
private XkOutMainMapper xkOutMainMapper;
@Resource
private XkTransfuseApplyMapper xkTransfuseApplyMapper;
@Transactional(rollbackFor = Exception.class)
public void saveBloodOutInfo(BloodOutInfoVO bloodOutInfoVO) {
XkOutMain xkOutMain = bloodOutInfoVO.getXkOutMain();
List<XkOutDetail> xkOutDetailList = bloodOutInfoVO.getXkOutDetailList();
XkTransfuseApply xkTransfuseApply = bloodOutInfoVO.getXkTransfuseApply();
xkOutMainMapper.insert(xkOutMain);
for (XkOutDetail xkOutDetail : xkOutDetailList) {
xkOutDetailMapper.insert(xkOutDetail);
}
if(xkTransfuseApply != null){
xkTransfuseApplyMapper.insert(xkTransfuseApply);
}
}
}

View File

@ -126,7 +126,7 @@ public class MatchBloodUtil {
@Transactional(rollbackFor = Exception.class)
public void updateData(MatchBloodVO matchBloodVO){
XkMatchMain xkMatchMain = matchBloodVO.getXkMatchMain();
xkMatchMainMapper.update(xkMatchMain);
// xkMatchMainMapper.update(xkMatchMain);
List<XkMatchDetail> xkMatchDetailList = matchBloodVO.getXkMatchDetailList();
xkMatchDetailMapper.deleteByBillNo(xkMatchMain.getBill_no());
for (XkMatchDetail xkMatchDetail : xkMatchDetailList) {

View File

@ -5,4 +5,157 @@
<select id="queryApplyBloodTypeCount" resultType="java.lang.Integer">
SELECT COUNT(1) FROM xk_transfuse_apply_bloodbreed A JOIN xk_blood_breed B ON B.breed_code=A.blood_breed AND B.Is_match='N' WHERE A.bill_no=#{billNo} and b.blood_kind = '0002'
</select>
<select id="queryApplyInfo" resultType="java.util.Map">
SELECT xk_patient_info.patient_name,
xk_patient_info.age,
xk_patient_info.patient_sex,
xk_transfuse_apply.bill_no,
xk_patient_info.transfuse_history,
xk_patient_info.gestation_history,
xk_patient_info.parturition_history,
xk_patient_info.reaction_history,
xk_patient_info.match_history,
xk_transfuse_apply.apply_date,
xk_transfuse_apply.abo_type,
xk_transfuse_apply.rh_type,
xk_transfuse_apply.diagnoses,
xk_transfuse_apply.intent,
xk_transfuse_apply.apply_type,
xk_transfuse_apply.zone_id,
xk_transfuse_apply.use3_date,
xk_transfuse_apply.use2_date,
xk_transfuse_apply.use1_date,
xk_transfuse_apply.beinhos_id,
xk_transfuse_apply.dept_id,
xk_transfuse_apply.patient_bed,
xk_check_bloodtype.affirm_abo,
xk_check_bloodtype.check_rh,
xk_check_bloodtype.affirm_antibody,
xk_check_bloodtype.Sub_Blood
FROM xk_patient_info RIGHT OUTER JOIN xk_transfuse_apply ON xk_patient_info.beinhos_id = xk_transfuse_apply.beinhos_id,
xk_check_bloodtype
WHERE
( xk_transfuse_apply.bill_no = xk_check_bloodtype.apply_no ) and
( xk_transfuse_apply.bill_no = #{billNo}) AND
( xk_transfuse_apply.bill_sort = 'B') AND
( xk_transfuse_apply.operation_type = 'C' OR isnull(xk_transfuse_apply.operation_type,'') = '')
union
SELECT xk_patient_info.patient_name,
xk_patient_info.age,
xk_patient_info.patient_sex,
xk_transfuse_apply.bill_no,
xk_patient_info.transfuse_history,
xk_patient_info.gestation_history,
xk_patient_info.parturition_history,
xk_patient_info.reaction_history,
xk_patient_info.match_history,
xk_transfuse_apply.apply_date,
xk_transfuse_apply.abo_type,
xk_transfuse_apply.rh_type,
xk_transfuse_apply.diagnoses,
xk_transfuse_apply.intent,
xk_transfuse_apply.apply_type,
xk_transfuse_apply.zone_id,
xk_transfuse_apply.use3_date,
xk_transfuse_apply.use2_date,
xk_transfuse_apply.use1_date,
xk_transfuse_apply.beinhos_id,
xk_transfuse_apply.dept_id,
xk_transfuse_apply.patient_bed,
space(4) affirm_abo,
space(4) check_rh,
space(8) affirm_antibody,
space(8) Sub_Blood
FROM xk_patient_info RIGHT OUTER JOIN xk_transfuse_apply ON xk_patient_info.beinhos_id = xk_transfuse_apply.beinhos_id
WHERE
( xk_transfuse_apply.bill_no = #{billNo}) and
( xk_transfuse_apply.bill_sort = 'C')AND
( xk_transfuse_apply.operation_type = 'C' OR isnull(xk_transfuse_apply.operation_type,'') = '')
union
SELECT xk_patient_info.patient_name,
xk_patient_info.age,
xk_patient_info.patient_sex,
xk_transfuse_apply.bill_no,
xk_patient_info.transfuse_history,
xk_patient_info.gestation_history,
xk_patient_info.parturition_history,
xk_patient_info.reaction_history,
xk_patient_info.match_history,
xk_transfuse_apply.apply_date,
xk_transfuse_apply.abo_type,
xk_transfuse_apply.rh_type,
xk_transfuse_apply.diagnoses,
xk_transfuse_apply.intent,
xk_transfuse_apply.apply_type,
xk_transfuse_apply.zone_id,
xk_transfuse_apply.use3_date,
xk_transfuse_apply.use2_date,
xk_transfuse_apply.use1_date,
xk_transfuse_apply.beinhos_id,
xk_transfuse_apply.dept_id,
xk_transfuse_apply.patient_bed,
xk_check_bloodtype.affirm_abo,
xk_check_bloodtype.check_rh,
xk_check_bloodtype.affirm_antibody ,
xk_check_bloodtype.Sub_Blood
FROM xk_patient_info RIGHT OUTER JOIN xk_transfuse_apply ON xk_patient_info.beinhos_id = xk_transfuse_apply.beinhos_id,
xk_check_bloodtype
WHERE
( xk_transfuse_apply.bill_no = xk_check_bloodtype.apply_no ) and
( xk_transfuse_apply.bill_sort = 'A')AND
( xk_transfuse_apply.operation_type = 'C' OR isnull(xk_transfuse_apply.operation_type,'') = '')AND
( xk_transfuse_apply.bill_no = #{billNo})
</select>
<select id="queryWaitInfo" resultType="java.util.Map">
SELECT xk_transfuse_apply.bill_no,
xk_patient_info.patient_name,
xk_transfuse_apply.dept_id ,xk_transfuse_apply_bloodbreed.blood_breed
FROM xk_transfuse_apply with (nolock) LEFT OUTER JOIN xk_patient_info with (nolock) ON xk_transfuse_apply.beinhos_id = xk_patient_info.beinhos_id ,xk_dmzd,
xk_transfuse_apply_bloodbreed with (nolock)
WHERE (xk_transfuse_apply_bloodbreed.bill_no = xk_transfuse_apply.bill_no) and
(xk_transfuse_apply.check_sign = 'Y' or xk_transfuse_apply.check_sign = 'y' )and
(( bill_sort = 'A' AND bill_stasus = 'F') OR (bill_sort = 'C' AND bill_stasus = 'B' )OR (bill_sort = 'B' AND (bill_stasus= 'C' OR bill_stasus = 'S')) ) AND
(xk_transfuse_apply.operation_type ='C' or isnull(xk_transfuse_apply.operation_type,'') = '')and
(( (xk_transfuse_apply.check_explain = xk_dmzd.wordbook_code) and (xk_dmzd.wordbook_sign ='sqdshyj')AND xk_dmzd.exp1 = 'Y' ) or isnull(xk_transfuse_apply.check_explain,'') = '') and
(xk_transfuse_apply.abnor_next = 'Y' or isnull(xk_transfuse_apply.abnor_next,'') = '')
-- 两天前 00:00:00 当天23:59:59
AND xk_transfuse_apply.apply_date between DATEADD(DD, DATEDIFF(DD,0,GETDATE())-2, 0) and DATEADD(SS, -1, DATEADD(DD, DATEDIFF(DD,0,GETDATE())+1, 0))
</select>
<select id="queryBloodBackOutCount" resultType="com.czblood.bus.pojo.XkBackoutDetail">
SELECT xk_backout_detail.* FROM xk_backout_main , xk_backout_detail
WHERE ( xk_backout_main.bill_no =xk_backout_detail.bill_no )
<![CDATA[ AND isnull ( xk_backout_main.audit_person , '' ) <> '' ]]>
and xk_backout_detail.blood_no = #{bloodNo} and xk_backout_detail.product_no = #{productNo}
</select>
<select id="queryBloodOutInfoCount" resultType="java.util.Map">
SELECT xk_out_main.bill_no,xk_out_main.apply_no,(select wordbook_name from xk_dmzd where wordbook_sign = 'ks' and xk_transfuse_apply.dept_id = wordbook_code) as dept_name,xk_transfuse_apply.beinhos_id,xk_patient_info.patient_name
FROM xk_out_main left join xk_transfuse_apply on (xk_out_main.apply_no = xk_transfuse_apply.bill_no), xk_out_detail,xk_patient_info
WHERE xk_out_main.bill_no = xk_out_detail.bill_no and xk_out_main.beinhos_id = xk_patient_info.beinhos_id
AND xk_out_main.check_sign ='Y' AND xk_out_detail.blood_no = #{bloodNo} and xk_out_detail.product_no = #{productNo}
</select>
<select id="queryDiscardCount" resultType="com.czblood.bus.pojo.XkDiscardMain">
SELECT xk_discard_main.*
FROM xk_discard_main , xk_discard_detail
WHERE ( xk_discard_main.bill_no =xk_discard_detail.bill_no )
<![CDATA[AND ( isnull ( xk_discard_main.audit_person , '' ) <> '' ) ]]>
and ( xk_discard_detail.blood_no = #{bloodNo} ) and xk_discard_detail.product_no = #{productNo}
</select>
<select id="queryMatchBloodInfo" resultType="java.util.Map">
SELECT isnull ( xk_dmzd.remark , '' ) as can_send , xk_dmzd.wordbook_name as result,xk_match_detail.match_method,xk_match_detail.check_method
FROM xk_dmzd , xk_match_detail , xk_match_main
WHERE ( xk_match_detail.result =xk_dmzd.wordbook_code ) AND
( xk_dmzd.wordbook_sign ='pxjg' ) AND
( xk_match_main.bill_no =xk_match_detail.bill_no ) AND
( xk_match_detail.blood_no = #{bloodNo} ) and
( xk_match_detail.product_no = #{productNo} ) AND
( xk_match_main.apply_no = #{applyNo} )
</select>
<select id="queryXkMatchMain" resultType="com.czblood.bus.pojo.XkMatchMain">
SELECT * FROM xk_match_main Where apply_no = #{applyNo} AND bill_status ='A'
</select>
</mapper>

View File

@ -61,20 +61,14 @@
xk_transfuse_apply.dept_id,
xk_transfuse_apply.patient_bed,
xk_transfuse_apply.bill_stasus,
xk_transfuse_apply_bloodbreed.blood_breed,
xk_transfuse_apply_bloodbreed.blood_num,
xk_transfuse_apply_bloodbreed.unit,
xk_transfuse_apply_bloodbreed.replace_bloodbreed,
xk_check_bloodtype.affirm_abo,
xk_check_bloodtype.check_rh,
xk_check_bloodtype.bill_no,
xk_check_bloodtype.affirm_antibody,
xk_transfuse_apply_bloodbreed.apply_bloodtype,
xk_check_bloodtype.Sub_Blood
FROM xk_patient_info RIGHT OUTER JOIN xk_transfuse_apply ON xk_patient_info.beinhos_id = xk_transfuse_apply.beinhos_id,
xk_transfuse_apply_bloodbreed,
xk_check_bloodtype
WHERE ( xk_transfuse_apply.bill_no = xk_transfuse_apply_bloodbreed.bill_no ) and
WHERE
( xk_transfuse_apply.bill_no = xk_check_bloodtype.apply_no ) and
( xk_transfuse_apply.bill_no = #{applyNo})
@ -208,14 +202,16 @@
xk_match_main.dept_id,
xk_match_main.bill_status
FROM xk_match_main,xk_check_bloodtype
WHERE (xk_match_main.test_date between #{stime} AND #{etime}) AND
<if test="billNo != null">(xk_match_main.bill_no = #{billNo}) AND</if>
( xk_match_main.apply_no NOT in(select xk_match_apply.apply_no from xk_match_apply) )AND
( xk_match_main.check_no = xk_check_bloodtype.bill_no) AND
<if test="applyNo != null">(xk_match_main.apply_no = #{applyNo}) and</if>
<if test="beinhos_id != null">(xk_match_main.beinhos_id like '%'+#{beinhos_id}+'%' ) and</if>
( xk_check_bloodtype.bill_sort = 'C' Or Isnull(xk_check_bloodtype.bill_sort,'') = '') AND
<if test="dept != null">(xk_match_main.dept_id = #{dept} Or xk_match_main.dept_id = #{dept} or isnull(xk_match_main.dept_id,'') = '')</if>
WHERE (xk_match_main.test_date between #{stime} AND #{etime})
<if test="billNo != null">AND (xk_match_main.bill_no = #{billNo}) </if>
AND ( xk_match_main.apply_no NOT in(select xk_match_apply.apply_no from xk_match_apply) )
AND ( xk_match_main.check_no = xk_check_bloodtype.bill_no)
<if test="applyNo != null">and (xk_match_main.apply_no = #{applyNo}) </if>
<if test="beinhos_id != null">and (xk_match_main.beinhos_id like '%'+#{beinhos_id}+'%' ) </if>
AND ( xk_check_bloodtype.bill_sort = 'C' Or Isnull(xk_check_bloodtype.bill_sort,'') = '')
<if test="dept != null">and (xk_match_main.dept_id = #{dept} Or xk_match_main.dept_id = #{dept} or isnull(xk_match_main.dept_id,'') = '')</if>
<if test="patientName != null and patientName!= ''">and (xk_match_main.patient_name like '%'+#{patientName}+'%' ) </if>
<if test="status != null and status!= ''">and (xk_match_main.bill_status = #{status}) </if>
</select>
<select id="queryBloodMatchOthers" resultType="java.util.Map">
SELECT xk_match_main.patient_name,
@ -231,4 +227,38 @@
( xk_match_detail.product_no = #{productNo} ))
</select>
<select id="queryMatchDetailInfo" resultType="java.util.Map">
SELECT xk_match_detail.hos_id ,
xk_match_detail.sid ,
xk_match_detail.blood_no ,
xk_match_detail.product_no ,
xk_match_detail.match_medic ,
xk_match_detail.second_match_medic ,
xk_match_detail.match_date ,
xk_match_detail.result ,
xk_match_detail.bill_no ,
xk_match_detail.match_method ,
xk_match_detail.check_method ,
xk_match_detail.check_offer_abo ,
xk_match_detail.check_offer_rh ,
xk_match_detail.check_offer_fabo ,
xk_blood_info.blood_breed ,
xk_blood_info.capacity ,
xk_blood_info.blood_type ,
xk_blood_info.rh_blood_type ,
xk_match_detail.offer_affirm_abo ,
xk_match_detail.first_side ,
xk_match_detail.second_side,
xk_blood_info.blood_status,
xk_match_detail.add_sign,
xk_match_detail.position_blood,
xk_match_detail.position_barcode,
xk_match_main.bill_status
FROM xk_match_detail ,
xk_match_main,
xk_blood_info
WHERE ( xk_match_detail.blood_no = xk_blood_info.blood_no ) and
( xk_match_detail.product_no = xk_blood_info.product_no ) and
( xk_match_main.bill_no = #{billNo} ) and xk_match_main.bill_no = xk_match_detail.bill_no
</select>
</mapper>

View File

@ -130,3 +130,53 @@ IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_instorage_d
ALTER TABLE xk_instorage_detail ADD CONSTRAINT PK_xk_instorage_detail PRIMARY KEY CLUSTERED (bill_no,blood_no,product_no);
END
GO
ALTER TABLE xk_backout_detail ALTER COLUMN product_no VARCHAR(18) NOT NULL;
IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_backout_detail' AND type = 'PK' )
BEGIN
ALTER TABLE xk_backout_detail ADD CONSTRAINT PK_xk_backout_detail PRIMARY KEY CLUSTERED (bill_no,blood_no,product_no);
END
GO
IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_backout_main' AND type = 'PK' )
BEGIN
ALTER TABLE xk_backout_main ADD CONSTRAINT PK_xk_backout_main PRIMARY KEY CLUSTERED (bill_no);
END
GO
ALTER TABLE xk_discard_detail ALTER COLUMN product_no VARCHAR(18) NOT NULL;
IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_discard_main' AND type = 'PK' )
BEGIN
ALTER TABLE xk_discard_main ADD CONSTRAINT PK_xk_discard_main PRIMARY KEY CLUSTERED (bill_no);
END
GO
IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_discard_detail' AND type = 'PK' )
BEGIN
ALTER TABLE xk_discard_detail ADD CONSTRAINT PK_xk_discard_detail PRIMARY KEY CLUSTERED (bill_no,blood_no,product_no);
END
GO
ALTER TABLE xk_out_detail ALTER COLUMN blood_no VARCHAR(32) NOT NULL;
ALTER TABLE xk_out_detail ALTER COLUMN product_no VARCHAR(18) NOT NULL;
IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_out_detail' AND type = 'PK' )
BEGIN
ALTER TABLE xk_out_detail ADD CONSTRAINT PK_xk_out_detail PRIMARY KEY CLUSTERED (bill_no,blood_no,product_no);
END
GO
IF NOT EXISTS (SELECT 1 FROM sys.key_constraints WHERE name = 'PK_xk_out_main' AND type = 'PK' )
BEGIN
ALTER TABLE xk_out_main ADD CONSTRAINT PK_xk_out_main PRIMARY KEY CLUSTERED (bill_no);
END
GO