wjj 3 天之前
父節點
當前提交
6bd31e6075

+ 1 - 1
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -1022,7 +1022,7 @@ public class Task {
                 fsStoreOrderService.createOmsOrder(l);
                 Thread.sleep(2000); // 1000毫秒 = 1秒
             } catch (Exception e) {
-                logger.error("推送订单异常:",e);
+                logger.error("订单号:{} ----- 推送订单异常:{}",l,e.getMessage());
                 continue;
             }
         }

+ 1 - 0
fs-service/src/main/java/com/fs/erp/service/impl/JSTErpOrderServiceImpl.java

@@ -185,6 +185,7 @@ public class JSTErpOrderServiceImpl implements IErpOrderService {
             fsJstCodPushMapper.insert(fsJstCodPush);
 
         }
+        log.info("推送ERP参数: {}",JSON.toJSONString(shopOrderDTO));
 
         ErpOrderResponseDTO upload = jstErpHttpService.upload(shopOrderDTO);
 

+ 2 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -663,6 +663,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         FsPatient patient=null;
         FsDoctor doctor=null;
         FsPackage fsPackage=fsPackageMapper.selectFsPackageByPackageId(param.getPackageId());
+        //TODO 后续前端更新加上  || fsPackage.getProductType()==3
         if(fsPackage.getProductType()==1 || fsPackage.getProductType()==2 || fsPackage.getProductType()==3){
             if(param.getPatientId()!=null){
                 patient=fsPatientMapper.selectFsPatientByPatientId(param.getPatientId());
@@ -785,7 +786,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
 
             //疗法制单
             String key = redisCache.getCacheObject("createPackageOrderKey:" + param.getCreatePackageOrderKey());
-            if (StringUtils.isNotEmpty(key) && (fsPackage.getProductType()==1 || fsPackage.getProductType()==2)) {
+            if (StringUtils.isNotEmpty(key) && (fsPackage.getProductType()==1 || fsPackage.getProductType()==2 || fsPackage.getProductType()==3)) {
                 //中药西药创建处方订单
                 fsStoreOrder = storeOrderService.confirmOrder(order,  param.getCreatePackageOrderKey());
                 //修改患者所属会员

+ 25 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -7,6 +7,7 @@ import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
@@ -22,6 +23,8 @@ import com.fs.his.service.*;
 import com.fs.his.utils.ConfigUtil;
 import com.fs.his.utils.qrcode.QRCodeUtils;
 import com.fs.his.vo.*;
+import com.fs.hisStore.domain.FsUserInformationCollection;
+import com.fs.hisStore.mapper.FsUserInformationCollectionMapper;
 import com.fs.im.dto.MsgCustomDTO;
 import com.fs.im.dto.MsgDTO;
 import com.fs.im.dto.MsgDataDTO;
@@ -95,6 +98,12 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
 
     @Autowired
     private IFsExportTaskService fsExportTaskService;
+
+    @Autowired
+    RedisCache redisCache;
+
+    @Autowired
+    private FsUserInformationCollectionMapper collectionMapper;
     /**
      * 查询处方
      *
@@ -573,12 +582,14 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         fsPrescribe.setPrescribeType(fsPackage.getProductType());
         fsPrescribe.setRecipeType(fsPackage.getRecipeType());
         fsPrescribe.setStoreId(fsPackage.getStoreId());
-        fsPrescribe.setStatus(1);
+        fsPrescribe.setStatus(0);
         fsPrescribe.setIcdCode(fsPackage.getIcdCode());
         fsPrescribe.setAuditTime(DateUtils.getNowDate());
         fsPrescribe.setCreateTime(DateUtils.getNowDate());
         fsPrescribe.setUsageJson("{}");
         fsPrescribe.setDiagnose(fsPackage.getTags());
+        //医生操作开始时间
+        fsPrescribe.setStartOperateTime(DateUtils.getNowDate());
         FsPrescribeUsageDTO fsPrescribeUsageDTO = new FsPrescribeUsageDTO();
         if (fsPackage.getProductType()==2){
             fsPrescribeUsageDTO.setCounts(fsPackage.getCounts()+0L);
@@ -1076,6 +1087,19 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         fsPrescribe.setStatus(0);
         fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
 
+
+        //用户信息采集医生确认
+        FsUserInformationCollection collection = redisCache.getCacheObject("collectionPrescribeId:" + fsPrescribe.getPrescribeId());
+        log.info("处方id:{},采集信息{}",fsPrescribe.getPrescribeId(),collection);
+        if (collection != null) {
+            FsUserInformationCollection map = new FsUserInformationCollection();
+            map.setId(collection.getId());
+            map.setDoctorConfirm(1);
+            collectionMapper.updateFsUserInformationCollection(map);
+            //确认完成后删除缓存
+            redisCache.deleteObject("collectionPrescribeId:" + fsPrescribe.getPrescribeId());
+        }
+
         // 医生确认后生成处方单
         PrescriptionTaskRecord record = new PrescriptionTaskRecord();
         record.setPrescribeId(param.getPrescribeId());

+ 9 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -874,6 +874,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             }
         }
         Long prescribeId =null;
+        //TODO 后续前端更新需加上  || productType == 3
         if (productType==1 || productType==2 || productType == 3){
             if (packageOrder.getDoctorId() == null) {
                 Long doctorID = iFsDoctorService.selectFsDoctorDoctorByPackage();
@@ -897,6 +898,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         if (collection != null) {
             //是否确认(用户信息采集 为0的不推送到ERP)1推送
             order.setIsConfirm(0);
+            //存入用户信息采集信息 用于第一次医生确认处方修改医生确认状态
+            log.info("处方单id:{}==============>",prescribeId);
+            if (prescribeId != null) {
+                redisCache.setCacheObject("collectionPrescribeId:" + prescribeId, collection);
+            }
         }
         order.setStatus(2);
         order.setPayDelivery(packageOrder.getPayDelivery());
@@ -1126,6 +1132,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 FsPrescribe fsPrescribe = new FsPrescribe();
                 fsPrescribe.setPrescribeId(prescribeId);
                 fsPrescribe.setStoreOrderId(order.getOrderId());
+                fsPrescribe.setDoctorConfirm(0);
                 fsPrescribeService.updateFsPrescribe(fsPrescribe);
             }
 
@@ -1962,7 +1969,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         Integer productType = (Integer) packageJson.get("productType");
         FsStoreOrder order = new FsStoreOrder();
         Long prescribeId =null;
-        if (productType==1 || packageSubType==2 || productType==2 || productType==3){
+        //TODO 后续前端更新需加上 || productType == 3
+        if (productType==1 || packageSubType==2 || productType==2 || productType == 3){
             if (packageOrder.getDoctorId() == null) {
                 Long doctorID = iFsDoctorService.selectFsDoctorDoctorByPackage();
                 packageOrder.setDoctorId(doctorID);

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsUserInformationCollectionMapper.java

@@ -72,7 +72,7 @@ public interface FsUserInformationCollectionMapper extends BaseMapper<FsUserInfo
 
     @Select({"<script> " +
             " SELECT uic.*,u.nickname userName FROM fs_user_information_collection uic LEFT JOIN fs_user u ON uic.user_id = u.user_id " +
-            "WHERE doctor_id = #{maps.doctorId} " +
+            "WHERE doctor_id = #{maps.doctorId} and is_package = 0  " +
             "<if test='maps.doctorConfirm != null' > and uic.doctor_confirm = #{maps.doctorConfirm}  </if>" +
             "<if test='maps.userConfirm != null' > and uic.user_confirm = #{maps.userConfirm}  </if>" +
             "<if test='maps.userName != null ' > and u.nickname like concat('%',#{maps.userName},'%')</if>" +

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/service/IFsUserInformationCollectionService.java

@@ -70,7 +70,7 @@ public interface IFsUserInformationCollectionService extends IService<FsUserInfo
     FsUserInformationCollectionVO getInfo(FsUserInformationCollection fsUserInformationCollection);
 
     /**
-     * 查询医生端用户信息采集列表
+     * 查询医生端用户信息采集列表(只查询未关联套餐包的信息采集)
      * @param param
      * @return
      */

+ 45 - 52
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -427,35 +427,35 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (answerVOS != null && !answerVOS.isEmpty()) {
             map.setJsonInfo(JSON.toJSONString(answerVOS));
         }
-        if (fsUserInformationCollection.getIsPackage() == 1) {
-            //插入生成处方签定时任务数据
-            if(fsUserInformationCollection.getPackageOrderCode() != null) {
-                //套餐包订单
-                FsPackageOrder fsPackageOrder = packageOrderMapper.selectByOderCode(fsUserInformationCollection.getPackageOrderCode());
-                if (fsPackageOrder != null && fsPackageOrder.getIsPay() == 1) {
-                    //套餐包信息
-                    FsPackage fsPackage = JSON.parseObject(fsPackageOrder.getPackageJson(), FsPackage.class);
-
-                    //套餐包为药品生成处方信息
-                    if(fsPackage != null && (fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2 || fsPackage.getProductType() == 3)) {
-                        FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderCode(fsUserInformationCollection.getPackageOrderCode());
-                        if (fsStoreOrder != null && fsStoreOrder.getIsPay() == 1 ) {
-                            if (fsStoreOrder.getPrescribeId() != null) {
-//                                FsPrescribeParam fsPrescribeParam = new FsPrescribeParam();
-//                                fsPrescribeParam.setPrescribeId(fsStoreOrder.getPrescribeId());
-//                                prescribeService.confirmPrescribe(fsPrescribeParam);
-                                prescribeService.collectionPrescribe(fsStoreOrder.getPrescribeId());
-                            }
-                        } else {
-                            throw new CustomException("生成处方信息中......");
-                        }
-                    }
-                }
-            }
-        } else {
-            //没有关联套餐包医生确认清空所有状态
-            map.setUserConfirm2(1);
-        }
+//        if (fsUserInformationCollection.getIsPackage() == 1) {
+//            //插入生成处方签定时任务数据
+//            if(fsUserInformationCollection.getPackageOrderCode() != null) {
+//                //套餐包订单
+//                FsPackageOrder fsPackageOrder = packageOrderMapper.selectByOderCode(fsUserInformationCollection.getPackageOrderCode());
+//                if (fsPackageOrder != null && fsPackageOrder.getIsPay() == 1) {
+//                    //套餐包信息
+//                    FsPackage fsPackage = JSON.parseObject(fsPackageOrder.getPackageJson(), FsPackage.class);
+//
+//                    //套餐包为药品生成处方信息
+//                    if(fsPackage != null && (fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2 || fsPackage.getProductType() == 3)) {
+//                        FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderCode(fsUserInformationCollection.getPackageOrderCode());
+//                        if (fsStoreOrder != null && fsStoreOrder.getIsPay() == 1 ) {
+//                            if (fsStoreOrder.getPrescribeId() != null) {
+////                                FsPrescribeParam fsPrescribeParam = new FsPrescribeParam();
+////                                fsPrescribeParam.setPrescribeId(fsStoreOrder.getPrescribeId());
+////                                prescribeService.confirmPrescribe(fsPrescribeParam);
+//                                prescribeService.collectionPrescribe(fsStoreOrder.getPrescribeId());
+//                            }
+//                        } else {
+//                            throw new CustomException("生成处方信息中......");
+//                        }
+//                    }
+//                }
+//            }
+//        } else {
+//            //没有关联套餐包医生确认清空所有状态
+//            map.setUserConfirm2(1);
+//        }
 
         if (fsUserInformationCollectionMapper.updateFsUserInformationCollection(map) > 0) {
 
@@ -508,7 +508,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                     vo.setOrderStatus(fsPackageOrder.getIsPay());
                     vo.setOrderId(fsPackageOrder.getOrderId());
                     vo.setPatientJson(fsPackageOrder.getPatientJson());
-                    if((fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2) && fsPackageOrder.getIsPay() == 1) {
+                    if((fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2 || fsPackage.getProductType() == 3) && fsPackageOrder.getIsPay() == 1) {
                         //套餐包为药品且已支付的查询处方订单拿到处方签
                         FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderCode(collection.getPackageOrderCode());
                         if (fsStoreOrder != null) {
@@ -562,29 +562,22 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         map.setUserConfirm(1);
         map.setUserAdvice(param.getUserAdvice());
 
-        //绑定了套餐包的用户第二次确认清空所有确认状态 未绑定的医生确认清空所有确认状态
-        if(collection.getIsPackage() == 1){
+
+        if (collection.getStatus() == 1) {
             //第一次确认
-            if (collection.getStatus() == 1) {
-                map.setStatus(2);
-            } else if (collection.getStatus() == 2) {
-                map.setUserConfirm2(1);
-//                //清空订单号
-//                fsUserInformationCollectionMapper.collectionOderCodeNULL(collection.getId());
-//                map.setStatus(1);
-//                map.setDoctorConfirm(0);
-//                map.setUserConfirm(0);
-//                map.setUserConfirm2(0);
-                if (collection.getUserConfirm2() == 0) {
-                    FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderCode(collection.getPackageOrderCode());
-                    if (fsStoreOrder != null) {
-                        FsStoreOrder editOrder   = new FsStoreOrder();
-                        editOrder.setOrderId(fsStoreOrder.getOrderId());
-                        editOrder.setIsConfirm(1);
-                        storeOrderService.updateFsStoreOrder(editOrder);
-                    } else {
-                        return R.error("没有找到订单");
-                    }
+            map.setStatus(2);
+        } else if (collection.getStatus() == 2) {
+            //第二次确认
+            map.setUserConfirm2(1);
+            if (collection.getUserConfirm2() == 0 && collection.getIsPackage() == 1) {
+                FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderCode(collection.getPackageOrderCode());
+                if (fsStoreOrder != null) {
+                    FsStoreOrder editOrder   = new FsStoreOrder();
+                    editOrder.setOrderId(fsStoreOrder.getOrderId());
+                    editOrder.setIsConfirm(1);
+                    storeOrderService.updateFsStoreOrder(editOrder);
+                } else {
+                    return R.error("没有找到订单");
                 }
             }
         }

+ 1 - 1
fs-service/src/main/resources/mapper/hisStore/FsUserInformationCollectionMapper.xml

@@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null">status,</if>
             <if test="doctorConfirmTime != null">doctor_confirm_time,</if>
             <if test="userPhoneFour != null">user_phone_four,</if>
-            <if test="user_name != null">userName,</if>
+            <if test="userName != null">user_name,</if>
             <if test="sex != null">sex,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">

+ 47 - 37
fs-user-app/src/main/java/com/fs/app/controller/PatientController.java

@@ -90,10 +90,11 @@ public class PatientController extends  AppBaseController {
 
         String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
         String mobile = param.getMobile();
-        if (idCardNumber == null || idCardNumber.trim().isEmpty()) {
-            return R.error("身份证号码不合法");
-        }
-        if (idCardNumber.length() != 18) {
+//        if (idCardNumber == null || idCardNumber.trim().isEmpty()) {
+//            return R.error("身份证号码不合法");
+//        }
+        if (StringUtils.isNotEmpty(idCardNumber)) {
+            if (idCardNumber.length() != 18) {
 //            //大陆身份证是18位
 //            if (isIdVerification != 1) {
 //                return R.error("身份证号码不合法");
@@ -103,21 +104,23 @@ public class PatientController extends  AppBaseController {
 //                    R.error("手机号不能为空");
 //                }
 //            }
-            //暂时仅支持大陆身份证
-            return  R.error("身份证号码不合法");
-        } else {
-            String regex = "\\d{17}[0-9Xx]";
-            if (!Pattern.matches(regex, idCardNumber)) {
-                return   R.error("身份证号码不合法");
+                //暂时仅支持大陆身份证
+                return  R.error("身份证号码不合法");
+            } else {
+                String regex = "\\d{17}[0-9Xx]";
+                if (!Pattern.matches(regex, idCardNumber)) {
+                    return   R.error("身份证号码不合法");
+                }
             }
         }
 
+
         if (param.getPatientName().length()<2||param.getPatientName().length()>30||!param.getPatientName().matches("^[\u4e00-\u9fa5]+$")) {
             return   R.error("就诊人名称不合法");
         }
 
         try {
-            if (idCardNumber != null) {
+            if (StringUtils.isNotEmpty(idCardNumber)) {
                 String birthDateString = idCardNumber.substring(6, 14);
                 LocalDate birthDate = LocalDate.parse(birthDateString, DateTimeFormatter.ofPattern("yyyyMMdd"));
                 LocalDate currentDate = LocalDate.now();
@@ -158,14 +161,16 @@ public class PatientController extends  AppBaseController {
 
         //三方校验
         if (isIdVerification!=null&&isIdVerification == 1){
-            boolean match = true;
-            if (idCardNumber.length() != 18) {
-                match = IdCardUtil.isMatchByMobile(storeConfig,param.getPatientName(), mobile);
-            } else {
-                match = IdCardUtil.isMatchById(storeConfig,param.getPatientName(), param.getIdCard());
-            }
-            if (!match){
-                return R.error("身份证校验错误");
+            if (StringUtils.isNotEmpty(idCardNumber)) {
+                boolean match = true;
+                if (idCardNumber.length() != 18) {
+                    match = IdCardUtil.isMatchByMobile(storeConfig,param.getPatientName(), mobile);
+                } else {
+                    match = IdCardUtil.isMatchById(storeConfig,param.getPatientName(), param.getIdCard());
+                }
+                if (!match){
+                    return R.error("身份证校验错误");
+                }
             }
         }
 
@@ -196,10 +201,11 @@ public class PatientController extends  AppBaseController {
         String mobile = param.getMobile();
 
         String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
-        if (idCardNumber == null || idCardNumber.trim().isEmpty()) {
-            return R.error("身份证号码不合法");
-        }
-        if (idCardNumber.length() != 18) {
+//        if (idCardNumber == null || idCardNumber.trim().isEmpty()) {
+//            return R.error("身份证号码不合法");
+//        }
+        if (StringUtils.isNotEmpty(idCardNumber)) {
+            if (idCardNumber.length() != 18) {
 //            //大陆身份证是18位
 //            if (isIdVerification != 1) {
 //                return R.error("身份证号码不合法");
@@ -209,15 +215,17 @@ public class PatientController extends  AppBaseController {
 //                    R.error("手机号不能为空");
 //                }
 //            }
-            //暂时仅支持大陆身份证
-            return  R.error("身份证号码不合法");
-        } else {
-            String regex = "\\d{17}[0-9Xx]";
-            if (!Pattern.matches(regex, idCardNumber)) {
-                return   R.error("身份证号码不合法");
+                //暂时仅支持大陆身份证
+                return  R.error("身份证号码不合法");
+            } else {
+                String regex = "\\d{17}[0-9Xx]";
+                if (!Pattern.matches(regex, idCardNumber)) {
+                    return   R.error("身份证号码不合法");
+                }
             }
         }
 
+
         if (param.getPatientName().length()<2||param.getPatientName().length()>30||!param.getPatientName().matches("^[\u4e00-\u9fa5]+$")) {
             return   R.error("就诊人名称不合法");
         }
@@ -256,14 +264,16 @@ public class PatientController extends  AppBaseController {
 
         //三方校验
         if (isIdVerification!=null&&isIdVerification == 1){
-            boolean match = true;
-            if (idCardNumber.length() != 18) {
-                match = IdCardUtil.isMatchByMobile(storeConfig,param.getPatientName(), mobile);
-            } else {
-                match = IdCardUtil.isMatchById(storeConfig,param.getPatientName(), param.getIdCard());
-            }
-            if (!match){
-                return R.error("身份证校验错误");
+            if (StringUtils.isNotEmpty(idCardNumber)) {
+                boolean match = true;
+                if (idCardNumber.length() != 18) {
+                    match = IdCardUtil.isMatchByMobile(storeConfig,param.getPatientName(), mobile);
+                } else {
+                    match = IdCardUtil.isMatchById(storeConfig,param.getPatientName(), param.getIdCard());
+                }
+                if (!match){
+                    return R.error("身份证校验错误");
+                }
             }
         }