ct před 1 dnem
rodič
revize
2a0cf59411

+ 4 - 0
fs-service/src/main/java/com/fs/his/config/StoreConfig.java

@@ -3,6 +3,7 @@ package com.fs.his.config;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 
 @Data
 public class StoreConfig implements Serializable {
@@ -22,5 +23,8 @@ public class StoreConfig implements Serializable {
     private String API_URL;
     private String HASHCODE;
     private String SECRET_KEY;
+    private String payPriceTip;//支付金额达限提示
+    private BigDecimal yearPayPrice;//年支付金额限制
+    private BigDecimal canPayPrice;//达限后支付限制金额
 
 }

+ 3 - 0
fs-service/src/main/java/com/fs/his/mapper/FsStoreOrderItemMapper.java

@@ -1,5 +1,6 @@
 package com.fs.his.mapper;
 
+import java.math.BigDecimal;
 import java.util.List;
 import com.fs.his.domain.FsStoreOrderItem;
 import com.fs.his.vo.FsStoreOrderItemExcelVO;
@@ -75,4 +76,6 @@ public interface FsStoreOrderItemMapper
     List<FsStoreOrderItemListDVO> selectFsStoreOrderItemListDVOByOrderId(Long orderId);
 
     List<FsStoreOrderItem> selectFsStoreOrderItemListByItemIds(@Param("itemIds") List<Long> itemIds);
+
+    BigDecimal selectPayPriceByYear(@Param("userId") String userId);
 }

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

@@ -278,4 +278,7 @@ public interface IFsStoreOrderService
     FsStoreOrder confirmOrder(FsPackageOrder packageOrder,Long doctorId);
 
     List<FsStoreOrder> selectOutTimeOrderList(Integer unPayTime);
+
+    BigDecimal selectPayPriceByYear(String userId);
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -4510,4 +4510,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         return fsStoreOrderMapper.selectOutTimeOrderList(unPayTime);
     }
 
+    @Override
+    public BigDecimal selectPayPriceByYear(String userId){
+        return fsStoreOrderItemMapper.selectPayPriceByYear(userId);
+    }
+
 }

+ 8 - 0
fs-service/src/main/resources/mapper/his/FsStoreOrderItemMapper.xml

@@ -47,6 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{itemId}
         </foreach>
     </select>
+    <select id="selectPayPriceByYear" resultType="java.math.BigDecimal">
+        SELECT SUM(pay_price) AS total_pay
+        FROM fs_store_order
+        WHERE status NOT IN (1, -2)
+          AND user_id = #{userId}
+        AND pay_time >= CONCAT(YEAR(CURDATE()), '-01-01')
+        AND pay_time &lt; DATE_ADD(CONCAT(YEAR(CURDATE()), '-01-01'), INTERVAL 1 YEAR);
+    </select>
 
     <insert id="insertFsStoreOrderItem" parameterType="FsStoreOrderItem" useGeneratedKeys="true" keyProperty="itemId">
         insert into fs_store_order_item

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

@@ -97,12 +97,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectFsUserInformationCollectionByDoctorType2"
             resultType="com.fs.his.domain.FsUserInformationCollection">
         select fui.*,fp.patient_name as patientName from fs_user_information_collection fui left join fs_patient fp on fui.patient_id = fp.patient_id
