Przeglądaj źródła

家庭关系修改

wangjun 4 lat temu
rodzic
commit
abc0b77449

+ 101 - 66
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -9,6 +9,7 @@ import com.yihu.jw.hospital.family.dao.BasePatientMemberDictDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -20,6 +21,7 @@ import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -42,6 +44,11 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Value("${wechat.id}")
    private String wxId;
    //添加关联家属
    @Transactional
    public MixEnvelop addFamily(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo) throws Exception {
@ -64,84 +71,112 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        if (null!=basePatientMemberDictDO){
            dictName = basePatientMemberDictDO.getRelationName();
        }
        String familyId="";
        String birth = "";
        int sex=3;
        //获取his家属数据
        JSONArray jsonArray = entranceService.BS10008(idCard,"","","","","",demo);
        if(jsonArray!=null&&jsonArray.size()>0){
            net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
            String familyId="";
            //如果病人id为空则没有就诊记录
            if (null!=jsonObject.get("Patient_Id")){
                familyId = jsonObject.getString("Patient_Id");
                String Pat_name = jsonObject.getString("Pat_Name");
                if (null!=jsonObject.get("Phone_Number_Business")){
                    String Next_Of_Kin_Phone = jsonObject.get("Phone_Number_Business").toString();
                    if(!Next_Of_Kin_Phone.equalsIgnoreCase(phoneNum)){
        JSONArray jsonArray = new JSONArray();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = ykyyEntranceService.findHisPatientByIdCard(idCard,false);
            if(jsonArray!=null&&jsonArray.size()>0){
                net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
                if (null!=jsonObject.get("brid")){
                    String Pat_name = jsonObject.getString("brxm");
                    if (!Pat_name.equalsIgnoreCase(familyName)) {
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您所添加的家属的电话有误,无法添加");
                        mixEnvelop.setMessage("您所添加的家属的名称有误,无法添加");
                        return mixEnvelop;
                    }
                }
                if(!Pat_name.equalsIgnoreCase(familyName)){
                    familyId= jsonObject.getString("brid");
                    birth= jsonObject.getString("csny");
                }else {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属的名称有误,无法添加");
                    mixEnvelop.setMessage("您所添加的家属无就诊记录无法添加");
                    return mixEnvelop;
                }
                result.setFamilyRelation(dictId);
                result.setFamilyRelationName(dictName);
                result.setIsDel(1);
                result.setPatient(patientId);
                result.setCardNo(idCard);
                result.setCardType(cardType);
                //保存到base_patient表中
                basePatientDO.setMobile(phoneNum);
                if(null!=jsonObject.get("Birth_Date")){
                    String birth = jsonObject.get("Birth_Date").toString();
                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
                    Date saveBirth = sf.parse(birth);
                    basePatientDO.setBirthday(saveBirth);
                }
                basePatientDO.setName(familyName);
                basePatientDO.setIdcard(idCard);
                basePatientDO.setRegister("0");
                basePatientDO.setDel("1");
                if(null!=jsonObject.get("Sex")){
                    basePatientDO.setSex(Integer.parseInt(jsonObject.get("Sex").toString()));
                }
                BasePatientDO sucessPatient= basePatientDao.save(basePatientDO);
                String patientNewId= "";
                if (sucessPatient!=null){
                    patientNewId=sucessPatient.getId();
                }
                result.setFamilyMember(patientNewId);
                wlyyPatientFamilyMemberDao.save(result);
                patientMappingDO.setIdcard(idCard);
                patientMappingDO.setSource("1");
                patientMappingDO.setPatientName(familyName);
                patientMappingDO.setMappingCode(familyId);
                patientMappingDO.setPatient(patientNewId);
                patientMappingDO.setCreateTime(new Date());
                patientMappingDao.save(patientMappingDO);
                resultMap.put("patientId",patientId);
                resultMap.put("familyMember",patientNewId);
                resultMap.put("idCard",idCard);
                resultMap.put("phoneNum",phoneNum);
                resultMap.put("relationName",dictName);
                resultMap.put("name",familyName);
                resultMap.put("cardType",cardType);
                List<Map<String,Object>> resultList = new ArrayList();
                resultList.add(resultMap);
                mixEnvelop.setStatus(200);
                mixEnvelop.setMessage("添加成功");
                mixEnvelop.setDetailModelList(resultList);
            }else {
            }
        }else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            jsonArray = entranceService.BS10008(idCard, "", "", "", "", "", demo);
            if (jsonArray != null && jsonArray.size() > 0) {
                net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
                //如果病人id为空则没有就诊记录
                if (null != jsonObject.get("Patient_Id")) {
                    familyId = jsonObject.getString("Patient_Id");
                    String Pat_name = jsonObject.getString("Pat_Name");
                    if (null != jsonObject.get("Phone_Number_Business")) {
                        String Next_Of_Kin_Phone = jsonObject.get("Phone_Number_Business").toString();
                        if (!Next_Of_Kin_Phone.equalsIgnoreCase(phoneNum)) {
                            mixEnvelop.setStatus(408);
                            mixEnvelop.setMessage("您所添加的家属的电话有误,无法添加");
                            return mixEnvelop;
                        }
                    }
                    if (!Pat_name.equalsIgnoreCase(familyName)) {
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您所添加的家属的名称有误,无法添加");
                        return mixEnvelop;
                    }
                    if(null!=jsonObject.get("Birth_Date")){
                        birth = jsonObject.get("Birth_Date").toString();
                    }
                    if(null!=jsonObject.get("Sex")){
                        sex = Integer.parseInt(jsonObject.get("Sex").toString());
                    }
                }else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法添加");
            }
        }
        else {
            }
        }else {
            mixEnvelop.setStatus(408);
            mixEnvelop.setMessage("您所添加的家属无就诊记录,无法添加");
            mixEnvelop.setMessage("心脏中心暂未开放");
        }
        basePatientDO.setSex(sex);
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        Date saveBirth = sf.parse(birth);
        basePatientDO.setBirthday(saveBirth);
        result.setFamilyRelation(dictId);
        result.setFamilyRelationName(dictName);
        result.setIsDel(1);
        result.setPatient(patientId);
        result.setCardNo(idCard);
        result.setCardType(cardType);
        //保存到base_patient表中
        basePatientDO.setMobile(phoneNum);
        basePatientDO.setName(familyName);
        basePatientDO.setIdcard(idCard);
        basePatientDO.setRegister("0");
        basePatientDO.setDel("1");
        BasePatientDO sucessPatient= basePatientDao.save(basePatientDO);
        String patientNewId= "";
        if (sucessPatient!=null){
            patientNewId=sucessPatient.getId();
        }
        result.setFamilyMember(patientNewId);
        wlyyPatientFamilyMemberDao.save(result);
        patientMappingDO.setIdcard(idCard);
        patientMappingDO.setSource("1");
        patientMappingDO.setPatientName(familyName);
        patientMappingDO.setMappingCode(familyId);
        patientMappingDO.setPatient(patientNewId);
        patientMappingDO.setCreateTime(new Date());
        patientMappingDao.save(patientMappingDO);
        resultMap.put("patientId",patientId);
        resultMap.put("familyMember",patientNewId);
        resultMap.put("idCard",idCard);
        resultMap.put("phoneNum",phoneNum);
        resultMap.put("relationName",dictName);
        resultMap.put("name",familyName);
        resultMap.put("cardType",cardType);
        List<Map<String,Object>> resultList = new ArrayList();
        resultList.add(resultMap);
        mixEnvelop.setStatus(200);
        mixEnvelop.setMessage("添加成功");
        mixEnvelop.setDetailModelList(resultList);
        return mixEnvelop;
    }

+ 56 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -1549,6 +1549,62 @@ public class YkyyEntranceService {
        return array;
    }
    /**
     * 获取his病人信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public net.sf.json.JSONArray findHisPatientByIdCard(String idcard,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
        net.sf.json.JSONArray array = new net.sf.json.JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            net.sf.json.JSONObject rs = net.sf.json.JSONObject.fromObject(content);
            Integer status = rs.getInt("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    /**

+ 1 - 2
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -2255,7 +2255,7 @@ public class ImService {
				sql = "SELECT " +
						"a.id AS \"id\"," +
						"op.pay_status AS \"payStatus\"," +
						"case op.type  when '1' then '9' when '2' then '16' else op.type end type," +
						"case op.type  when '1' then '9' when '2' then '16' else op.type end \"type\"," +
						"op.description AS \"title\"," +
						"op.description AS \"symptoms\",";
				if ("xm_ykyy_wx".equals(wxId)) {
@ -2514,7 +2514,6 @@ public class ImService {
		}
		return mapList;
	}
	/**
	 * 查询患者所有的咨询记录总数
	 * 	 * @param doctor 患者标识

+ 41 - 13
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.hospital.family.service.PatientMemberDictService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -48,6 +49,8 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    private final String KEY_SUFFIX = ":code";
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Value("${wechat.id}")
    private String wxId;
@ -67,28 +70,53 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
        String phoneNum = obj.getString("phoneNum");
        String idCard = obj.getString("idCard");
        String familyName = obj.getString("familyName");
        JSONArray jsonArray = entranceService.BS10008(idCard, "", "", "", "", "", false);
        if(jsonArray!=null&&jsonArray.size()>0){
            net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
            String familyId="";
            if (null!=jsonObject.get("Patient_Id")){
                String Pat_name = jsonObject.getString("Pat_Name");
                if (null!=jsonObject.get("Phone_Number_Business")){
                    String Next_Of_Kin_Phone = jsonObject.get("Phone_Number_Business").toString();
                    if(!Next_Of_Kin_Phone.equalsIgnoreCase(phoneNum)){
        net.sf.json.JSONArray jsonArray = new JSONArray();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = ykyyEntranceService.findHisPatientByIdCard(idCard,false);
            if(jsonArray!=null&&jsonArray.size()>0){
                net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
                if (null!=jsonObject.get("brid")){
                    String Pat_name = jsonObject.getString("brxm");
                    if(!Pat_name.equalsIgnoreCase(familyName)){
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您所添加的家属的电话有误,无法发送验证码");
                        mixEnvelop.setMessage("您所添加的家属的名称有误,无法发送验证码");
                        return mixEnvelop;
                    }
                }
                if(!Pat_name.equalsIgnoreCase(familyName)){
                }else {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属的名称有误,无法发送验证码");
                    mixEnvelop.setMessage("您所添加的家属无就诊记录无法添加");
                    return mixEnvelop;
                }
            }
        }else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = entranceService.BS10008(idCard, "", "", "", "", "", false);
            if(jsonArray!=null&&jsonArray.size()>0){
                net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
                if (null!=jsonObject.get("Patient_Id")){
                    String Pat_name = jsonObject.getString("Pat_Name");
                    if (null!=jsonObject.get("Phone_Number_Business")){
                        String Next_Of_Kin_Phone = jsonObject.get("Phone_Number_Business").toString();
                        if(!Next_Of_Kin_Phone.equalsIgnoreCase(phoneNum)){
                            mixEnvelop.setStatus(408);
                            mixEnvelop.setMessage("您所添加的家属的电话有误,无法发送验证码");
                            return mixEnvelop;
                        }
                    }
                    if(!Pat_name.equalsIgnoreCase(familyName)){
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您所添加的家属的名称有误,无法发送验证码");
                        return mixEnvelop;
                    }
                }
            }
        }else if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            mixEnvelop.setStatus(408);
            mixEnvelop.setMessage("心脏中心暂未开放");
            return mixEnvelop;
        }
        if (StringUtils.isEmpty(client_id)) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("client_id不能为空");