diff --git a/src/main/java/com/cardiff/client_project/controller/ViewController.java b/src/main/java/com/cardiff/client_project/controller/ViewController.java index 5e34db4fc488ef5c80dfc67c2a787a41fa7a9a68..a75dfe8c654e4351bb4e1f2aafcb26068d7f6531 100644 --- a/src/main/java/com/cardiff/client_project/controller/ViewController.java +++ b/src/main/java/com/cardiff/client_project/controller/ViewController.java @@ -67,7 +67,7 @@ public class ViewController { public String loadMainView_3(Model model) { System.out.println("hospitalLoadMain2"); //System.out.println("loadMainView_2"); - Result result = superAdminService.selectAllHospital(); + Result result = hospitalService.selectAllHospital(); // Add data to the model System.out.println("result"+result.getData()); model.addAttribute("tableData", result.getData()); diff --git a/src/main/java/com/cardiff/client_project/controller/device/DeviceController.java b/src/main/java/com/cardiff/client_project/controller/device/DeviceController.java index 2851b9a5fae67714d778260d8e9a9d28c5daedf0..145d7f555a9a7b428191195b7af423d55cf35041 100644 --- a/src/main/java/com/cardiff/client_project/controller/device/DeviceController.java +++ b/src/main/java/com/cardiff/client_project/controller/device/DeviceController.java @@ -18,7 +18,6 @@ public class DeviceController { /** * select all - * * @return */ @PostMapping("/selectAll") @@ -27,18 +26,53 @@ public class DeviceController { return result; } + /** + * insert + * @return + */ + @PostMapping("/insert") + public Result insertDeviceInform(@RequestBody Device device){ + System.out.println(device); + Result result= deviceService.insertDevice(device); + System.out.println(result); + return result; + } + + + /** + *delete device information by id + * @param ids + * @return + */ + @DeleteMapping("/deleteDeviceById") + public Result deletePatientById(@RequestBody List<Integer> ids){ + Result result = deviceService.deleteById(ids, "hospital"); + return result; + } /** * fuzzy query - * * @param * @return */ @PostMapping("/select") - public Result selectByItem(@RequestBody Device device) { + public Result selectByItem(@RequestBody Device device){ System.out.println(device); Result result = deviceService.selectByItem(device); return result; } + + + /** + * Update data + * @param device + * @return + */ + @PutMapping("/update") + public Result updateById(@RequestBody Device device){ + System.out.println("update" + device); + Result result = deviceService.update(device); + return result; + } } diff --git a/src/main/java/com/cardiff/client_project/controller/nurse/NurseController.java b/src/main/java/com/cardiff/client_project/controller/nurse/NurseController.java index 9dd174702dccbdd4eaa1b6f2bbb1f8aeeaf7b2e7..b09ce45ce0a597c3646291dce3780bebb7aa713b 100644 --- a/src/main/java/com/cardiff/client_project/controller/nurse/NurseController.java +++ b/src/main/java/com/cardiff/client_project/controller/nurse/NurseController.java @@ -6,6 +6,8 @@ import com.cardiff.client_project.utils.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("/nurse") public class NurseController { @@ -49,4 +51,27 @@ public class NurseController { return result; } + /** + *add nurse + * @param + * @return + */ + @PostMapping("/insert") + public Result insertNurseInform(@RequestBody Nurse nurse){ + System.out.println(nurse); + Result result= nurseService.insertNurse(nurse); + System.out.println(result); + return result; + } + + /** + *delete nurse information by id + * @param ids + * @return + */ + @DeleteMapping("/deleteNurseById") + public Result deleteNurseById(@RequestBody List<Integer> ids){ + Result result = nurseService.deleteById(ids, "hospital"); + return result; + } } diff --git a/src/main/java/com/cardiff/client_project/controller/patient/PatientController.java b/src/main/java/com/cardiff/client_project/controller/patient/PatientController.java index e1c5439f306a4f70b1a051b37c0710ce97afa7a1..47befa807f7079690acb5c3d697cbef4f986c603 100644 --- a/src/main/java/com/cardiff/client_project/controller/patient/PatientController.java +++ b/src/main/java/com/cardiff/client_project/controller/patient/PatientController.java @@ -36,7 +36,6 @@ public class PatientController { return result; } - /** * Update data * @param patient @@ -48,4 +47,28 @@ public class PatientController { Result result = patientService.update(patient); return result; } + + /** + *add patient + * @param + * @return + */ + @PostMapping("/insert") + public Result insertPatientInform(@RequestBody Patient patient){ + System.out.println(patient); + Result result= patientService.insertPatient(patient); + System.out.println(result); + return result; + } + + /** + *delete patient information by id + * @param ids + * @return + */ + @DeleteMapping("/deletePatientById") + public Result deletePatientById(@RequestBody List<Integer> ids){ + Result result = patientService.deleteById(ids, "hospital"); + return result; + } } \ No newline at end of file diff --git a/src/main/java/com/cardiff/client_project/mapper/DeviceMapper.java b/src/main/java/com/cardiff/client_project/mapper/DeviceMapper.java index 0ad00c62f8842801243e8446bc4812a83161b289..00cef7744d11b7eea32b441036a397211816780f 100644 --- a/src/main/java/com/cardiff/client_project/mapper/DeviceMapper.java +++ b/src/main/java/com/cardiff/client_project/mapper/DeviceMapper.java @@ -19,6 +19,45 @@ public class DeviceMapper { @Autowired JdbcTemplate jdbcTemplate; + /** + * update device data + * @param device + * @return + */ + public int update(Device device) { + String sql = "UPDATE device SET name = ?,type = ?, freetime=?,hospitalId =?, id =? WHERE id = ?"; + int update = jdbcTemplate.update(sql, preparedStatement -> { + preparedStatement.setString(1, device.getName()); + preparedStatement.setString(2, device.getType()); + preparedStatement.setDate(3, device.getFreeTime()); + preparedStatement.setInt(4, device.getHospitalId()); + preparedStatement.setInt(5, device.getId()); + preparedStatement.setInt(6, device.getId()); + }); + return update; + } + + /** + * Batch deletion based on id + * @param ids + * @return + */ + public int[] deleteByIdAndType(List<Integer> ids, String type) { + String sql = "DELETE FROM device WHERE id=?"; + String sql_1="ALTER TABLE device DROP COLUMN id;"; + String sql_2="ALTER TABLE device ADD COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST;"; + + List<Object[]> idList = new ArrayList<>(); + // Build parameter list + for (Integer id : ids) { + idList.add(new Object[]{id}); + } + // Batch delete + int[] item = jdbcTemplate.batchUpdate(sql, idList); + jdbcTemplate.update(sql_1); + jdbcTemplate.update(sql_2); + return item; + } /** * select device @@ -49,6 +88,10 @@ public class DeviceMapper { List<Object> params = new ArrayList<>(); //Dynamic concatenation of query conditions + if (device.getHospitalId() > -1) { + sql.append(" AND hospitalId = ?"); + params.add(device.getHospitalId()); + } if (device.getName() != null && device.getName() != "") { sql.append(" AND name LIKE ?"); params.add("%" + device.getName() + "%"); @@ -72,7 +115,7 @@ public class DeviceMapper { */ public Object getDeviceByName(String name){ try { - // 1. 查询 device 表 + // 查询 device 表 String sql = "select * from device where name=?"; return jdbcTemplate.queryForObject(sql, new Object[]{name}, new BeanPropertyRowMapper<>(Device.class)); } catch (Exception e) { @@ -82,4 +125,32 @@ public class DeviceMapper { return null; } + + /** + * insert device + * @param device + */ + public Result insertDeviceInform(Device device) { + + //insert data + SimpleJdbcInsert insert = new SimpleJdbcInsert(jdbcTemplate) + .withTableName("device") + .usingGeneratedKeyColumns("id"); + + Map<String, Object> parameters = new HashMap<>(); + parameters.put("Id",device.getId()); + parameters.put("hospitalId",device.getHospitalId()); + parameters.put("name",device.getName()); + parameters.put("type",device.getType()); + parameters.put("freeTime", device.getFreeTime()); + + + Number number = insert.executeAndReturnKey(parameters); + if(number.longValue() > 0){ + return Result.success(ResponseCode.SUCCESS); + }else { + return Result.error(ResponseCode.ERROR); + } + } + } diff --git a/src/main/java/com/cardiff/client_project/mapper/NurseMapper.java b/src/main/java/com/cardiff/client_project/mapper/NurseMapper.java index 4f24e448af8258fbac69937fabe8aaa29d57d640..9274bd3982b64acf86941d00b082e77713f16ffe 100644 --- a/src/main/java/com/cardiff/client_project/mapper/NurseMapper.java +++ b/src/main/java/com/cardiff/client_project/mapper/NurseMapper.java @@ -100,13 +100,13 @@ public class NurseMapper { */ public Object getNurseByName(String name){ try { - // 1. 查询 nurse 表 + //Query nurse table String sql = "select * from nurse where name=?"; return jdbcTemplate.queryForObject(sql, new Object[]{name}, new BeanPropertyRowMapper<>(Nurse.class)); } catch (Exception e) { e.printStackTrace(); } - // 如果所有查询都为空,返回 null + // If all queries are null, return null return null; } @@ -121,4 +121,62 @@ public class NurseMapper { return type; } + /** + * insert nurse + * @param nurse + */ + public Result insertNurseInform(Nurse nurse) { + //Check whether the account exists(If the name and email address are the same, the account is confirmed to exist) + String sql = "SELECT count(id) FROM nurse where name = ? and email = ?"; + Integer count= jdbcTemplate.queryForObject(sql, new Object[]{nurse.getName(), nurse.getEmail()}, Integer.class); + System.out.println(count); + if(count > 0){ + return Result.error(ResponseCode.ACCOUNT_EXISTS_ERROR); + } + + //insert data + SimpleJdbcInsert insert = new SimpleJdbcInsert(jdbcTemplate) + .withTableName("nurse") + .usingGeneratedKeyColumns("id"); + + Map<String, Object> parameters = new HashMap<>(); + parameters.put("Id",nurse.getId()); + parameters.put("hospitalId",nurse.getHospitalId()); + parameters.put("name",nurse.getName()); + parameters.put("age", nurse.getAge()); + parameters.put("phone",nurse.getPhone()); + parameters.put("email",nurse.getEmail()); + parameters.put("address", nurse.getAddress()); + parameters.put("status",nurse.getStatus()); + + Number number = insert.executeAndReturnKey(parameters); + if(number.longValue() > 0){ + return Result.success(ResponseCode.SUCCESS); + }else { + return Result.error(ResponseCode.ERROR); + } + } + + /** + * Batch deletion based on id + * @param ids + * @return + */ + public int[] deleteByIdAndType(List<Integer> ids, String type) { + String sql = "DELETE FROM nurse WHERE id=?"; + String sql_1="ALTER TABLE nurse DROP COLUMN id;"; + String sql_2="ALTER TABLE nurse ADD COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST;"; + + List<Object[]> idList = new ArrayList<>(); + // Build parameter list + for (Integer id : ids) { + idList.add(new Object[]{id}); + } + // Batch delete + int[] item = jdbcTemplate.batchUpdate(sql, idList); + jdbcTemplate.update(sql_1); + jdbcTemplate.update(sql_2); + return item; + } + } diff --git a/src/main/java/com/cardiff/client_project/mapper/PatientMapper.java b/src/main/java/com/cardiff/client_project/mapper/PatientMapper.java index aad655cdcfcd86f46410af1dad625db204cf7ce9..0566faf7628f27b387cfaca60ed7aa827d29d198 100644 --- a/src/main/java/com/cardiff/client_project/mapper/PatientMapper.java +++ b/src/main/java/com/cardiff/client_project/mapper/PatientMapper.java @@ -124,6 +124,63 @@ public class PatientMapper { return type; } + /** + * insert patient + * @param patient + */ + public Result insertPatientInform(Patient patient) { + //Check whether the account exists(If the name and email address are the same, the account is confirmed to exist) + String sql = "SELECT count(id) FROM patient where name = ? and email = ?"; + Integer count= jdbcTemplate.queryForObject(sql, new Object[]{patient.getName(), patient.getEmail()}, Integer.class); + System.out.println(count); + if(count > 0){ + return Result.error(ResponseCode.ACCOUNT_EXISTS_ERROR); + } + + //insert data + SimpleJdbcInsert insert = new SimpleJdbcInsert(jdbcTemplate) + .withTableName("patient") + .usingGeneratedKeyColumns("id"); + + Map<String, Object> parameters = new HashMap<>(); + parameters.put("Id",patient.getId()); + parameters.put("hospitalId",patient.getHospitalId()); + parameters.put("name",patient.getName()); + parameters.put("age", patient.getAge()); + parameters.put("phone",patient.getPhone()); + parameters.put("email",patient.getEmail()); + parameters.put("roleId",patient.getRoleId()); + parameters.put("type",patient.getType()); + //parameters.put("address", patient.getAddress()); + parameters.put("status",patient.getStatus()); + + Number number = insert.executeAndReturnKey(parameters); + if(number.longValue() > 0){ + return Result.success(ResponseCode.SUCCESS); + }else { + return Result.error(ResponseCode.ERROR); + } + } + + /** + * Batch deletion based on id + * @param ids + * @return + */ + public int[] deleteByIdAndType(List<Integer> ids, String type) { + String sql = "DELETE FROM patient WHERE id=?"; + String sql_1="ALTER TABLE patient DROP COLUMN id;"; + String sql_2="ALTER TABLE patient ADD COLUMN id INT NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST;"; + + List<Object[]> idList = new ArrayList<>(); + for (Integer id : ids) { + idList.add(new Object[]{id}); + } + int[] item = jdbcTemplate.batchUpdate(sql, idList); + jdbcTemplate.update(sql_1); + jdbcTemplate.update(sql_2); + return item; + } } diff --git a/src/main/java/com/cardiff/client_project/service/DeviceService.java b/src/main/java/com/cardiff/client_project/service/DeviceService.java index 82342ac3730c9597805d4fdf9b1a70e032e5470d..44ec39af05ff56d65f4d86c67a66791188194af3 100644 --- a/src/main/java/com/cardiff/client_project/service/DeviceService.java +++ b/src/main/java/com/cardiff/client_project/service/DeviceService.java @@ -7,12 +7,32 @@ import java.util.List; public interface DeviceService { + /** + * @param device + * @return + */ + Result insertDevice(Device device); + + /** + * delete information by id + * @param ids + * @return + */ + Result deleteById(List<Integer> ids, String type); + /** * Query device information * @return */ Result selectAllDevice(int hospitalId); + /** + * Update data + * @param device + * @return + */ + Result update(Device device); + /** * fuzzy query * @param device diff --git a/src/main/java/com/cardiff/client_project/service/NurseService.java b/src/main/java/com/cardiff/client_project/service/NurseService.java index 8b2aba483cdf2153adce46cf34c445ae5fe0254c..6698889e4a5fbde2f48a3fe2f45da205267dd12f 100644 --- a/src/main/java/com/cardiff/client_project/service/NurseService.java +++ b/src/main/java/com/cardiff/client_project/service/NurseService.java @@ -6,6 +6,20 @@ import java.util.List; public interface NurseService { + /** + * insert nurse + * @param nurse + * @return + */ + Result insertNurse(Nurse nurse); + + /** + * delete information by id + * @param ids + * @return + */ + Result deleteById(List<Integer> ids, String type); + /** * Query nurse information * @return diff --git a/src/main/java/com/cardiff/client_project/service/PatientService.java b/src/main/java/com/cardiff/client_project/service/PatientService.java index 4c6dc9c441dd38fa73bb3a2cda5b9a5954010516..eded2abd094d8f69d1cd3f9162cb702519acb8c5 100644 --- a/src/main/java/com/cardiff/client_project/service/PatientService.java +++ b/src/main/java/com/cardiff/client_project/service/PatientService.java @@ -7,6 +7,20 @@ import java.util.List; public interface PatientService { + /** + * insert patient + * @param patient + * @return + */ + Result insertPatient(Patient patient); + + /** + * delete information by id + * @param ids + * @return + */ + Result deleteById(List<Integer> ids, String type); + /** * Query patient information * @return diff --git a/src/main/java/com/cardiff/client_project/service/imp/DeviceServiceImpl.java b/src/main/java/com/cardiff/client_project/service/imp/DeviceServiceImpl.java index b77983d8218be466052b86dcba3983128376434d..7b7078f9127be66955520251dea294a084212f5e 100644 --- a/src/main/java/com/cardiff/client_project/service/imp/DeviceServiceImpl.java +++ b/src/main/java/com/cardiff/client_project/service/imp/DeviceServiceImpl.java @@ -18,6 +18,18 @@ public class DeviceServiceImpl implements DeviceService { @Autowired private DeviceMapper deviceMapper; + @Override + public Result insertDevice(Device device) { + Result result = deviceMapper.insertDeviceInform(device); + return result; + } + + @Override + public Result deleteById(List<Integer> ids, String type) { + deviceMapper.deleteByIdAndType(ids,type); + return Result.success(ResponseCode.SUCCESS); + } + @Override public Result selectAllDevice(int hospitalId) { List<Device> selectVOS = deviceMapper.selectAllDevice(hospitalId); @@ -31,6 +43,15 @@ public class DeviceServiceImpl implements DeviceService { return Result.success(deviceVOS); } + @Override + public Result update(Device device) { + int update = deviceMapper.update(device); + if (update > 0) { + return Result.success(ResponseCode.SUCCESS); + } + return Result.error(ResponseCode.ERROR); + } + @Override public Result selectByItem(Device device) { List<Device> selectVos = deviceMapper.selectByItem(device); diff --git a/src/main/java/com/cardiff/client_project/service/imp/NurseServiceImp.java b/src/main/java/com/cardiff/client_project/service/imp/NurseServiceImp.java index bcaf08819b236b7c4647aad3ec080f8e88bbcaa0..0df3c38e2504d233286aea6e2c1ab66cc5688f14 100644 --- a/src/main/java/com/cardiff/client_project/service/imp/NurseServiceImp.java +++ b/src/main/java/com/cardiff/client_project/service/imp/NurseServiceImp.java @@ -17,6 +17,17 @@ public class NurseServiceImp implements NurseService { @Autowired private NurseMapper nurseMapper; + @Override + public Result insertNurse(Nurse nurse) { + Result result = nurseMapper.insertNurseInform(nurse); + return result; + } + + @Override + public Result deleteById(List<Integer> ids, String type) { + nurseMapper.deleteByIdAndType(ids,type); + return Result.success(ResponseCode.SUCCESS); + } @Override public Result selectAllNurse(int hospitalId) { diff --git a/src/main/java/com/cardiff/client_project/service/imp/PatientServiceImp.java b/src/main/java/com/cardiff/client_project/service/imp/PatientServiceImp.java index 8cf48ef474c9778a601b55faec9793f8646f9187..1a71b7743729c415ca18d288fdf4afc1a8280558 100644 --- a/src/main/java/com/cardiff/client_project/service/imp/PatientServiceImp.java +++ b/src/main/java/com/cardiff/client_project/service/imp/PatientServiceImp.java @@ -18,6 +18,20 @@ public class PatientServiceImp implements PatientService { @Autowired private PatientMapper patientMapper; + @Override + public Result insertPatient(Patient patient) { + patient.setRoleId(Authority.PATIENT); + patient.setType("patient"); + Result result = patientMapper.insertPatientInform(patient); + return result; + } + + @Override + public Result deleteById(List<Integer> ids, String type) { + patientMapper.deleteByIdAndType(ids,type); + return Result.success(ResponseCode.SUCCESS); + } + @Override public Result selectAllPatient(int hospitalId) { List<Patient> selectVOS = patientMapper.selectAllPatient(hospitalId); diff --git a/src/main/resources/static/html/login.html b/src/main/resources/static/html/login.html index b249fc496f4c39a111cf84df3e842cc882bb1256..c983789ee46b04558b61ae4037cb922fde6a982a 100644 --- a/src/main/resources/static/html/login.html +++ b/src/main/resources/static/html/login.html @@ -8,11 +8,11 @@ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body - class="bg-gradient-to-r from-purple-300 to-blue-200 h-screen flex justify-center items-center" + class="bg-gradient-to-r from-purple-300 to-blue-200 h-screen flex justify-center items-center" style="background: linear-gradient(to bottom, #4a90e2, #84b9db); " > <div class="max-w-md w-full bg-white rounded-lg shadow-md p-8"> <h2 class="text-2xl font-bold text-center text-purple-800 mb-4"> - Welcome back to <span class="text-purple-500">System?</span> + Welcome back to <span class="text-purple-500">System</span> </h2> <p class="text-sm text-center text-purple-800 mb-8"> Log in to your account diff --git a/src/main/resources/static/html/superAdminView.html b/src/main/resources/static/html/superAdminView.html index 90bcc3c14da9296e0c5f2609fe23cd79ab16fcc5..328844d8ca5077bec65b9b126897ab39a84eeac5 100644 --- a/src/main/resources/static/html/superAdminView.html +++ b/src/main/resources/static/html/superAdminView.html @@ -23,11 +23,16 @@ <div id="container" style="display: flex; flex-direction: column; height: 100vh;"> <!-- top area --> - <div id="top" style="border-radius: 15px;margin-bottom:5px;background-color: #2c3e50; height: 10vh; width: 100%; display: flex; align-items: center; justify-content: center; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);"> - <span style="color: #ecf0f1; font-size: 1.5rem; font-weight: bold; font-family: 'Arial', sans-serif;">Digital Insight for Health</span> + <div id="top" style="border-radius: 15px; margin-bottom: 5px; background-color: #2c3e50; height: 10vh; width: 100%; position: relative; display: flex; align-items: center; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);"> + <span style="color: #ecf0f1; font-size: 1.5rem; font-weight: bold; font-family: 'Arial', sans-serif; position: absolute; left: 50%; transform: translateX(-50%);"> + Digital Insight for Health + </span> + <span id="showSpan" style="color: #ecf0f1; position: absolute; right: 20px; display: flex; flex-direction: column; align-items: flex-end;"></span> </div> + + <!-- main block,left and right --> <div style="display: flex; height: 80vh;"> <!-- left area --> @@ -45,6 +50,15 @@ </body> <script> $(document).ready(function (){ + //create show block + var status=localStorage.getItem("type"); + var name=localStorage.getItem("name"); + + document.getElementById("showSpan").innerHTML=` + <span>name: ${name}</span> + <span>role: ${status}</span> + ` + $('#leftview').load("/loadLeft"); // Gets the parameters in the URL const urlParams = new URLSearchParams(window.location.search); diff --git a/src/main/resources/static/js/mainDeviceView.js b/src/main/resources/static/js/mainDeviceView.js index d0578acf6ce11c7055f14cf72163ae96663ad391..c0910f87d2dc9d6d01bdf62d483eeed94caa5f2f 100644 --- a/src/main/resources/static/js/mainDeviceView.js +++ b/src/main/resources/static/js/mainDeviceView.js @@ -1,4 +1,4 @@ -//add data +//add data of admin $(document).on("click","#addButton",function (){ const overlay = document.getElementById("overlay_add"); const formContainerAdd = document.getElementById("formContainer_add"); @@ -14,7 +14,6 @@ $(document).on("click","#addDevice",function (){ "name":document.getElementById("addName").value, "type":document.getElementById("addType").value, "freeTime":document.getElementById("addFreeTime").value, - "type":"hospital", "role":"HOSPITAL" } console.log(data) @@ -50,8 +49,7 @@ $(document).on("click","#edit",function (){ } var data={ "id":row.data('id'), - "type":"hospital", - "hospitalId":row.data('hospitalId'), + "hospitalId":localStorage.getItem('hospitalId'), "name":row.data('name'), "type":row.data('type'), "freeTime":row.data('freeTime'), @@ -140,7 +138,7 @@ $(document).on("click","#freeze",function (){ var data={ "id":row.data('id'), "type":"hospital", - "hospitalId":row.data('hospitalId'), + "hospitalId":localStorage.getItem('hospitalId'), "name":row.data('name'), "age":row.data('age'), "phone":row.data('phone'), @@ -227,8 +225,8 @@ $(document).on("click", "#searchButton", function () { var data={ 'name':document.getElementById("searchName").value, 'type':document.getElementById("searchType").value, + 'hospitalId':localStorage.getItem("hospitalId") // 'email':document.getElementById("searchAddress").value, - 'type':"hospital", } $.ajax({ contentType: "application/json",