Explorar el Código

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

chenyongxing hace 8 años
padre
commit
ea4543afa2

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

@ -640,7 +640,7 @@ public class PrescriptionService extends ZysoftBaseService{
        params.put("cardNo",cardNo);
        params.put("visitNo",visitNo);
        String response = postSecond("getDispUnSettleFeeList","查询处方结算结果列表",params,null,header,false,2);
        String response = postSecond("getDispUnSettleFeeInfoList","查询处方结算结果列表",params,null,header,false,2);
        return response;
    }

+ 98 - 10
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ZyDictJob.java

@ -16,7 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Created by chenweida on 2017/8/10.
@ -87,6 +88,7 @@ public class ZyDictJob implements Job {
            //清空表
            zyIvDiagnoseDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_diagnose_dict  ,size:" + zyIvDiagnoseDicts.size());
            zyIvDiagnoseDictDao.save(zyIvDiagnoseDicts);
        }
        logger.info("synchronized zy_iv_diagnose_dict end");
@ -104,6 +106,7 @@ public class ZyDictJob implements Job {
            //清空表
            zyIvSubjectClassDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_subject_class_dict  ,size:" + zyIvSubjectClassDicts.size());
            zyIvSubjectClassDictDao.save(zyIvSubjectClassDicts);
            logger.info("synchronized zy_iv_subject_class_dict end");
        }
@ -116,10 +119,10 @@ public class ZyDictJob implements Job {
        List<ZyIvStaffRegTypeAllotDict> zyIvStaffRegTypeAllotDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvStaffRegTypeAllotDicts, ZyIvStaffRegTypeAllotDict.class, dictName);
        //清空表
        zyIvStaffRegTypeAllotDictDao.deleteAll();
        //新增数据
        logger.info("save table zy_iv_staff_reg_type_allot_dict  ,size:" + zyIvStaffRegTypeAllotDicts.size());
        zyIvStaffRegTypeAllotDictDao.save(zyIvStaffRegTypeAllotDicts);
        logger.info("synchronized zy_iv_staff_reg_type_allot_dict end");
    }
@ -134,6 +137,7 @@ public class ZyDictJob implements Job {
        //清空表
        zyIvStaffDictDao.deleteAll();
        //新增数据
        logger.info("save table zy_iv_staff_dict  ,size:" + zyIvStaffDicts.size());
        zyIvStaffDictDao.save(zyIvStaffDicts);
        logger.info("synchronized zy_iv_staff_dict end");
    }
@ -145,10 +149,10 @@ public class ZyDictJob implements Job {
        List<ZyIvPhysicDict> zyIvPhysicDicts = new ArrayList<>();
        //得到list
        commonGetOneDict(zyIvPhysicDicts, ZyIvPhysicDict.class, dictName);
        //清空表
        zyIvPhysicDictDao.deleteAll();
        //新增数据
        logger.info("save table zy_iv_physic_dict  ,size:" + zyIvPhysicDicts.size());
        zyIvPhysicDictDao.save(zyIvPhysicDicts);
        logger.info("synchronized zy_iv_physic_dict end");
    }
@ -164,6 +168,7 @@ public class ZyDictJob implements Job {
            //清空表
            zyIvOrgPhysicAllotDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_org_physic_allot_dict  ,size:" + zyIvOrgPhysicAllotDicts.size());
            zyIvOrgPhysicAllotDictDao.save(zyIvOrgPhysicAllotDicts);
        }
        logger.info("synchronized zy_iv_org_physic_allot_dict end");
@ -180,6 +185,8 @@ public class ZyDictJob implements Job {
            //清空表
            zyIvDiagnoseClassDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_diagnose_class_dict  ,size:" + zIvDiagnoseClassDicts.size());
            zyIvDiagnoseClassDictDao.save(zIvDiagnoseClassDicts);
        }
        logger.info("synchronized zy_iv_diagnose_class_dict end");
@ -197,6 +204,7 @@ public class ZyDictJob implements Job {
            //清空表
            zyIvDeptStaffAllotDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_dept_staff_allot_dict  ,size:" + syIvDeptStaffAllotDictz.size());
            zyIvDeptStaffAllotDictDao.save(syIvDeptStaffAllotDictz);
        }
        logger.info("synchronized zy_iv_dept_staff_allot_dict end");
