Browse Source

update dtp档案管理

wangshuangpan 3 weeks ago
parent
commit
056e3458c5

+ 19 - 3
health-admin/src/main/java/com/bzd/web/controller/dtp/PharmaceuticalServiceController.java

@@ -167,9 +167,25 @@ public class PharmaceuticalServiceController extends BaseController {
         PageData pd = this.getPageData();
         pd.put("up", "up");
         try {
-            if(!pd.get("insuranceValue").toString().isEmpty()){
-                String insuranceValue=   pd.get("insuranceValue").toString();
-                pd.put("insurance",insuranceValue);
+            Object insuranceValue = pd.get("insuranceValue");
+            if(insuranceValue != null && !pd.get("insuranceValue").toString().isEmpty()){
+                String insuranceValueStr=   pd.get("insuranceValue").toString();
+                pd.put("insurance",insuranceValueStr);
+            }
+            Object dietaryPreferenceValue = pd.get("dietaryPreferenceValue");
+            if(dietaryPreferenceValue != null && !pd.get("dietaryPreferenceValue").toString().isEmpty()){
+                String insuranceValueStr=   pd.get("dietaryPreferenceValue").toString();
+                pd.put("dietaryPreference",insuranceValueStr);
+            }
+            Object sleepConditionValue = pd.get("sleepConditionValue");
+            if(sleepConditionValue != null && !pd.get("sleepConditionValue").toString().isEmpty()){
+                String sleepConditionValueStr=   pd.get("sleepConditionValue").toString();
+                pd.put("sleepCondition",sleepConditionValueStr);
+            }
+            Object caregiverValue = pd.get("caregiverValue");
+            if(caregiverValue != null &&  !pd.get("caregiverValue").toString().isEmpty()){
+                String caregiverValueStr=   pd.get("caregiverValue").toString();
+                pd.put("caregiver",caregiverValueStr);
             }
             Integer updateResult = pharmaceuticalService.updateArchives(pd);
 

+ 185 - 66
health-admin/src/main/resources/templates/dtp/archives/archivesEdit.html

@@ -28,7 +28,7 @@
                         </ul>
                         <div class="tab-content">
                             <!-- 需要隐藏的div -->
-                            <div id="tab-1" class="tab-pane active">
+                       <div id="tab-1" class="tab-pane active">
                                 <form class="form-horizontal" id="form-server-edit1" >
                                     <input type="hidden" id="id" name="id" th:value="${id}">
                                 <div class="row">
@@ -257,11 +257,11 @@
                                 </div>
                                 </form>
                         </div>
-                            <div id="tab-2" class="tab-pane">
-                             <form class="form-horizontal" id="form-server-edit">
-                                    <input type="hidden" id="id2" name="id" th:value="${id}">
+                       <div id="tab-2" class="tab-pane">
+                         <form class="form-horizontal" id="form-server-edit">
+                                <input type="hidden" id="id2" name="id" th:value="${id}">
                                  <input type="hidden" id="basicInformation" name="basicInformation" value="true">
-                                <div class="panel-body">
+                              <div class="panel-body">
                                 <ul class="nav nav-tabs" id="myTabs">
                                     <li class="active"><a data-toggle="tab" href="#tab-21" aria-expanded="true"> 基础信息</a>
                                     </li>
@@ -278,7 +278,7 @@
                                     <li class=""><a data-toggle="tab" href="#tab-27" aria-expanded="false">其他信息</a>
                                     </li>
                                 </ul>
-                                </div>
+                              </div>
                                 <div id="tab-21" class="tab-pane  fade in active">
                                     <div class="panel-body">
                                         <strong>基础信息</strong>
@@ -311,12 +311,12 @@
                                              <label class="col-sm-1 control-label is-required">保险:</label>
                                              <div class="col-sm-9" >
                                                  <div class="form-group">
-                                                     <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_bxlx')}">
+                                                     <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_bxlx')}" id="targetInsuranceDiv">
 
                                                          <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
                                                              <input type="checkbox"     th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   name="insurance2" id="insurance2">
                                                          </label>
-                                                         <input type="hidden" id="insuranceValue2" name="insuranceValue">
+                                                         <input type="hidden" id="insuranceValue2" name="insuranceValue" value="">
                                                      </div>
                                                  </div>
                                                  <div class="error-message" id="insurance-error">请选择至少一项保险</div>
@@ -361,8 +361,8 @@
                                                 <label class="col-sm-1 control-label">心率:</label>
                                                 <div class="col-sm-3" >
                                                     <div class="input-group">
-                                                        <select name="heartRate" class="styled-input" th:with="type=${@dict.getType('sys_yes_no')}" style="width: 300px;">
-                                                            <option value="">请选择</option>
+                                                        <select name="heartRate" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_xl')}" style="width: 300px;" placeholder="请选择心率">
+                                                            <option value="">请选择心率</option>
                                                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                                                     th:selected="${dict.dictLabel}==${heartRate}"></option>
                                                         </select>
@@ -371,7 +371,7 @@
                                                 <label class="col-sm-1 control-label">血压:</label>
                                                 <div class="col-sm-3" >
                                                     <div class="input-group">
-                                                        <select name="bloodPressureStatus" class="styled-input" th:with="type=${@dict.getType('sys_yes_no')}" style="width: 300px;">
+                                                        <select name="bloodPressureStatus" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_xueya')}" style="width: 300px;">
                                                             <option value="">请选择</option>
                                                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                                                     th:selected="${dict.dictLabel}==${bloodPressureStatus}"></option>
@@ -384,23 +384,27 @@
                                             </div>
                                             <div class="col-sm-12">
                                                 <label class="col-sm-1 control-label">吸烟史:</label>
-                                                <div class="col-sm-3" >
+                                                <div class="col-sm-5" >
                                                     <div class="input-group">
-                                                        <div class="input-group" th:with="type=${@dict.getType('sys_yes_no')}">
+                                                        <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_xys')}">
                                                             <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
                                                                 <input type="radio"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${smokingHistory}" name="smokingHistory" ></label>
                                                         </div>
                                                     </div>
                                                 </div>
                                                 <label class="col-sm-1 control-label">饮酒史:</label>
-                                                <div class="col-sm-3" >
+                                                <div class="col-sm-5" >
                                                     <div class="input-group">
-                                                        <div class="input-group" th:with="type=${@dict.getType('sys_yes_no')}">
+                                                        <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_yjs')}">
                                                             <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
                                                                 <input type="radio"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:checked="${dict.dictLabel}==${drinkingHistory}"   name="drinkingHistory" ></label>
                                                         </div>
                                                     </div>
                                                 </div>
+
+                                         </div>
+                                            <div class="col-sm-12">
+
                                                 <label class="col-sm-1 control-label">运动习惯:</label>
                                                 <div class="col-sm-3" >
                                                     <div class="input-group">
@@ -410,7 +414,7 @@
                                                         </div>
                                                     </div>
                                                 </div>
-                                         </div>
+                                            </div>
                                             <div class="col-sm-12">
                                                 &nbsp;
                                             </div>
@@ -420,18 +424,21 @@
                                          <div class="col-sm-12">
                                                 <label class="col-sm-1 control-label">饮食偏好:</label>
                                                 <div class="col-sm-4" >
-                                                    <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_bxlx')}">
+                                                    <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_ysph')}" id="dietaryPreferenceDiv">
                                                         <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
-                                                            <input type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictValue}"  th:checked="${dict.dictLabel}==${dietaryPreference}"  name="dietaryPreference" ></label>
+                                                            <input type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"  th:checked="${dict.dictLabel}==${dietaryPreference}"  name="dietaryPreference" id="dietaryPreference"></label>
                                                     </div>
+                                                     <input type="hidden" id="dietaryPreference2" name="dietaryPreferenceValue" value="">
                                                 </div>
                                                 <label class="col-sm-1 control-label">睡眠状况:</label>
                                                 <div class="col-sm-5" >
                                                     <div class="input-group">
-                                                        <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_bxlx')}">
+                                                        <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_smzk')}" id="sleepConditionDiv">
                                                             <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
-                                                                <input type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:checked="${dict.dictLabel}==${sleepCondition}"  name="sleepCondition" ></label>
+                                                                <input type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:checked="${dict.dictLabel}==${sleepCondition}"  name="sleepCondition" id="sleepCondition">
+                                                            </label>
                                                         </div>
+                                                        <input type="hidden" id="sleepCondition2" name="sleepConditionValue" value="">
                                                     </div>
                                                 </div>
                                          </div>
@@ -477,7 +484,7 @@
                                                 <label class="col-sm-1 control-label is-required">病理分期:</label>
                                                 <div class="col-sm-3" >
                                                     <div class="input-group">
-                                                        <select name="pathologicalStage" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_mbzllx')}" style="width: 300px;" required>
+                                                        <select name="pathologicalStage" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_blfq')}" style="width: 300px;" required>
                                                             <option value="">请选择</option>
                                                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                                                     th:selected="${dict.dictLabel}==${pathologicalStage}"></option>
@@ -487,11 +494,11 @@
                                                     <label class="col-sm-1 control-label is-required">治疗分期:</label>
                                                     <div class="col-sm-3" >
                                                         <div class="input-group">
-                                                            <select name="treatmentStage" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_mbzllx')}" style="width: 300px;" required>
-                                                                <option value="">请选择</option>
-                                                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
-                                                                        th:selected="${dict.dictLabel}==${treatmentStage}"></option>
-                                                            </select>
+                                                            <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_zlfq')}">
+                                                                <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
+                                                                    <input type="radio"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"   th:checked="${dict.dictLabel}==${treatmentStage}" name="treatmentStage" required></label>
+                                                            </div>
+
                                                         </div>
                                                     </div>
                                             </div>
@@ -564,7 +571,7 @@
                                             <label class="col-sm-1 control-label">疾病史:</label>
                                             <div class="col-sm-3" >
                                                 <div class="input-group">
-                                                    <select name="medicalHistory" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_bxlx')}" style="width: 300px;">
+                                                    <select name="medicalHistory" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_jibinshi')}" style="width: 300px;">
                                                         <option value="">请选择</option>
                                                         <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                                                 th:selected="${dict.dictLabel}==${medicalHistory}"></option>
@@ -581,7 +588,7 @@
                                            <label class="col-sm-1 control-label">传染病史:</label>
                                            <div class="col-sm-3" >
                                                <div class="input-group">
-                                                   <select name="infectiousDiseaseHistory" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_bxlx')}" style="width: 300px;">
+                                                   <select name="infectiousDiseaseHistory" class="styled-input" th:with="type=${@dict.getType('sys_select_dtp_ysfw_crbs')}" style="width: 300px;">
                                                        <option value="">请选择</option>
                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"
                                                                th:selected="${dict.dictLabel}==${infectiousDiseaseHistory}"></option>
@@ -695,16 +702,18 @@
                                 <div id="tab-25" class="tab-pane fade in active">
                                     <div class="panel-body">
                                         <strong>治疗手段</strong>
+                                      <div class="form-group">
                                         <div class="row">
                                             <div class="col-sm-12">
                                                 <label class="col-sm-1  control-label">多个治疗方案原因描述:</label>
-                                                <div class="col-sm-11" >
+                                                <div class="col-sm-11">
                                                     <div class="input-group">
                                                         <textarea id="multipleTreatmentReasonsDescription" name="multipleTreatmentReasonsDescription" placeholder="治疗方案原因描述"   rows="5" cols="185" th:text="${multipleTreatmentReasonsDescription}"></textarea>
                                                     </div>
                                                 </div>
                                             </div>
                                         </div>
+                                       </div>
                                      </div>
                                 </div>
                                 <div id="tab-26" class="tab-pane fade in active">
@@ -781,8 +790,8 @@
                                 </div>
                                 <div id="tab-27" class="tab-pane fade in active">
                                     <div class="panel-body">
-                                        <strong>其他信息</strong>
-                                        <div class="row">
+                                            <strong>其他信息</strong>
+                                        <div class="form-group">
                                             <div class="col-sm-12">
                                                 <label class="col-sm-1 control-label">联系人:</label>
                                                 <div class="col-sm-11" >
@@ -863,27 +872,25 @@
                                                         <button type="button"  data-toggle="modal" data-target="#myModal3">新增</button>
                                                     </div>
                                                 </div>
-
                                             </div>
-                                        </div>
-                                    </div>
-                                    <div class="row">
-                                        <div class="col-sm-12">
-                                            <label class="col-sm-1 control-label">陪护人:</label>
-                                            <div class="col-sm-11" >
-                                                <div class="input-group">
-                                                    <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_phr')}">
-                                                        <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
-                                                            <input type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:checked="${dict.dictLabel}==${caregiver}"  name="caregiver" id="caregiver"></label>
+                                            <div class="col-sm-12">
+                                                <label class="col-sm-1 control-label">陪护人:</label>
+                                                <div class="col-sm-11" >
+                                                    <div class="form-group">
+                                                        <div class="input-group" th:with="type=${@dict.getType('sys_select_dtp_ysfw_phr')}" id="caregiverDiv">
+                                                            <label class="checkbox-inline check-box" th:each="dict : ${type}"  >
+                                                         <input type="checkbox"  th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:checked="${dict.dictLabel}==${caregiver}"  name="caregiver" id="caregiver">
+                                                            </label>
+                                                        </div>
+                                                        <input type="hidden" id="caregiver2" name="caregiverValue" value="">
                                                     </div>
-
                                                 </div>
                                             </div>
-                                        </div>
+                                          </div>
                                     </div>
-                                </div>
-                              </form>
-                            </div>
+                             </div>
+                         </form>
+                       </div>
                             <div id="tab-3" class="tab-pane">
                                 <div class="panel-body">
                                     <strong>用药购药</strong>
@@ -1108,12 +1115,57 @@
             inputsToDisable.forEach(function(input) {
                 formData.delete(input.name);
             });
+
+            // 获取指定的 div
+            var targetInsuranceDiv = document.getElementById('targetInsuranceDiv');//基础表单 保险
+            var sleepConditionDiv = document.getElementById('sleepConditionDiv');//基础表单 睡眠状况
+            var dietaryPreferenceDiv = document.getElementById('dietaryPreferenceDiv');//基础表单 饮食偏好
+            var caregiverDiv = document.getElementById('caregiverDiv');//基础表单 陪护人
+
             // 获取所有 class 为 icheckbox-blue 并且包含 checked 类的 div
-            var divs = document.querySelectorAll('.icheckbox-blue.checked');
+            var InsuranceDivs = targetInsuranceDiv.querySelectorAll('.icheckbox-blue.checked');
+            var sleepConditionDivs = sleepConditionDiv.querySelectorAll('.icheckbox-blue.checked');
+            var dietaryPreferenceDivs = dietaryPreferenceDiv.querySelectorAll('.icheckbox-blue.checked');
+            var caregiverDivs = caregiverDiv.querySelectorAll('.icheckbox-blue.checked');
             var checkedValues = [];
-
+            var sleepConditionCheckedValues = [];
+            var dietaryPreferenceCheckedValues = [];
+            var caregiverCheckedValues = [];
+            if (sleepConditionDivs.length > 0) {
+                // 遍历所有符合条件的 div
+                sleepConditionDivs.forEach(function(div) {
+                    // 获取 div 内部的复选框
+                    var checkbox = div.querySelector('input[type="checkbox"]');
+                    if (checkbox) {
+                        // 如果复选框被选中,将其值添加到数组中
+                        sleepConditionCheckedValues.push(checkbox.value);
+                    }
+                });
+            }
+            if (dietaryPreferenceDivs.length > 0) {
+                // 遍历所有符合条件的 div
+                dietaryPreferenceDivs.forEach(function(div) {
+                    // 获取 div 内部的复选框
+                    var checkbox = div.querySelector('input[type="checkbox"]');
+                    if (checkbox) {
+                        // 如果复选框被选中,将其值添加到数组中
+                        dietaryPreferenceCheckedValues.push(checkbox.value);
+                    }
+                });
+            }
+            if (caregiverDivs.length > 0) {
+                // 遍历所有符合条件的 div
+                caregiverDivs.forEach(function(div) {
+                    // 获取 div 内部的复选框
+                    var checkbox = div.querySelector('input[type="checkbox"]');
+                    if (checkbox) {
+                        // 如果复选框被选中,将其值添加到数组中
+                        caregiverCheckedValues.push(checkbox.value);
+                    }
+                });
+            }
             // 遍历所有符合条件的 div
-            divs.forEach(function(div) {
+            InsuranceDivs.forEach(function(div) {
                 // 获取 div 内部的复选框
                 var checkbox = div.querySelector('input[type="checkbox"]');
                 if (checkbox) {
@@ -1121,13 +1173,12 @@
                     checkedValues.push(checkbox.value);
                 }
             });
-            if (divs.length === 0) {
+            if (InsuranceDivs.length === 0) {
                 $('#insurance-error').show();
                 return false;
             } else {
                 $('#insurance-error').hide();
             }
-
             if (checkedValues) {
                 // 将选中的值合并成一个字符串
                 var combinedValue = checkedValues.join(',');
@@ -1137,19 +1188,44 @@
                 // 如果没有选中任何值,设置为空字符串
                 $('#insuranceValue2').val('');
             }
-            // var combinedValue = checkedValues.join(',');
-            // $('#insuranceValue2').val(combinedValue);
-
-            var valuexx= $('#insuranceValue2').val();
-            console.log(valuexx)
+            if (sleepConditionCheckedValues) {
+                // 将选中的值合并成一个字符串
+                var sleepCondition = sleepConditionCheckedValues.join(',');
+                // 设置隐藏字段的值
+                $('#sleepCondition2').val(sleepCondition);
+            } else {
+                // 如果没有选中任何值,设置为空字符串
+                $('#sleepCondition2').val('');
+            }
+            if (dietaryPreferenceCheckedValues) {
+                // 将选中的值合并成一个字符串
+                var dietaryPreference = dietaryPreferenceCheckedValues.join(',');
+                // 设置隐藏字段的值
+                $('#dietaryPreference2').val(dietaryPreference);
+            } else {
+                // 如果没有选中任何值,设置为空字符串
+                $('#dietaryPreference2').val('');
+            }
+            if (caregiverCheckedValues) {
+                // 将选中的值合并成一个字符串
+                var caregiver = caregiverCheckedValues.join(',');
+                // 设置隐藏字段的值
+                $('#caregiver2').val(caregiver);
+            } else {
+                // 如果没有选中任何值,设置为空字符串
+                $('#caregiver2').val('');
+            }
             if ($.validate.form("form-server-edit")) {
                 var data = $("#form-server-edit").serializeArray();
                 // 获取 textarea 的值
                 var textareaValue = document.getElementById('multipleTreatmentReasonsDescription').value;
                 data.push({name:"multipleTreatmentReasonsDescription",value:textareaValue})
+                // 获取 caregiver2 的值
+                var caregiver2 = document.getElementById('caregiver2').value;
+                data.push({name:"caregiverValue",value:caregiver2})
+
                 // 遍历 data 数组,查找 realNameStatus flipStatus 字段
                 var realNameStatus = null;
-                var flipStatus = null;
                 for (var i = 0; i < data.length; i++) {
                     if (data[i].name === 'realNameStatus') {
                         realNameStatus = data[i].value;
@@ -1165,7 +1241,7 @@
                     const rowshbs = [];//患病史table
                     $('#familyHistoryTableBody tr').each(function () {
                         const row = {
-                            patient_archive_id:  $("#id").val(),
+                            archiveId:  $("#id").val(),
                             disease: $(this).find('td:eq(1)').text(),
                             member: $(this).find('td:eq(2)').text(),
                         };
@@ -1177,9 +1253,9 @@
                     const rowsRcords = [];//用药情况table
                     $('#yyqkTableBody tr').each(function () {
                         const row = {
-                            patient_archive_id:  $("#id").val(),
-                            medication_description: $(this).find('td:eq(1)').text(),
-                            medication_type: $(this).find('td:eq(2)').text(),
+                            archiveId:  $("#id").val(),
+                            medicationDescription: $(this).find('td:eq(1)').text(),
+                            medicationType: $(this).find('td:eq(2)').text(),
                         };
                         rowsRcords.push(row);
                     });
@@ -1189,7 +1265,7 @@
                     const rowslxr = [];//联系人table
                     $('#relationTableBody  tr').each(function () {
                         const row = {
-                            patient_archive_id:  $("#id").val(),
+                            archiveId:  $("#id").val(),
                             contactPhone: $(this).find('td:eq(1)').text(),
                             contactName: $(this).find('td:eq(2)').text(),
                             contactRelationship: $(this).find('td:eq(3)').text()
@@ -1243,7 +1319,6 @@
             // 获取当前点击的选项卡链接
             var $this = $(this);
             var x = document.getElementById("content-main");
-            var hiddenDiv = document.getElementById("hiddenDiv");
             if($this.attr('href') === '#tab-1'){
                 formSubmitted=true;
             }
@@ -1262,7 +1337,7 @@
             } else {
                 x.style.display = "block";
             }
-            // 初始化时回显已选中的值
+            // 初始化时回显保险已选中的值
             function check(insuranceList) {
                 var insurances = insuranceList.split(',');
                 $.each(insurances, function(index, value) {
@@ -1277,6 +1352,51 @@
             if(insuranceList){
                 check(insuranceList);
             }
+            // 初始化时回显陪护人已选中的值
+            function checkCaregiver(caregiverList) {
+                var caregiver = caregiverList.split(',');
+                $.each(caregiver, function(index, value) {
+                    var checkbox = $('input[name="caregiver"][value="'+value.trim()+'"]');
+                    checkbox.append('div class="icheckbox-blue"');
+                    checkbox.closest('.icheckbox-blue').addClass('checked');
+                });
+            }
+            /*<![CDATA[*/
+            var caregiverList = /*[[${caregiver}]]*/ '';
+            /*]]>*/
+            if(caregiverList){
+                checkCaregiver(caregiverList);
+            }
+            // 初始化时回显睡眠状况已选中的值
+            function checkSleepCondition(sleepConditionList) {
+                var sleepCondition = sleepConditionList.split(',');
+                $.each(sleepCondition, function(index, value) {
+                    var checkbox = $('input[name="sleepCondition"][value="'+value.trim()+'"]');
+                    checkbox.append('div class="icheckbox-blue"');
+                    checkbox.closest('.icheckbox-blue').addClass('checked');
+                });
+            }
+            /*<![CDATA[*/
+            var sleepConditionList = /*[[${sleepCondition}]]*/ '';
+            /*]]>*/
+            if(sleepConditionList){
+                checkSleepCondition(sleepConditionList);
+            }
+            // 初始化时回显饮食偏好已选中的值
+            function checkDietaryPreference(dietaryPreferenceList) {
+                var dietaryPreference = dietaryPreferenceList.split(',');
+                $.each(dietaryPreference, function(index, value) {
+                    var checkbox = $('input[name="dietaryPreference"][value="'+value.trim()+'"]');
+                    checkbox.append('div class="icheckbox-blue"');
+                    checkbox.closest('.icheckbox-blue').addClass('checked');
+                });
+            }
+            /*<![CDATA[*/
+            var dietaryPreferenceList = /*[[${dietaryPreference}]]*/ '';
+            /*]]>*/
+            if(dietaryPreferenceList){
+                checkDietaryPreference(dietaryPreferenceList);
+            }
 
         });
     });
@@ -1556,7 +1676,6 @@
             // editButton.textContent = '修改';
             // editButton.onclick = function() { editRow(this);/* 复制逻辑 */ };
             // actionCell.appendChild(editButton);
-            //
             // var copyButton = document.createElement('button');
             // copyButton.textContent = '复制';
             // copyButton.onclick = function() { /* 复制逻辑 */ };

+ 119 - 4
health-system/src/main/java/com/bzd/system/service/PharmaceuticalService.java

@@ -5,12 +5,15 @@ import com.bzd.common.config.dao.DaoSupport;
 import com.bzd.common.config.dao.PageData;
 import com.bzd.common.utils.DateUtils;
 import com.bzd.common.utils.StringUtils;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import static com.bzd.common.utils.ShiroUtils.getSysUser;
 
@@ -47,21 +50,133 @@ public class PharmaceuticalService {
 
     @Transactional(rollbackFor = Exception.class)
     public Integer updateArchives(PageData pd)throws Exception {
-        // 检查 basicInformation 是否为 null
+        pd.put("archiveId", pd.get("id"));
+        pd.put("createdBy", getSysUser().getLoginName());
+        pd.put("createdAt", DateUtils.getTime());
+
+        Object rowshbsObj = pd.get("rowshbs");
+        Object rowsRcordsObj = pd.get("rowsRcords");
+        Object rowslxrObj = pd.get("rowslxr");
+        // 检查 basicInformation 完善基础信息部分标识=true 是否为 null
         Object basicInformation = pd.get("basicInformation");
         if (basicInformation != null && "true".equals(basicInformation.toString())) {
           Object updatePatientBasicInfo =  daoSupport.findForObject("PharmaceuticalServiceMapper.selectPatientBasicInfoById", pd);
           if(StringUtils.isNull(updatePatientBasicInfo)){
-              pd.put("archiveId", pd.get("id"));
-              pd.put("createdBy", getSysUser().getLoginName());
-              pd.put("createdAt", DateUtils.getTime());
               daoSupport.update("PharmaceuticalServiceMapper.insertPatientBasicInfo", pd);
+              if(StringUtils.isNotNull(rowshbsObj)){
+                  try {
+                      // 将 JSON 字符串转换为 List<Map<String, Object>>
+                      ObjectMapper objectMapper = new ObjectMapper();
+                      List<Map<String, Object>> rowsList = objectMapper.readValue(rowshbsObj.toString(), List.class);
+                      // 遍历列表并调用插入数据接口
+                      for (Map<String, Object> hbs : rowsList) {
+                      pd.put("disease", hbs.get("disease"));
+                      pd.put("member", hbs.get("member"));
+                      daoSupport.update("PharmaceuticalServiceMapper.insertFamilyHistory", pd);
+                      //daoSupport.update("PharmaceuticalServiceMapper.updateFamilyHistory", pd);
+                  }
+              } catch (Exception e) {
+                  e.printStackTrace();
+              }
+              }
+              if(StringUtils.isNotNull(rowsRcordsObj)){
+                  try {
+                      // 将 JSON 字符串转换为 List<Map<String, Object>>
+                      ObjectMapper objectMapper = new ObjectMapper();
+                      List<Map<String, Object>> rowsList = objectMapper.readValue(rowsRcordsObj.toString(), List.class);
+                      // 遍历列表并调用插入数据接口
+                      for (Map<String, Object> Rcords : rowsList) {
+                      pd.put("medicationDescription", Rcords.get("medicationDescription"));
+                      pd.put("medicationType", Rcords.get("medicationType"));
+                      daoSupport.update("PharmaceuticalServiceMapper.insertMedicationRecord", pd);
+                      //daoSupport.update("PharmaceuticalServiceMapper.updateMedicationRecord", pd);
+                      }
+                  } catch (Exception e) {
+                      e.printStackTrace();
+                  }
+              }
+              if(StringUtils.isNotNull(rowslxrObj)){
+                  try {
+                      // 将 JSON 字符串转换为 List<Map<String, Object>>
+                      ObjectMapper objectMapper = new ObjectMapper();
+                      List<Map<String, Object>> rowsList = objectMapper.readValue(rowslxrObj.toString(), List.class);
+                      // 遍历列表并调用插入数据接口
+                      for (Map<String, Object> lxr : rowsList) {
+                          pd.put("contactPhone", lxr.get("contactPhone"));
+                          pd.put("contactName", lxr.get("contactName"));
+                          pd.put("contactRelationship", lxr.get("contactRelationship"));
+                          daoSupport.update("PharmaceuticalServiceMapper.insertContact", pd);
+                          // daoSupport.update("PharmaceuticalServiceMapper.updateContact", pd);
+                      }
+                  } catch (Exception e) {
+                      e.printStackTrace();
+                  }
+
+              }
           }else {
+                     //有患者基础信息 做修改
+              if(StringUtils.isNotNull(rowshbsObj)){
+                  try {
+                      daoSupport.update("PharmaceuticalServiceMapper.DeleteFamilyHistory", pd);
+                      pd.put("updatedAt", DateUtils.getTime());
+
+                      // 将 JSON 字符串转换为 List<Map<String, Object>>
+                      ObjectMapper objectMapper = new ObjectMapper();
+                      List<Map<String, Object>> rowsList = objectMapper.readValue(rowshbsObj.toString(), List.class);
+                      // 遍历列表并调用插入数据接口
+                      for (Map<String, Object> hbs : rowsList) {
+                          pd.put("disease", hbs.get("disease"));
+                          pd.put("member", hbs.get("member"));
+                          daoSupport.update("PharmaceuticalServiceMapper.insertFamilyHistory", pd);
+                          //daoSupport.update("PharmaceuticalServiceMapper.updateFamilyHistory", pd);
+                      }
+                  } catch (Exception e) {
+                      e.printStackTrace();
+                  }
+              }
+              if(StringUtils.isNotNull(rowsRcordsObj)){
+                  try {
+                      daoSupport.update("PharmaceuticalServiceMapper.DeleteMedicationRecord", pd);
+                      // 将 JSON 字符串转换为 List<Map<String, Object>>
+                      ObjectMapper objectMapper = new ObjectMapper();
+                      List<Map<String, Object>> rowsList = objectMapper.readValue(rowsRcordsObj.toString(), List.class);
+                      // 遍历列表并调用插入数据接口
+                      for (Map<String, Object> Rcords : rowsList) {
+                          pd.put("medicationDescription", Rcords.get("medicationDescription"));
+                          pd.put("medicationType", Rcords.get("medicationType"));
+                          daoSupport.update("PharmaceuticalServiceMapper.insertMedicationRecord", pd);
+                          //daoSupport.update("PharmaceuticalServiceMapper.updateMedicationRecord", pd);
+                      }
+                  } catch (Exception e) {
+                      e.printStackTrace();
+                  }
+              }
+              if(StringUtils.isNotNull(rowslxrObj)){
+                  try {
+                      daoSupport.update("PharmaceuticalServiceMapper.DeleteContact", pd);
+                      // 将 JSON 字符串转换为 List<Map<String, Object>>
+                      ObjectMapper objectMapper = new ObjectMapper();
+                      List<Map<String, Object>> rowsList = objectMapper.readValue(rowslxrObj.toString(), List.class);
+                      // 遍历列表并调用插入数据接口
+                      for (Map<String, Object> lxr : rowsList) {
+                          pd.put("contactPhone", lxr.get("contactPhone"));
+                          pd.put("contactName", lxr.get("contactName"));
+                          pd.put("contactRelationship", lxr.get("contactRelationship"));
+                          daoSupport.update("PharmaceuticalServiceMapper.insertContact", pd);
+                          // daoSupport.update("PharmaceuticalServiceMapper.updateContact", pd);
+                      }
+                  } catch (Exception e) {
+                      e.printStackTrace();
+                  }
+
+              }
               pd.put("basicInfoCompleter", getSysUser().getLoginName());
               pd.put("recordUpdateTimestamp", DateUtils.getTime());
               daoSupport.update("PharmaceuticalServiceMapper.updatePatientBasicInfo", pd);
           }
         }
+        pd.put("archiveCreator", getSysUser().getLoginName());//档案更新人
+        pd.put("updateTime", DateUtils.getTime());//更新时间
         return daoSupport.update("PharmaceuticalServiceMapper.updateArchives", pd);
     }
 

+ 90 - 83
health-system/src/main/resources/mapper/pmServiceMapper/PharmaceuticalServiceMapper.xml

@@ -1183,20 +1183,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="id != null and id != ''">
 			AND id = #{id}
 		</if>
-		<if test="patient_archive_id != null and patient_archive_id != ''">
-			AND patient_archive_id = #{patient_archive_id}
+		<if test="archiveId != null and archiveId != ''">
+			AND archiveId = #{archiveId}
 		</if>
-		<if test="contact_phone != null and contact_phone != ''">
-			AND contact_phone = #{contact_phone}
+		<if test="contactPhone != null and contactPhone != ''">
+			AND contactPhone = #{contactPhone}
 		</if>
-		<if test="contact_name != null and contact_name != ''">
-			AND contact_name = #{contact_name}
+		<if test="contactName != null and contactName != ''">
+			AND contactName = #{contactName}
 		</if>
-		<if test="contact_relationship != null and contact_relationship != ''">
-			AND contact_relationship = #{contact_relationship}
+		<if test="contactRelationship != null and contactRelationship != ''">
+			AND contactRelationship = #{contactRelationship}
 		</if>
-		<if test="created_by != null and created_by != ''">
-			AND created_by = #{created_by}
+		<if test="createdBy != null and createdBy != ''">
+			AND createdBy = #{createdBy}
 		</if>
 		<if test="status != null and status != ''">
 			AND status = #{status}
@@ -1207,26 +1207,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<insert id="insertContact" parameterType="pd">
 		INSERT INTO s_dtp_ysfw_contacts
 		<trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
-			<if test="id != null and id != ''">id,</if>
-			<if test="patient_archive_id != null and patient_archive_id != ''">patient_archive_id,</if>
-			<if test="contact_phone != null and contact_phone != ''">contact_phone,</if>
-			<if test="contact_name != null and contact_name != ''">contact_name,</if>
-			<if test="contact_relationship != null and contact_relationship != ''">contact_relationship,</if>
-			<if test="created_by != null and created_by != ''">created_by,</if>
-			<if test="created_at != null and created_at != ''">created_at,</if>
-			<if test="updated_at != null and updated_at != ''">updated_at,</if>
+			<if test="archiveId != null and archiveId != ''">archiveId,</if>
+			<if test="contactPhone != null and contactPhone != ''">contactPhone,</if>
+			<if test="contactName != null and contactNamecontactName != ''">contactName,</if>
+			<if test="contactRelationship != null and contactRelationship != ''">contactRelationship,</if>
+			<if test="createdBy != null and createdBy != ''">createdBy,</if>
+			<if test="createdAt != null and createdAt != ''">createdAt,</if>
+			<if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
 			<if test="status != null and status != ''">status</if>
 		</trim>
 
 		<trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
-			<if test="id != null and id != ''">#{id},</if>
-			<if test="patient_archive_id != null and patient_archive_id != ''">#{patient_archive_id},</if>
-			<if test="contact_phone != null and contact_phone != ''">#{contact_phone},</if>
-			<if test="contact_name != null and contact_name != ''">#{contact_name},</if>
-			<if test="contact_relationship != null and contact_relationship != ''">#{contact_relationship},</if>
-			<if test="created_by != null and created_by != ''">#{created_by},</if>
-			<if test="created_at != null and created_at != ''">#{created_at},</if>
-			<if test="updated_at != null and updated_at != ''">#{updated_at},</if>
+			<if test="archiveId != null and archiveId != ''">#{archiveId},</if>
+			<if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
+			<if test="contactName != null and contactName != ''">#{contactName},</if>
+			<if test="contactRelationship != null and contactRelationship != ''">#{contactRelationship},</if>
+			<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
+			<if test="createdAt != null and createdAt != ''">#{createdAt},</if>
+			<if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
 			<if test="status != null and status != ''">#{status}</if>
 		</trim>
 	</insert>
@@ -1234,20 +1232,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<update id="updateContact" parameterType="pd">
 		UPDATE s_dtp_ysfw_contacts SET
 		<trim prefix="" suffixOverrides="," prefixOverrides=",">
-			<if test="patient_archive_id != null and patient_archive_id != ''">
-				patient_archive_id = #{patient_archive_id},
+			<if test="archiveId != null and archiveId != ''">
+				archiveId = #{archiveId},
 			</if>
-			<if test="contact_phone != null and contact_phone != ''">
-				contact_phone = #{contact_phone},
+			<if test="contactPhone != null and contactPhone != ''">
+				contactPhone = #{contactPhone},
 			</if>
-			<if test="contact_name != null and contact_name != ''">
-				contact_name = #{contact_name},
+			<if test="contactName != null and contactName != ''">
+				contactName = #{contactName},
 			</if>
-			<if test="contact_relationship != null and contact_relationship != ''">
-				contact_relationship = #{contact_relationship},
+			<if test="contactRelationship != null and contactRelationship != ''">
+				contactRelationship = #{contactRelationship},
 			</if>
-			<if test="created_by != null and created_by != ''">
-				created_by = #{created_by},
+			<if test="createdBy != null and createdBy != ''">
+				createdBy = #{createdBy},
 			</if>
 			<if test="status != null and status != ''">
 				status = #{status}
@@ -1262,8 +1260,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="id != null and id != ''">
 			AND id = #{id}
 		</if>
-		<if test="patient_archive_id != null and patient_archive_id != ''">
-			AND patient_archive_id = #{patient_archive_id}
+		<if test="archiveId != null and archiveId != ''">
+			AND archiveId = #{archiveId}
 		</if>
 		<if test="disease != null and disease != ''">
 			AND disease = #{disease}
@@ -1271,8 +1269,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="member != null and member != ''">
 			AND member = #{member}
 		</if>
-		<if test="created_by != null and created_by != ''">
-			AND created_by = #{created_by}
+		<if test="createdBy != null and createdBy != ''">
+			AND createdBy = #{createdBy}
 		</if>
 		<if test="status != null and status != ''">
 			AND status = #{status}
@@ -1283,24 +1281,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<insert id="insertFamilyHistory" parameterType="pd">
 		INSERT INTO s_dtp_ysfw_family_history
 		<trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
-			<if test="id != null and id != ''">id,</if>
-			<if test="patient_archive_id != null and patient_archive_id != ''">patient_archive_id,</if>
+			<if test="archiveId != null and archiveId != ''">archiveId,</if>
 			<if test="disease != null and disease != ''">disease,</if>
 			<if test="member != null and member != ''">member,</if>
-			<if test="created_by != null and created_by != ''">created_by,</if>
-			<if test="created_at != null and created_at != ''">created_at,</if>
-			<if test="updated_at != null and updated_at != ''">updated_at,</if>
+			<if test="createdBy != null and createdBy != ''">createdBy,</if>
+			<if test="createdAt != null and createdAt != ''">createdAt,</if>
+			<if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
 			<if test="status != null and status != ''">status</if>
 		</trim>
 
 		<trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
-			<if test="id != null and id != ''">#{id},</if>
-			<if test="patient_archive_id != null and patient_archive_id != ''">#{patient_archive_id},</if>
+			<if test="archiveId != null and archiveId != ''">#{archiveId},</if>
 			<if test="disease != null and disease != ''">#{disease},</if>
 			<if test="member != null and member != ''">#{member},</if>
-			<if test="created_by != null and created_by != ''">#{created_by},</if>
-			<if test="created_at != null and created_at != ''">#{created_at},</if>
-			<if test="updated_at != null and updated_at != ''">#{updated_at},</if>
+			<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
+			<if test="createdAt != null and createdAt != ''">#{createdAt},</if>
+			<if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
 			<if test="status != null and status != ''">#{status}</if>
 		</trim>
 	</insert>
@@ -1308,8 +1304,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<update id="updateFamilyHistory" parameterType="pd">
 		UPDATE s_dtp_ysfw_family_history SET
 		<trim prefix="" suffixOverrides="," prefixOverrides=",">
-			<if test="patient_archive_id != null and patient_archive_id != ''">
-				patient_archive_id = #{patient_archive_id},
+			<if test="archiveId != null and archiveId != ''">
+				archiveId = #{archiveId},
 			</if>
 			<if test="disease != null and disease != ''">
 				disease = #{disease},
@@ -1317,8 +1313,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="member != null and member != ''">
 				member = #{member},
 			</if>
-			<if test="created_by != null and created_by != ''">
-				created_by = #{created_by},
+			<if test="createdBy != null and createdBy != ''">
+				createdBy = #{createdBy},
 			</if>
 			<if test="status != null and status != ''">
 				status = #{status}
@@ -1332,17 +1328,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="id != null and id != ''">
 			AND id = #{id}
 		</if>
-		<if test="patient_archive_id != null and patient_archive_id != ''">
-			AND patient_archive_id = #{patient_archive_id}
+		<if test="archiveId != null and archiveId != ''">
+			AND archiveId = #{archiveId}
 		</if>
-		<if test="medication_description != null and medication_description != ''">
-			AND medication_description = #{medication_description}
+		<if test="medicationDescription != null and medicationDescription != ''">
+			AND medicationDescription = #{medicationDescription}
 		</if>
-		<if test="medication_type != null and medication_type != ''">
-			AND medication_type = #{medication_type}
+		<if test="medicationType != null and medicationType != ''">
+			AND medicationType = #{medicationType}
 		</if>
-		<if test="created_by != null and created_by != ''">
-			AND created_by = #{created_by}
+		<if test="createdBy != null and createdBy != ''">
+			AND createdBy = #{createdBy}
 		</if>
 		<if test="status != null and status != ''">
 			AND status = #{status}
@@ -1352,24 +1348,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<insert id="insertMedicationRecord" parameterType="pd">
 		INSERT INTO s_dtp_ysfw_medication_records
 		<trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
-			<if test="id != null and id != ''">id,</if>
-			<if test="patient_archive_id != null and patient_archive_id != ''">patient_archive_id,</if>
-			<if test="medication_description != null and medication_description != ''">medication_description,</if>
-			<if test="medication_type != null and medication_type != ''">medication_type,</if>
-			<if test="created_by != null and created_by != ''">created_by,</if>
-			<if test="created_at != null and created_at != ''">created_at,</if>
-			<if test="updated_at != null and updated_at != ''">updated_at,</if>
+			<if test="archiveId != null and archiveId != ''">archiveId,</if>
+			<if test="medicationDescription != null and medicationDescription != ''">medicationDescription,</if>
+			<if test="medicationType != null and medicationType != ''">medicationType,</if>
+			<if test="createdBy != null and createdBy != ''">createdBy,</if>
+			<if test="createdAt != null and createdAt != ''">createdAt,</if>
+			<if test="updatedAt != null and updatedAt != ''">updatedAt,</if>
 			<if test="status != null and status != ''">status</if>
 		</trim>
 
 		<trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
-			<if test="id != null and id != ''">#{id},</if>
-			<if test="patient_archive_id != null and patient_archive_id != ''">#{patient_archive_id},</if>
-			<if test="medication_description != null and medication_description != ''">#{medication_description},</if>
-			<if test="medication_type != null and medication_type != ''">#{medication_type},</if>
-			<if test="created_by != null and created_by != ''">#{created_by},</if>
-			<if test="created_at != null and created_at != ''">#{created_at},</if>
-			<if test="updated_at != null and updated_at != ''">#{updated_at},</if>
+			<if test="archiveId != null and archiveId != ''">#{archiveId},</if>
+			<if test="medicationDescription != null and medicationDescription != ''">#{medicationDescription},</if>
+			<if test="medicationType != null and medicationType != ''">#{medicationType},</if>
+			<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
+			<if test="createdAt != null and createdAt != ''">#{createdAt},</if>
+			<if test="updatedAt != null and updatedAt != ''">#{updatedAt},</if>
 			<if test="status != null and status != ''">#{status}</if>
 		</trim>
 	</insert>
@@ -1378,17 +1372,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<update id="updateMedicationRecord" parameterType="pd">
 		UPDATE s_dtp_ysfw_medication_records SET
 		<trim prefix="" suffixOverrides="," prefixOverrides=",">
-			<if test="patient_archive_id != null and patient_archive_id != ''">
-				patient_archive_id = #{patient_archive_id},
+			<if test="archiveId != null and archiveId != ''">
+				archiveId = #{archiveId},
 			</if>
-			<if test="medication_description != null and medication_description != ''">
-				medication_description = #{medication_description},
+			<if test="medicationDescription != null and medicationDescription != ''">
+				medicationDescription = #{medicationDescription},
 			</if>
-			<if test="medication_type != null and medication_type != ''">
-				medication_type = #{medication_type},
+			<if test="medicationType != null and medicationType != ''">
+				medicationType = #{medicationType},
 			</if>
 			<if test="created_by != null and created_by != ''">
-				created_by = #{created_by},
+				createdBy = #{createdBy},
 			</if>
 			<if test="status != null and status != ''">
 				status = #{status}
@@ -1411,4 +1405,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		DELETE FROM s_dtp_ysfw_medication_records WHERE id = #{id}
 	</update>
 
+
+	<!--物理删除家 联系人表,族病史表,用药情况表根据档案 archiveId 删除-->
+	<update id="DeleteContact" parameterType="pd">
+		DELETE FROM s_dtp_ysfw_contacts WHERE archiveId = #{archiveId}
+	</update>
+
+	<update id="DeleteFamilyHistory" parameterType="pd">
+		DELETE FROM s_dtp_ysfw_family_history WHERE archiveId = #{archiveId}
+	</update>
+
+	<update id="DeleteMedicationRecord" parameterType="pd">
+		DELETE FROM s_dtp_ysfw_medication_records WHERE archiveId = #{archiveId}
+	</update>
 </mapper>