trick9191 7 éve
szülő
commit
75d03fd4df

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

@ -31,10 +31,13 @@ import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.service.third.jw.JwArchivesService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.MD5;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -87,7 +90,10 @@ public class PatientInfoService extends BaseService {
    PatientService patientService;
    @Autowired
    SystemDictDao systemDictDao;
    @Autowired
    JwArchivesService jwArchivesService;
    @Autowired
    JdbcTemplate jdbcTemplate;
    /**
     * 患者更换手机号
@ -328,4 +334,53 @@ public class PatientInfoService extends BaseService {
        return 1;
    }
    public int createProfile(String doctorCode ,String patient,String jwCountryCode,String nation,String blood,String marry)throws Exception{
        Patient p = patientDao.findByCode(patient);
        JSONObject json = new JSONObject();
        json.put("ARCHIVE_TIME", DateUtil.getStringDateShort());//建档时间
        json.put("ARCHIVE_STATUS","3");//档案状态【1.未管理 2.死亡 3.正常 4.高危】
        json.put("SICK_NAME",p.getName());//姓名
        json.put("SICK_SEX",p.getSex());//性别【1.男 2.女 9 未知】
        json.put("BIRTHDAY",p.getBirthday());//出生日期
        json.put("ZONE_CODE",jwCountryCode);//所属社区【ZONE_DICT】
        json.put("IDENTITY_TYPE","1");//证件类型【IDENTITY_TYPE_DICT】
        json.put("IDENTITY_CARD_NO",p.getIdcard());//身份证号
        json.put("HOME_PHONE",p.getMobile());//本人电话
        json.put("HOME_ADDRESS","测试地址");//现住址
        json.put("ORG_ID","0");//新增默认传0
        json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
        json.put("NATIONAL",nation);//民族【NATION_DICT】
        json.put("ORIGO","3502030502");//户口所在地【ZONE_DICT】
        json.put("BLOOD",blood);//血型【1.A型 2.3.O型4.AB型 5.不详】
        json.put("BLOOD_RH","1");//RH阴性【1.否 2.是 3.不详】
        json.put("MARRIAGE",marry);//婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
        String doctor = doctorCode;
        String response = jwArchivesService.saveSickArchiveRecord(json.toString(),doctor);
        return 1;
    }
    public  List<Map<String,Object>> getNationDict(){
        String sql = "SELECT t.NATION_CODE,t.NATION_NAME FROM zy_nation_dict t ";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
    public List<Map<String,Object>> getMarryDict(){
        return getDictByName("MARRY_STATE");
    }
    public List<Map<String,Object>> getBloodDict(){
        return getDictByName("BLOOD_TYPE");
    }
    public List<Map<String,Object>> getDictByName(String name){
        String sql = "SELECT t.code,t.`value` FROM system_dict t WHERE t.dict_name=?";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql,new Object[]{name});
        return rs;
    }
}

+ 62 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
@ -15,6 +16,7 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -25,6 +27,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.DateFormat;
@ -75,4 +78,63 @@ public class PatientInfoController extends BaseController {
            return invalidUserException(e, -1, "获取患者信息失败!");
        }
    }
    @RequestMapping(value = "createProfile",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("档案建立")
    @ObserverRequired
    public String createProfile(@ApiParam(value = "医生code", name = "doctorCode") @RequestParam(required = true)String doctorCode ,
                                @ApiParam(value = "患者code", name = "patient") @RequestParam(required = true)String patient,
                                @ApiParam(value = "居委会", name = "jwCountryCode") @RequestParam(required = true)String jwCountryCode,
                                @ApiParam(value = "民族", name = "nation") @RequestParam(required = true)String nation,
                                @ApiParam(value = "血型", name = "blood") @RequestParam(required = true)String blood,
                                @ApiParam(value = "婚姻状况", name = "marry") @RequestParam(required = true)String marry){
        try {
            // 获取医生下的患者
            return write(200, "档案建立成功!", "data", patientInfoService.createProfile(doctorCode , patient, jwCountryCode, nation, blood, marry));
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取患者信息失败!");
        }
    }
    @RequestMapping(value = "getNationDict",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取民族信息列表")
    public String getNationDict(){
        try {
            // 获取医生下的患者
            return write(200, "获取成功!", "data",patientInfoService.getNationDict());
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取字典信息失败!");
        }
    }
    @RequestMapping(value = "getMarryDict",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("婚姻状态字典")
    public String getMarryDict(){
        try {
            // 获取医生下的患者
            return write(200, "获取成功!", "data",patientInfoService.getMarryDict());
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取字典信息失败!");
        }
    }
    @RequestMapping(value = "getBloodDict",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("血型状态字典")
    public String getBloodDict(){
        try {
            // 获取医生下的患者
            return write(200, "获取成功!", "data",patientInfoService.getBloodDict());
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取字典信息失败!");
        }
    }
}