自助开单界面

This commit is contained in:
jiangs 2026-03-13 11:03:55 +08:00
parent 35cd338a6c
commit 6bf44f29ce
10 changed files with 118 additions and 12 deletions

View File

@ -52,8 +52,9 @@ public class RegApply {
private String update_by;
private Date update_time;
/**
* 状态 0.正常,1 作废
* 状态 0.正常,9 作废
*/
private String Status;
private String applyid;
private String reqDetailName;
}

View File

@ -26,4 +26,5 @@ public class RegApplyDetail {
private Date update_time;
private String DataSource;
private BigDecimal amount;
private String itemclass;
}

View File

@ -8,5 +8,6 @@ public interface RegApplyDetailMapper {
void insert(RegApplyDetail regApplyDetail);
List<RegApplyDetail> queryList(RegApplyDetail regApplyDetail);
void update(RegApplyDetail regApplyDetail);
void delete(String applyid);
void delete(Long uid);
void deleteByapplyId(String applyId);
}

View File

@ -26,6 +26,8 @@
select * from reg_apply_detail
<where>
<if test="applyid != null and applyid != ''">and applyid = #{applyid}</if>
<if test="uid != null and uid != ''">and uid = #{uid}</if>
</where>
</select>
@ -52,6 +54,10 @@
</update>
<delete id="delete">
delete from reg_apply_detail where uid = #{uid}
</delete>
<delete id="deleteByapplyId">
delete from reg_apply_detail where applyid = #{applyid}
</delete>
</mapper>

View File

@ -42,6 +42,7 @@
<if test="DataSource != null and DataSource !=''">DataSource,</if>
<if test="applyid != null and applyid !=''">applyid,</if>
<if test="Status != null and Status !=''">Status,</if>
<if test="reqDetailName != null and reqDetailName !=''">reqDetailName,</if>
create_by,create_time
)
values (
@ -83,6 +84,7 @@
<if test="DataSource != null and DataSource !=''">#{DataSource},</if>
<if test="applyid != null and applyid !=''">#{applyid},</if>
<if test="Status != null and Status !=''">#{Status},</if>
<if test="reqDetailName != null and reqDetailName !=''">#{reqDetailName},</if>
#{create_by},#{create_time}
)
</insert>
@ -137,8 +139,8 @@
<if test="create_time != null">create_time = #{create_time},</if>
<if test="update_by != null and update_by != ''">update_by = #{update_by},</if>
<if test="update_time != null">update_time = #{update_time},</if>
<if test="applyid != null and applyid != ''">applyid = #{applyid},</if>
<if test="Status != null and Status != ''">Status = #{Status},</if>
<if test="reqDetailName != null and reqDetailName != ''">reqDetailName = #{reqDetailName},</if>
applyid = #{applyid}
</set>
where applyid = #{applyid}

View File

@ -55,4 +55,15 @@ public class RegRequestInfoController extends BaseController {
}
/**
* 打印条码
* @return
*/
@ApiOperation("打印条码")
@GetMapping("/print")
public Result printBarCode(String applyId){
return regRequestInfoService.printBarCode(applyId);
}
}

View File

@ -12,4 +12,6 @@ public interface RegRequestInfoService {
Result getItemInfo();
Result saveReqInfo(ReqApplyInfoDTO reqApplyInfoDTO);
Result printBarCode(String applyId);
}

View File

