Преглед изворни кода

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 пре 7 година
родитељ
комит
64460cfdb1

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -1250,7 +1250,7 @@ public class PrescriptionService extends ZysoftBaseService{
                String recipeNo = json.getString("recipeNo");//处方编号
            
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue())){
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                    } else{

+ 97 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/SignToRenewJob.java

@ -0,0 +1,97 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyMapping;
import com.yihu.wlyy.entity.patient.SignFamilyRenewLog;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyMappingDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewLogDao;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 处理家庭签约到期数据未迁移到续签表数据
 * Created by Reece on 2018/1/9/029.
 */
@Component
public class SignToRenewJob implements Job {
    @Autowired
    private SignFamilyRenewLogDao RenewLogDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private SignFamilyMappingDao mappingDao;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("SignToRenewJob start");
        try {
            //1.查询wlyy_sign_family有续签却未同步到wlyy_sign_family_renew_log数据(过滤掉已到期)
            List<SignFamily> totalSign = signFamilyDao.findRenew();
            for (SignFamily sign:totalSign) {
                String idcard = sign.getIdcard();
                if (idcard == null){
                    continue;
                }
                //2.根据身份证号查询最近的已到期签约数据
                SignFamily latelySign = signFamilyDao.findLatelyRenew(idcard);
                if (latelySign != null){
                    SignFamilyRenewLog renewLog = new SignFamilyRenewLog();
                    renewLog.setSignCode(sign.getCode());
//                    renewLog.setRenewSignCode();
                    renewLog.setIdcard(sign.getIdcard()) ;
                    renewLog.setHospital(sign.getHospital());
                    renewLog.setAdminTeamId(sign.getAdminTeamId());
                    renewLog.setDoctor(sign.getDoctor());
                    renewLog.setOldSignCode(latelySign.getSignDoctorCode());
                    renewLog.setOldHospital(latelySign.getHospital());
                    renewLog.setOldAdminTeamId(latelySign.getAdminTeamId());
                    renewLog.setOldDoctor(latelySign.getDoctor());
                    SignFamilyMapping signMapping = mappingDao.findByCode(sign.getCode());
                    if (signMapping != null){
                        String proId = signMapping.getProId();
                        if (StringUtils.isNotEmpty(proId)){
                            renewLog.setNeedUpload("0");
                        }else {
                            renewLog.setNeedUpload("1");
                        }
                        renewLog.setSignYear(signMapping.getSignYear());
                        renewLog.setRenewProId(signMapping.getRenewProId());
                        renewLog.setProId(signMapping.getProId());
                    }
                    SignFamilyMapping renewMapping = mappingDao.findByCode(latelySign.getCode());
                    if (renewMapping != null){
                        renewLog.setOldProId(renewMapping.getProId());
                    }
//                    renewLog.setUploadLog() ;
                    renewLog.setCreateTime(new Date());
                    renewLog.setUpdateTime(new Date());
                    renewLog.setStatus(sign.getStatus());
                    renewLog.setApplyDate(sign.getApplyDate());
                    renewLog.setRenewChangeReason(sign.getRenewChangeReason());
                    renewLog.setExpensesStatus(sign.getExpensesStatus());
                    renewLog.setPatient(sign.getPatient());
                    RenewLogDao.save(renewLog);
                }
            }
            System.out.println("SignToRenewJob end");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("SignToRenewJob failed");
        }
    }
}

+ 9 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -422,4 +422,13 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
            " AND o.medical_time>?2 )ORDER BY t1.openid DESC,CONVERT(t1.NAME USING gbk) ",nativeQuery = true)
    List<SignFamily> findExaminationByHospital(String hospital,Date examinationTime);
    //查询wlyy_sign_family有续签却未同步到wlyy_sign_family_renew_log数据
    @Query(value = "SELECT f.* FROM wlyy_sign_family f LEFT JOIN wlyy_sign_family_renew_log r ON f.`code` = r.sign_code WHERE r.sign_code IS NULL  " +
            " AND f.renew_flag IN (1, 2) and f.`status`!=-4  ",nativeQuery = true)
    List<SignFamily> findRenew();
    //根据身份证号查询最近的已到期签约数据
    @Query(value = "SELECT f.* FROM wlyy_sign_family f WHERE f.idcard = ?1 and f.`status` = -4 ORDER BY sign_year desc LIMIT 0,1 ",nativeQuery = true)
    SignFamily findLatelyRenew(String idcard);
}

+ 5 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyMappingDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.patient;
import com.yihu.wlyy.entity.patient.SignFamilyMapping;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -9,4 +10,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface SignFamilyMappingDao extends PagingAndSortingRepository<SignFamilyMapping, Long>, JpaSpecificationExecutor<SignFamilyMapping> {
    //根据签约code查询映射数据
    @Query(value = "select a from SignFamilyMapping a where a.code = ?1 ")
    SignFamilyMapping findByCode(String code);
}

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

@ -729,4 +729,21 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 签约数据wlyy_sign_family清洗到续签表wlyy_sign_family_renew_log
     * @return
     */
    @RequestMapping(value = "startSignToRenewJob", method = RequestMethod.GET)
    @ApiOperation("签约续签数据清洗")
    public String startSignToRenewJob() {
        try {
            quartzHelper.startNow(SignToRenewJob.class, "SignToRenewJob", null);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/scheme/PatientSchemeListDao.java

@ -16,6 +16,6 @@ public interface PatientSchemeListDao extends
        JpaSpecificationExecutor<PatientSchemeList> {
    @Modifying
    @Query("delete PatientSchemeList where patientcode=?1 and type=?2 and schemecode=?3")
    void delByPatientCodeAndSchemeCode(String patientcode, int i, String code);
    @Query("delete PatientSchemeList where patientcode=?1 and type=?2")
    void delByPatientCode(String patientcode, int i);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -133,7 +133,7 @@ public class SignPatientLabelInfoService extends BaseService {
        //预警状态
        json.put("standardStatus",p.getStandardStatus());
        //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
        json.put("deviceType",p.getDeviceType());
        json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
        SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
        SignFamily familySign = signFamilyDao.findSignByPatient(patient, 2);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -397,7 +397,7 @@ public class DoctorSchemeService extends BaseService{
            try {
                for (String patientcode : patientcodeList) {
                    patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
                    patientSchemeListDao.delByPatientCode(patientcode, Integer.parseInt(type));
                    PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                    patientSchemeListObj.setCode(UUID.randomUUID().toString());
                    patientSchemeListObj.setPatientcode(patientcode);