Browse Source

1.商城订单添加SOP档期标签 2.疗法制单添加SOP档期标签 3.互联网医院订单添加SOP档期标签

wjj 2 weeks ago
parent
commit
2d127f8d31

+ 3 - 0
fs-service/src/main/java/com/fs/his/domain/FsStoreOrder.java

@@ -279,4 +279,7 @@ public class FsStoreOrder extends BaseEntity
     private BigDecimal divAmount;
     //中医院分账金额
     private BigDecimal zyyDivAmount;
+
+    //档期标签名称
+    private String tagNames;
 }

+ 10 - 2
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -72,6 +72,7 @@ import com.fs.im.service.IImService;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.mapper.QwExternalContactMapper;
+import com.fs.qw.service.IQwExternalContactService;
 import com.fs.qw.service.impl.QwUserServiceImpl;
 import com.fs.system.domain.SysConfig;
 import com.fs.tzBankPay.doman.*;
@@ -307,6 +308,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     @Autowired
     private DoctorMsgMapper doctorMsgMapper;
 
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
     //ERP 类型到服务的映射
     private Map<Integer, IErpOrderService> erpServiceMap;
     @PostConstruct
@@ -869,6 +873,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         Integer packageSubType = (Integer) packageJson.get("packageSubType");
         Integer productType = (Integer) packageJson.get("productType");
         FsStoreOrder order = new FsStoreOrder();