@ -23,6 +23,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@Slf4j
@ -62,8 +64,10 @@ public class RegRequestInfoServiceImpl implements RegRequestInfoService {
*/
@Override
public Result queryReqDetail(String applyId) {
RegApply regApply = regApplyMapper.queryOne(applyId);
List<RegApplyDetail> regApplyDetailList = regRequestInfoMapper.queryReqDetail(applyId);
return new Result("0","查询成功!",regApplyDetailList);
ReqApplyInfoDTO reqApplyInfoDTO = new ReqApplyInfoDTO(regApply,regApplyDetailList);
return new Result("0","查询成功!",reqApplyInfoDTO);
}
@Override
@ -83,14 +87,20 @@ public class RegRequestInfoServiceImpl implements RegRequestInfoService {
List<RegApplyDetail> regApplyDetailList = reqApplyInfoDTO.getRegApplyDetailList();
String status = regApply.getStatus();
if(status == null) status = "";
if(!status.equals("0") && !status.equals("")) return new Result("0","不是新增状态不能修改申请单!");
//修改数据
if(!status.equals("")){
//保存条码信息
applicationContext.getBean(RegRequestInfoServiceImpl.class).updateApply(regApply,regApplyDetailList);
//删除条码信息
applicationContext.getBean(RegRequestInfoServiceImpl.class).delSampleInfo(regApply.getApplyid());
//重新生成条码信息
createBarcode(regApply.getApplyid());
}else{
//申请单号
String applyId = "PT"+regApply.getSrcHospCode()+DateUtil.format(commonUtil.getCurrentTime(),"yyyyMMdd")+commonUtil.getNextSeq_pro("applyno",4);
regApply.setApplyid(applyId);
regApply.setStatus("1");
regApply.setStatus("0"); //申请单状态 0 正常,1 作废
regApply.setCreate_by(regApply.getUserCode());
regApply.setCreate_time(commonUtil.getCurrentTime());
regApply.setOrderTime(commonUtil.getCurrentTime());
@ -98,10 +108,12 @@ public class RegRequestInfoServiceImpl implements RegRequestInfoService {
//病人生日
Date birthDayFromAge = LisUtil.getBirthDayFromAge(Integer.parseInt(regApply.getPatAge()), regApply.getAgeUnit());
regApply.setPatBirthday(birthDayFromAge);
String xmmc = "";
for (RegApplyDetail regApplyDetail : regApplyDetailList) {
regApplyDetail.setApplyid(applyId);
xmmc = xmmc + "," + regApplyDetail.getOrderItemName();
}
regApply.setReqDetailName(xmmc.substring(1));
//保存申请单信息
applicationContext.getBean(RegRequestInfoServiceImpl.class).saveReqInfo(regApply,regApplyDetailList);
@ -114,6 +126,32 @@ public class RegRequestInfoServiceImpl implements RegRequestInfoService {
return new Result("0","保存成功!");
}
/**
* 打印条码
* @param applyId
* @return
*/
@Override
public Result printBarCode(String applyId) {
RegTransitSampleDetail regTransitSampleDetail = new RegTransitSampleDetail();
regTransitSampleDetail.setApplyid(applyId);
List<RegTransitSampleDetail> regTransitSampleDetailList = regTransitSampleMapper.getRegTransitSampleDetail(regTransitSampleDetail);
if(regTransitSampleDetailList.size() <= 0) return new Result("-1","没有找到对应的申请单信息!");
List<String> barcodeList = new ArrayList<>();
for (RegTransitSampleDetail transitSampleDetail : regTransitSampleDetailList) {
if(barcodeList.contains(transitSampleDetail.getBarcode())) continue;
barcodeList.add(transitSampleDetail.getBarcode());
}
for (String barCode: barcodeList) {
Result result = printBar(barCode);
if(!result.equals("0")) return result;
//修改状态
applicationContext.getBean(RegRequestInfoServiceImpl.class).updateStatus(applyId,barCode);
}
return new Result("0","打印成功!");
}
@Transactional(rollbackFor = Exception.class)
public void saveReqInfo(RegApply regApply,List<RegApplyDetail> regApplyDetailList){
regApplyMapper.insert(regApply);
@ -320,8 +358,6 @@ public class RegRequestInfoServiceImpl implements RegRequestInfoService {
return new Result("0","生成条码成功!");
}
@Transactional(rollbackFor = Exception.class)
@ -337,12 +373,57 @@ public class RegRequestInfoServiceImpl implements RegRequestInfoService {
@Transactional(rollbackFor = Exception.class)
public void updateApply(RegApply regApply, List<RegApplyDetail> regApplyDetailList){
regApplyMapper.delete(regApply.getApplyid());
regApplyMapper.insert(regApply);
RegApplyDetail regApplyDetail1 = new RegApplyDetail();
regApplyDetail1.setApplyid(regApply.getApplyid());
String xmmc = "";
regApplyDetailMapper.deleteByapplyId(regApply.getApplyid());
for (RegApplyDetail regApplyDetail : regApplyDetailList) {
regApplyDetailMapper.delete(regApplyDetail.getApplyid());
regApplyDetailMapper.insert(regApplyDetail);
//重新设置主表的项目信息
xmmc = xmmc + "," + regApplyDetail.getOrderItemName();
}
regApply.setReqDetailName(xmmc.substring(1));
regApplyMapper.update(regApply);
}
/**
* 删除条码信息
* @param applyId
*/
@Transactional(rollbackFor = Exception.class)
public void delSampleInfo(String applyId){
RegTransitSampleDetail regTransitSampleDetail = new RegTransitSampleDetail();
regTransitSampleDetail.setApplyid(applyId);
List<RegTransitSampleDetail> regTransitSampleDetailList = regTransitSampleMapper.getRegTransitSampleDetail(regTransitSampleDetail);
for (RegTransitSampleDetail transitSampleDetail : regTransitSampleDetailList) {
regTransitSampleMapper.delRegTransitSampleDetail(transitSampleDetail.getBarcode());
regTransitSampleMapper.delRegTransitSample(transitSampleDetail.getBarcode());
}
}
/**
* 打印条码
* @param barcode
*/
public Result printBar(String barcode){
return null;
}
@Transactional(rollbackFor = Exception.class)
public void updateStatus(String applyId,String barCode){
//修改申请单状态
RegApply regApply = new RegApply();
regApply.setStatus("1");
regApply.setApplyid(applyId);
regApplyMapper.update(regApply);
//条码状态
RegTransitSample regTransitSample = new RegTransitSample();
regTransitSample.setStatus("20");
regTransitSample.setBarcode(barCode);
regTransitSampleMapper.updateRegTransitSample(regTransitSample);
}
}

View File

@ -11,7 +11,7 @@
</select>
<select id="queryReqDetail" resultType="com.transitPlatForm.common.core.domain.entity.reg.RegApplyDetail">
select * from reg_apply_detail where applyid = #{applyId}
select a.*,b.itemclass from reg_apply_detail a,reg_item b where a.applyid = #{applyId} and a.OrderItemCode = b.itemcode
</select>
<select id="getItemInfo" resultType="map">

View File

@ -28,6 +28,7 @@
select * from Reg_TransitSample_detail
<where>
<if test="Barcode != null and Barcode !=''">and Barcode = #{Barcode}</if>
<if test="applyid != null and applyid !=''">and applyid = #{applyid}</if>
</where>
</select>