Parcourir la source

更新SOP配置页面和先销售后登记页面和药品总库20250106开会讨论的调整

bzd_wsp il y a 3 mois
Parent
commit
2cd3c6cff2

+ 1 - 2
health-admin/src/main/java/com/bzd/web/controller/dtp/RecipeRegisterController.java

@@ -193,8 +193,7 @@ public class RecipeRegisterController extends BaseController {
     @PostMapping("/saveCFDJ")
     @ResponseBody
     public AjaxResult saveCFDJ() throws Exception {
-        PageData pd = new PageData();
-        pd = this.getPageData();
+        PageData pd = this.getPageData();
         PageData p = dtpService.saveCFDJ(pd);
         if(p.get("code").toString().equals("200")){
             return AjaxResult.success(p);

+ 40 - 3
health-admin/src/main/java/com/bzd/web/controller/dtp/SDtpYypzFollowUpSopController.java

@@ -6,6 +6,7 @@ import com.bzd.common.core.controller.BaseController;
 import com.bzd.common.core.domain.AjaxResult;
 import com.bzd.common.core.page.TableDataInfo;
 import com.bzd.common.enums.BusinessType;
+import com.bzd.common.utils.StringUtils;
 import com.bzd.system.service.PharmaceuticalService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -118,11 +119,19 @@ public class SDtpYypzFollowUpSopController extends BaseController {
     */
     @RequiresPermissions("dtp:dtp:edit")
     @GetMapping("/sDtpYypzFollowUpSopEdit/{id}")
-    public String sdtpyypzfollowupsopView(@PathVariable("id") Long id, ModelMap mmap) throws Exception {
+    public String sDtpYypzFollowUpSopEditPage(@PathVariable("id") Long id, ModelMap mmap) throws Exception {
         PageData pd = this.getPageData();
         pd.put("id", id);
-        PageData pageData = sDtpYypzFollowUpSopService.findSDtpYypzFollowUpSopList(pd).get(0);
-        mmap.putAll(pageData);
+        PageData Template = sDtpYypzFollowUpSopService.selectTemplateById(pd);
+        if(StringUtils.isNotNull(Template)){
+            pd.put("templateId", Template.get("templateId"));
+            List<PageData> drugsData = sDtpYypzFollowUpSopService.selectDrugsByTemplateId(pd);
+            List<PageData> NodeList = sDtpYypzFollowUpSopService.selectNodeConfigByTemplateId(pd);
+            mmap.put("drugs",drugsData);
+            mmap.put("NodeList",NodeList);
+        }
+        mmap.put("Template",Template);
+
         if(null!=pd.getString("editTage")){
             return prefix+ "/sfrw/SDtpYypzFollowUpSopPageEdit";
         }
@@ -155,4 +164,32 @@ public class SDtpYypzFollowUpSopController extends BaseController {
             return AjaxResult.error("系统异常:" + e.getMessage());
         }
     }
+
+    /**
+     * 随访SOP状态 状态: 0已创建 1启用,2禁用 默认为已创建0
+     */
+    @RequiresPermissions("dtp:dtp:edit")
+    @Log(title = "随访SOP表修改", businessType = BusinessType.UPDATE)
+    @PostMapping("/updateSopStatusByTemplateId")
+    @ResponseBody
+    public AjaxResult updateSopStatusByTemplateId() throws Exception {
+        PageData pd = this.getPageData();
+        try {
+            Integer updateResult = sDtpYypzFollowUpSopService.updateSopStatusByTemplateId(pd);
+            if (updateResult>0) {
+                // 成功更新
+                return AjaxResult.success("成功");
+            } else {
+                // 更新失败
+                logger.error("Failed to update 表sdtpyypzfollowupsop with templateId: {}", pd.get("templateId"));
+                return AjaxResult.error("失败");
+            }
+        } catch (Exception e) {
+            // 异常处理
+            logger.error("Error occurred while updating 表sdtpyypzfollowupsop with templateId: {}, Exception: {}", pd.get("templateId"), e.getMessage(), e);
+            return AjaxResult.error("系统异常:" + e.getMessage());
+        }
+    }
+
+
 }

+ 7 - 1
health-admin/src/main/java/com/bzd/web/controller/spgl/SPConfigInfoController.java

@@ -102,8 +102,14 @@ public class SPConfigInfoController extends BaseController {
     public AjaxResult ProductAdd() {
         try {
             PageData pd = this.getPageData();
+         String productCode = (String) pd.get("product_code");
+            if (StringUtils.isEmpty(productCode)){
+                return AjaxResult.error("商品编号不能为空");
+            }
+            PageData pd2=new PageData();
+            pd2.put("product_code",productCode);
             // 直接service 保存
-            List<PageData> pageData = sPProductinfoService.findSPProductinfoList(pd);
+            List<PageData> pageData = sPProductinfoService.findSPProductinfoListBYProductCode(pd2);
             if (pageData.size() > 0){
                 return AjaxResult.error("商品编号已存在");
             }

+ 66 - 52
health-admin/src/main/resources/templates/dtp/recipe/newRecipe.html

@@ -13,7 +13,7 @@
             <div class="customize-form-group-container">
                 <div class="customize-form-group">
                     <label>患者信息:</label>
-                    <input type="text" class="styled-input" placeholder="输入姓名或手机号/证件号码" id="query" name="query"/>
+                    <input type="text" class="styled-input" placeholder="输入姓名,患者ID或手机号/证件号码" id="query" name="query"/>
                 </div>
                 <div class="customize-form-group">
                     <a class="btn btn-primary btn-rounded btn-sm" onclick="search_hz()">&nbsp;搜索</a>
@@ -102,8 +102,8 @@
 <!--                            <input name="registerPharmacistName" id="registerPharmacistName" placeholder="登记药师姓名"   class="styled-input" type="text">-->
 <!--                        </div>-->
                         <div class="customize-form-group">
-                            <label class="is-required">登记人:</label>
-                            <input name="registrant" id="registrant" placeholder="登记人"  class="styled-input" type="text">
+                            <label>登记人:</label>
+                            <input name="registrant" id="registrant" placeholder="未填登记人,系统默认当前用户"  class="styled-input" type="text">
                         </div>
                         <!--<div class="customize-form-group">
                             <label>审核药师姓名:</label>
@@ -163,6 +163,11 @@
                 </tbody>
             </table>
         </div>
+            <div class="center-block ibox-title" >
+                <label class="is-required">是否开启药师审核:</label>
+                    <button type="button" class="btn btn-primary"  onclick="onclickshow()">是</button>
+                    <button type="button" class="btn btn-info"     onclick="onclickhide()">否</button>
+            </div>
     </div>
     <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
         <div class="modal-dialog">
@@ -204,13 +209,21 @@
                     <div class="modal-footer">
                         <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                         <button type="button" class="btn btn-primary" onclick="submitReview()">提交</button>
+
+
                     </div>
                 </div>
             </form>
+
         </div>
+
     </div>
+
     <div class="main-content">
         <div class="col-sm-offset-5 col-sm-10">
+
+            <button type="button" class="btn btn-sm btn-info" onclick="openCheckYSSH()" id="openCheckYSSid">药师审核</button>&nbsp;
+
             <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>提 交</button>&nbsp;
             <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
         </div>
@@ -232,6 +245,10 @@
     var hzparam =[];
     var hzparam1 ={};
     var openId='';
+
+    var remarks;
+    var reviewingName;
+    var reviewStatus;
     var data;
     var shangci=false;
     var shangcigyList=[];
@@ -239,8 +256,11 @@
     var selectdataList=[];
     var  prescriptionNumber;
     var  drugsLinkId;
-
+    var reviewFormData = new FormData();
      $(document).ready(function() {
+
+
+
         // 获取所有的输入元素(input, textarea, select)
         var $inputs = $('form').find('input, textarea, select').filter(':visible');
 
@@ -380,9 +400,18 @@
                  $('#subcategory-select').trigger('change');
              }
          });
-         // 监听医院下拉框的选择事件
-
+             //药师审核选择事件 默认打开
+             $('#openCheckYSSid').show();
     });
+
+    // 监听药师审核选择事件
+    function onclickshow() {
+        $('#openCheckYSSid').show();
+    }
+    function onclickhide() {
+        $('#openCheckYSSid').hide();
+    }
+
     function loadSubcategories(categoryId) {
         // 模拟从服务器获取子类别数据
         $.ajax({
@@ -417,7 +446,7 @@
         tbody.empty(); // 清空现有行
 
         datas.forEach(function(patient, index) {
-            var genderText = patient.gender === 1 ? '男' : '女';
+            var genderText = patient.gender === 0 ? '男' : '女';
             var row = `
             <tr data-index="${index}">
                 <td><input type="radio" name="selectPatient" value="${index}"></td>
@@ -658,6 +687,10 @@ function initTab(datas){
         formData.append('xlname', XL);
         console.log("DL=" + DL);
         console.log("XL=" + XL);
+        formData.append('remarks', remarks);
+        formData.append('reviewingName', reviewingName);
+        formData.append('reviewStatus', reviewStatus);
+        formData.append('reviewFormData', reviewFormData);
 // 将药物数据序列化为 JSON 字符串并添加到 FormData 中
         /*var drugData = getTableData(); // 假设此函数正确获取表格数据
         if (drugData.length > 0) {
@@ -772,20 +805,16 @@ function initTab(datas){
                 if(data.data.code==200){
                     prescriptionNumber = data.data.prescriptionNumber;
                     drugsLinkId = data.data.drugsLinkId;
-
-                    openCheckYSJC();
-
-
-                    //  $.modal.closeTab();
+                    $.modal.msg(data.msg);
+                    $.modal.closeTab();
                 }else{
-                    $.modal.alertError(data.msg);
+                    $.modal.alertError(data.data.msg);
                 }
 
             }
         });
     }
-
-    function openCheckYSJC(){
+    function openCheckYSSH(){
         //初始化时加载药师信息
         loadPharmacists();
             //$.modal.open("药师审核", prefix_pmService+'/openCheckYSJC'); findRevieForList
@@ -872,57 +901,42 @@ function initTab(datas){
     });
     // 提交审核信息
     function submitReview() {
+        debugger
         if ($('#pharmacistNameSelect').val() && $('#password').is(':visible')) {
             verifyPassword();
         } else {
-            alert('请选择审核药师并输入密码');
+            $.modal.alert('请选择审核药师并输入密码');
         }
-
         // 如果 checkView 显示,则可以提交表单
         if ($('#checkView').is(':visible')) {
-            var formData = new FormData();
-
             // 直接从特定的输入元素中获取值
             // 获取审核药师姓名
             var reviewingNameOption = $('#pharmacistNameSelect option:selected');
-            var reviewingName = reviewingNameOption.text();  // 获取选中的选项文本
-            var reviewStatus = $('input[name="checkResult"]:checked').val(); // 获取选中的审核结果
-            var remarks = $('#remarks').val();
+            var reviewingName1 = reviewingNameOption.text();  // 获取选中的选项文本
+            var reviewStatus1 = $('input[name="checkResult"]:checked').val(); // 获取选中的审核结果
+            var remarks1 = $('#remarks').val();
 
             // 检查是否所有必填项都已填写
-            if (!reviewingName || !reviewStatus || !prescriptionNumber) {
-                alert('请确保所有必填项都已填写');
+            if (!reviewingName1) {
+                $.modal.alert('请选择审核人');
+                return;
+            }
+            if (!reviewStatus1) {
+                $.modal.alert('请选择审核结果');
                 return;
             }
+            remarks= remarks1;
+            reviewingName=reviewingName1;
+            reviewStatus=reviewStatus1;
 
             // 添加到 formData 中
-            formData.append("reviewingName", reviewingName);
-            formData.append("reviewStatus", reviewStatus);
-            formData.append("prescriptionNumber", prescriptionNumber);
-            formData.append("drugsLinkId", drugsLinkId);
-            formData.append("remarks", remarks);
-
-            $.ajax({
-                cache: false,
-                type: "POST",
-                url: prefix_recipe+'/review', // 这是提交审核信息的API端点
-                data: formData,
-                processData: false,
-                contentType: false,
-                async: true,
-                error: function (request) {
-                    $.modal.alertError("操作失败");
-                },
-                success: function (data) {
-                    if (data.code === 200) {
-                        $('#myModal').modal('hide'); // 关闭弹窗
-                        $.modal.alertSuccess('提交成功');
-                        $.modal.closeTab();
-                    } else {
-                        $.modal.alertError(data.message || "提交失败");
-                    }
-                }
-            });
+            reviewFormData.append("reviewingName", reviewingName1);
+            reviewFormData.append("reviewStatus", reviewStatus1);
+            // reviewFormData.append("prescriptionNumber", prescriptionNumber);
+            // reviewFormData.append("drugsLinkId", drugsLinkId);
+            reviewFormData.append("remarks", remarks1);
+            $.modal.msgSuccess('审核信息已保存到处方登记页');
+            $('#myModal').modal('hide'); // 关闭弹窗
         }
     }
 
@@ -1232,7 +1246,7 @@ function initTab(datas){
     /*    border-radius: 4px;*/
     /*}*/
     .ibox-title {
-        background-color: #f3f3f4;
+        background-color: #e6e3da;
         border-bottom: 1px solid #e7eaec;
         padding: 10px 15px;
         font-size: 16px;

+ 20 - 14
health-admin/src/main/resources/templates/dtp/sfrw/SDtpYypzFollowUpSopAdd.html

@@ -29,20 +29,14 @@
             </form>
             <form id="form-syyp-durg">
                         <div class="ibox" id="data-ibox" style="overflow: auto;">
-                            <div class="ibox-title" style="width: 100%;">适用药品:已添加 <span id="drug-count">0</span> 个药品</div>
+                            <div class="ibox-title" style="width: 100%;">适用药品:已选择 <span id="drug-count">0</span> 种药品</div>
                             <table class="fixed-layout-table table1" id="drugInfoTable">
                                 <thead>
                                 <tr>
                                     <th>操作+<a type="button" class="btn btn-primary btn-sm" onclick="selectUsersToParentCallBack2()">添加药品</a></th>
                                     <th>药品编码</th>
                                     <th>药品名</th>
-                                    <th class="hidden-column">通用名</th>
                                     <th>规格</th>
-                                    <th class="hidden-column">厂家简称</th>
-                                    <th class="hidden-column">给药方式</th>
-                                    <th class="hidden-column">随访品</th>
-                                    <th class="hidden-column">冷链品</th>
-                                    <th class="hidden-column">登记品</th>
                                 </tr>
                                 </thead>
                                 <tbody>
@@ -117,6 +111,7 @@
             $.modal.alertWarning("请选择业务归属");
             return;
         }
+        applicableDrug=  getTableData();
         if(applicableDrug.length==0){
             $.modal.alertWarning("请添加药品");
             return;
@@ -128,6 +123,8 @@
         console.log("data="+data)
         $.operate.saveTab(prefix + "/sDtpYypzFollowUpSopAdd", data);
     }
+
+
     function collectNodesData() {
         // 获取所有节点
         const nodes = document.querySelectorAll('.tabs-container .tab-pane');
@@ -941,14 +938,7 @@
                     <td><button class="btn btn-danger delete-drug-btn" data-product-id="${columnsData.productId}">删除重选择药品</button></td>
                     <td>${columnsData.productCode}</td>
                     <td>${columnsData.productName}</td>
-                    <td class="hidden-column">${columnsData.genericName}</td>
                     <td>${columnsData.specification}</td>
-                    <td class="hidden-column">${columnsData.manufacturerAbbreviation}</td>
-                    <td class="hidden-column">${columnsData.administrationMethod}</td>
-                    <td class="hidden-column">${columnsData.followUpItem === 1 ? '是' : '否'}</td>
-                    <td class="hidden-column">${columnsData.coldChainItem === 1 ? '是' : '否'}</td>
-                    <td class="hidden-column">${columnsData.registeredItem === 1 ? '是' : '否'}</td>
-
                 </tr>
             `;
                 tableBody.append(row);
@@ -1024,6 +1014,22 @@
         });
 
     }
+    //获取药品表格数据
+    function getTableData() {
+        var tableRows = [];
+
+        $('#drugInfoTable tbody tr').each(function(index, row) {
+            var rowData = {
+                productId: $(row).data('product-id'),
+                productCode: $(row).find('td:eq(1)').text().trim(), // 药品编码
+                productName: $(row).find('td:eq(2)').text().trim(), // 药品名
+                specification: $(row).find('td:eq(3)').text().trim(), // 规格
+            };
+            tableRows.push(rowData);
+        });
+
+        return tableRows;
+    }
 </script>
 <style>
 

+ 21 - 5
health-admin/src/main/resources/templates/dtp/sfrw/SDtpYypzFollowUpSopList.html

@@ -31,7 +31,7 @@
                         </div>
                         <div class="customize-form-group">
                             <label>药品:</label>
-                            <input type="text" class="styled-input" placeholder="请输入商品名/通用名/MDM编码" name="drug" autocomplete="off"/>
+                            <input type="text" class="styled-input" placeholder="请输入商品名/通用名/MDM编码" name="query" autocomplete="off"/>
                         </div>
                         <div class="customize-form-group">
                             <label>模板名称:</label>
@@ -129,17 +129,33 @@
             columns: [{
                 checkbox: true
             },
-                { field: 'id', title: '主键', align: 'center' ,visible:false},
-                    { field: 'drug', title: '药品', align: 'center' },
+                    { field: 'id', title: '主键', align: 'center' ,visible:false},
+                    { field: 'productName', title: '药品名称', align: 'center' },
+                    { field: 'productCode', title: '药品编码', align: 'center' },
+                    { field: 'specification', title: '规格', align: 'center' },
                     { field: 'businessBelonging', title: '业务归属', align: 'center' },
                     { field: 'templateName', title: '模板名称', align: 'center' },
                     { field: 'templateId', title: '模版ID', align: 'center' },
                     { field: 'createdBy', title: '创建人', align: 'center' },
-                    { field: 'status', title: '状态', align: 'center' },
+                    { field: 'status', title: '状态', align: 'center',
+                        formatter: function(value, row, index) {
+                            switch (value) {
+                                case 0:
+                                    return '<span class=\"btn-info">已创建</span>';
+                                    break;
+                                case 1:
+                                    return '<span class=\"btn-primary">启用</span>';
+                                    break;
+                                case 2:
+                                    return '<span class=\"btn-danger">禁用</span>';
+                                    break;
+                                default:
+                                    return '<span class=\"btn-warning">无</span>';
+                            }
+                        } },
                     { field: 'createdTime', title: '创建时间', align: 'center' },
                     { field: 'updatedTime', title: '更新时间', align: 'center' },
                     { field: 'updatedBy', title: '更新人', align: 'center' },
-
                 {
                     title: '操作',
                     align: 'center',

Fichier diff supprimé car celui-ci est trop grand
+ 807 - 94
health-admin/src/main/resources/templates/dtp/sfrw/SDtpYypzFollowUpSopPageEdit.html


+ 4 - 1
health-admin/src/main/resources/templates/gxhpz/drugconfigList.html

@@ -134,7 +134,7 @@
              </form>
             </div>
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
+                <a class="btn btn-success" id="button-open-2"  shiro:hasPermission="system:user:add">
                     <i class="fa fa-plus"></i> 新增患者管理品
                 </a>
                 <a class="btn btn-success" onclick="$.operate.add2()" shiro:hasPermission="system:user:add">
@@ -181,6 +181,9 @@
         queryArchivesList();
     });
 
+    $("#button-open-2").click(function(){
+        $.modal.open('新增患者管理品', prefix + "/add", '900', '900');
+    })
     function queryArchivesList() {
         var options = {
             url: prefix + "/drugconfigList",

+ 191 - 70
health-admin/src/main/resources/templates/spgl/SPProductAdd.html

@@ -77,7 +77,7 @@
                         <!-- 通用名 -->
                         <div class="customize-form-group edit">
                             <label class="is-required">通用名:</label>
-                            <input type="text" name="generic_name" class="styled-input edit_inputs" />
+                            <input type="text" name="generic_name" id="generic_name" class="styled-input edit_inputs" />
                             <span class="span_line" readonly></span>
                         </div>
 
@@ -441,7 +441,7 @@
 
                         <div class="customize-form-group edit">
                             <label class="is-required">是否凭处方销售:</label>
-                            <select name="prescription_required" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
+                            <select name="prescription_required" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
                                 <option value="">请选择</option>
                                 <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                             </select>
@@ -471,7 +471,7 @@
 
                         <div class="customize-form-group edit">
                             <label class="is-required">登记品:</label>
-                            <select name="registered_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
+                            <select name="registered_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
                                 <option value="">请选择</option>
                                 <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                             </select>
@@ -480,7 +480,7 @@
 
                         <div class="customize-form-group edit">
                             <label class="is-required">随访品:</label>
-                            <select name="follow_up_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
+                            <select name="follow_up_item" id="follow_up_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
                                 <option value="">请选择</option>
                                 <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                             </select>
@@ -489,7 +489,7 @@
 
                         <div class="customize-form-group edit">
                             <label class="is-required">冷链品:</label>
-                            <select name="cold_chain_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
+                            <select name="cold_chain_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
                                 <option value="">请选择</option>
                                 <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                             </select>
@@ -498,7 +498,7 @@
 
                         <div class="customize-form-group edit">
                             <label class="is-required">流向品:</label>
-                            <select name="flow_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
+                            <select name="flow_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
                                 <option value="">请选择</option>
                                 <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                             </select>
@@ -517,11 +517,11 @@
                         <div class="form-grid1">
                             <div class="form-field-left">
                                 <label class="is-required">最大剂量数量:</label>
-                                <input type="number" name="dosage_max"  placeholder="最大剂量数量" class="styled-input1" />
+                                <input type="number" name="dosage_max"  placeholder="最大剂量数量" class="styled-input1" required/>
                             </div>
                             <div class="form-field-right">
                                 <label class="is-required">最大剂量单位:</label>
-                                <select name="unit_max" class="styled-input1"  placeholder="最大剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
+                                <select name="unit_max" class="styled-input1"  placeholder="最大剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
                                     <option value="">请选择</option>
                                     <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                                 </select>
@@ -529,11 +529,11 @@
 
                             <div class="form-field-left">
                                 <label class="is-required">常用剂量数量:</label>
-                                <input type="number" name="dosage_normal"  placeholder="常用剂量数量" class="styled-input1" />
+                                <input type="number" name="dosage_normal"  placeholder="常用剂量数量" class="styled-input1"required />
                             </div>
                             <div class="form-field-right">
-                                <label>常用剂量单位:</label>
-                                <select name="unit_normal" class="styled-input1"  placeholder="常用剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
+                                <label class="is-required">常用剂量单位:</label>
+                                <select name="unit_normal" class="styled-input1"  placeholder="常用剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
                                     <option value="">请选择</option>
                                     <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                                 </select>
@@ -542,22 +542,22 @@
                         <div class="form-grid2">
                             <div class="form-field-left">
                                 <label class="is-required">最小剂量数量:</label>
-                                <input type="number" name="dosage_min"  placeholder="最小剂量数量" class="styled-input1" />
+                                <input type="number" name="dosage_min"  placeholder="最小剂量数量" class="styled-input1" required />
                             </div>
                             <div class="form-field-right">
                                 <label class="is-required">最小剂量单位:</label>
-                                <select name="unit_min" class="styled-input1"  placeholder="最小剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
+                                <select name="unit_min" class="styled-input1"  placeholder="最小剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
                                     <option value="">请选择</option>
                                     <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                                 </select>
                             </div>
                             <div class="form-field-left">
                                 <label class="is-required">购药包装单位数值:</label>
-                                <input type="number" name="packing_value"  placeholder="购药包装单位数值" class="styled-input1" />
+                                <input type="number" name="packing_value"  placeholder="购药包装单位数值" class="styled-input1" required />
                             </div>
                             <div class="form-field-right">
                                 <label>包装单位:</label>
-                                <select name="packing_unit" class="styled-input1" placeholder="包装单位"  th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
+                                <select name="packing_unit" class="styled-input1" placeholder="包装单位"  th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
                                     <option value="">请选择</option>
                                     <option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
                                 </select>
@@ -1618,151 +1618,241 @@
             $("#form-server-edit6"),
             $("#form-server-edit12")
         ];
-
+      var flag = true;
         // 获取 product_code 并验证是否已填写
         var productCodeData = $("#form-server-edit1").serializeArray().find(item => item.name === 'product_code');
         if (productCodeData.value === '') {
             $.modal.alertWarning("请先填写【基本属性】产品编码!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('product_code', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var product_name = $("#form-server-edit1").serializeArray().find(item => item.name === 'product_name');
         if (product_name.value === '') {
             $.modal.alertWarning("请先填写【基本属性】商品名称!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('product_name', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+        var manufacturer = $("#form-server-edit1").serializeArray().find(item => item.name === 'generic_name');
+        if (manufacturer.value === '') {
+            $.modal.alertWarning("请先填写【基本属性】通用名!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('generic_name', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var manufacturer = $("#form-server-edit1").serializeArray().find(item => item.name === 'manufacturer');
         if (manufacturer.value === '') {
             $.modal.alertWarning("请先填写【基本属性】生产厂家!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('manufacturer', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
+
+
         var product_status = $("#form-server-edit1").serializeArray().find(item => item.name === 'product_status');
         if (product_status.value === '') {
             $.modal.alertWarning("请先填写【基本属性】商品状态!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('product_status', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var category_maj = $("#form-server-edit1").serializeArray().find(item => item.name === 'category_maj');
         if (category_maj.value === '') {
             $.modal.alertWarning("请先填写【基本属性】商品大类!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('category_maj', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var category_min = $("#form-server-edit1").serializeArray().find(item => item.name === 'category_min');
         if (category_min.value === '') {
             $.modal.alertWarning("请先填写【基本属性】商品小类!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('category_min', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var specification = $("#form-server-edit1").serializeArray().find(item => item.name === 'specification');
         if (specification.value === '') {
             $.modal.alertWarning("请先填写【基本属性】规格!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('specification', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var packaging = $("#form-server-edit1").serializeArray().find(item => item.name === 'packaging');
         if (packaging.value === '') {
             $.modal.alertWarning("请先填【基本属性】写包装!");
-            return null;
-        }
-        var reference_purchase_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'reference_purchase_price');
-        if (reference_purchase_price.value === '') {
-            $.modal.alertWarning("请先填写【采购属性】参考进价!");
-            return null;
-        }
-        var national_negotiated_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'national_negotiated_price');
-        if (national_negotiated_price.value === '') {
-            $.modal.alertWarning("请先填写【采购属性】国谈价格!");
-            return null;
-        }
-        var storage_category = $("#form-server-edit3").serializeArray().find(item => item.name === 'storage_category');
-        if (storage_category.value === '') {
-            $.modal.alertWarning("请先填写【存储分类】存储分类!");
-            return null;
-        }
-
-        var approval_number_1 = $("#form-server-edit4").serializeArray().find(item => item.name === 'approval_number_1');
-        if (approval_number_1.value === '') {
-            $.modal.alertWarning("请先填写【质管属性】批准文号1!");
-            return null;
-        }
-        var reference_retail_price = $("#form-server-edit5").serializeArray().find(item => item.name === 'reference_retail_price');
-        if (reference_retail_price.value === '') {
-            $.modal.alertWarning("请先填写【销售属性】参考零售价!");
-            return null;
-        }
-        var platform_property = $("#form-server-edit6").serializeArray().find(item => item.name === 'platform_property');
-        if (platform_property.value === '') {
-            $.modal.alertWarning("请先填写【业态属性】平台属性!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('packaging', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
-
         var follow_up_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'follow_up_item');
         if (follow_up_item.value === '') {
             $.modal.alertWarning("请选择是【D值配置属性】否随访品!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('follow_up_item', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
 
         var cold_chain_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'cold_chain_item');
         if (cold_chain_item.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】是否冷链品!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('cold_chain_item', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
 
         var registered_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'registered_item');
         if (registered_item.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】是否登记品!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('registered_item', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
 
         var flow_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'flow_item');
         if (flow_item.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】是否流向品!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('flow_item', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
 
         var prescription_required = $("#form-server-edit12").serializeArray().find(item => item.name === 'prescription_required');
         if (prescription_required.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】是否是否凭处方销售!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('prescription_required', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
 
         var dosage_max = $("#form-server-edit12").serializeArray().find(item => item.name === 'dosage_max');
         if (dosage_max.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】最大剂量数量!");
-            return null;
+            flag= false;
+            return flag;
         }
         var dosage_min = $("#form-server-edit12").serializeArray().find(item => item.name === 'dosage_min');
         if (dosage_min.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】最小剂量数量!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('dosage_min', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var unit_max = $("#form-server-edit12").serializeArray().find(item => item.name === 'unit_max');
         if (unit_max.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】最大剂量单位!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('unit_max', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var unit_min = $("#form-server-edit12").serializeArray().find(item => item.name === 'unit_min');
         if (unit_min.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】最小剂量单位!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('unit_min', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var unit_normal = $("#form-server-edit12").serializeArray().find(item => item.name === 'unit_normal');
         if (unit_normal.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】常见计量单位!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('unit_normal', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var dosage_normal = $("#form-server-edit12").serializeArray().find(item => item.name === 'dosage_normal');
         if (dosage_normal.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】常见计量数量!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('dosage_normal', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var packing_value = $("#form-server-edit12").serializeArray().find(item => item.name === 'packing_value');
         if (packing_value.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】包装单位值!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('packing_value', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
         var packing_unit = $("#form-server-edit12").serializeArray().find(item => item.name === 'packing_unit');
         if (packing_unit.value === '') {
             $.modal.alertWarning("请选择【D值配置属性】包装单位!");
-            return null;
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('packing_unit', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+        var reference_purchase_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'reference_purchase_price');
+        if (reference_purchase_price.value === '') {
+            $.modal.alertWarning("请先填写【采购属性】参考进价!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('reference_purchase_price', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+        var national_negotiated_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'national_negotiated_price');
+        if (national_negotiated_price.value === '') {
+            $.modal.alertWarning("请先填写【采购属性】国谈价格!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('national_negotiated_price', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+        var storage_category = $("#form-server-edit3").serializeArray().find(item => item.name === 'storage_category');
+        if (storage_category.value === '') {
+            $.modal.alertWarning("请先填写【存储分类】存储分类!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('storage_category', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
         }
 
+        var approval_number_1 = $("#form-server-edit4").serializeArray().find(item => item.name === 'approval_number_1');
+        if (approval_number_1.value === '') {
+            $.modal.alertWarning("请先填写【质管属性】批准文号1!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('approval_number_1', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+        var reference_retail_price = $("#form-server-edit5").serializeArray().find(item => item.name === 'reference_retail_price');
+        if (reference_retail_price.value === '') {
+            $.modal.alertWarning("请先填写【销售属性】参考零售价!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('reference_retail_price', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+        var platform_property = $("#form-server-edit6").serializeArray().find(item => item.name === 'platform_property');
+        if (platform_property.value === '') {
+            $.modal.alertWarning("请先填写【业态属性】平台属性!");
+            // 调用函数设置焦点到必填项,并保持一段时间内的焦点
+            keepFocusOnInput('platform_property', 5000); // 保持焦点 5 秒钟
+            flag= false;
+            return flag;
+        }
+
+
+
         // 初始化合并后的数据数组
         var allData = [];
 
@@ -1773,12 +1863,43 @@
             formData.push({ name: 'product_code', value: productCodeData.value });
             allData = allData.concat(formData);
         });
+        if (flag){
+            return allData;
+        }else{
+            return false;
+        }
 
-        return allData;
     }
+    function keepFocusOnInput(fieldName, duration = 5000) {
+        var element = $('[name="' + fieldName + '"]');
+        let intervalId;
+
+        if (element.length && element.is(':visible')) {
+            element.focus();
+
+            // 开始一个间隔定时器,在指定的时间内重复设置焦点
+            intervalId = setInterval(() => {
+                element.focus();
+                if (element.is('input[type="text"], textarea')) {
+                    element[0].setSelectionRange(element.val().length, element.val().length);
+                }
+            }, 200); // 每 200ms 设置一次焦点
+
+            // 在指定时间后清除定时器
+            setTimeout(() => {
+                clearInterval(intervalId);
+            }, duration);
+        } else {
+            console.warn("无法找到或访问名为 " + fieldName + " 的元素");
+        }
+    }
+
     function submitHandler() {
         if ($.validate.form()) {
             var allData = collectFormData();
+            if (allData === false) {
+                return;
+            }
             $.ajax({
                 url: prefix + "/ProductAdd", // 后台接口地址
                 type: "post",

+ 4 - 0
health-system/src/main/java/com/bzd/system/service/DTPService.java

@@ -414,6 +414,10 @@ public class DTPService {
                 pd.put("status", 5);//5待订单销售
                 pd.put("registrationDate", DateUtils.getTime());
                 pd.put("drugQuantity", drugQuantity);
+               String registrant = (String) pd.get("registrant");
+               if(StringUtils.isEmpty(registrant)){
+                   pd.put("registrant", getSysUser().getLoginName());
+               }
                 int result = daoSupport.save("DTPCFDJMapper.insertPrescriptionRegistration", pd);
                 if(resultDrug>0 && result>0){
                     returnPageData.put("code", 200);

+ 77 - 23
health-system/src/main/java/com/bzd/system/service/dtp/SDtpYypzFollowUpSopService.java

@@ -7,11 +7,16 @@ import com.bzd.common.utils.DateUtils;
 import com.bzd.common.utils.StringUtils;
 import com.bzd.common.utils.uuid.SnowflakeIdGenerator;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.io.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.sql.Blob;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -52,19 +57,18 @@ public class SDtpYypzFollowUpSopService {
                 if (rowsdrugList.size() > 0) {
                     for (Map<String, Object> lxr : rowsdrugList) {
                         PageData pageData = new PageData();
-                        pageData.put("creator", getSysUser().getLoginName());
+                        pageData.put("storeId", getSysUser().getDeptId());
                         pageData.put("createTime", DateUtils.getTime());
                         pageData.put("productName", lxr.get("productName"));
-                        pageData.put("genericName", lxr.get("genericName"));
-                        pageData.put("mdmCode", lxr.get("mdmCode"));
+                        pageData.put("productCode", lxr.get("productCode"));
                         pageData.put("specification", lxr.get("specification"));
-                        pageData.put("isFlipItem", lxr.get("isFlipItem"));
-                        pageData.put("soptemplateId", templateId);
+                        pageData.put("templateId", templateId);
+                        pageData.put("templateName", pd.get("templateName"));
                         addList.add(pageData);
                     }
                     final HashMap<String, Object> addMap = new HashMap<String, Object>();
                     addMap.put("dataList", addList);
-                    int resultDrug= dao.executeBatch("DTPMapper.batchAddPrescriptionDrug", addMap);
+                    int resultDrug= dao.executeBatch("SDtpYypzFollowUpSopMapper.batchAddTemplateDrugDynamic", addMap);
                     if (resultDrug <= 0) {
                         throw new RuntimeException("药品信息插入失败");
                     }
@@ -82,12 +86,18 @@ public class SDtpYypzFollowUpSopService {
             List<Map<String, Object>> nodesList = objectMapper.readValue(nodesDataList.toString(), List.class);
             // 遍历列表并调用插入数据接口
             if (nodesList.size() > 0) {
-            for (Map<String, Object> lxr : nodesList) {
+                for (int i = 0; i < nodesList.size(); i++) {
+                    Map<String, Object> lxr = nodesList.get(i);
                     PageData pageData = new PageData();
+
+                // 自动生成节点名称和编码
+                String nodeName = "节点" + (i + 1); // 节点名称从节点1开始
+                String nodeCode = String.valueOf(i + 1); // 编码从1开始
                     pageData.put("creator", getSysUser().getLoginName());
                     pageData.put("createTime", DateUtils.getTime());
-                    pageData.put("sopTemplateId", templateId);
-                    pageData.put("nodeName", lxr.get("nodeName"));
+                    pageData.put("templateId", templateId);
+                    pageData.put("nodeName", nodeName);
+                    pageData.put("nodeCode", nodeCode);
                     pageData.put("activateStructures", lxr.get("activateStructures"));
                     pageData.put("activateWhichDay", lxr.get("activateWhichDay"));
                     pageData.put("activateNodeRule", lxr.get("activateNodeRule"));
@@ -108,10 +118,7 @@ public class SDtpYypzFollowUpSopService {
                     pageData.put("deliveryChannel", lxr.get("deliveryChannel"));
                     pageData.put("smsId",lxr.get("smsId"));
                     pageData.put("useForm",lxr.get("useForm"));
-                    pageData.put("creator",getSysUser().getLoginName());
-                    pageData.put("createTime",DateUtils.getTime());
-                    pageData.put("status",0);//0已创建 1启用,2禁用
-                    pageData.put("deliveryChannel",lxr.get("createTaskStructures"));
+                    pageData.put("status",0);//状态: 0已创建 1启用,2禁用 默认为已创建0
                     // 处理 过滤条件 filtersData
                     @SuppressWarnings("unchecked")
                     List<Map<String, Object>> filtersData = (List<Map<String, Object>>) lxr.get("filtersData");
@@ -119,15 +126,20 @@ public class SDtpYypzFollowUpSopService {
                         String filtersDataJson = objectMapper.writeValueAsString(filtersData);
                         pageData.put("filterCondition", filtersDataJson);
                     }
-
+                    System.out.println("pageData:"+pageData);
+                    int node1= dao.executeBatch("SDtpYypzFollowUpSopMapper.insertNodeConfig", pageData);
                     nodeList.add(pageData);
+                    if (node1 <= 0) {
+                        throw new RuntimeException("节点配置插入失败");
+                    }
                 }
-                final HashMap<String, Object> addMap = new HashMap<String, Object>();
-                addMap.put("dataList", nodeList);
-                int node= dao.executeBatch("SDtpYypzFollowUpSopMapper.batchAddNodeConfig", addMap);
-                if (node <= 0) {
-                    throw new RuntimeException("节点配置插入失败");
-                }
+        //                final HashMap<String, Object> addMap = new HashMap<String, Object>();
+        //                addMap.put("dataList", nodeList);
+                          //批量插入暂时不用
+        //                int node= dao.executeBatch("SDtpYypzFollowUpSopMapper.batchAddNodeConfig", addMap);
+        //                if (node <= 0) {
+        //                    throw new RuntimeException("节点配置插入失败");
+        //                }
             }
 
         } catch (Exception e) {
@@ -140,7 +152,7 @@ public class SDtpYypzFollowUpSopService {
         pd.put("createdBy", getSysUser().getLoginName());//'创建人
         pd.put("storeId",getSysUser().getDeptId().toString());//门店id
         pd.put("storeName",getSysUser().getDept().getDeptName());//门店名称
-        pd.put("status","已创建");//状态: 0已创建 1启用,2禁用
+        pd.put("status",0);//状态: 0已创建 1启用,2禁用 默认为已创建0
         pd.put("templateId", templateId);
         int result =  daoSupport.update("SDtpYypzFollowUpSopMapper.addSDtpYypzFollowUpSop", pd);
         if (result <= 0) {
@@ -152,14 +164,56 @@ public class SDtpYypzFollowUpSopService {
     public List<PageData> findSDtpYypzFollowUpSopList(PageData pd) throws Exception{
         return (List<PageData>) daoSupport.findForList("SDtpYypzFollowUpSopMapper.selectSDtpYypzFollowUpSopList", pd);
     }
+    public List<PageData> selectDrugsByTemplateId(PageData pd) throws Exception{
+        return (List<PageData>) daoSupport.findForList("SDtpYypzFollowUpSopMapper.selectDrugsByTemplateId", pd);
+    }
+    public List<PageData> selectNodeConfigByTemplateId(PageData pd) throws Exception{
+        List<PageData> nodeList= (List<PageData>) daoSupport.findForList("SDtpYypzFollowUpSopMapper.selectNodeConfigByTemplateId", pd);
+        // 遍历 nodeList 并处理每个节点的 filterCondition 字段
+                for (PageData node : nodeList) {
+                Object filterConditionBlob = node.get("filterCondition");
+                if (filterConditionBlob instanceof Blob) {
+                    try {
+                        Blob blob = (Blob) filterConditionBlob;
+                        String jsonString = IOUtils.toString(blob.getBinaryStream(), StandardCharsets.UTF_8);
+                        // 将 JSON 字符串解析为 Map 或其他合适的对象类型
+                        // 将解析后的对象设置回 PageData
+                        node.put("filterCondition", jsonString);
+                    } catch (IOException | SQLException e) {
+                        // 处理异常
+                        System.out.println("处理 filterCondition BLOB 数据失败: "+ e);
+                        node.put("filterCondition", null); // 或者设置默认值
+                    }
+                }
+
+             }
+          return nodeList;
+    }
+    public PageData selectTemplateById(PageData pd) throws Exception{
+        PageData pdObj= (PageData) daoSupport.findForObject("SDtpYypzFollowUpSopMapper.selectTemplateById", pd);
+        return pdObj ;
+    }
 
     public Integer SDtpYypzFollowUpSopRemove(PageData pd)throws Exception {
         return daoSupport.delete("SDtpYypzFollowUpSopMapper.SDtpYypzFollowUpSopRemove", pd);
     }
 
-
     public Integer updateSDtpYypzFollowUpSop(PageData pd)throws Exception {
         return daoSupport.update("SDtpYypzFollowUpSopMapper.updateSDtpYypzFollowUpSop", pd);
     }
-
+    public Integer updateSopStatusByTemplateId(PageData pd)throws Exception {
+        pd.put("updatedBy",getSysUser().getLoginName());
+        pd.put("updatedTime",DateUtils.getTime());
+        int b=0;
+       int a=  daoSupport.update("SDtpYypzFollowUpSopMapper.updateSopStatusByTemplateId", pd);
+       if(a>0){
+           b=  daoSupport.update("SDtpYypzFollowUpSopMapper.updateNodeconfigStatusByTemplateId", pd);
+       }
+        System.out.println("a:"+a+"b:"+b);
+       if(a>0 && b>0){
+           return 2;
+       }else{
+           return 0;
+       }
+   }
 }

+ 3 - 0
health-system/src/main/java/com/bzd/system/service/spgl/SPProductinfoService.java

@@ -132,6 +132,9 @@ public class SPProductinfoService {
     public List<PageData> findSPProductinfoList(PageData pd) throws Exception{
         return (List<PageData>) daoSupport.findForList("SPProductinfoMapper.findSPProductinfoList", pd);
     }
+    public List<PageData> findSPProductinfoListBYProductCode(PageData pd) throws Exception{
+        return (List<PageData>) daoSupport.findForList("SPProductinfoMapper.findSPProductinfoListBYProductCode", pd);
+    }
 
     public Integer SPProductinfoRemove(PageData pd)throws Exception {
         // 查询数据 code

+ 232 - 22
health-system/src/main/resources/mapper/dtp/SDtpYypzFollowUpSopMapper.xml

@@ -4,46 +4,84 @@
     <!-- 通用查询映射结果 -->
 
     <select id="selectSDtpYypzFollowUpSopList" parameterType="pd" resultType="pd">
-        select * from s_dtp_yypz_follow_up_sop where 1=1
+        select up.*,dr.productName,dr.productCode,dr.specification from s_dtp_yypz_follow_up_sop up  left join s_dtp_yypz_template_drug dr on up.templateId=dr.templateId where 1=1
         <if test="id !=null and id !='' ">
-            and id = #{id}
+            and up.id = #{id}
         </if>
-        <if test="drug !=null and drug !='' ">
-            and drug = #{drug}
+        <if test="query != null and query != ''">
+            AND (dr.productName LIKE CONCAT('%', #{query}, '%') OR dr.productCode LIKE CONCAT('%', #{query}, '%'))
         </if>
         <if test="businessBelonging !=null and businessBelonging !='' ">
-            and businessBelonging = #{businessBelonging}
+            and up.businessBelonging = #{businessBelonging}
         </if>
         <if test="templateName !=null and templateName !='' ">
-            and templateName = #{templateName}
+            and up.templateName = #{templateName}
         </if>
         <if test="templateId !=null and templateId !='' ">
-            and templateId = #{templateId}
+            and up.templateId = #{templateId}
         </if>
         <if test="storeName !=null and storeName !='' ">
-            and storeName= #{storeName}
+            and up.storeName= #{storeName}
         </if>
         <if test="storeId !=null and storeId !='' ">
-            and storeId=  #{storeId}
+            and up.storeId=  #{storeId}
         </if>
         <if test="createdBy !=null and createdBy !='' ">
-            and createdBy = #{createdBy}
+            and up.createdBy = #{createdBy}
         </if>
         <if test="status !=null and status !='' ">
-            and status = #{status}
+            and up.status = #{status}
         </if>
-        <if test="createdTime !=null and createdTime !='' ">
-            and createdTime = #{createdTime}
+        <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
+            and up.createdTime between #{beginTime} and #{endTime}
         </if>
         <if test="updatedTime !=null and updatedTime !='' ">
-            and updatedTime = #{updatedTime}
+            and up.updatedTime = #{updatedTime}
         </if>
         <if test="updatedBy !=null and updatedBy !='' ">
-            and updatedBy = #{updatedBy}
+            and up.updatedBy = #{updatedBy}
         </if>
     </select>
 
+    <select id="selectDrugsByTemplateId" parameterType="pd" resultType="pd">
+        SELECT * FROM s_dtp_yypz_template_drug WHERE templateId = #{templateId}
+    </select>
+    <select id="selectTemplateById" parameterType="pd" resultType="pd">
+        SELECT * FROM s_dtp_yypz_follow_up_sop WHERE id = #{id}
+    </select>
+    <select id="selectNodeConfigByTemplateId" parameterType="pd" resultType="pd">
+        SELECT * FROM s_dtp_yypz_nodeconfig WHERE templateId = #{templateId}
+    </select>
 
+
+    <update id="updateNodeconfigStatusByTemplateId" parameterType="pd" >
+        update s_dtp_yypz_nodeconfig
+        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
+        <if test="status !=null and status !='' ">
+            status = #{status},
+        </if>
+        </trim>
+            <if test="templateId != null and templateId!=''">
+                where templateId=#{templateId}
+            </if>
+    </update>
+    <update id="updateSopStatusByTemplateId" parameterType="pd" >
+        update s_dtp_yypz_follow_up_sop
+        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
+            <if test="status !=null and status !='' ">
+                status = #{status},
+            </if>
+            <if test="updatedTime !=null and updatedTime !='' ">
+                updatedTime = #{updatedTime},
+            </if>
+            <if test="updatedBy !=null and updatedBy !='' ">
+                updatedBy = #{updatedBy},
+            </if>
+        </trim>
+            <if test="templateId != null and templateId!=''">
+                where templateId=#{templateId}
+            </if>
+    </update>
     <update id="updateSDtpYypzFollowUpSop" parameterType="pd" >
         update s_dtp_yypz_follow_up_sop
         <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
@@ -179,7 +217,7 @@
     <insert id="insertNodeConfig" parameterType="pd">
         INSERT INTO s_dtp_yypz_nodeconfig
         <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
-            <if test="sopTemplateId != null and sopTemplateId != ''">sopTemplateId,</if>
+            <if test="templateId != null and templateId != ''">templateId,</if>
             <if test="nodeName != null and nodeName != ''">nodeName,</if>
             <if test="nodeCode != null and nodeCode != ''">nodeCode,</if>
             <if test="activateStructures != null and activateStructures != ''">activateStructures,</if>
@@ -212,7 +250,7 @@
             <if test="status != null and status != ''">status</if>
         </trim>
         <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
-            <if test="sopTemplateId != null and sopTemplateId != ''">#{sopTemplateId},</if>
+            <if test="templateId != null and templateId != ''">#{templateId},</if>
             <if test="nodeName != null and nodeName != ''">#{nodeName},</if>
             <if test="nodeCode != null and nodeCode != ''">#{nodeCode},</if>
             <if test="activateStructures != null and activateStructures != ''">#{activateStructures},</if>
@@ -248,7 +286,7 @@
     <update id="updateNodeConfig" parameterType="pd">
         UPDATE s_dtp_yypz_nodeconfig
         <set>
-            <if test="sopTemplateId != null and sopTemplateId != ''">sopTemplateId = #{sopTemplateId},</if>
+            <if test="templateId != null and templateId != ''">templateId = #{templateId},</if>
             <if test="nodeName != null and nodeName != ''">nodeName = #{nodeName},</if>
             <if test="nodeCode != null and nodeCode != ''">nodeCode = #{nodeCode},</if>
             <if test="activateStructures != null and activateStructures != ''">activateStructures = #{activateStructures},</if>
@@ -302,7 +340,7 @@
     <insert id="batchAddNodeConfig" parameterType="java.util.List" useGeneratedKeys="false">
         INSERT INTO s_dtp_yypz_nodeconfig
         <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
-            <if test="dataList[0].sopTemplateId != null and dataList[0].sopTemplateId != ''">sopTemplateId,</if>
+            <if test="dataList[0].templateId != null and dataList[0].templateId != ''">templateId,</if>
             <if test="dataList[0].nodeName != null and dataList[0].nodeName != ''">nodeName,</if>
             <if test="dataList[0].nodeCode != null and dataList[0].nodeCode != ''">nodeCode,</if>
             <if test="dataList[0].activateStructures != null and dataList[0].activateStructures != ''">activateStructures,</if>
@@ -337,7 +375,7 @@
         VALUES
         <foreach item="item" index="index" collection="dataList" separator=",">
             <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
-                <if test="item.sopTemplateId != null and item.sopTemplateId != ''">#{item.sopTemplateId},</if>
+                <if test="item.templateId != null and item.templateId != ''">#{templateId},</if>
                 <if test="item.nodeName != null and item.nodeName != ''">#{item.nodeName},</if>
                 <if test="item.nodeCode != null and item.nodeCode != ''">#{item.nodeCode},</if>
                 <if test="item.activateStructures != null and item.activateStructures != ''">#{item.activateStructures},</if>
@@ -377,8 +415,8 @@
             UPDATE s_dtp_yypz_nodeconfig
             SET
             <trim prefix="" suffixOverrides=",">
-                <if test="item.sopTemplateId != null and item.sopTemplateId != ''">
-                    sopTemplateId = #{item.sopTemplateId},
+                <if test="item.templateId != null and item.templateId != ''">
+                    templateId = #{templateId},
                 </if>
                 <if test="item.nodeName != null and item.nodeName != ''">
                     nodeName = #{item.nodeName},
@@ -475,4 +513,176 @@
         </foreach>
     </update>
 
+
+
+
+
+    <select id="selectTemplateDrug" parameterType="pd" resultType="pd">
+        select * from s_dtp_yypz_template_drug where 1=1
+        <if test="templateName != null and templateName != ''">
+            and templateName = #{templateName}
+        </if>
+        <if test="templateId != null and templateId != ''">
+            and templateId = #{templateId}
+        </if>
+        <if test="productName != null and productName != ''">
+            and productName = #{productName}
+        </if>
+        <if test="productCode != null and productCode != ''">
+            and productCode = #{productCode}
+        </if>
+        <if test="specification != null and specification != ''">
+            and specification = #{specification}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            and storeId = #{storeId}
+        </if>
+        <if test="createdTime != null">
+            and createdTime = #{createdTime}
+        </if>
+        <if test="updatedTime != null">
+            and updatedTime = #{updatedTime}
+        </if>
+    </select>
+
+    <select id="selectOneById" parameterType="pd" resultType="pd">
+        select * from s_dtp_yypz_template_drug where id = #{id}
+    </select>
+
+    <select id="checkValueByCode" parameterType="pd" resultType="pd">
+        select * from s_dtp_yypz_template_drug where productCode = #{productCode}
+    </select>
+
+    <delete id="deleteTemplateDrugByIds" parameterType="java.util.List">
+        <if test="list != null and list.size() > 0">
+            delete from s_dtp_yypz_template_drug
+            where id in
+            <foreach item="id" index="index" collection="list" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+    </delete>
+
+
+    <delete id="deleteTemplateDrugByTemplateId" parameterType="pd">
+            delete from s_dtp_yypz_template_drug  where templateId = #{templateId}
+    </delete>
+
+    <update id="updateTemplateDrug" parameterType="pd">
+        update s_dtp_yypz_template_drug
+        <trim prefix="SET " suffix="" prefixOverrides="," suffixOverrides=",">
+            <if test="templateName != null and templateName != ''">
+                templateName = #{templateName},
+            </if>
+            <if test="templateId != null and templateId != ''">
+                templateId = #{templateId},
+            </if>
+            <if test="productName != null and productName != ''">
+                productName = #{productName},
+            </if>
+            <if test="productCode != null and productCode != ''">
+                productCode = #{productCode},
+            </if>
+            <if test="specification != null and specification != ''">
+                specification = #{specification},
+            </if>
+            <if test="storeId != null and storeId != ''">
+                storeId = #{storeId},
+            </if>
+            <if test="updatedBy != null and updatedBy != ''">
+                updatedBy = #{updatedBy},
+            </if>
+            <if test="updatedTime != null">
+                updatedTime = #{updatedTime},
+            </if>
+        </trim>
+        <if test="id != null">
+            where id = #{id}
+        </if>
+    </update>
+
+
+
+    <insert id="insertTemplateDrug" parameterType="pd">
+        insert into s_dtp_yypz_template_drug
+        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="templateName != null and templateName != ''">
+                templateName,
+            </if>
+            <if test="templateId != null and templateId != ''">
+                templateId,
+            </if>
+            <if test="productName != null and productName != ''">
+                productName,
+            </if>
+            <if test="productCode != null and productCode != ''">
+                productCode,
+            </if>
+            <if test="specification != null and specification != ''">
+                specification,
+            </if>
+            <if test="storeId != null and storeId != ''">
+                storeId,
+            </if>
+            <if test="createdTime != null">
+                createdTime,
+            </if>
+            <if test="updatedTime != null">
+                updatedTime,
+            </if>
+        </trim>
+        <trim prefix="VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="templateName != null and templateName != ''">
+                #{templateName},
+            </if>
+            <if test="templateId != null and templateId != ''">
+                #{templateId},
+            </if>
+            <if test="productName != null and productName != ''">
+                #{productName},
+            </if>
+            <if test="productCode != null and productCode != ''">
+                #{productCode},
+            </if>
+            <if test="specification != null and specification != ''">
+                #{specification},
+            </if>
+            <if test="storeId != null and storeId != ''">
+                #{storeId},
+            </if>
+            <if test="createdTime != null">
+                #{createdTime},
+            </if>
+            <if test="updatedTime != null">
+                #{updatedTime},
+            </if>
+        </trim>
+    </insert>
+
+    <insert id="batchAddTemplateDrugDynamic" parameterType="java.util.List">
+        INSERT INTO s_dtp_yypz_template_drug
+        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+            <if test="dataList[0].templateName != null and dataList[0].templateName != ''">templateName,</if>
+            <if test="dataList[0].templateId != null and dataList[0].templateId != ''">templateId,</if>
+            <if test="dataList[0].productName != null and dataList[0].productName != ''">productName,</if>
+            <if test="dataList[0].productCode != null and dataList[0].productCode != ''">productCode,</if>
+            <if test="dataList[0].specification != null and dataList[0].specification != ''">specification,</if>
+            <if test="dataList[0].storeId != null and dataList[0].storeId != ''">storeId,</if>
+            <if test="dataList[0].createdTime != null">createdTime,</if>
+            <if test="dataList[0].updatedTime != null">updatedTime</if>
+        </trim>
+        VALUES
+        <foreach collection="dataList" item="item" separator=",">
+            <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
+                <if test="item.templateName != null and item.templateName != ''">#{item.templateName},</if>
+                <if test="item.templateId != null and item.templateId != ''">#{item.templateId},</if>
+                <if test="item.productName != null and item.productName != ''">#{item.productName},</if>
+                <if test="item.productCode != null and item.productCode != ''">#{item.productCode},</if>
+                <if test="item.specification != null and item.specification != ''">#{item.specification},</if>
+                <if test="item.storeId != null and item.storeId != ''">#{item.storeId},</if>
+                <if test="item.createdTime != null">#{item.createdTime},</if>
+                <if test="item.updatedTime != null">#{item.updatedTime}</if>
+            </trim>
+        </foreach>
+    </insert>
 </mapper>

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

@@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
 	<select id="slectPatientByNameOrPhoneOrIdCard" parameterType="pd" resultType="pd">
-		select * from s_dtp_ysfw_archive_management where  1=1  AND name LIKE CONCAT('%', #{query}, '%') or phoneNumber=#{query} or documentNumber=#{query}
+		select * from s_dtp_ysfw_archive_management where  1=1  AND name LIKE CONCAT('%', #{query}, '%') or phoneNumber=#{query} or id=#{query} or documentNumber=#{query}
 	</select>
 
 	<select id="slectPatientById" parameterType="pd" resultType="pd">

+ 6 - 0
health-system/src/main/resources/mapper/spgl/SPProductinfoMapper.xml

@@ -83,7 +83,13 @@
         </if>
 
     </select>
+    <select id="findSPProductinfoListBYProductCode" parameterType="pd" resultType="pd">
+        select * from s_gxhpz_product_info where 1=1
 
+        <if test="product_code != null and product_code != ''">
+            and product_code = #{product_code}
+        </if>
+    </select>
 
     <update id="updateSSpglJfspProductinfo" parameterType="pd" >
         update s_gxhpz_product_info

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff