|
@@ -220,13 +220,23 @@ public class ViewController extends Controller {
|
|
|
return idd[0]+idd[1]+idd[2];
|
|
|
}
|
|
|
|
|
|
- private static String getDoctorIdByName(String name) {
|
|
|
- if (name == null) {
|
|
|
- return "1";
|
|
|
+ private String getDoctorIdByName(String name) {
|
|
|
+ if (name == null || name.isBlank()) {
|
|
|
+ return null;
|
|
|
}
|
|
|
- Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=73090001",name);
|
|
|
+ name = name.replace(" ", "");
|
|
|
+ Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=15700002 and realname is not null",name);
|
|
|
if (doctors == null) {
|
|
|
- return "1";
|
|
|
+ Doctors newDoctors = new Doctors().use("zskk");
|
|
|
+ newDoctors.setId(creatId());
|
|
|
+ newDoctors.setUsername("none");
|
|
|
+ newDoctors.setRealname(name);
|
|
|
+ newDoctors.setPassword("123456");
|
|
|
+ newDoctors.setInstitutionId("15700002");
|
|
|
+ newDoctors.setCreatedAt(new Date());
|
|
|
+ newDoctors.setUpdatedAt(new Date());
|
|
|
+ newDoctors.save();
|
|
|
+ return newDoctors.getId();
|
|
|
}
|
|
|
return doctors.getId();
|
|
|
}
|