@ -222,16 +230,34 @@ public class ZyDictJob implements Job {
                    throw new Exception("zy dict error status not 200");
                }
                if (returnJson.containsKey("data")) {
                    JSONArray dataJSONArray = returnJson.getJSONObject("data").getJSONArray("returnData");
                    String dataString = returnJson.getString("data");
                    JSONArray dataJSONArray = JSONObject.fromObject(dataString).getJSONArray("returnData");
                    logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                    if (dataJSONArray.size() == 0) {
                        throw new Exception("zy dict error data size 0");
                        continue;
                    }
                    ZyCommonDict[] zyCommonDictArrays = (ZyCommonDict[]) JSONArray.toArray(dataJSONArray, ZyCommonDict.class);
                    //下划线转驼峰
                    JSONArray newJA = new JSONArray();
                    JSONArray jsonArrayTemp = dataJSONArray.getJSONArray(0);
                    for (int i = 0; i < jsonArrayTemp.size(); i++) {
                        JSONObject jo = jsonArrayTemp.getJSONObject(i);
                        JSONObject newJO = new JSONObject();
                        jo.keySet().stream().forEach(key -> {
                            Object value = jo.get(key);
                            String newKey = Tool.lineToHump(key.toString());
                            newJO.put(newKey, value);
                        });
                        newJA.add(newJO);
                    }
                    ZyCommonDict[] zyCommonDictArrays = (ZyCommonDict[]) JSONArray.toArray(newJA, ZyCommonDict.class);
                    zyCommonDictz.addAll(Arrays.asList(zyCommonDictArrays));
                } else {
                    throw new Exception("zy dict error no contain data");
                }
            } catch (Exception e) {
                e.printStackTrace();
                isFlush = false; //设置状态不能更新
                logger.error("dictName:" + dictName);
                logger.error("returnJson:" + json);
@ -245,6 +271,7 @@ public class ZyDictJob implements Job {
                //清空表
                zyCommonDictDao.deleteAll();
                //新增数据
                logger.info("save table zy_common_dict  ,size:" + zyCommonDictz.size());
                zyCommonDictDao.save(zyCommonDictz);
            }
        }
@ -263,6 +290,7 @@ public class ZyDictJob implements Job {
            //清空表
            zyIvDeptDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_dept_dict  ,size:" + zyIvDeptDicts.size());
            zyIvDeptDictDao.save(zyIvDeptDicts);
        }
        logger.info("synchronized zy_iv_dept_dict end");
@ -285,11 +313,24 @@ public class ZyDictJob implements Job {
                throw new Exception("zy dict error status not 200");
            }
            if (returnJson.containsKey("data")) {
                JSONArray dataJSONArray = returnJson.getJSONObject("data").getJSONArray("returnData");
                if (dataJSONArray.size() == 0) {
                    throw new Exception("zy dict error data size 0");
                JSONArray dataJSONArray = JSONObject.fromObject(returnJson.getString("data")).getJSONArray("returnData");
                logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                //下划线转驼峰
                JSONArray newJA = new JSONArray();
                for (int i = 0; i < dataJSONArray.getJSONArray(0).size(); i++) {
                    JSONObject jo = dataJSONArray.getJSONArray(0).getJSONObject(i);
                    JSONObject newJO = new JSONObject();
                    jo.keySet().stream().forEach(key -> {
                        Object value = jo.get(key);
                        String newKey = Tool.lineToHump(key.toString());
                        newJO.put(newKey, value);
                    });
                    newJA.add(newJO);
                }
                tList.addAll(Arrays.asList(JSONArray.toArray(dataJSONArray, clazz)));
                tList.addAll(Arrays.asList(JSONArray.toArray(newJA, clazz)));
            } else {
                throw new Exception("zy dict error no contain data");
            }
@ -434,4 +475,51 @@ public class ZyDictJob implements Job {
        }
        return "";
    }
    public static class Tool {
        private static Pattern linePattern = Pattern.compile("_(\\w)");
        /**
         * 下划线转驼峰
         */
        public static String lineToHump(String str) {
            str = str.toLowerCase();
            Matcher matcher = linePattern.matcher(str);
            StringBuffer sb = new StringBuffer();
            while (matcher.find()) {
                matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
            }
            matcher.appendTail(sb);
            return sb.toString();
        }
        /**
         * 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)})
         */
        public static String humpToLine(String str) {
            return str.replaceAll("[A-Z]", "_$0").toLowerCase();
        }
        private static Pattern humpPattern = Pattern.compile("[A-Z]");
        /**
         * 驼峰转下划线,效率比上面高
         */
        public static String humpToLine2(String str) {
            Matcher matcher = humpPattern.matcher(str);
            StringBuffer sb = new StringBuffer();
            while (matcher.find()) {
                matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
            }
            matcher.appendTail(sb);
            return sb.toString();
        }
        public static void main(String[] args) {
            String lineToHump = lineToHump("f_parent_no_leader");
            System.out.println(lineToHump);//fParentNoLeader
            System.out.println(humpToLine(lineToHump));//f_parent_no_leader
            System.out.println(humpToLine2(lineToHump));//f_parent_no_leader
        }
    }
}