+        //获取用户档期标签
+        List<String> names = qwExternalContactService.selectTagNameByFsUserId(packageOrder.getUserId());
+        order.setTagNames(JSON.toJSONString(names));
         //确认订单返回结果
         if (result != null && result.getResp_code().equals("00000000") && (result.getTrans_stat().equals("S") || result.getTrans_stat().equals("P"))) {
             order.setZyyDivAmount(result.getYsyAmount());
@@ -879,7 +886,6 @@ 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();
@@ -1981,8 +1987,10 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         Integer packageSubType = (Integer) packageJson.get("packageSubType");
         Integer productType = (Integer) packageJson.get("productType");
         FsStoreOrder order = new FsStoreOrder();
+        //获取用户档期标签
+        List<String> names = qwExternalContactService.selectTagNameByFsUserId(packageOrder.getUserId());
+        order.setTagNames(JSON.toJSONString(names));
         Long prescribeId =null;
-        //TODO 后续前端更新需加上 || productType == 3
         if (productType==1 || packageSubType==2 || productType==2 || productType == 3){
             if (packageOrder.getDoctorId() == null) {
                 Long doctorID = iFsDoctorService.selectFsDoctorDoctorByPackage();

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/domain/FsStoreOrderScrm.java

@@ -361,4 +361,6 @@ public class FsStoreOrderScrm extends BaseEntity
     //中医院分账金额
     private BigDecimal zyyDivAmount;
 
+    //档期标签名称
+    private String tagNames;
 }

+ 7 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -94,6 +94,7 @@ import com.fs.hisStore.constants.StoreConstants;
 import com.fs.hisStore.domain.*;
 import com.fs.hisStore.enums.*;
 import com.fs.hisStore.service.*;
+import com.fs.qw.service.IQwExternalContactService;
 import com.fs.system.service.ISysConfigService;
 import com.fs.wx.miniapp.config.WxMaProperties;
 import com.fs.ybPay.domain.OrderResult;
@@ -343,6 +344,9 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
     @Autowired
     private WxMaProperties properties;
 
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
     //ERP 类型到服务的映射
     private Map<Integer, IErpOrderService> erpServiceMap;
     @PostConstruct
@@ -736,6 +740,9 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
             Boolean isIntegral = false;
             //组合数据
             FsStoreOrderScrm storeOrder = new FsStoreOrderScrm();
+            //获取用户档期标签
+            List<String> names = qwExternalContactService.selectTagNameByFsUserId(userId);
+            storeOrder.setTagNames(JSON.toJSONString(names));
             storeOrder.setStoreHouseCode("CK01");
             storeOrder.setCompanyId(param.getCompanyId());
             storeOrder.setCompanyUserId(param.getCompanyUserId());

+ 3 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwExternalContactMapper.java

@@ -522,4 +522,7 @@ public interface QwExternalContactMapper extends BaseMapper<QwExternalContact> {
     void updateQwExternalContactStatusById(QwExternalContact qwExternalContact);
 
     List<QwExternalContactVO> selectQwExternalContactListVONewSys(QwExternalContactParam qwExternalContact);
+
+    @Select("SELECT tag_ids FROM qw_external_contact WHERE fs_user_id = #{fsUserId}")
+    List<String> selectTagsByFsUserId(Long fsUserId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/qw/service/IQwExternalContactService.java

@@ -249,4 +249,6 @@ public interface IQwExternalContactService extends IService<QwExternalContact> {
 
 
     List<QwExternalContactVO> selectQwExternalContactListVONewSys(QwExternalContactParam qwExternalContact);
+
+    List<String> selectTagNameByFsUserId(Long fsUserId);
 }

+ 54 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -64,6 +64,8 @@ import com.fs.sop.service.ISopUserLogsService;
 import com.fs.system.service.ISysConfigService;
 import com.fs.system.service.ISysDictTypeService;
 import com.fs.voice.utils.StringUtil;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import lombok.extern.slf4j.Slf4j;
@@ -76,6 +78,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
 import java.math.BigDecimal;
@@ -5719,6 +5722,48 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
         return qwExternalContactMapper.selectQwExternalContactListVONewSys(qwExternalContact);
     }
 
+    @Override
+    public List<String> selectTagNameByFsUserId(Long fsUserId) {
+
+        List<String> tagNames = Lists.newArrayList();
+
+        //获取微信用户绑定的外部联系人SOP标签
+        List<String> qwExTagIds = qwExternalContactMapper.selectTagsByFsUserId(fsUserId);
+        logger.info("外部联系人标签:{}",qwExTagIds);
+        if (!CollectionUtils.isEmpty(qwExTagIds)) {
+            //处理外部联系人标签
+            List<String> newTags = Lists.newArrayList();
+            for (String qwExTagId : qwExTagIds) {
+                List<String> tags = JSON.parseArray(qwExTagId, String.class);
+                if (!CollectionUtils.isEmpty(tags)) {
+                    newTags.addAll(tags);
+                }
+            }
+            logger.info("处理后的外部联系人标签:{}",newTags);
+            //查询sop标签
+            List<String> sopTagIds = qwSopMapper.selectSopTagIds();
+            logger.info("SOP标签id:{}",sopTagIds);
+            if (!CollectionUtils.isEmpty(sopTagIds)) {
+                //获取name
+                List<ExternalContactTagVO> vo = qwTagMapper.selectQwTagListByTagIds(sopTagIds);
+                logger.info("SOP标签name:{}",vo);
+                if (!CollectionUtils.isEmpty(vo) && !CollectionUtils.isEmpty(newTags)) {
+                    Map<String, String> map = vo.stream().collect(Collectors.toMap(ExternalContactTagVO::getTagId, ExternalContactTagVO::getName));
+                    logger.info("map:{}",map);
+                    newTags.forEach(item -> {
+                        String name = map.get(item);
+                        if (StringUtils.isNotEmpty(name)){
+                            tagNames.add(name);
+                        }
+                    });
+                    logger.info("tagNames:{}",tagNames);
+                }
+
+            }
+        }
+        return tagNames;
+    }
+
 
     public Boolean getSopAiChatByRedis(String qwUserId,String corpId,String externalUserId){
 
@@ -5735,4 +5780,13 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
         }
         return false;
     }
+
+    public static void main(String[] args) {
+
+
+        String s = null;
+        List<String> strings = JSON.parseArray(s, String.class);
+        System.out.println(strings);
+        System.out.println(!CollectionUtils.isEmpty(strings));
+    }
 }

+ 2 - 0
fs-service/src/main/java/com/fs/sop/service/IQwSopService.java

@@ -100,4 +100,6 @@ public interface IQwSopService
     List<QwSop> selectAllQwSopInfo(QwSop qwSop);
 
     int deleteQwSopLogsBySopIds(String[] ids);
+
+    List<String> selectSopTagIds();
 }

+ 16 - 0
fs-service/src/main/java/com/fs/sop/service/impl/QwSopServiceImpl.java

@@ -1094,6 +1094,22 @@ public class QwSopServiceImpl implements IQwSopService
         return qwSopLogsMapper.delete(new QueryWrapper<QwSopLogs>().in("sop_id", Arrays.asList(ids)));
     }
 
