Browse Source

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

trick9191 7 years ago
parent
commit
8b0da94e5b

+ 43 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -135,9 +135,19 @@ public class PrescriptionInfoService extends BaseService {
                for(int i=0;i<pres.size();i++){
                    com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) pres.get(i);
                    r.put("reviewedState",presCheckState(r.getString("code")));
                    r.put("patientName",p.getName());
                    r.put("patient",p.getCode());
                    String rState = presCheckStateObj(r.getString("code"));
                    if("1".equals(rState)){
                        r.put("reviewedState",1);
                        r.put("patientName",p.getName());
                        r.put("patient",p.getCode());
                        r.put("prescriptionCode","");
                    }else{
                        r.put("reviewedState",0);
                        r.put("prescriptionCode",rState);
                        r.put("patientName",p.getName());
                        r.put("patient",p.getCode());
                    }
                }
                //过滤可续签
                if(StringUtils.isNotBlank(isRenewal)&&"1".equals(isRenewal)){
@ -210,14 +220,16 @@ public class PrescriptionInfoService extends BaseService {
     * @param code
     * @return
     */
    public JSONObject getContinuedPrescription(String code){
    public com.alibaba.fastjson.JSONObject getContinuedPrescription(String code){
        Prescription prescription = prescriptionDao.findByCode(code);
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        PrescriptionReviewed reviewed =  prescriptionReviewedDao.findByPrescriptionCode(code);
        JSONObject rs = new JSONObject();
        List<PrescriptionDiagnosis> diagnosises = prescriptionDiagnosisDao.findByPrescriptionCode(code);
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        rs.put("prescription",prescription);
        rs.put("prescriptionInfos",prescriptionInfos);
        rs.put("prescriptionInfo",prescriptionInfos);
        rs.put("reviewed",reviewed);
        rs.put("prescriptionDt",diagnosises);
        if(prescription!=null&&StringUtils.isNotBlank(prescription.getDoctor())){
            Doctor doctor = doctorDao.findByCode(prescription.getDoctor());
            if(doctor.getCertifiedOvertime()!=null &&(new Date().before(doctor.getCertifiedOvertime()))){
@ -242,7 +254,15 @@ public class PrescriptionInfoService extends BaseService {
    public com.alibaba.fastjson.JSONObject getPrescription(String code){
        String rs = jwPrescriptionService.getRecipe(code,null);
        com.alibaba.fastjson.JSONObject r = presModeAdapter.modelToSinglePrescription(rs);
        r.put("reviewedState",presCheckState(code));
        String rState = presCheckStateObj(code);
        if("1".equals(rState)){
            r.put("reviewedState",1);
            r.put("prescriptionCode","");
        }else{
            r.put("reviewedState",0);
            r.put("prescriptionCode",rState);
        }
        return r;
    }
@ -251,6 +271,8 @@ public class PrescriptionInfoService extends BaseService {
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        PrescriptionReviewed reviewed =  prescriptionReviewedDao.findByPrescriptionCode(code);
        List<PrescriptionAdjust> prescriptionAdjusts = prescriptionAdjustDao.findByPrescriptionCode(code);
        List<PrescriptionDiagnosis> diagnosises = prescriptionDiagnosisDao.findByPrescriptionCode(code);
        com.alibaba.fastjson.JSONObject rs = new  com.alibaba.fastjson.JSONObject();
        if(prescription!=null&&StringUtils.isNotBlank(prescription.getPatient())){
            Patient p = patientDao.findByCode(prescription.getPatient());
@ -296,7 +318,8 @@ public class PrescriptionInfoService extends BaseService {
        }
        rs.put("reviewed",reviewed);
        rs.put("prescription",prescription);
        rs.put("prescriptionInfos",prescriptionInfos);
        rs.put("prescriptionInfo",prescriptionInfos);
        rs.put("prescriptionDt",diagnosises);
        return rs;
    }
@ -436,7 +459,7 @@ public class PrescriptionInfoService extends BaseService {
        List<PrescriptionAdjust>  prescriptionAdjusts =  prescriptionAdjustDao.findByPrescriptionCodeOrderByIdDesc(code);
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        rs.put("prescription",prescription);
        rs.put("prescriptionInfos",prescriptionInfos);
        rs.put("prescriptionInfo",prescriptionInfos);
        rs.put("reviewed",reviewed);
//        if(prescription!=null&&StringUtils.isNotBlank(prescription.getDoctor())){
//            rs.put("doctor",doctorDao.findByCode(prescription.getDoctor()));
@ -523,7 +546,7 @@ public class PrescriptionInfoService extends BaseService {
            //删除所有药品
            StringBuffer sql = new StringBuffer("UPDATE wlyy_prescription_info SET del = 0 WHERE prescription_code = '"+code+"'");
            jdbcTemplate.execute(sql.toString());
            net.sf.json.JSONArray jsonArray= net.sf.json.JSONArray.fromObject(sql);
            net.sf.json.JSONArray jsonArray= net.sf.json.JSONArray.fromObject(infos);
            Iterator<Object> it = jsonArray.iterator();
            while (it.hasNext()){
                net.sf.json.JSONObject info = (net.sf.json.JSONObject) it.next();
@ -1013,6 +1036,16 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public String presCheckStateObj(String code){
        StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND r.status = 0");
        List<Map<String,Object>> mp = jdbcTemplate.queryForList(sql.toString(),code);
        if(mp!=null&&mp.size()>0){
            return (String)((mp.get(0)).get("code"));
        }else{
            return "1";
        }
    }
    public JSONArray getRateList(){
        StringBuffer sql = new StringBuffer("SELECT * from zy_common_dict WHERE dict_name = 'IV_RECIPE_FREQUENCY_DICT'");