Browse Source

小程序销售端新增接口

xdd 1 month ago
parent
commit
f21521d3e3

+ 2 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPrescribeMapper.java

@@ -134,6 +134,8 @@ public interface FsPrescribeMapper
             "</script>"})
     List<FsPrescribeListUVO> selectFsPrescribeListUVO(@Param("maps")FsPrescribeListUParam param);
 
+    List<FsPrescribeListUVO> selectFsPrescribeListUVOWithOrder(@Param("maps")FsPrescribeListUParam param);
+
 
     @Select("select so.*,ffff.doctor_name prescribeDoctorName, us.nick_name ,dc.doctor_name,dp.doctor_name doctor_drug_name,fso.order_code,fso.`status` order_status,fse.store_name FROM fs_prescribe so  LEFT JOIN fs_user us ON us.user_id=so.user_id LEFT JOIN fs_doctor dc ON dc.doctor_id = so.doctor_id LEFT JOIN fs_doctor dp ON dp.doctor_id =so.drug_doctor_id LEFT JOIN fs_store_order fso ON fso.order_id = so.store_order_id LEFT JOIN fs_store fse ON fse.store_id = so.store_id  LEFT JOIN fs_doctor ffff ON ffff.doctor_id=so.prescribe_doctor_id  where so.prescribe_id=#{prescribeId}")
     FsPrescribeVO selectFsPrescribeByPrescribeIdVO(Long prescribeId);

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

@@ -345,4 +345,7 @@ public interface FsUserMapper
 
     @Select("select * from fs_user where course_ma_open_id=#{openId}")
     FsUser selectFsUserByCourseMaOpenId(String openId);
+
+    @Select("select user_id from fs_user where company_user_id=#{companyUserId}")
+    List<Long> selectFsUserIdByCompanyUserId(@Param("companyUserId") Long companyUserId);
 }

+ 18 - 2
fs-service/src/main/java/com/fs/his/param/FsPrescribeListUParam.java

@@ -3,9 +3,25 @@ package com.fs.his.param;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 @Data
 public class FsPrescribeListUParam extends BaseParam implements Serializable {
-    Long userId;
-    Integer status;
+    private Long userId;
+    private Integer status;
+
+    /**
+     * 销售
+     */
+    private Long companyUserId;
+
+    /**
+     * 销售关联的用户
+     */
+    private List<Long> userIds;
+
+    /**
+     * 患者姓名
+     */
+    private String patientName;
 }

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

@@ -174,4 +174,7 @@ public interface IFsUserService
     ResponseResult<Boolean> becomeMember(@Valid FsUserCourseBeMemberParam param);
 
     FsUserPageListVO selectFsUserPageListVOByUserId(Long userId);
+
+    List<Long> selectFsUserIdByCompanyUserId(Long companyUserId);
+
 }

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

@@ -1028,6 +1028,11 @@ public class FsUserServiceImpl implements IFsUserService
         return item;
     }
 
+    @Override
+    public List<Long> selectFsUserIdByCompanyUserId(Long companyUserId) {
+        return fsUserMapper.selectFsUserIdByCompanyUserId(companyUserId);
+    }
+
 
     private FsUserStatisticsVO getUserStatistics(UserStatisticsCommonParam param) {
         FsUserStatisticsVO fsUserStatisticsVO = new FsUserStatisticsVO();

+ 10 - 0
fs-service/src/main/java/com/fs/his/vo/FsPrescribeListUVO.java

@@ -49,6 +49,16 @@ public class FsPrescribeListUVO implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date auditTime;
 
+    /**
+     * 用户确认0未确认 1已确认
+     */
+    private Integer userConfirm;
+
+    /**
+     * 是否支付
+     */
+    private Integer isPay;
+
     List<FsPrescribeDrug> drugs;
 
 

+ 26 - 0
fs-service/src/main/resources/mapper/his/FsPrescribeMapper.xml

@@ -270,4 +270,30 @@
         <if test="orderStatus != null "> and fso.`status` = #{orderStatus}</if>
         <if test="storeId != null "> and so.store_id = #{storeId}</if>
     </select>
+    <select id="selectFsPrescribeListUVOWithOrder" resultType="com.fs.his.vo.FsPrescribeListUVO">
+        select p.*,o.is_pay  from fs_prescribe p
+        left join fs_store_order o
+        on o.order_id=p.order_id
+        <where>
+            <if test = "maps.userId != null">
+                and p.user_id = #{maps.userId}
+            </if>
+            <if test = "maps.status != null">
+                and p.status = #{maps.status}
+            </if>
+            <if test="maps.patientName != null">
+                and p.patient_name like count(#{patientName},'%')
+            </if>
+            <if test="maps.userIds != null and maps.userIds.size() > 0">
+                and p.user_id in
+                <foreach collection="maps.userIds" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+         order by
+        case when o.is_pay = 0 or o.is_pay is null then 0 else 1 end,
+        case when p.user_confirm=0 or p.user_confirm is null then 0 else 1 end,
+        p.create_time desc
+    </select>
 </mapper>

+ 25 - 0
fs-user-app/src/main/java/com/fs/app/controller/PrescribeController.java

@@ -49,6 +49,9 @@ public class PrescribeController extends  AppBaseController {
     @Autowired
     private IFsDoctorService doctorService;
 
+    @Autowired
+    private IFsUserService fsUserService;
+
 
     @Login
     @GetMapping("/getPrescribeList")
@@ -61,6 +64,28 @@ public class PrescribeController extends  AppBaseController {
         return R.ok().put("data",listPageInfo);
     }
 
+    /**
+     * 获取销售处方订单
+     * @param param
+     * @return
+     */
+    @Login
+    @GetMapping("/getSalerPrescribeList")
+    public R getSalerPrescribeList(FsPrescribeListUParam param)
+    {
+        Long companyUserId = getCompanyUserId();
+        param.setCompanyUserId(companyUserId);
+
+        // 获取当前销售关联的所有用户
+        List<Long> userIds = fsUserService.selectFsUserIdByCompanyUserId(companyUserId);
+        param.setUserIds(userIds);
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<FsPrescribeListUVO> list=prescribeService.selectFsPrescribeListUVO(param);
+        PageInfo<FsPrescribeListUVO> listPageInfo=new PageInfo<>(list);
+        return R.ok().put("data",listPageInfo);
+    }
+
 
     @Login
     @GetMapping("/getPrescribeById")