diff --git a/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql b/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql index 846fcf4..ceb9bce 100644 --- a/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql +++ b/DataBase/版本日志/SGGLDB_2025-04-14-geh.sql @@ -1,5 +1,5 @@ ALTER TABLE Training_TestRecord -ADD COLUMN Signature NVARCHAR(1000), -ADD COLUMN Fingerprint NVARCHAR(1000), -ADD COLUMN CompanyTrainingItemId NVARCHAR(50); +ADD Signature NVARCHAR(1000), +ADD Fingerprint NVARCHAR(1000), +ADD CompanyTrainingItemId NVARCHAR(50); go \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_2025-04-15-geh.sql b/DataBase/版本日志/SGGLDB_2025-04-15-geh.sql new file mode 100644 index 0000000..0526406 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_2025-04-15-geh.sql @@ -0,0 +1,72 @@ + + +CREATE TABLE [dbo].[InformedConsentForm] ( + [FormId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL, + [WorkPostName] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL, + [JobRiskNotice] nvarchar(max) NULL, + [HealthCommitment] nvarchar(max) NULL, + [SafetyCommitment] nvarchar(max) NULL, + [SafetyQualityResponsibility] nvarchar(max) NULL, +) + +GO + +EXEC sp_addextendedproperty +'MS_Description', N'主键', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm', +'COLUMN', N'FormId' +GO + +EXEC sp_addextendedproperty +'MS_Description', N'岗位', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm', +'COLUMN', N'WorkPostName' +GO + +EXEC sp_addextendedproperty +'MS_Description', N'岗位危险告知书', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm', +'COLUMN', N'JobRiskNotice' +GO + +EXEC sp_addextendedproperty +'MS_Description', N'入场工人健康承诺书', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm', +'COLUMN', N'HealthCommitment' +GO + +EXEC sp_addextendedproperty +'MS_Description', N'安全承诺书', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm', +'COLUMN', N'SafetyCommitment' +GO + +EXEC sp_addextendedproperty +'MS_Description', N'安全质量责任书', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm', +'COLUMN', N'SafetyQualityResponsibility' +GO + +EXEC sp_addextendedproperty +'MS_Description', N'告知承诺书', +'SCHEMA', N'dbo', +'TABLE', N'InformedConsentForm' + + + +ALTER TABLE SitePerson_Person +ADD SignTime datetime NULL +go + +EXEC sp_addextendedproperty +'MS_Description', N'签字时间', +'SCHEMA', N'dbo', +'TABLE', N'SitePerson_Person', +'COLUMN', N'SignTime' +GO diff --git a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电工).doc b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电工).doc index 444d2f8..6548481 100644 --- a/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电工).doc +++ b/SUBQHSE/FineUIPro.Web/File/Word/Person/安全教育培训打印整套(电工).doc @@ -113,7 +113,7 @@ 中化学建设投资集团安徽工程有限公司 - 合肥市五里庙复建点东区项目部 + «projectName» «date2» @@ -143,7 +143,7 @@ 承诺人(签字和按手印)«sign3» - 日期: 年 月 日 + 日期: «date2» @@ -168,7 +168,7 @@ 承诺人:«sign4» - 承诺时间: 年 月 日 + 承诺时间: «date2» @@ -261,7 +261,7 @@ - 年 月 日 年 月 日 + 年 月 日 «date2» diff --git a/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs b/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs index 5dac125..1bdd9ce 100644 --- a/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs +++ b/SUBQHSE/FineUIPro.Web/HSSE/SitePerson/PersonList.aspx.cs @@ -777,6 +777,7 @@ namespace FineUIPro.Web.HSSE.SitePerson } var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == Grid1.SelectedRowID); + var personData = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == Grid1.SelectedRowID); if (person != null) { @@ -903,7 +904,6 @@ namespace FineUIPro.Web.HSSE.SitePerson join user in Funs.DB.Sys_User on TestPlan.PlanManId equals user.UserId into gUser from user in gUser.DefaultIfEmpty() where x.TestManId == person.PersonId - // where x.TestManId == "d9f795a2-b8eb-4872-9e4c-4a3dba028b5c" orderby x.TestEndTime descending select new { @@ -998,20 +998,16 @@ namespace FineUIPro.Web.HSSE.SitePerson helper.AddImage(string.Empty, "sign2", 0, 0, 0, 0); } - DateTime dateTime2 = new DateTime(2024, 6, 25); - // 构建格式化的字符串 - string date2 = $" {dateTime2.Year} 年 {dateTime2.Month:D2} 月 {dateTime2.Day:D2} 日"; + string date2 = personData.SignTime.HasValue + ? $" {personData.SignTime.Value.Year} 年 {personData.SignTime.Value.Month:D2} 月 {personData.SignTime.Value.Day:D2} 日" + : ""; string IdentityCard = person.IdentityCard; string Telephone = person.Telephone; - // 假设我们有一个DateTime对象 - DateTime dateTime = new DateTime(2024, 6, 25); - - // 提取年、月、日 - int year = dateTime.Year; - int month = dateTime.Month; - int day = dateTime.Day; + string year = person.InTime.HasValue ? person.InTime.Value.Year.ToString() : ""; + string month = person.InTime.HasValue ? person.InTime.Value.Month.ToString() : ""; + string day = person.InTime.HasValue ? person.InTime.Value.Day.ToString() : ""; string sign3 = AttachFileService.getFileUrl(person.PersonId + "_3"); if (!string.IsNullOrEmpty(sign3)) diff --git a/SUBQHSE/Model/Model.cs b/SUBQHSE/Model/Model.cs index f8e0ad8..f4004d7 100644 --- a/SUBQHSE/Model/Model.cs +++ b/SUBQHSE/Model/Model.cs @@ -6909,6 +6909,14 @@ namespace Model } } + public System.Data.Linq.Table InformedConsentForm + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table InterFaceLog { get @@ -237894,6 +237902,123 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.InformedConsentForm")] + public partial class InformedConsentForm + { + + private string _FormId; + + private string _WorkPostName; + + private string _JobRiskNotice; + + private string _HealthCommitment; + + private string _SafetyCommitment; + + private string _SafetyQualityResponsibility; + + public InformedConsentForm() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FormId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string FormId + { + get + { + return this._FormId; + } + set + { + if ((this._FormId != value)) + { + this._FormId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostName", DbType="NVarChar(50)")] + public string WorkPostName + { + get + { + return this._WorkPostName; + } + set + { + if ((this._WorkPostName != value)) + { + this._WorkPostName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobRiskNotice", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string JobRiskNotice + { + get + { + return this._JobRiskNotice; + } + set + { + if ((this._JobRiskNotice != value)) + { + this._JobRiskNotice = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HealthCommitment", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string HealthCommitment + { + get + { + return this._HealthCommitment; + } + set + { + if ((this._HealthCommitment != value)) + { + this._HealthCommitment = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SafetyCommitment", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string SafetyCommitment + { + get + { + return this._SafetyCommitment; + } + set + { + if ((this._SafetyCommitment != value)) + { + this._SafetyCommitment = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SafetyQualityResponsibility", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] + public string SafetyQualityResponsibility + { + get + { + return this._SafetyQualityResponsibility; + } + set + { + if ((this._SafetyQualityResponsibility != value)) + { + this._SafetyQualityResponsibility = value; + } + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.InterFaceLog")] public partial class InterFaceLog : INotifyPropertyChanging, INotifyPropertyChanged { @@ -363390,6 +363515,8 @@ namespace Model private string _PersonStates; + private System.Nullable _SignTime; + private EntitySet _Accident_AccidentPersonRecord; private EntitySet _Accident_AccidentReportOtherItem; @@ -363592,6 +363719,8 @@ namespace Model partial void OnLanguagesChanged(); partial void OnPersonStatesChanging(string value); partial void OnPersonStatesChanged(); + partial void OnSignTimeChanging(System.Nullable value); + partial void OnSignTimeChanged(); #endregion public SitePerson_Person() @@ -365022,6 +365151,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SignTime", DbType="DateTime")] + public System.Nullable SignTime + { + get + { + return this._SignTime; + } + set + { + if ((this._SignTime != value)) + { + this.OnSignTimeChanging(value); + this.SendPropertyChanging(); + this._SignTime = value; + this.SendPropertyChanged("SignTime"); + this.OnSignTimeChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentPersonRecord_SitePerson_Person", Storage="_Accident_AccidentPersonRecord", ThisKey="PersonId", OtherKey="PersonId", DeleteRule="NO ACTION")] public EntitySet Accident_AccidentPersonRecord { diff --git a/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs b/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs new file mode 100644 index 0000000..9dd1fec --- /dev/null +++ b/SUBQHSE/WebAPI/Controllers/HSSE/InformedConsentFormController.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using BLL; +using Model; + +namespace WebAPI.Controllers.HSSE +{ + public class InformedConsentFormController:ApiController + { + #region 根据用户获取告知书 + + /// + /// + /// + /// + public Model.ResponeData getFormByWorkPostName(string PersonId) + { + var responeData = new Model.ResponeData(); + try + { + var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == PersonId); + InformedConsentForm getData = new InformedConsentForm(); + if (person != null) + { + string projectName = Funs.DB.Base_Project.First(z => z.ProjectId == person.ProjectId).ProjectName; + string name = person.PersonName; + string IdentityCard = person.IdentityCard; + string Telephone = person.Telephone; + string year = person.InTime.HasValue ? person.InTime.Value.Year.ToString() : ""; + string month = person.InTime.HasValue ? person.InTime.Value.Month.ToString() : ""; + string day = person.InTime.HasValue ? person.InTime.Value.Day.ToString() : ""; + getData = (from x in Funs.DB.InformedConsentForm + where x.WorkPostName == person.WorkPostName + select x).FirstOrDefault(); + if (getData != null) + { + // 替换$name占位符 + getData.JobRiskNotice = getData.JobRiskNotice.Replace("$name", name); + // 替换多个占位符 + getData.HealthCommitment = getData.HealthCommitment.Replace("$name", name) + .Replace("$IdentityCard", IdentityCard) + .Replace("$Telephone", Telephone) + .Replace("$year", year) + .Replace("$month", month) + .Replace("$day", day) + .Replace("$projectName", projectName); + } + } + + responeData.data = new { getData }; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion + + #region 签字保存后根据人员id修改签字时间 + + /// + /// 保存签字图片的时格式是tokenkey=PersonId_1 + /// + /// + [HttpPost] + public Model.ResponeData updateSignTime(string PersonId, DateTime? newSignTime = null) + { + using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString)) + { + var responeData = new Model.ResponeData(); + try + { + // 查找要修改的记录 + var person = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == PersonId); + if (person != null) + { + person.SignTime = newSignTime.HasValue ? newSignTime.Value : DateTime.Now; // 更新签字时间 + db.SubmitChanges(); + responeData.code = 1; + responeData.message = "保存成功。"; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + } + + #endregion + } +} \ No newline at end of file diff --git a/SUBQHSE/WebAPI/WebAPI.csproj b/SUBQHSE/WebAPI/WebAPI.csproj index 81556ae..31706d2 100644 --- a/SUBQHSE/WebAPI/WebAPI.csproj +++ b/SUBQHSE/WebAPI/WebAPI.csproj @@ -201,6 +201,7 @@ +