浏览代码

Merge branch 'dev' of wujunjie/patient-co-management into dev

yeshijie 7 年之前
父节点
当前提交
03f73afb1c

+ 14 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/SignFamily.java

@ -87,6 +87,20 @@ public class SignFamily extends IdEntity {
    // 居委会字段名称
    private String sickVillageName;
    private Integer signPaySource;//签约支付渠道: 1线下 2线上
    //1.4.3新增医生拒签原因
    private String refuseSpeak;//医生拒签原因
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    public String getRefuseSpeak() {
        return refuseSpeak;
    }
    public void setRefuseSpeak(String refuseSpeak) {
        this.refuseSpeak = refuseSpeak;
    }
    public Integer getSignPaySource() {
        return signPaySource;

+ 19 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -30,6 +30,8 @@ public class Prescription extends IdEntity {
    private Date failTime;                  //基位 开方失败时间
    private String failReason;                  //基位 开方失败原因
    private Date dosageTime;                //配药完成时间
    private Date extendTime;                //延长收药的系统
    private Integer extendCount;                //延长收药次数(限1次)
    private Date dispatchingTime;          //配送员领药时间
    private Date expressageTime;            //配送员到服务站的时间
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
@ -109,6 +111,23 @@ public class Prescription extends IdEntity {
    private String drugDeliveryOperatorName; //操作人员名字
    private Date drugDeliveryTime; //异常出药时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getExtendTime() {
        return extendTime;
    }
    public void setExtendTime(Date extendTime) {
        this.extendTime = extendTime;
    }
    @Column(name = "extend_count", unique = true, nullable = false)
    public Integer getExtendCount() {
        return extendCount;
    }
    public void setExtendCount(Integer extendCount) {
        this.extendCount = extendCount;
    }
    @Column(name = "code", unique = true, nullable = false)
    public String getCode() {

+ 9 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -215,6 +215,15 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("sicard_query_job  job exist");
            }
            //续方订单自动确认收货,每天每隔2小时执行一次
            if (!quartzHelper.isExistJob("patient_confirm_receipt_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("patient_confirm_receipt_job");
                quartzHelper.addJob(PatientConfirmReceiptJob.class, trigger, "patient_confirm_receipt_job", new HashMap<String, Object>());
                logger.info("patient_confirm_receipt_job  job success");
            } else {
                logger.info("patient_confirm_receipt_job  job exist");
            }
            //待分配健管师消息提醒 从统计工程中转到到job工程
            if (!quartzHelper.isExistJob(HealthMessageJob.jobKey)) {
                quartzHelper.addJob(HealthMessageJob.class, HealthMessageJob.cron, HealthMessageJob.jobKey, new HashMap<String, Object>());

+ 68 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientConfirmReceiptJob.java

@ -0,0 +1,68 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.util.DateUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 续方订单确认收货接口(支付完成后7天自动确认收货,延长收货1次支付完成后14天自动确认收货)
 * Created by Reece on 2018/02/07
 *
 */
public class PatientConfirmReceiptJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(PatientConfirmReceiptJob.class);
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private SystemDictDao systemDictDao;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("PatientConfirmReceiptJob start ..........");
        try {
            //job执行开关
            String jobRunning = systemDictDao.findByDictNameAndCode("JOB_RUNNING","PatientConfirmReceiptJob");
            if("1".equals(jobRunning)) {
                List<Prescription> list = new ArrayList<>();
                //1.找出状态是已支付未完成且取药方式不是健管师配送的续方
                List<Prescription> PrescriptionList = prescriptionDao.findUndelivered();
                for (Prescription prescription : PrescriptionList) {
                    //2.取出延长收货的次数及支付时间
                    int extendCount = prescription.getExtendCount();
                    Date payTime = prescription.getPayTime();
                    if (payTime != null) {
                        //3.根据延长收货次数确定确认收货时间
                        Date today = new Date();
                        Date confirm = DateUtil.getPreDays(payTime, ((extendCount + 1) * 7));
                        int result = today.compareTo(confirm);
                        if (result >= 0) {
                            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
                            list.add(prescription);
                        }
                    }
                }
                if (list.size() > 0) {
                    prescriptionDao.save(list);
                }
            }
            logger.info("PatientConfirmReceiptJob end ..........");
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("PatientConfirmReceiptJob error ..........,message:" + e.getMessage());
        }
    }
}

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -28,4 +28,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Modifying
    @Query("update Prescription p set p.jwPayStatus=1 where p.code=?1")
    void updatejwPayStatus(String prescriptionCode);
    //查询居民已支付未完成且为自取及快递的续方
    @Query("from Prescription p where p.status >= 50 and p.status< 100 and p.dispensaryType in (1,2) ")
    List<Prescription> findUndelivered();
}

+ 16 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -730,6 +730,22 @@ public class JobController extends BaseController {
        }
    }
    /**
     * 居民端续方订单自动确认收货
     * @return
     */
    @RequestMapping(value = "startDoctorPrenatalInspectorJob", method = RequestMethod.GET)
    @ApiOperation("居民端续方订单自动确认收货")
    public String startPatientConfirmReceiptJob() {
        try {
            quartzHelper.startNow(PatientConfirmReceiptJob.class, "PatientConfirmReceiptJob", null);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 签约数据wlyy_sign_family清洗到续签表wlyy_sign_family_renew_log
     * @return

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -128,6 +128,9 @@ sicard_query_job=0 0 6,12,18,23 * * ?
#\u533B\u751F\u7AEF\u4EA7\u68C0\u7CFB\u7EDF\u63D0\u9192\uFF08\u6BCF\u4E2A\u5DE5\u4F5C\u65E510\u70B9\u6267\u884C\u4E00\u6B21\uFF09
doctor_prenatal_inspector_job=0 0 10 ? * MON-FRI
# \u7EED\u65B9\u8BA2\u5355\u81EA\u52A8\u786E\u8BA4\u6536\u8D27\u5E76\u63A8\u9001\u6D88\u606F
patient_confirm_receipt_job=0 0 8,12,18,21 * * ?
#\u7EDF\u4E00\u652F\u4ED8\u5E73\u53F0\u652F\u4ED8\u6210\u529F\u540E\u9875\u9762\u8DF3\u8F6C\u5730\u5740
return_url={server}/wx/html/qygl/html/pay_result.html
#\u7EDF\u4E00\u652F\u4ED8\u5E73\u53F0\u652F\u4ED8\u63A5\u53E3\u5730\u5740

+ 26 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -26,6 +26,7 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.MessageType;
import io.swagger.models.auth.In;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -96,6 +97,31 @@ public class PrescriptionService extends BaseService {
        return prescriptionDao.findByCode(prescriptionCode);
    }
    /**
     * 续方确认收药接口
     *
     * @param prescriptionCode 续方code
     * @param type 1:确认收药 2:延长收药
     * @return
     */
    public void confirmReceipt(String prescriptionCode, Integer type) throws Exception{
        try {
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            if (type == 1){
                //直接更改状态为已完成
                prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            }else if (type == 2){
                //不更改状态只添加延长收药时间
                prescription.setExtendTime(new Date());
                prescription.setExtendCount(prescription.getExtendCount()+1);
            }
            prescriptionDao.save(prescription);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -1358,7 +1358,8 @@ public class FamilyContractService extends BaseService {
                                 String patientCard, int type,
                                 String healthLabel, String customLabel, String disease,
                                 String expenses, long adminTeamCode,
                                 String sevId) throws Exception {
                                 String sevId,
                                 String refuseReason) throws Exception {
        JSONObject result = new JSONObject();
        String caller = "";
        if (type != 1 && type != 2) {
@ -1549,6 +1550,9 @@ public class FamilyContractService extends BaseService {
            // 医生拒绝
            sf.setStatus(-2);
            sf.setCzrq(new Date());
            if (StringUtils.isNotEmpty(refuseReason)){
                sf.setRefuseSpeak(refuseReason);
            }
            // 拒绝签约
            JSONObject json = new JSONObject();
            json.put("first", "签约失败通知");

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -525,6 +525,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     * @param patientIDcard    患者身份证
     * @param type             处理类型:1同意,2拒绝
     * @param adminTeamCode    行政团队code
     * @param refuseReason    居民签约时的医生拒签原因(可选 限制200字)
     * @return
     */
    @RequestMapping(value = "sign")
@ -544,7 +545,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            int type,
            long adminTeamCode,
            @RequestParam(required = false, defaultValue = "0") String expenses,
            @RequestParam(required = false) String sevId) {
            @RequestParam(required = false) String sevId,
            @RequestParam(required = false) String refuseReason) {
        try {
            if (type != 2) {
                try {
@ -579,7 +581,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                return error(-1, "健康情况标签不能为空!");
            }
            JSONObject res = familyContractService.handleSign(signType, getAccessToken(), doctor, doctorName, healthDoctor, healthDoctorName, msgid, patientIDcard, type, healthLabel, customLabel, disease, expenses, adminTeamCode, sevId);
            JSONObject res = familyContractService.handleSign(signType, getAccessToken(), doctor, doctorName, healthDoctor, healthDoctorName, msgid, patientIDcard, type, healthLabel, customLabel, disease, expenses, adminTeamCode, sevId,refuseReason);
            if (res.getInt("status") == -1) {
                return error(-1, "未知的处理类型!");
            } else if (res.getInt("status") == 0) {

+ 14 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -261,12 +261,25 @@ public class AdminTeamController extends BaseController {
        }
    }
    /**
     * 当前医生为团队长信息排在最前,成员在后
     * @param doctorCode
     * @return
     */
    @RequestMapping(value = "/team/{doctor_code}/teams", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生团队列表")
    public String getDoctorTeams(@PathVariable("doctor_code") String doctorCode) {
        try {
            ArrayList teams = new ArrayList();
            List<AdminTeam> teamList = teamService.getDoctorTeams(doctorCode);
            return write(200, "OK", "data", new JSONArray(teamList));
            AdminTeam team = teamService.findByLeaderCode(doctorCode);
            teams.add(team);
            for (AdminTeam list : teamList){
                if (!doctorCode.equals(list.getLeaderCode())){
                    teams.add(list);
                }
            }
            return write(200, "OK", "data", new JSONArray(teams));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());

+ 22 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -247,6 +247,8 @@ public class PatientPrescriptionController extends WeixinBaseController {
                jo.put("prescriptionStatus", prescription.getStatus());//处方状态
                jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(), "",""));//处方状态名称
                jo.put("ssc",prescription.getSsc());//医保卡号
                jo.put("payTime",prescription.getPayTime());//支付时间
                jo.put("extendCount",prescription.getExtendCount());//延长收货次数
            }
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {
@ -254,6 +256,26 @@ public class PatientPrescriptionController extends WeixinBaseController {
        }
    }
    /**
     * 续方确认收药接口
     *
     * @param prescriptionCode 续方code原状态为60
     * @param type 1:确认收药 2:延长收药
     * @return
     */
    @RequestMapping(value = "/confirmReceipt", method = RequestMethod.POST)
    @ApiOperation(value = "续方确认收药接口")
    public String confirmReceipt(
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode,
            @RequestParam(required = true) @ApiParam(value = "收药方式", name = "type") Integer type) {
        try {
            prescriptionService.confirmReceipt(prescriptionCode,type);
            return write(200, "确认成功");
        } catch (Exception e) {
            return error(-1, "确认失败");
        }
    }
    @RequestMapping(value = "/fadeRecipe", method = RequestMethod.POST)
    @ApiOperation(value = "挂号作废处方接口")