|
@@ -99,12 +99,12 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
private ZyDetailChargeMapper zyDetailChargeMapper;
|
|
|
|
|
|
@Override
|
|
|
- public List<YzYpPageNoVo> queryYzYpPageNo(YzYpPageNoVo yzYpPageNoVo){
|
|
|
+ public List<YzYpPageNoVo> queryYzYpPageNo(YzYpPageNoVo yzYpPageNoVo) {
|
|
|
List<YzYpPageNoVo> yzYpPageNoVos = new ArrayList<>();
|
|
|
List<YzYpPageNo> yzYpPageNos = yzYpPageNoMapper.selectYzYpPageNo(yzYpPageNoVo);
|
|
|
yzYpPageNos.forEach(yzYpPageNo -> {
|
|
|
YzYpPageNoVo vo = new YzYpPageNoVo();
|
|
|
- BeanUtils.copyProperties(yzYpPageNo,vo);
|
|
|
+ BeanUtils.copyProperties(yzYpPageNo, vo);
|
|
|
yzYpPageNoVos.add(vo);
|
|
|
});
|
|
|
return yzYpPageNoVos;
|
|
@@ -117,25 +117,25 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
|
|
|
@Override
|
|
|
public String queryYzYpPageNoStr(String groupNo, String wardCode, String pageClass) {
|
|
|
- String reslutStr="";
|
|
|
+ String reslutStr = "";
|
|
|
String[] strings = yzYpPageNoMapper.selectYzYpPageNos(groupNo, wardCode, pageClass);
|
|
|
for (int i = 0; i < strings.length; i++) {
|
|
|
- if(i==0){
|
|
|
- reslutStr=strings[i];
|
|
|
- }else{
|
|
|
- reslutStr+="/"+strings[i];
|
|
|
+ if (i == 0) {
|
|
|
+ reslutStr = strings[i];
|
|
|
+ } else {
|
|
|
+ reslutStr += "/" + strings[i];
|
|
|
}
|
|
|
}
|
|
|
return reslutStr;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<YfWardVo> queryZyDrug(String pageNo,Integer submitFlag) {
|
|
|
+ public List<YfWardVo> queryZyDrug(String pageNo, Integer submitFlag) {
|
|
|
List<YfWardVo> yfWardVos = new ArrayList<>();
|
|
|
- List<ZyDrug> zyDrugs = zyDrugMapper.selectZyDrugByPageNo(pageNo, submitFlag==3?"1":"0");
|
|
|
+ List<ZyDrug> zyDrugs = zyDrugMapper.selectZyDrugByPageNo(pageNo, submitFlag == 3 ? "1" : "0");
|
|
|
zyDrugs.forEach(zyDrug -> {
|
|
|
YfWardVo vo = new YfWardVo();
|
|
|
- BeanUtils.copyProperties(zyDrug,vo);
|
|
|
+ BeanUtils.copyProperties(zyDrug, vo);
|
|
|
yfWardVos.add(vo);
|
|
|
});
|
|
|
return yfWardVos;
|
|
@@ -144,10 +144,10 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
@Override
|
|
|
public List<YfWardVo> queryZyDrugDetail(String pageNo, String submitFlag) {
|
|
|
List<YfWardVo> yfWardVos = new ArrayList<>();
|
|
|
- List<ZyDrug> zyDrugs = zyDrugMapper.selectZyDrugDetailByPageNo(pageNo,submitFlag.equals("0")?"1":null);//通过普通药单的状态去调整医技明细状态查询
|
|
|
+ List<ZyDrug> zyDrugs = zyDrugMapper.selectZyDrugDetailByPageNo(pageNo, submitFlag.equals("0") ? "1" : null);//通过普通药单的状态去调整医技明细状态查询
|
|
|
zyDrugs.forEach(zyDrug -> {
|
|
|
YfWardVo vo = new YfWardVo();
|
|
|
- BeanUtils.copyProperties(zyDrug,vo);
|
|
|
+ BeanUtils.copyProperties(zyDrug, vo);
|
|
|
vo.setOccTime(zyDrug.getChargeDate());
|
|
|
yfWardVos.add(vo);
|
|
|
});
|
|
@@ -158,31 +158,31 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
public List<YfWardVo> queryYzYpOrder(String pageNo, String isTy, Integer submitFlag) {
|
|
|
List<YfWardVo> yfWardVos = new ArrayList<>();
|
|
|
List<YzYpZyOrder> yzYpZyOrders;
|
|
|
- if("1".equals(isTy)){
|
|
|
- yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderTy(pageNo,submitFlag==3?"0":"1,3,4");
|
|
|
- }else{
|
|
|
- yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderFy(pageNo,submitFlag==3?"0":"1,3,4");
|
|
|
+ if ("1".equals(isTy)) {
|
|
|
+ yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderTy(pageNo, submitFlag == 3 ? "0" : "1,3,4");
|
|
|
+ } else {
|
|
|
+ yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderFy(pageNo, submitFlag == 3 ? "0" : "1,3,4");
|
|
|
}
|
|
|
yzYpZyOrders.forEach(yzYpZyOrder -> {
|
|
|
YfWardVo vo = new YfWardVo();
|
|
|
- BeanUtils.copyProperties(yzYpZyOrder,vo);
|
|
|
+ BeanUtils.copyProperties(yzYpZyOrder, vo);
|
|
|
yfWardVos.add(vo);
|
|
|
});
|
|
|
return yfWardVos;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<YfWardVo> queryYzYpOrderDetail(String pageNo, String isTy, String submitFlag){
|
|
|
+ public List<YfWardVo> queryYzYpOrderDetail(String pageNo, String isTy, String submitFlag) {
|
|
|
List<YfWardVo> yfWardVos = new ArrayList<>();
|
|
|
List<YzYpZyOrder> yzYpZyOrders;
|
|
|
- if("1".equals(isTy)){
|
|
|
- yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderTyDetail(pageNo,submitFlag);//0:已发药
|
|
|
- }else{
|
|
|
- yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderFyDetail(pageNo,submitFlag);
|
|
|
+ if ("1".equals(isTy)) {
|
|
|
+ yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderTyDetail(pageNo, submitFlag);//0:已发药
|
|
|
+ } else {
|
|
|
+ yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderFyDetail(pageNo, submitFlag);
|
|
|
}
|
|
|
yzYpZyOrders.forEach(yzYpZyOrder -> {
|
|
|
YfWardVo vo = new YfWardVo();
|
|
|
- BeanUtils.copyProperties(yzYpZyOrder,vo);
|
|
|
+ BeanUtils.copyProperties(yzYpZyOrder, vo);
|
|
|
yfWardVos.add(vo);
|
|
|
});
|
|
|
return yfWardVos;
|
|
@@ -194,7 +194,7 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
List<YzYpZyOrder> yzYpZyOrders = yzYpZyOrderMapper.selectYzYpOrderWard(groupNo, wardCode, pageClass);
|
|
|
yzYpZyOrders.forEach(yzYpZyOrder -> {
|
|
|
YfWardVo vo = new YfWardVo();
|
|
|
- BeanUtils.copyProperties(yzYpZyOrder,vo);
|
|
|
+ BeanUtils.copyProperties(yzYpZyOrder, vo);
|
|
|
yfWardVos.add(vo);
|
|
|
});
|
|
|
return yfWardVos;
|
|
@@ -202,65 +202,65 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
- public Map<String, Object> sendWard(List<YzYpZyOrder> yzYpZyOrders,String pageNo,String userCode) throws MzException {
|
|
|
+ public Map<String, Object> sendWard(List<YzYpZyOrder> yzYpZyOrders, String pageNo, String userCode) throws MzException {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
String[] pageNos = pageNo.split("/");
|
|
|
List<YzYpZyOrder> yyzos;
|
|
|
- int count =0;
|
|
|
+ int count = 0;
|
|
|
for (int j = 0; j < pageNos.length; j++) {
|
|
|
List<YpZyPatient> ypZyPatients = new ArrayList<>();
|
|
|
String pageNoStr = pageNos[j];
|
|
|
- if(yzYpZyOrders.get(0).getPageClass().equals("A")){//医技药单
|
|
|
+ if (yzYpZyOrders.get(0).getPageClass().equals("A")) {//医技药单
|
|
|
count = zyDrugMapper.selectDrugCountByPageNo(pageNoStr);
|
|
|
- }else if(!yzYpZyOrders.get(0).getPageClass().equals("T")){
|
|
|
+ } else if (!yzYpZyOrders.get(0).getPageClass().equals("T")) {
|
|
|
count = yzYpZyOrderMapper.selectDrugCountByPageNo(Integer.parseInt(pageNoStr));
|
|
|
}
|
|
|
- if(StringUtils.isBlank(yzYpZyOrders.get(0).getName())){//判断前端传值是否为明细
|
|
|
+ if (StringUtils.isBlank(yzYpZyOrders.get(0).getName())) {//判断前端传值是否为明细
|
|
|
List<YfWardVo> yfWardVos = getDetail(pageNoStr, yzYpZyOrders.get(0).getPageClass(), "1,3,4");
|
|
|
List<YzYpZyOrder> yyzo = new ArrayList<>();
|
|
|
Set<String> chargeCodes = yzYpZyOrders.parallelStream().map(YzYpZyOrder::getChargeCode).distinct().collect(Collectors.toSet());
|
|
|
- Set<String> zeroChargeCodes = yzYpZyOrders.parallelStream().filter(yzYpZyOrder -> yzYpZyOrder.getAmount()==0).map(YzYpZyOrder::getChargeCode).distinct().collect(Collectors.toSet());
|
|
|
+ Set<String> zeroChargeCodes = yzYpZyOrders.parallelStream().filter(yzYpZyOrder -> yzYpZyOrder.getAmount() == 0).map(YzYpZyOrder::getChargeCode).distinct().collect(Collectors.toSet());
|
|
|
for (int i = 0; i < yfWardVos.size(); i++) {
|
|
|
- if(!chargeCodes.contains(yfWardVos.get(i).getChargeCode())){
|
|
|
+ if (!chargeCodes.contains(yfWardVos.get(i).getChargeCode())) {
|
|
|
yfWardVos.remove(i);
|
|
|
i--;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
YzYpZyOrder yzYpZyOrder = new YzYpZyOrder();
|
|
|
- BeanUtils.copyProperties(yfWardVos.get(i),yzYpZyOrder);
|
|
|
+ BeanUtils.copyProperties(yfWardVos.get(i), yzYpZyOrder);
|
|
|
yzYpZyOrder.setOldAmount(yzYpZyOrder.getAmount());
|
|
|
- if(zeroChargeCodes.contains(yfWardVos.get(i).getChargeCode())){
|
|
|
+ if (zeroChargeCodes.contains(yfWardVos.get(i).getChargeCode())) {
|
|
|
yzYpZyOrder.setAmount(0);
|
|
|
}
|
|
|
yyzo.add(yzYpZyOrder);
|
|
|
}
|
|
|
}
|
|
|
yyzos = yyzo;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
yyzos = yzYpZyOrders;
|
|
|
}
|
|
|
int i = 0;
|
|
|
- for ( ; i < yyzos.size(); i++) {//传发药和拒发到后台,合计等于药单总数时删除药单
|
|
|
+ for (; i < yyzos.size(); i++) {//传发药和拒发到后台,合计等于药单总数时删除药单
|
|
|
YzYpZyOrder yzYpZyOrder = yyzos.get(i);
|
|
|
YpZyPatient ypZyPatient = new YpZyPatient();
|
|
|
- BeanUtils.copyProperties(yzYpZyOrder,ypZyPatient);
|
|
|
- if(ypZyPatient.getAlwaysFlag()==null){
|
|
|
+ BeanUtils.copyProperties(yzYpZyOrder, ypZyPatient);
|
|
|
+ if (ypZyPatient.getAlwaysFlag() == null) {
|
|
|
ypZyPatient.setAlwaysFlag("");
|
|
|
}
|
|
|
ypZyPatient.setOrderDate(yzYpZyOrder.getOccTime());
|
|
|
ypZyPatient.setSectionCode("");
|
|
|
- if(yzYpZyOrder.getPageClass().equals("A")){
|
|
|
+ if (yzYpZyOrder.getPageClass().equals("A")) {
|
|
|
ypZyPatient.setAcctSign("2");
|
|
|
- }else{
|
|
|
- ypZyPatient.setAcctSign(yzYpZyOrder.getAmount()==0?"2":"0");
|
|
|
+ } else {
|
|
|
+ ypZyPatient.setAcctSign(yzYpZyOrder.getAmount() == 0 ? "2" : "0");
|
|
|
}
|
|
|
- ypZyPatient.setOutSeri(i+1);
|
|
|
+ ypZyPatient.setOutSeri(i + 1);
|
|
|
ypZyPatient.setKeeper(userCode);
|
|
|
ypZyPatient.setTotalFlag("");
|
|
|
ypZyPatient.setConfirmTime(new Date());
|
|
|
ypZyPatient.setJyFlag("0");
|
|
|
ypZyPatient.setPageType(yzYpZyOrder.getPageClass());
|
|
|
String supplyCode = "";
|
|
|
- switch (yzYpZyOrder.getPageClass()){
|
|
|
+ switch (yzYpZyOrder.getPageClass()) {
|
|
|
case "1":
|
|
|
supplyCode = "c";
|
|
|
break;
|
|
@@ -291,14 +291,14 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
supplyCode = "t";
|
|
|
break;
|
|
|
}
|
|
|
- if(yzYpZyOrder.getAmount()==0){//拒发
|
|
|
+ if (yzYpZyOrder.getAmount() == 0) {//拒发
|
|
|
supplyCode = "w";
|
|
|
}
|
|
|
ypZyPatient.setSupplyCode(supplyCode);
|
|
|
- if(yzYpZyOrder.getPageClass().equals("4") || yzYpZyOrder.getPageClass().equals("3")){//基数药、大输液
|
|
|
+ if (yzYpZyOrder.getPageClass().equals("4") || yzYpZyOrder.getPageClass().equals("3")) {//基数药、大输液
|
|
|
ypZyPatientMapper.updateYpZyPatient(ypZyPatient);
|
|
|
- }else{
|
|
|
- if(yzYpZyOrder.getPageClass().equals("A")){//医技
|
|
|
+ } else {
|
|
|
+ if (yzYpZyOrder.getPageClass().equals("A")) {//医技
|
|
|
ZyDetailCharge zyDetailCharge = new ZyDetailCharge();
|
|
|
zyDetailCharge.setInpatientNo(ypZyPatient.getInpatientNo());
|
|
|
zyDetailCharge.setAdmissTimes(ypZyPatient.getAdmissTimes());
|
|
@@ -306,52 +306,48 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
zyDetailCharge.setChargeDate(ypZyPatient.getOrderDate());
|
|
|
List<ZyDetailCharge> zyDetailCharges = zyDetailChargeMapper.selectZyDetailChargeList(zyDetailCharge);
|
|
|
String zySerialNo = "";
|
|
|
- if(zyDetailCharges.size() >0){
|
|
|
+ if (zyDetailCharges.size() > 0) {
|
|
|
zySerialNo = zyDetailCharges.get(0).getZySerialNo();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
log.info("未查询到该病人的住院流水号[{}]", JSONObject.valueToString(zyDetailCharge));
|
|
|
}
|
|
|
ypZyPatient.setZySerialNo(zySerialNo);
|
|
|
String execUnit = zyDrugMapper.selectExecUnitPageNo(pageNoStr);
|
|
|
ypZyPatient.setSectionCode(execUnit);
|
|
|
- }else{
|
|
|
- if(ypZyPatient.getAmount() != 0){
|
|
|
+ } else {
|
|
|
+ if (ypZyPatient.getAmount() != 0) {
|
|
|
ypZyPatients.add(ypZyPatient);
|
|
|
}
|
|
|
}
|
|
|
ypZyPatientMapper.insertYpZyPatient(ypZyPatient);
|
|
|
}
|
|
|
- if(ypZyPatient.getAmount() != 0){
|
|
|
- if(1 != ypBaseYfMapper.updateStockAmount(ypZyPatient.getChargeCode(), ypZyPatient.getSerial()
|
|
|
- ,ypZyPatient.getGroupNo(), -ypZyPatient.getAmount(), BigDecimal.valueOf(-ypZyPatient.getAmount() * ypZyPatient.getRetprice()))){
|
|
|
+ if (ypZyPatient.getAmount() != 0) {
|
|
|
+ if (1 != ypBaseYfMapper.updateStockAmount(ypZyPatient.getChargeCode(), ypZyPatient.getSerial()
|
|
|
+ , ypZyPatient.getGroupNo(), -ypZyPatient.getAmount(), BigDecimal.valueOf(-ypZyPatient.getAmount() * ypZyPatient.getRetprice()))) {
|
|
|
throw new MzException("保存住院病人发药记录失败,更新库存异常");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- if(yzYpZyOrder.getPageClass().equals("A")){//医技药单
|
|
|
- if(0 == zyDrugMapper.updateZyDrugConfirm(ypZyPatient.getAmount()==0?"2":"1",userCode,ypZyPatient.getAmount()==0?"2":"1",yzYpZyOrder.getInpatientNo(),yzYpZyOrder.getAdmissTimes(),yzYpZyOrder.getLedgerSn(),yzYpZyOrder.getDetailSn())){
|
|
|
+ if (yzYpZyOrder.getPageClass().equals("A")) {//医技药单
|
|
|
+ if (0 == zyDrugMapper.updateZyDrugConfirm(ypZyPatient.getAmount() == 0 ? "2" : "1", userCode, ypZyPatient.getAmount() == 0 ? "2" : "1", yzYpZyOrder.getInpatientNo(), yzYpZyOrder.getAdmissTimes(), yzYpZyOrder.getLedgerSn(), yzYpZyOrder.getDetailSn())) {
|
|
|
throw new MzException("保存住院病人发药记录失败,修改医技药品发药状态异常");
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
YzYpZyOrder y = new YzYpZyOrder();
|
|
|
- y.setStatusFlag(ypZyPatient.getAmount()==0?"2":"0");
|
|
|
+ y.setStatusFlag(ypZyPatient.getAmount() == 0 ? "2" : "0");
|
|
|
y.setInpatientNo(yzYpZyOrder.getInpatientNo());
|
|
|
y.setActOrderNo(yzYpZyOrder.getActOrderNo());
|
|
|
y.setChargeCode(yzYpZyOrder.getChargeCode());
|
|
|
y.setOccTime(yzYpZyOrder.getOccTime());
|
|
|
- if(1 != yzYpZyOrderMapper.updateStatusFlag(y)){
|
|
|
+ if (1 != yzYpZyOrderMapper.updateStatusFlag(y)) {
|
|
|
throw new MzException("保存住院病人发药记录失败,修改医嘱药品发药状态异常");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /*if(ypZyPatients.size() > 0){
|
|
|
- saveZyDetailCharge(ypZyPatients);
|
|
|
- }*/
|
|
|
- if (yzYpZyOrders.get(0).getPageClass().equals("5") || yzYpZyOrders.get(0).getPageClass().equals("6")){
|
|
|
- savePrescription(ypZyPatients);
|
|
|
+ if (i == count || yzYpZyOrders.get(0).getPageClass().equals("T")) {
|
|
|
+ yzYpPageNoMapper.updateYzYpPageNo(Integer.parseInt(pageNoStr), 3, userCode);
|
|
|
}
|
|
|
- if(i == count || yzYpZyOrders.get(0).getPageClass().equals("T")){
|
|
|
- yzYpPageNoMapper.updateYzYpPageNo(Integer.parseInt(pageNoStr), 3,userCode);
|
|
|
+ if (yzYpZyOrders.get(0).getPageClass().equals("5") || yzYpZyOrders.get(0).getPageClass().equals("6")) {
|
|
|
+ resultMap.put("data", ypZyPatients);
|
|
|
}
|
|
|
}
|
|
|
resultMap.put("code", 0);
|
|
@@ -361,9 +357,10 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
|
|
|
/**
|
|
|
* 确认发药费用上账
|
|
|
+ *
|
|
|
* @param ypZyPatients
|
|
|
*/
|
|
|
- public void saveZyDetailCharge(List<YpZyPatient> ypZyPatients){
|
|
|
+ public void saveZyDetailCharge(List<YpZyPatient> ypZyPatients) {
|
|
|
List<ZyDetailCharge> zyDetailCharges = new ArrayList<>();
|
|
|
int maxDetailSn = zyDetailChargeMapper.selectMaxDetailSn(ypZyPatients.get(0).getInpatientNo(), ypZyPatients.get(0).getAdmissTimes());
|
|
|
for (YpZyPatient ypZyPatient : ypZyPatients) {
|
|
@@ -375,15 +372,15 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
zyDetailCharge.setDetailSn(maxDetailSn);
|
|
|
zyDetailCharge.setChargeDate(ypZyPatient.getOrderDate());
|
|
|
zyDetailCharge.setOpIdCode(ypZyPatient.getDrawer());
|
|
|
- YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(ypZyPatient.getChargeCode(),ypZyPatient.getSerial());
|
|
|
+ YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(ypZyPatient.getChargeCode(), ypZyPatient.getSerial());
|
|
|
zyDetailCharge.setChargeCode(Constants.BILL_ITEM_CODE_prev + ypZdDict.getBillItemZy().substring(1));
|
|
|
- zyDetailCharge.setInfantFlag(ypZyPatient.getInpatientNo().indexOf("$")==-1?"0":"1");
|
|
|
+ zyDetailCharge.setInfantFlag(ypZyPatient.getInpatientNo().indexOf("$") == -1 ? "0" : "1");
|
|
|
zyDetailCharge.setChargeStatus("2");
|
|
|
- zyDetailCharge.setChargeAmount(ypZyPatient.getAmount()+"");
|
|
|
- zyDetailCharge.setChargeFee((ypZyPatient.getAmount()*ypZyPatient.getRetprice())+"");
|
|
|
- zyDetailCharge.setSelfFlag(ypZdDict.getSelfFlag()==null?"0":ypZdDict.getSelfFlag());
|
|
|
- zyDetailCharge.setSeparateFlag(ypZdDict.getSeparateFlag()==null?"0":ypZdDict.getSeparateFlag());
|
|
|
- zyDetailCharge.setSuppressFlag(ypZdDict.getSupriceFlag()==null?"0":ypZdDict.getSupriceFlag());
|
|
|
+ zyDetailCharge.setChargeAmount(ypZyPatient.getAmount() + "");
|
|
|
+ zyDetailCharge.setChargeFee((ypZyPatient.getAmount() * ypZyPatient.getRetprice()) + "");
|
|
|
+ zyDetailCharge.setSelfFlag(ypZdDict.getSelfFlag() == null ? "0" : ypZdDict.getSelfFlag());
|
|
|
+ zyDetailCharge.setSeparateFlag(ypZdDict.getSeparateFlag() == null ? "0" : ypZdDict.getSeparateFlag());
|
|
|
+ zyDetailCharge.setSuppressFlag(ypZdDict.getSupriceFlag() == null ? "0" : ypZdDict.getSupriceFlag());
|
|
|
YzActOrder yzActOrder = yzActOrderMapper.selectYzActOrderByActOrderNo(ypZyPatient.getActOrderNo());
|
|
|
ZyActpatient zyActpatient = zyActpatientMapper.selectByInpatientNo("zy_actpatient", ypZyPatient.getInpatientNo(), ypZyPatient.getAdmissTimes());
|
|
|
zyDetailCharge.setWardCode(zyActpatient.getZkWard());
|
|
@@ -405,22 +402,24 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
|
|
|
/**
|
|
|
* 确认发药插入摆药机中间表
|
|
|
+ *
|
|
|
* @param ypZyPatients
|
|
|
* @return
|
|
|
*/
|
|
|
- public void savePrescription(List<YpZyPatient> ypZyPatients) {
|
|
|
+ public int savePrescription(List<YpZyPatient> ypZyPatients) {
|
|
|
+ int flag = 0;
|
|
|
int seqNo = 0;
|
|
|
for (int i = 0; i < ypZyPatients.size(); i++) {
|
|
|
Prescription prescription = new Prescription();
|
|
|
YpZyPatient ypZyPatient = ypZyPatients.get(i);
|
|
|
- if(ypZyPatient.getDrugClass().equals("d")){
|
|
|
+ if (ypZyPatient.getDrugClass().equals("d")) {
|
|
|
YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(ypZyPatient.getChargeCode(), ypZyPatient.getSerial());
|
|
|
- if(ypZdDict.getByjFlag() == 1){
|
|
|
+ if (ypZdDict.getByjFlag() == 1) {
|
|
|
SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
prescription.setWardName(zdUnitCodeMapper.selectByCode(ypZyPatient.getDeptCode()).getName());
|
|
|
String confirmTime = smf.format(ypZyPatient.getConfirmTime());
|
|
|
- prescription.setPrescriptionNo(confirmTime.split(" ")[0].replace("-","")+
|
|
|
- confirmTime.split(" ")[1].replace(":","").replace(".",""));
|
|
|
+ prescription.setPrescriptionNo(confirmTime.split(" ")[0].replace("-", "") +
|
|
|
+ confirmTime.split(" ")[1].replace(":", "").replace(".", ""));
|
|
|
prescription.setSeqNo(seqNo++);
|
|
|
prescription.setPatientId(ypZyPatient.getInpatientNo());
|
|
|
prescription.setWardCd(ypZyPatient.getDeptCode());
|
|
@@ -429,28 +428,28 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
prescription.setDoctorName(employeeMapper.selectByUserCode(ypZyPatient.getDoctorName()).getEmployeeName());
|
|
|
prescription.setTakeDate(ypZyPatient.getOrderDate());
|
|
|
String orderDate = smf.format(ypZyPatient.getOrderDate());
|
|
|
- String takeTime = orderDate.split(" ")[1].substring(0,5).replace(":","");
|
|
|
+ String takeTime = orderDate.split(" ")[1].substring(0, 5).replace(":", "");
|
|
|
prescription.setTakeTime(takeTime);
|
|
|
prescription.setDrugCd(ypZyPatient.getChargeCode());
|
|
|
prescription.setFreqDescDetailCode(takeTime);
|
|
|
- prescription.setFreqDescDetail(orderDate.split(" ")[1].substring(0,5));
|
|
|
+ prescription.setFreqDescDetail(orderDate.split(" ")[1].substring(0, 5));
|
|
|
prescription.setMakeRecTime(ypZyPatient.getConfirmTime());
|
|
|
- if(ypZyPatient.getAlwaysFlag().equals("a")){
|
|
|
+ if (ypZyPatient.getAlwaysFlag().equals("a")) {
|
|
|
prescription.setIoFlg("2");
|
|
|
- }else if(ypZyPatient.getAlwaysFlag().equals("t")){
|
|
|
+ } else if (ypZyPatient.getAlwaysFlag().equals("t")) {
|
|
|
prescription.setIoFlg("3");
|
|
|
}
|
|
|
- prescription.setHisId(ypZyPatient.getPageNo()+"");
|
|
|
+ prescription.setHisId(ypZyPatient.getPageNo() + "");
|
|
|
YzActOrder yzActOrder = yzActOrderMapper.selectYzActOrderByActOrderNo(ypZyPatient.getActOrderNo());
|
|
|
prescription.setPrescriptionDate(yzActOrder.getStartTime());
|
|
|
prescription.setDrugName(yzActOrder.getOrderName());
|
|
|
prescription.setPrescriptionDose(yzActOrder.getDose());
|
|
|
prescription.setPrescriptionUnit(mzPharmacyMapper.selectYpUnitName(yzActOrder.getDoseUnit()));
|
|
|
prescription.setDispensedUnit(mzPharmacyMapper.selectYpUnitName(yzActOrder.getMiniUnit()));
|
|
|
- if((yzActOrder.getDoseUnit().equals("01") || yzActOrder.getDoseUnit().equals("03"))
|
|
|
- && (yzActOrder.getMiniUnit().equals("01") && yzActOrder.getMiniUnit().equals("03"))){
|
|
|
+ if ((yzActOrder.getDoseUnit().equals("01") || yzActOrder.getDoseUnit().equals("03"))
|
|
|
+ && (yzActOrder.getMiniUnit().equals("01") && yzActOrder.getMiniUnit().equals("03"))) {
|
|
|
prescription.setAmountPerPackage(Double.parseDouble("1"));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
prescription.setAmountPerPackage(ypZdDict.getWeight().doubleValue());
|
|
|
}
|
|
|
prescription.setDispenseDays(1);
|
|
@@ -460,22 +459,24 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
APatientMi aPatientMi = aPatientMiMapper.selectPatientMiByInPatientNo(ypZyPatient.getInpatientNo());
|
|
|
prescription.setPatientName(aPatientMi.getName());
|
|
|
prescription.setBirthday(aPatientMi.getBirthDate());
|
|
|
- prescription.setSex(aPatientMi.getSex()); prescriptionMapper.insertPrescription(prescription);
|
|
|
+ prescription.setSex(aPatientMi.getSex());
|
|
|
+ flag = prescriptionMapper.insertPrescription(prescription);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<YfWardVo> getDetail(String pageNo, String pageClass, String submitFlag) {
|
|
|
List<YfWardVo> yfWardVos = new ArrayList<>();
|
|
|
String[] pageNos = pageNo.split("/");
|
|
|
- if(pageClass.equals("A")){//医技科室领药
|
|
|
- yfWardVos = queryZyDrugDetail(pageNos[0],submitFlag);
|
|
|
- }else{
|
|
|
+ if (pageClass.equals("A")) {//医技科室领药
|
|
|
+ yfWardVos = queryZyDrugDetail(pageNos[0], submitFlag);
|
|
|
+ } else {
|
|
|
for (String no : pageNos) {
|
|
|
List<YfWardVo> t = queryYzYpOrderDetail(no, pageClass.equals("T") ? "1" : "0", submitFlag);
|
|
|
- if(t.size() > 0){
|
|
|
+ if (t.size() > 0) {
|
|
|
yfWardVos.addAll(t);
|
|
|
}
|
|
|
}
|
|
@@ -488,14 +489,14 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
zyActpatient = zyActpatientMapper.selectByInpatientNo(ZyActpatient.ZY_INACTPATIENT, yfWardVo.getInpatientNo(), yfWardVo.getAdmissTimes());
|
|
|
}
|
|
|
|
|
|
- if(!pageClass.equals("A")){//非医技科室领药
|
|
|
+ if (!pageClass.equals("A")) {//非医技科室领药
|
|
|
YzActOrder yzActOrder = yzActOrderMapper.selectYzActOrderByActOrderNo(yfWardVo.getActOrderNo());
|
|
|
- if(yzActOrder != null){
|
|
|
+ if (yzActOrder != null) {
|
|
|
yfWardVo.setInstruction(yzActOrder.getInstruction());
|
|
|
yfWardVo.setSupplyName(yzSupplyTypeMapper.selectSupplyNameByCode(yzActOrder.getSupplyCode()));
|
|
|
}
|
|
|
//毒麻药单,长期口服,临时口服,统领单
|
|
|
- if(pageClass.equals("2") || pageClass.equals("5") || pageClass.equals("6") || pageClass.equals("7")){
|
|
|
+ if (pageClass.equals("2") || pageClass.equals("5") || pageClass.equals("6") || pageClass.equals("7")) {
|
|
|
yfWardVo.setFrequCode(yzActOrder.getFrequCode());
|
|
|
yfWardVo.setDose(yzActOrder.getDose());
|
|
|
yfWardVo.setDoseUnit(mzPharmacyMapper.selectYpUnitName(yzActOrder.getDoseUnit()));
|
|
@@ -523,33 +524,31 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<YfWardVo> getLabelPrintDatas(String pageNo, Integer submitFlag) {
|
|
|
+ public List<YfWardVo> getLabelPrintDatas(String pageNo, Integer submitFlag, Integer isByj) {
|
|
|
List<YfWardVo> yfWardVos = new ArrayList<>();
|
|
|
String[] pageNos = pageNo.split("/");
|
|
|
for (String no : pageNos) {
|
|
|
List<YfWardVo> t = queryYzYpOrderDetail(no, "0", "0,1,2,3,4");
|
|
|
- if(t.size() > 0){
|
|
|
+ if (t.size() > 0) {
|
|
|
yfWardVos.addAll(t);
|
|
|
}
|
|
|
}
|
|
|
for (int i = 0; i < yfWardVos.size(); i++) {
|
|
|
YfWardVo yfWardVo = yfWardVos.get(i);
|
|
|
YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(yfWardVo.getChargeCode(), yfWardVo.getSerial());
|
|
|
- if(((yfWardVo.getPageClass().equals("5")||yfWardVo.getPageClass().equals("6")) && (submitFlag == 3 || ypZdDict.getByjFlag() == 0))//口服单
|
|
|
- || ((!yfWardVo.getPageClass().equals("5")&&!yfWardVo.getPageClass().equals("6")) && "d".equals(yfWardVo.getDrugClass()))//非口服单的口服药
|
|
|
- ){
|
|
|
+ if ((isByj == 0 && "d".equals(yfWardVo.getDrugClass())) || (isByj == 1 && ypZdDict.getByjFlag() == 0)) {//口服药
|
|
|
YzActOrder yzActOrder = yzActOrderMapper.selectYzActOrderByActOrderNo(yfWardVo.getActOrderNo());
|
|
|
yfWardVo.setDose(yzActOrder.getDose());
|
|
|
String ypUnitName = mzPharmacyMapper.selectYpUnitName(yzActOrder.getDoseUnit());
|
|
|
yfWardVo.setDoseUnit(ypUnitName);
|
|
|
String dosage;
|
|
|
- if(yzActOrder.getDoseUnit().equals(yzActOrder.getDrugVolUnit())){
|
|
|
- dosage = yzActOrder.getDose()/yzActOrder.getDrugVolume()+"";
|
|
|
- }else{
|
|
|
- dosage = yzActOrder.getDose()/yzActOrder.getDrugWeight()+"";
|
|
|
+ if (yzActOrder.getDoseUnit().equals(yzActOrder.getDrugVolUnit())) {
|
|
|
+ dosage = yzActOrder.getDose() / yzActOrder.getDrugVolume() + "";
|
|
|
+ } else {
|
|
|
+ dosage = yzActOrder.getDose() / yzActOrder.getDrugWeight() + "";
|
|
|
}
|
|
|
- if(yzActOrder.getDrugWeight() <= 0 || Double.parseDouble(dosage) < 1){
|
|
|
- dosage = NumberFormat.getInstance().format(yfWardVo.getDose())+ypUnitName;
|
|
|
+ if (yzActOrder.getDrugWeight() <= 0 || Double.parseDouble(dosage) < 1) {
|
|
|
+ dosage = NumberFormat.getInstance().format(yfWardVo.getDose()) + ypUnitName;
|
|
|
}
|
|
|
yfWardVo.setDosage(dosage);
|
|
|
APatientMi aPatientMi = aPatientMiMapper.selectPatientMiByInPatientNo(yfWardVo.getInpatientNo());
|
|
@@ -558,7 +557,7 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
yfWardVo.setName(aPatientMi.getName());
|
|
|
yfWardVo.setDrugName(ypZdDict.getName());
|
|
|
yfWardVo.setSpecification(ypZdDict.getSpecification());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
yfWardVos.remove(i);
|
|
|
i--;
|
|
|
}
|
|
@@ -569,13 +568,13 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int cancelWardPrescriptionSubmit(String pageNo, String pageClass, String userIdCode) throws MzException {
|
|
|
- int i=1;
|
|
|
- if(pageClass.equals("A")){
|
|
|
+ int i = 1;
|
|
|
+ if (pageClass.equals("A")) {
|
|
|
i = zyDrugMapper.selectIsInitFlag(pageNo);
|
|
|
- }else if(!pageClass.equals("T")){
|
|
|
+ } else if (!pageClass.equals("T")) {
|
|
|
i = yzYpZyOrderMapper.selectIsInitFlag(pageNo);
|
|
|
}
|
|
|
- if(i == 0){
|
|
|
+ if (i == 0) {
|
|
|
throw new MzException("撤销药单失败,药单含有非初始和拒发状态的药品!");
|
|
|
}
|
|
|
return yzYpPageNoMapper.updateSubmitCancelFlag(pageNo, userIdCode);
|