Selaa lähdekoodia

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

chenweida 7 vuotta sitten
vanhempi
commit
3f87b00be1

+ 15 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -6,6 +6,9 @@ import com.yihu.wlyy.service.service.prescription.PrescriptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -20,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
@Api(description = "长处方接口")
public class PrescriptionController extends BaseController{
	private static Logger logger = LoggerFactory.getLogger(PrescriptionController.class);
	@Autowired
	PrescriptionCAService caService;
@ -183,7 +188,16 @@ public class PrescriptionController extends BaseController{
			return Result.success("挂号开处方接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
			logger.info("智业接口请求失败");
			//异常处理
			String message = ex.getMessage();
			if(StringUtils.isNotBlank(message)){
				if(message.contains("System.Exception:")){
					message = message.substring(message.indexOf("System.Exception:")+18,message.indexOf("\\n"));
					return Result.error(message);
				}
			}
			return Result.error("请求失败");
		}
	}

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

@ -1,7 +1,6 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
@ -22,4 +21,7 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("select p from Prescription p where p.jwCode=?1 and p.status=?2 ")
    List<Prescription> fingdByJwCodeAndStatus(String jwcode,Integer status);
    @Query(value = "select p.prescription_code from wlyy_prescription_pay p LEFT JOIN  wlyy_prescription a on a.code = p.prescription_code where p.trade_status = 1 and a.jw_pay_status = 0",nativeQuery = true)
    List<String> findCodesByPayStautsAndExecuteSickStatus();
}

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

@ -1,20 +1,14 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionPay;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionPayDao extends PagingAndSortingRepository<PrescriptionPay, Long>, JpaSpecificationExecutor<PrescriptionPay> {
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 ")
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
    @Query(value = "select p.prescription_code from wlyy_prescription_pay p LEFT JOIN  wlyy_prescription a on a.code = p.prescription_code where p.trade_status = 1 and a.jw_pay_status = 0")
    List<String> findCodesByPayStautsAndExecuteSickStatus();
}

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

@ -17,9 +17,6 @@ public class PrescriptionService extends BaseService {
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionPayDao prescriptionPayDao;
    /**
     *  获取处方信息
     * @param prescriptionCode 处方code
@ -35,7 +32,7 @@ public class PrescriptionService extends BaseService {
     *@date 2017/8/17 19:27
     */
    public List<String> findCodesByPayStautsAndExecuteSickStatus() {
        return prescriptionPayDao.findCodesByPayStautsAndExecuteSickStatus();
        return prescriptionDao.findCodesByPayStautsAndExecuteSickStatus();
    }
}

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

