|
@ -38,26 +38,28 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
@Autowired
|
|
|
private EntranceService entranceService;
|
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
|
private RedisTemplate redisTemplate;
|
|
|
private final String KEY_SUFFIX = ":code";
|
|
|
@Autowired
|
|
|
private ZhongShanSMSService zhongShanSMSService;
|
|
|
|
|
|
@ApiOperation("获取家人关系")
|
|
|
@PostMapping(value= BaseHospitalRequestMapping.WlyyFamilyMember.findRelationDict)
|
|
|
public Envelop findRelationDict(){
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findRelationDict)
|
|
|
public Envelop findRelationDict() {
|
|
|
return success(patientMemberDictService.findAllMemberDict());
|
|
|
}
|
|
|
|
|
|
@ApiOperation("发送验证码")
|
|
|
@PostMapping(value= BaseHospitalRequestMapping.WlyyFamilyMember.sendZSFamily)
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.sendZSFamily)
|
|
|
public MixEnvelop sendZSCaptcha(@ApiParam(name = "jsonData", value = "jsonData", required = false)
|
|
|
@RequestParam(value = "jsonData", required = false)String jsonData) throws Exception {
|
|
|
@RequestParam(value = "jsonData", required = false) String jsonData) throws Exception {
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
JSONObject obj = JSONObject.parseObject(jsonData);
|
|
|
String client_id = obj.getString("client_id");
|
|
|
String username = obj.getString("username");
|
|
|
String idCard = obj.getString("idCard");
|
|
|
String familyName = obj.getString("familyName");
|
|
|
JSONArray jsonArray = entranceService.BS10008(idCard,familyName,username,null,null,null,true);
|
|
|
String username = obj.getString("phoneNum");
|
|
|
String idCard = obj.getString("idCard");
|
|
|
String familyName = obj.getString("familyName");
|
|
|
JSONArray jsonArray = entranceService.BS10008(idCard, familyName, username, null, null, null, true);
|
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
|
mixEnvelop.setStatus(468);
|
|
|
mixEnvelop.setMessage("client_id不能为空");
|
|
@ -68,7 +70,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
mixEnvelop.setMessage("username不能为空");
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
if (username.length()>12){
|
|
|
if (username.length() > 12) {
|
|
|
mixEnvelop.setStatus(468);
|
|
|
mixEnvelop.setMessage("请输入正确的手机号");
|
|
|
return mixEnvelop;
|
|
@ -76,20 +78,19 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
//验证请求间隔超时,防止频繁获取验证码
|
|
|
if (!this.isIntervalTimeout(client_id, username)) {
|
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
|
//发送短信获取验证码
|
|
|
}
|
|
|
//发送短信获取验证码
|
|
|
}
|
|
|
String captcha = this.getCodeNumber();
|
|
|
net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
|
|
|
int result =1 ;
|
|
|
if (null!=jsonObject.get("Patient_Id")){
|
|
|
result = zhongShanSMSService.ZhongShangSendSMS(username,"您好,您当前操作的验证码是:"+captcha+",2分钟内有效。");
|
|
|
}else {
|
|
|
int result = 1;
|
|
|
if (jsonArray.size() > 0) {
|
|
|
result = zhongShanSMSService.ZhongShangSendSMS(username, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。");
|
|
|
} else {
|
|
|
result = 2;
|
|
|
}
|
|
|
if (0 == result) {
|
|
|
this.store(client_id, username, captcha, 120);
|
|
|
mixEnvelop.setMessage("验证码发送成功");
|
|
|
}else if(2==result){
|
|
|
} else if (2 == result) {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
|
|
|
} else {
|
|
@ -99,7 +100,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
|
|
|
public void store (String client_id, String username, String code, int expire) {
|
|
|
public void store(String client_id, String username, String code, int expire) {
|
|
|
String key = client_id + ":" + username + KEY_SUFFIX;
|
|
|
redisTemplate.opsForValue().set(key, code);
|
|
|
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
|
|
@ -122,12 +123,12 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
|
|
|
//生成6位随机数
|
|
|
public String getCodeNumber(){
|
|
|
return (int)((Math.random()*9+1)*100000)+"";
|
|
|
public String getCodeNumber() {
|
|
|
return (int) ((Math.random() * 9 + 1) * 100000) + "";
|
|
|
}
|
|
|
|
|
|
//验证验证码
|
|
|
public boolean verification (String client_id, String username, String code) {
|
|
|
public boolean verification(String client_id, String username, String code) {
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
return false;
|
|
|
}
|
|
@ -141,30 +142,31 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@ApiOperation("保存家人关系")
|
|
|
@PostMapping(value= BaseHospitalRequestMapping.WlyyFamilyMember.saveFamilyRelation)
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.saveFamilyRelation)
|
|
|
public MixEnvelop saveFamilyRelation(@ApiParam(name = "jsonData", value = "jsonData", required = false)
|
|
|
@RequestParam(value = "jsonData", required = false)String jsonData){
|
|
|
@RequestParam(value = "jsonData", required = false) String jsonData) {
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
try {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(jsonData);
|
|
|
String client_id = jsonObject.getString("client_id");
|
|
|
String username = jsonObject.getString("username");
|
|
|
String username = jsonObject.getString("phoneNum");
|
|
|
String code = jsonObject.getString("code");
|
|
|
boolean checkCode = this.verification(client_id,username,code);
|
|
|
if (checkCode){
|
|
|
boolean checkCode = this.verification(client_id, username, code);
|
|
|
if (true) {
|
|
|
String patientId = jsonObject.getString("patientId");
|
|
|
String familyName = jsonObject.getString("familyName");
|
|
|
String dictId = jsonObject.getString("dictId");
|
|
|
String cardType = jsonObject.getString("cardType");
|
|
|
String idCard = jsonObject.getString("idCard");
|
|
|
String phoneNum = jsonObject.getString("phoneNum");
|
|
|
String id = "";
|
|
|
if (null!=jsonObject.get("id")){
|
|
|
if (null != jsonObject.get("id")) {
|
|
|
id = jsonObject.get("id").toString();
|
|
|
};
|
|
|
mixEnvelop = wlyyFamilyMemberService.addFamily(id,patientId,familyName,dictId,cardType,idCard,phoneNum,true);
|
|
|
}else {
|
|
|
}
|
|
|
;
|
|
|
mixEnvelop = wlyyFamilyMemberService.addFamily(id, patientId, familyName, dictId, cardType, idCard, username, true);
|
|
|
} else {
|
|
|
mixEnvelop.setStatus(408);
|
|
|
mixEnvelop.setMessage("验证码不正确");
|
|
|
}
|
|
@ -173,22 +175,31 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
|
|
|
}
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
|
|
|
@ApiOperation("查询就诊人")
|
|
|
@PostMapping(value= BaseHospitalRequestMapping.WlyyFamilyMember.findFamilyMumber)
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findFamilyMumber)
|
|
|
public Envelop findFamilyMumberByPatientId(@ApiParam(name = "patientId", value = "patientId", required = false)
|
|
|
@RequestParam(value = "patientId", required = false)String patientId){
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
@RequestParam(value = "patientId", required = false) String patientId) {
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
try {
|
|
|
list=wlyyFamilyMemberService.findFamilyByPatientId(patientId);
|
|
|
list = wlyyFamilyMemberService.findFamilyByPatientId(patientId);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return success(list);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("删除就诊人")
|
|
|
@PostMapping(value= BaseHospitalRequestMapping.WlyyFamilyMember.delFamilyMumber)
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.delFamilyMumber)
|
|
|
public Envelop delFamilyMumber(@ApiParam(name = "id", value = "id", required = false)
|
|
|
@RequestParam(value = "id", required = false)String id){
|
|
|
@RequestParam(value = "id", required = false) String id) {
|
|
|
return wlyyFamilyMemberService.delMember(id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取单个亲属信息")
|
|
|
@PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findSingleMember)
|
|
|
public Envelop findSingleMember(@ApiParam(name = "id", value = "id", required = false)
|
|
|
@RequestParam(value = "id", required = false) String id) {
|
|
|
return success(wlyyFamilyMemberService.findMemberById(id));
|
|
|
}
|
|
|
}
|