-            <where>
+            where fui.doctor_confirm = 1
                 <if test="maps.doctorType2Id != null and maps.doctorType2Id != ''"> and fui.doctor_type2_id = #{maps.doctorType2Id}</if>
                 <if test="maps.doctorType2Confirm != null"> and fui.doctor_type2_confirm = #{maps.doctorType2Confirm}</if>
                 <if test="maps.packageOrderCode != null  and maps.packageOrderCode != ''"> and fui.package_order_code = #{maps.packageOrderCode}</if>
                 <if test="maps.patientName != null  and maps.patientName != ''"> and fp.patient_name like concat(#{maps.patientName},"%")</if>
-            </where>
         order by id desc
     </select>
     <select id="selectFsUserInformationCollectionByDoctorType1"

+ 34 - 2
fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

@@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
+import static com.fs.his.utils.PhoneUtil.decryptPhone;
+
 
 /**
  * 用户信息采集Controller
@@ -51,8 +53,38 @@ public class FsUserInformationCollectionController extends AppBaseController
             return R.error("未查询到信息!");
         }
         String userId = getUserId();
-        if (vo.getUserId()!=null && vo.getUserId() != Long.parseLong(userId)){
-            return R.error("未查询您的采集信息!");
+        long nowUserId = Long.parseLong(userId);
+        if (vo.getUserId()!=null){
+            if (vo.getUserId() != nowUserId) {
+                //一对多 创建新的用户采集
+                FsUserInformationCollectionParam info = new FsUserInformationCollectionParam();
+                FsUser fsUser = fsUserService.selectFsUserById(nowUserId);
+                String nickName = fsUser.getNickname();
+                if (StringUtils.isNotBlank(nickName)){
+                    nickName = fsUser.getNickName();
+                }
+                String phone = fsUser.getPhone();
+                if (StringUtils.isNotBlank(phone)){
+                    phone = decryptPhone(phone);
+                }
+                BeanUtils.copyProperties(vo, info);
+                //一对多 这条记录已绑定用户 就重新创建一条
+                info.setId(null);
+                info.setUserId(nowUserId);
+                info.setPayType(null);
+                info.setAmount(null);
+                info.setDoctorSign(null);
+                info.setPackageOrderCode(null);
+                info.setSex(fsUser.getSex());
+                info.setUserName(nickName);
+                info.setUserPhoneFour(phone.substring(phone.length()-4));
+                info.setAllergy(null);
+                info.setRemark(null);
+                info.setPatientId(null);
+                Long newId = fsUserInformationCollectionService.insertFsUserInformationCollection(info);
+                vo = fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(newId);//                return R.error("未查询您的采集信息!");
+            }
+
         }
         if (vo.getDoctorConfirm() == 0){
             vo.setPackageId(null);

+ 33 - 0
fs-user-app/src/main/java/com/fs/app/controller/PackageController.java

@@ -1,6 +1,7 @@
 package com.fs.app.controller;
 
 
+import cn.hutool.json.JSONUtil;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -15,6 +16,7 @@ import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.course.domain.FsUserCourseFavorite;
 import com.fs.course.param.FsUserCourseFollowUParam;
+import com.fs.his.config.StoreConfig;
 import com.fs.his.domain.*;
 import com.fs.his.param.*;
 import com.fs.his.service.*;
@@ -22,6 +24,7 @@ import com.fs.his.vo.FsDiseaseListUVO;
 import com.fs.his.vo.FsDoctorListUVO;
 import com.fs.his.vo.FsPackageDetailVO;
 import com.fs.his.vo.FsPackageListUVO;
+import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.jsonwebtoken.Claims;
@@ -40,6 +43,7 @@ import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletRequest;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.net.URL;
 import java.util.Date;
 import java.util.List;
@@ -65,6 +69,11 @@ public class PackageController extends AppBaseController {
     private ICompanyUserService companyUserService;
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private ISysConfigService configService;
+
+    @Autowired
+    private IFsStoreOrderService storeOrderService;
 
     @ApiOperation("获取套餐分类")
     @GetMapping("/getPackagCateList")
@@ -193,4 +202,28 @@ public class PackageController extends AppBaseController {
         }
     }
 
+    @ApiOperation("校验是否可继续下单")
+    @GetMapping("/checkContinue/{packageId}")
+    public R checkContinue(@PathVariable("packageId") Long packageId){
+        String userId = getUserId();
+        String json = configService.selectConfigByKey("his.store");
+        StoreConfig config = JSONUtil.toBean(json, StoreConfig.class);
+        BigDecimal canPayPrice = config.getCanPayPrice();
+        BigDecimal yearPayPrice = config.getYearPayPrice();
+        if(canPayPrice==null||yearPayPrice==null){
+            return R.ok();
+        }
+        String payPriceTip = config.getPayPriceTip();
+        //查询用户本年内支付处方订单+公私域套餐包总金额
+        FsPackage fsPackage = packageService.selectFsPackageByPackageId(packageId);
+        BigDecimal bigDecimal = storeOrderService.selectPayPriceByYear(userId);
+        if(bigDecimal==null){
+            return R.ok();
+        }
+        if (bigDecimal.compareTo(yearPayPrice)>=0&&fsPackage.getTotalPrice().compareTo(canPayPrice)>=0){
+            return R.ok().put("tip",payPriceTip);
+        }
+        return R.ok();
+    }
+
 }