+    @Override
+    public List<String> selectSopTagIds() {
+        List<String> sopTagIds = qwSopMapper.selectSopTagIds();
+        if(CollectionUtils.isEmpty(sopTagIds)){
+            for (String s:sopTagIds) {
+                //多标签处理
+                if (s.contains(",")) {
+                    sopTagIds.addAll(Arrays.asList(s.split(",")));
+                }
+            }
+            //标签去重
+            sopTagIds = sopTagIds.stream().distinct().collect(Collectors.toList());
+        }
+        return sopTagIds;
+    }
+
     /**
      *新增员工执行SOP
      */

+ 4 - 0
fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml

@@ -97,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="divHuifuId"    column="div_huifu_id"    />
         <result property="zyyDivAmount"    column="zyy_div_amount"    />
         <result property="zyyHuifuId"    column="zyy_huifu_id"    />
+        <result property="tagNames"    column="tag_names"    />
     </resultMap>
 
     <sql id="selectFsStoreOrderVo">
@@ -246,6 +247,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="divAmount != null">div_amount,</if>
             <if test="zyyDivAmount != null">zyy_div_amount,</if>
             <if test="zyyHuifuId != null">zyy_huifu_id,</if>
+            <if test="tagNames != null">tag_names,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="storeId != null">#{storeId},</if>
@@ -338,6 +340,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="zyyHuifuId != null">#{zyyHuifuId},</if>
             <if test="divAmount != null">#{divAmount},</if>
             <if test="zyyDivAmount != null">#{zyyDivAmount},</if>
+            <if test="tagNames != null">#{tagNames},</if>
          </trim>
     </insert>
 
@@ -435,6 +438,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="zyyHuifuId != null and zyyHuifuId != ''">zyy_huifu_id = #{zyyHuifuId},</if>
             <if test="divAmount != null and divAmount != ''">div_amount = #{divAmount},</if>
             <if test="zyyDivAmount != null and zyyDivAmount != ''">zyy_div_amount = #{zyyDivAmount},</if>
+            <if test="tagNames != null and tagNames != ''">tag_names = #{tagNames},</if>
         </trim>
         where order_id = #{orderId}
     </update>

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

@@ -93,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="zyyDivAmount"    column="zyy_div_amount"    />
         <result property="zyyHuifuId"    column="zyy_huifu_id"    />
         <!--<result property="orderMedium"    column="order_medium"    />-->
+        <result property="tagNames"    column="tag_names"    />
     </resultMap>
 
     <sql id="selectFsStoreOrderVo">
@@ -107,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                company_id,company_user_id,is_package,package_json,item_json,order_type,package_id,finish_time,delivery_status,
                delivery_pay_status,delivery_time,delivery_pay_time,delivery_pay_money,tui_money,tui_money_status,delivery_import_time,
                tui_user_id,tui_user_money_status,order_create_type,store_house_code,dept_id,is_edit_money,customer_id,is_pay_remain,
-               delivery_send_time,certificates,schedule_id,div_amount, div_huifu_id,zyy_div_amount,zyy_huifu_id from fs_store_order_scrm
+               delivery_send_time,certificates,schedule_id,div_amount, div_huifu_id,zyy_div_amount,zyy_huifu_id,tag_names from fs_store_order_scrm
     </sql>
 
     <select id="selectFsStoreOrderList" parameterType="FsStoreOrderScrm" resultMap="FsStoreOrderResult">
@@ -267,6 +268,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="divAmount != null">div_amount,</if>
             <if test="zyyDivAmount != null">zyy_div_amount,</if>
             <if test="zyyHuifuId != null">zyy_huifu_id,</if>
+            <if test="tagNames != null">tag_names,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="orderCode != null and orderCode != ''">#{orderCode},</if>
@@ -357,6 +359,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="divAmount != null">#{divAmount},</if>
             <if test="zyyDivAmount != null">#{zyyDivAmount},</if>
             <if test="cycle != null">#{cycle},</if>
+            <if test="tagNames != null">#{tagNames},</if>
          </trim>
     </insert>
 
@@ -454,6 +457,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="zyyHuifuId != null and zyyHuifuId != ''">zyy_huifu_id = #{zyyHuifuId},</if>
             <if test="divAmount != null and divAmount != ''">div_amount = #{divAmount},</if>
             <if test="zyyDivAmount != null and zyyDivAmount != ''">zyy_div_amount = #{zyyDivAmount},</if>
+            <if test="tagNames != null and tagNames != ''">tag_names = #{tagNames},</if>
         </trim>
         where id = #{id}
     </update>