@ -1,9 +1,6 @@
package com.yihu.wlyy.web.quota;
import com.yihu.wlyy.job.FollowupPlanJob;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.job.SFExpressJob;
import com.yihu.wlyy.job.ZyDictJob;
import com.yihu.wlyy.job.*;
import com.yihu.wlyy.job.consult.ConsultCleanerJob;
import com.yihu.wlyy.job.consult.FamousConsultTimesJob;
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
@ -358,7 +355,7 @@ public class JobController extends BaseController {
     * @date 2017/8/12 15:35
     */
    @RequestMapping(value = "/reOrderExpress", method = RequestMethod.POST)
    @ApiOperation("添加超时咨询自动关闭任务")
    @ApiOperation("遍历顺丰快递下单失败的记录,重新下单")
    public String reOrderExpressJob() {
        try {
            quartzHelper.startNow(SFExpressJob.class, "SFEXPRESS-REORDER", null);
@ -390,5 +387,22 @@ public class JobController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
    /**
     *遍历长处方支付成功但是院内结算失败的记录,重新执行院内结算 --
     *@author huangwenjie
     *@date 2017/8/18 14:16
     */
    @RequestMapping(value = "/executeSickSettleJob", method = RequestMethod.POST)
    @ApiOperation("遍历长处方支付成功但是院内结算失败的记录,重新执行院内结算")
    public String executeSickSettleJob() {
        try {
            quartzHelper.startNow(PrescriptionExecuteSickSettleJob.class, "ZY-SICK-SETTLE", null);
            return write(200, "");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    //******************************长处方 end********************************
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1495,7 +1495,8 @@ public class DoctorInfoService extends BaseService {
                    return jsonObject;
                }
            }else{
                throw new Exception(responseObject.getString("msg"));
                String error = msg.split("\\|\\|")[0].split(":")[2];
                throw new Exception(error);
            }
        }else{
            throw new Exception("null response.");

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionAdjustService.java

@ -21,6 +21,8 @@ public class PrescriptionAdjustService extends BaseService {
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    /**
     * 线下调整处方
@ -48,19 +50,20 @@ public class PrescriptionAdjustService extends BaseService {
                        prescriptionDao.save(prescription);
                        //添加日志
                        prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),1,2);
                    }else {
                        //请求失败
                        prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                    }
                }else {
                    //调整请求失败
                    prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
                }
            }else{
                //请求报错
                prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
            }

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -217,10 +217,10 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        return sb.toString();
    }
    public Map<String, Object> getQrcode(String prescriptionCode ,String patientCode ,Integer type){
    public Map<String, Object> getQrcode(String prescriptionCode ,String patientCode ,Integer type) throws Exception {
        String sql = "select  p2.is_use as isUse,p2.code as dispensaryCode,p2.img_url,p3.hospital_name as hospitalName  from wlyy_prescription_dispensary_code p2 " +
                " left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code " +
                " where p2.prescription_code=?  and p2.type=?  and p2.is_Use=0 ";
                " where p2.prescription_code=?  and p2.type=? ";
        if(type==2||type==3){
            sql +=" and p3.expressage_code=? ";
        }else{
@ -230,7 +230,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        if(result.size()>0){
            return result.get(0);
        }
        return null;
        throw new Exception("二维码错误或者已过期!");
    }
    @Transactional

+ 29 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.service.app.sign;
import com.sun.corba.se.spi.activation.Server;
import com.yihu.wlyy.entity.address.Country;
import com.yihu.wlyy.entity.address.Street;
import com.yihu.wlyy.entity.address.Town;
@ -33,7 +32,6 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
@ -47,9 +45,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.sql.*;
import java.util.*;
import java.util.Date;
/**
 * 网络签约业务处理类
@ -2489,4 +2485,33 @@ public class SignWebService extends BaseService {
        String sql = "select w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        return jdbcTemplate.queryForList(sql, String.class);
    }
    /**
     * 获取居民服务类型
     * @param patient
     * @return
     */
    public JSONObject getPatientFamilyServer(String patient){
        JSONObject json = new JSONObject();
        SignFamily signFamily = signFamilyDao.findByPatient(patient);
        if(signFamily==null){
            json.put("msg","该居民未签约");
            return json;
        }
        List<SignFamilyServer> list = signFamilyServerDao.findBySignCodeAndType(signFamily.getCode());
        JSONArray ja = new JSONArray();
        if(list!=null&&list.size()>0){
            json.put("slowDiseasePatient",1);
            for (SignFamilyServer server:list){
                JSONObject js = new JSONObject();
                js.put("name",server.getServerTypeName());
                js.put("code",server.getServerType());
                ja.put(js);
            }
        }else {
            json.put("slowDiseasePatient",0);
        }
        json.put("signFamilyServer",ja);
        return json;
    }
}

+ 6 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -119,7 +119,8 @@ public class CommonUtil {
    }
    /**
     * double*100转int
     * double转字符串,在转int
     * double*100转int 有bug 34.3会会变成3429
     * @param d
     * @return
     */
@ -135,9 +136,10 @@ public class CommonUtil {
            amLong = Integer.valueOf(currency+"00");
        }else if(length - index >= 3){
            amLong = Integer.valueOf((currency.substring(0, index+3)).replace(".", ""));
            Integer i = Integer.valueOf(currency.substring(index+3,index+4));
            if(i>=5){
                amLong++;
            if(length-index>3){
                if(Integer.valueOf(currency.substring(index+3,index+4))>=5){
                    amLong++;
                }
            }
        }else if(length - index == 2){
            amLong = Integer.valueOf((currency.substring(0, index+2)).replace(".", "")+0);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -124,7 +124,7 @@ public class PrescriptionCodeController extends BaseController{
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getUID(),2);
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getUID(),2);//xh1D2017031503333
//            map.put("code", Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取配送员取药码成功!", "data", map);
        } catch (Exception e) {

+ 17 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -1,12 +1,7 @@
package com.yihu.wlyy.web.doctor.sign;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.address.Country;
import com.yihu.wlyy.entity.address.Street;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.address.StreetDao;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.sign.SignWebService;
@ -17,6 +12,7 @@ import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,6 +51,22 @@ public class DoctorSignController extends WeixinBaseController {
    @Autowired
    private PatientService patientService;
    @RequestMapping(value = "getPatientFamilyServer",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取居民慢病服务类型")
    public String getPatientFamilyServer(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient){
        try {
            JSONObject json = signWebService.getPatientFamilyServer(patient);
            if(json.has("msg")){
                return error(-1,json.getString("msg"));
            }
            return write(200,"获取成功","data",json);
        }catch (Exception e){
            error(e);
            return error(-1,"请求失败");
        }
    }
    /**
     * 三师签约列表查询
     *