+ 50 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -139,6 +139,10 @@ public class ConsultTeamService extends ConsultService {
    private PresModeAdapter presModeAdapter;
    @Autowired
    private ZyDictService zyDictService;
    //健康问题 高血压
    private static final String gxy = "HP0093";
    //健康问题 糖尿病
    private static final String tnb ="HP0047";
    Map<Integer, String> relations = new HashMap<>();
@ -159,6 +163,52 @@ public class ConsultTeamService extends ConsultService {
        relations.put(7, "未知");
    }
    /**
     * 处方判断
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONObject isPrescriptConsult(String patient) throws Exception{
        JSONObject json = new JSONObject();
        SignFamily signFamily = signFamilyDao.findByPatient(patient);
        if(signFamily==null){
            json.put("msg","您还未签约,不能发起续方咨询");
            return json;
        }
        //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
        int num = 0;
        Patient p = patientDao.findByCode(patient);
        String rp= jwPrescriptionService.getLastRecipe(p.getSsc(),null,null,null);
        com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
        Iterator iterator = pres.iterator();
        while (iterator.hasNext()){
            com.alibaba.fastjson.JSONObject r = ( com.alibaba.fastjson.JSONObject)iterator.next();
            com.alibaba.fastjson.JSONArray des = r.getJSONArray("prescriptionDt");
            for(int i=0 ;i<des.size();i++){
                PrescriptionDiagnosis ds = des.getObject(i,PrescriptionDiagnosis.class);
                if(gxy.equals(ds.getHealthProblem())||tnb.equals(ds.getHealthProblem())){
                    //为糖尿病高血压
                    num++;
                    break;
                }
            }
        }
        if(num==0){
            json.put("msg","当前没有可以申请续方的处方记录");
            return json;
        }
        Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
        json.put("doctor",doctor.getCode());
        json.put("doctorName",doctor.getName());
        json.put("adminTeamId",signFamily.getAdminTeamId());
        json.put("hospital",doctor.getHospital());
        json.put("hospitalName",doctor.getHospitalName());
        return json;
    }
    /**
     * 查询患者是否还有未结束的三师咨询
     *

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

@ -254,7 +254,8 @@ public class PatientPrescriptionPayService extends BaseService {
     * @param
     * @return
     */
    public void recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
    public Map recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
        Map resultMap = new HashMap();
        Prescription prescription = null;
        int flag = 0;
        Boolean isSuccess = false;
@ -415,6 +416,8 @@ public class PatientPrescriptionPayService extends BaseService {
            prescription = prescriptionDao.findByCode(prescriptionCode);
            PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
            if ("0".equals(tradeStatus)) {
                //支付成功返回续方code给前端
                resultMap.put("prescriptionCode",prescriptionCode);
                prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
                prescription.setStatus(30);//续费状态 30支付成功 21支付失败
                expressage.setDel(1);//快递信息状态 1可用 0删除
@ -456,6 +459,7 @@ public class PatientPrescriptionPayService extends BaseService {
        logService.saveHttpLog(isSuccess, config.getReturnUrl(), "长处方支付页面跳转", "POST", null, "", responses, error, logService.onepayType);
        //记录支付log日志到数据库
        payLogService.addLog(prescription, 2, flag, 1);
        return resultMap;
    }
    /**
@ -645,7 +649,8 @@ public class PatientPrescriptionPayService extends BaseService {
     * 长处方支付,成功则返回支付路径
     */
    @Transactional
    public String charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl) throws Exception {
    public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl) throws Exception {
        Map resultMap = new HashMap();
        //获取机构映射
        HospitalMapping hos = mappingDao.findByCode(orgCode);
        if (hos == null) {
@ -957,8 +962,9 @@ public class PatientPrescriptionPayService extends BaseService {
        if (!isSuccess) {
            throw new Exception(error);
        }
        return result;
        resultMap.put("outChargeNo", uuid);
        resultMap.put("payUrl", result);
        return resultMap;
    }

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

@ -32,7 +32,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Array;
import java.util.*;
/**
@ -363,7 +362,7 @@ public class PrescriptionInfoService extends BaseService {
            int st = respone.getInteger("status");
            com.alibaba.fastjson.JSONObject data = respone.getJSONObject("data");
            String code = data.getString("CODE");
            com.alibaba.fastjson.JSONObject byRefParaData = (com.alibaba.fastjson.JSONObject)data.getJSONObject("byRefParaData");
            com.alibaba.fastjson.JSONArray byRefParaData = data.getJSONArray("byRefParaData");
            if(st==200&&"1".equals(code)&&data.getJSONArray("returnData").size()>0){
                //开方成功返回遗嘱号
                com.alibaba.fastjson.JSONArray returnDatas = data.getJSONArray("returnData");
@ -374,7 +373,7 @@ public class PrescriptionInfoService extends BaseService {
                return 1;
            }else{
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.add_error.getValue());
                p.setPrescribeReason((String)byRefParaData.get("errorMsg"));
                p.setPrescribeReason(byRefParaData.getJSONObject(0).getString("errorMsg"));
                p.setPrescribeTime(new Date());
                prescriptionDao.save(p);
                return 0;

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

@ -3,7 +3,6 @@ package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.DoctorMapping;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
@ -88,10 +87,10 @@ public class PrescriptionService extends BaseService {
                //自取
                Patient patient = patientDao.findByCode(prescription.getPatient());
                try {
                    String dispensaryCode = prescriptionDispensaryCodeDao.getCodeByPrescriptionCodeAndType(code,1);
//                    String dispensaryCode = prescriptionDispensaryCodeDao.getCodeByPrescriptionCodeAndType(code,1);
                    StringBuffer url = new StringBuffer();
                    url.append(wechat_base_url);
                    url.append("wx/prescription/html/code-detail.html?dispensaryCode=").append(dispensaryCode);
                    url.append("wx/prescription/html/code-detail.html?prescriptionCode=").append(code);
                    url.append("&openid=").append(patient.getOpenid());
                    url.append("&toUser=").append(patient.getCode());
                    url.append("&toName=").append(patient.getName());

+ 3 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -6,7 +6,6 @@ import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.consult.ConsultDao;
@ -964,24 +963,11 @@ public class ConsultController extends WeixinBaseController {
    @ApiOperation("是否可以续方咨询")
    public String isPrescriptConsult(@ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true)String patient){
        try{
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily==null){
                return error(-1,"您还未签约,不能发起续方咨询!");
            JSONObject json = consultTeamService.isPrescriptConsult(patient);
            if(json.has("msg")){
                return error(-1,json.getString("msg"));
            }
            //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
            Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
            JSONObject json = new JSONObject();
            json.put("doctor",doctor.getCode());
            json.put("doctorName",doctor.getName());
            json.put("adminTeamId",signFamily.getAdminTeamId());
            json.put("hospital",doctor.getHospital());
            json.put("hospitalName",doctor.getHospitalName());
            return write(200, "查询成功!", "data", json);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -78,8 +78,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        try {
            String accessToken = getAccessToken();
            String patient = getUID();
            payService.charge(type,addressJson,orgCode, prescriptionCode, totalAmount, patient, accessToken,returnUrl);
            return write(200, "支付成功!");
            Map result = payService.charge(type,addressJson,orgCode, prescriptionCode, totalAmount, patient, accessToken,returnUrl);
            return write(200, "支付成功!","data",result);
        } catch (Exception e) {
            return error(-1, "支付失败!");
        }
@ -115,8 +115,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    public String recipeReturnUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
        try {
            String accessToken = getAccessToken();
            payService.recipeReturnUrl(request, response, accessToken);
            return write(200, "页面回调成功!");
            Map result = payService.recipeReturnUrl(request, response, accessToken);
            return write(200, "页面回调成功!","data",result);
        } catch (Exception e) {
            return error(-1, "页面回调失败!");
        }

+ 6 - 6
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

@ -59,6 +59,11 @@
   {
	  "name":"我的",
	  "sub_button":[
		{
		   "type":"view",
		   "name":"专属服务",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fdist%2fhtml%2fexclusive-service.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
		{
		   "type":"view",
		   "name":"我的资料",
@ -74,14 +79,9 @@
		   "name":"我的设备",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdsb%2fhtml%2fmy-equipments.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
        {
         	"type":"click",
         	"name":"操作说明",
         	"key":"caozuoshuoming"
        },
        {
        	 "type":"view",
        	 "name":"集美反馈",
        	 "name":"意见反馈",
        	 "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyjfk%2fhtml%2ffeedback.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
	 ]