|
@@ -1,8 +1,10 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "FollowUp_Notice/Nats/NatsServer"
|
|
|
"FollowUp_Notice/conf"
|
|
|
"FollowUp_Notice/http"
|
|
|
+ "FollowUp_Notice/http/submail"
|
|
|
"FollowUp_Notice/lib"
|
|
|
"FollowUp_Notice/logs"
|
|
|
"FollowUp_Notice/models/Account"
|
|
@@ -12,9 +14,14 @@ import (
|
|
|
"FollowUp_Notice/models/System"
|
|
|
"FollowUp_Notice/models/Tag"
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
|
"github.com/robfig/cron/v3"
|
|
|
+ "github.com/signintech/gopdf"
|
|
|
+ "github.com/signintech/gopdf/fontmaker/core"
|
|
|
+ "log"
|
|
|
"math"
|
|
|
+ "os"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -76,7 +83,7 @@ func (c *PatientController) Patient_List() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// 添加患者信息
|
|
|
+// 导入患者信息
|
|
|
func (c *PatientController) Patient_Add() {
|
|
|
|
|
|
T_number := c.GetString("T_number")
|
|
@@ -267,7 +274,7 @@ func (c *PatientController) Patient_Del() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- if c.User.Id != 1 || c.User.Id != patient.T_uid {
|
|
|
+ if c.User.Id != 1 && c.User.Id != patient.T_uid {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "无权删除!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
@@ -285,6 +292,56 @@ func (c *PatientController) Patient_Del() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// 发送患者满意度调查
|
|
|
+func (c *PatientController) Patient_Send_Satisfaction() {
|
|
|
+ T_pid := c.GetString("T_pid")
|
|
|
+ if len(T_pid) == 0 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_pid Err!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ pidList := strings.Split(T_pid, ",")
|
|
|
+
|
|
|
+ go func() {
|
|
|
+
|
|
|
+ for _, v := range pidList {
|
|
|
+ pid, _ := strconv.Atoi(v)
|
|
|
+ patient, err := Patient.Read_Patient_ById(pid)
|
|
|
+ playInfoList := http.GetSatisfactionPlayInfoList([]string{patient.T_name, c.User.T_user})
|
|
|
+ res, err := http.VoiceNotifyAPI(conf.VoiceCall_Phone, "+86"+patient.T_phone, playInfoList)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "电话通知失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存电话通知发送记录
|
|
|
+ send := Patient.PatientSend{
|
|
|
+ T_uid: c.User.Id,
|
|
|
+ T_pid: patient.Id,
|
|
|
+ T_phone: patient.T_phone,
|
|
|
+ T_type: 3,
|
|
|
+ T_id: res.SessionId,
|
|
|
+ T_code: res.Resultcode,
|
|
|
+ T_State: 0,
|
|
|
+ }
|
|
|
+
|
|
|
+ _, err = Patient.Add_PatientSend(send)
|
|
|
+ if err != nil {
|
|
|
+ System.Add_SysLogs_T("复诊通知", "添加发送记录失败", send)
|
|
|
+ }
|
|
|
+
|
|
|
+ if res.Resultcode != "0" {
|
|
|
+ System.Add_SysLogs_T("复诊通知", "添加发送记录失败", send)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }()
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "发送成功!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func (c *PatientController) VoiceCall_Status() {
|
|
|
// {"eventType":"callout","statusInfo":{"sessionId":"1201_14852_4294967295_20230529072219@callenabler245.huaweicaas.com","timestamp":"2023-05-29 07:22:19","caller":"+8651668971369","called":"+8618086869080"}}
|
|
|
logs.Println("VoiceCall RequestBody-", string(c.Ctx.Input.RequestBody))
|
|
@@ -298,6 +355,7 @@ func (c *PatientController) VoiceCall_Status() {
|
|
|
Called string `json:"called"`
|
|
|
StateCode int `json:"stateCode"`
|
|
|
StateDesc string `json:"stateDesc"`
|
|
|
+ DigitInfo string `json:"digitInfo"`
|
|
|
} `json:"statusInfo"`
|
|
|
}
|
|
|
|
|
@@ -308,18 +366,18 @@ func (c *PatientController) VoiceCall_Status() {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "json.Unmarshal is err:" + err.Error()}
|
|
|
c.ServeJSON()
|
|
|
}
|
|
|
+ r, err := Patient.Read_PatientSend_ByT_id(body.StatusInfo.SessionId)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "SessionId Err!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if body.EventType == "disconnect" {
|
|
|
- r, err := Patient.Read_PatientSend_ByT_id(body.StatusInfo.SessionId)
|
|
|
- if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "SessionId Err!"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
if body.StatusInfo.StateCode == 0 {
|
|
|
r.T_State = 1
|
|
|
}
|
|
|
- r.T_code = body.StatusInfo.StateCode
|
|
|
+ r.T_code = strconv.Itoa(body.StatusInfo.StateCode)
|
|
|
r.T_remark = body.StatusInfo.StateDesc
|
|
|
err = Patient.Update_PatientSend(r, "T_State", "T_remark", "T_code")
|
|
|
if err != nil {
|
|
@@ -327,14 +385,424 @@ func (c *PatientController) VoiceCall_Status() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ if body.EventType == "collectInfo" {
|
|
|
+ // 放音收号回调
|
|
|
+ r.T_type = 3
|
|
|
+ r.T_code = strconv.Itoa(body.StatusInfo.StateCode)
|
|
|
+ if len(r.T_digitInfo) == 0 {
|
|
|
+ r.T_digitInfo = body.StatusInfo.DigitInfo
|
|
|
+ } else if len(r.T_digitInfo) > 0 {
|
|
|
+ r.T_digitInfo += "," + body.StatusInfo.DigitInfo
|
|
|
+ }
|
|
|
+ err = Patient.Update_PatientSend(r, "T_type", "T_digitInfo")
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改放音收号结果失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if r.T_type == 3 {
|
|
|
+ go Add_PatientSatisfaction(body.StatusInfo.SessionId)
|
|
|
}
|
|
|
+
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
+func Add_PatientSatisfaction(SessionId string) {
|
|
|
+ r, err := Patient.Read_PatientSend_ByT_id(SessionId)
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(lib.FuncName(), err)
|
|
|
+ }
|
|
|
+ //if len(r.T_digitInfo) == 0 {
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ var T_digitInfo []string
|
|
|
+ if len(r.T_digitInfo) > 0 {
|
|
|
+ T_digitInfo = strings.Split(r.T_digitInfo, ",")
|
|
|
+ }
|
|
|
+ // 补齐长度为5
|
|
|
+ for len(T_digitInfo) < 5 {
|
|
|
+ T_digitInfo = append(T_digitInfo, "0")
|
|
|
+ }
|
|
|
+
|
|
|
+ satis := Patient.PatientSatisfaction{
|
|
|
+ T_id: SessionId,
|
|
|
+ T_uid: r.T_uid,
|
|
|
+ T_pid: r.T_pid,
|
|
|
+ T_question1: T_digitInfo[0],
|
|
|
+ T_question2: T_digitInfo[1],
|
|
|
+ T_question3: T_digitInfo[2],
|
|
|
+ T_question4: T_digitInfo[3],
|
|
|
+ T_question5: T_digitInfo[4],
|
|
|
+ }
|
|
|
+ Patient.Add_PatientSatisfaction(satis)
|
|
|
+}
|
|
|
+
|
|
|
+// 导入患者信息
|
|
|
+func (c *PatientController) Patient_Import() {
|
|
|
+
|
|
|
+ T_number := c.GetString("T_number")
|
|
|
+ T_name := c.GetString("T_name")
|
|
|
+ T_age, _ := c.GetInt("T_age")
|
|
|
+
|
|
|
+ T_tag := c.GetString("T_tag")
|
|
|
+
|
|
|
+ T_tag_list := strings.Split(strings.Trim(T_tag, " "), "、")
|
|
|
+ tagIdList := []string{}
|
|
|
+ for _, t := range T_tag_list {
|
|
|
+ id, err := Tag.ReadOrCreate_Tag(Tag.Tag{
|
|
|
+ T_uid: c.User.Id,
|
|
|
+ T_name: t,
|
|
|
+ T_State: 1,
|
|
|
+ })
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加标签失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ tagIdList = append(tagIdList, strconv.Itoa(int(id)))
|
|
|
+ }
|
|
|
+
|
|
|
+ T_illness := c.GetString("T_illness")
|
|
|
+ illnesslId, err := Illness.ReadOrCreate_Illness(Illness.Illness{
|
|
|
+ T_uid: c.User.Id,
|
|
|
+ T_name: T_illness,
|
|
|
+ T_State: 1,
|
|
|
+ })
|
|
|
+ T_surgical := c.GetString("T_surgical")
|
|
|
+ surgicalId, err := Surgical.ReadOrCreate_Surgical(Surgical.Surgical{
|
|
|
+ T_uid: c.User.Id,
|
|
|
+ T_name: T_surgical,
|
|
|
+ T_State: 1,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加术式失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ T_phone := c.GetString("T_phone")
|
|
|
+ T_notice_phone := c.GetString("T_notice_phone")
|
|
|
+ phone := 0
|
|
|
+ if strings.Contains(T_notice_phone, "是") {
|
|
|
+ phone = 1
|
|
|
+ }
|
|
|
+ T_notice_message := c.GetString("T_notice_message")
|
|
|
+ message := 0
|
|
|
+ if strings.Contains(T_notice_message, "是") {
|
|
|
+ message = 1
|
|
|
+ }
|
|
|
+ // 下次复诊间隔天数
|
|
|
+ T_next_interval := c.GetString("T_next_interval")
|
|
|
+ T_record := time.Now().Format("2006-01-02") + "," + T_next_interval + "|"
|
|
|
+ var_ := Patient.Patient{
|
|
|
+ T_uid: c.User.Id,
|
|
|
+ T_number: T_number,
|
|
|
+ T_name: T_name,
|
|
|
+ T_age: T_age,
|
|
|
+ T_tag: "|" + strings.Join(tagIdList, "|") + "|",
|
|
|
+ T_illness: int(illnesslId),
|
|
|
+ T_surgical: int(surgicalId),
|
|
|
+ T_phone: T_phone,
|
|
|
+ T_notice_phone: phone,
|
|
|
+ T_notice_message: message,
|
|
|
+ T_notice_interval: "1,3",
|
|
|
+ T_record: T_record,
|
|
|
+ T_State: 1,
|
|
|
+ }
|
|
|
+ T_record_list := strings.Split(strings.Trim(T_record, "|"), "|")
|
|
|
+ var T_time string // 复诊时间
|
|
|
+ var T_interval int // 复诊间隔
|
|
|
+ if len(T_record_list) > 0 {
|
|
|
+ temp := T_record_list[len(T_record_list)-1]
|
|
|
+ T_time = strings.Split(temp, ",")[0]
|
|
|
+ T_interval, _ = strconv.Atoi(strings.Split(temp, ",")[1])
|
|
|
+ t, _ := lib.DateStrToTime(T_time)
|
|
|
+ nextTime := t.AddDate(0, 0, T_interval)
|
|
|
+ // 复诊状态 1正常 2超时 3结束
|
|
|
+ var_.T_follow_up = 1
|
|
|
+ if nextTime.Before(time.Now()) {
|
|
|
+ var_.T_follow_up = 2
|
|
|
+ }
|
|
|
+ if T_interval == 0 {
|
|
|
+ var_.T_follow_up = 3
|
|
|
+ }
|
|
|
+ var_.T_next_time = nextTime.Format("2006-01-02")
|
|
|
+ var_.T_notice = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ _, err = Patient.Add_Patient(var_)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 209, Msg: "添加失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ System.Add_UserLogs_T(c.User.T_uuid, "患者", "导入", var_)
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// 导出模板
|
|
|
+func (c *PatientController) Patient_ExportTemplate() {
|
|
|
+
|
|
|
+ //第一个参数是文件的地址,第二个参数是下载显示的文件的名称
|
|
|
+ c.Ctx.Output.Download("static/导入患者模板.xlsx", "导入患者模板.xlsx")
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (c *PatientController) VoiceCall_Satisfaction_PDF() {
|
|
|
+ T_id := c.GetString("T_id")
|
|
|
+ var err error
|
|
|
+ r, err := Patient.Read_PatientSatisfaction_ByT_id(T_id)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "SessionId Err!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ username := "某某医院某某科室"
|
|
|
+ if r.T_pid > 0 {
|
|
|
+ user, err := Account.Read_User_ByT_id(r.T_uid)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取用户信息失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ username = user.T_user
|
|
|
+ }
|
|
|
+
|
|
|
+ //读取pdf文件
|
|
|
+ pdf := &gopdf.GoPdf{}
|
|
|
+ pdf.Start(gopdf.Config{PageSize: *gopdf.PageSizeA4}) //595.28, 841.89 = A4
|
|
|
+ pdf.AddPage()
|
|
|
+ err = pdf.AddTTFFont("simsun", "static/fonts/MiSans-Medium.ttf")
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = pdf.SetFont("simsun", "", 26)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ textw, _ := pdf.MeasureTextWidth("患者满意度调查表")
|
|
|
+ pdf.SetX((595 / 2) - (textw / 2))
|
|
|
+ pdf.SetY(60)
|
|
|
+ pdf.Text("患者满意度调查表")
|
|
|
+
|
|
|
+ fontSize := 14
|
|
|
+ err = pdf.SetFont("simsun", "", fontSize)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var parser core.TTFParser
|
|
|
+ err = parser.Parse("static/fonts/MiSans-Medium.ttf")
|
|
|
+ if err != nil {
|
|
|
+ log.Print(err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ cap := float64(float64(parser.CapHeight()) * 1000.00 / float64(parser.UnitsPerEm()))
|
|
|
+ //convert
|
|
|
+ realHeight := cap * (float64(fontSize) / 1000.0) * 3
|
|
|
+ var x float64 = 45
|
|
|
+ pdf.SetXY(x, 100)
|
|
|
+ pdf.Cell(nil, "尊敬的各位患者朋友:")
|
|
|
+
|
|
|
+ msg := fmt.Sprintf("为了解各位对%s向社会和广大群众提供医疗服务的真实状况,请根据您的亲身经历或感受就以下5个问题对本科室进行真实、客观的评价,请在您认为合适的选项方框内划勾,非常感谢您的配合与支持!", username)
|
|
|
+ msgRune := []rune(msg)
|
|
|
+ for i := 0; i < len(msgRune); {
|
|
|
+ pdf.Br(realHeight)
|
|
|
+
|
|
|
+ end := 0
|
|
|
+ step := 0
|
|
|
+ if i == 0 {
|
|
|
+ pdf.SetX(x + float64(fontSize*2))
|
|
|
+ end = i + 34
|
|
|
+ step = 34
|
|
|
+ } else {
|
|
|
+ pdf.SetX(x)
|
|
|
+ end = i + 36
|
|
|
+ step = 36
|
|
|
+ }
|
|
|
+ if end > len(msgRune) {
|
|
|
+ end = len(msgRune)
|
|
|
+ }
|
|
|
+ pdf.Cell(nil, string(msgRune[i:end]))
|
|
|
+ i += step
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ realHeight2 := cap * (float64(fontSize) / 1000.0) * 4
|
|
|
+
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ RectFill(pdf, "1、您对初入病房时医护人员及时询问病情和检查,是否满意?", fontSize, x, realHeight2, r.T_question1)
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ RectFill2(pdf, "2、您入院后是否有告知您的管床医生和护士是谁?", fontSize, x, realHeight2, r.T_question2)
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ RectFill(pdf, "3、您对住院期间入院注意事项的交代是否满意?", fontSize, x, realHeight2, r.T_question3)
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ RectFill(pdf, "4、在住院期间,您对病情解释是否满意?", fontSize, x, realHeight2, r.T_question4)
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ RectFill(pdf, "5、您对医护人员的服务态度是否满意?", fontSize, x, realHeight2, r.T_question3)
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ pdf.Br(realHeight2)
|
|
|
+ pdf.SetX(400)
|
|
|
+ pdf.Cell(nil, fmt.Sprintf("日期:%s", r.CreateTime.Format("2006-01-02")))
|
|
|
+
|
|
|
+ timeStr := "ofile/" + time.Now().Format("20060102150405") + ".pdf"
|
|
|
+
|
|
|
+ err = pdf.WritePdf(timeStr)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: err.Error()}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 上传 OSS
|
|
|
+ url, is := NatsServer.Qiniu_UploadFile(lib.GetCurrentDirectory()+"/"+timeStr, timeStr)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "oss!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除目录
|
|
|
+ err = os.Remove(timeStr)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: url}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func RectFill(pdf *gopdf.GoPdf, text string, fontSize int, x, realHeight float64, digitInfo string) {
|
|
|
+ pdf.SetX(x)
|
|
|
+ pdf.Cell(nil, text)
|
|
|
+
|
|
|
+ pdf.Br(realHeight)
|
|
|
+
|
|
|
+ //textw, _ := pdf.MeasureTextWidth(text)
|
|
|
+
|
|
|
+ //y := x + textw
|
|
|
+ y := x
|
|
|
+
|
|
|
+ var LineWidth float64 = 1
|
|
|
+
|
|
|
+ var text1 = ""
|
|
|
+ if digitInfo == "1" {
|
|
|
+ text1 = "√"
|
|
|
+ }
|
|
|
+ pdf.SetX(y + float64(fontSize*2))
|
|
|
+ pdf.SetLineWidth(LineWidth)
|
|
|
+ pdf.SetLineType("") // 线条样式
|
|
|
+ pdf.CellWithOption(&gopdf.Rect{
|
|
|
+ W: float64(fontSize),
|
|
|
+ H: float64(fontSize),
|
|
|
+ }, text1, gopdf.CellOption{Align: gopdf.Center | gopdf.Middle,
|
|
|
+ Border: gopdf.Left | gopdf.Right | gopdf.Bottom | gopdf.Top,
|
|
|
+ })
|
|
|
+ pdf.Cell(nil, " 非常满意")
|
|
|
+
|
|
|
+ var text2 = ""
|
|
|
+ if digitInfo == "2" {
|
|
|
+ text2 = "√"
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf.SetX(y + float64(fontSize*9))
|
|
|
+ pdf.SetLineWidth(LineWidth)
|
|
|
+ pdf.SetLineType("") // 线条样式
|
|
|
+ pdf.CellWithOption(&gopdf.Rect{
|
|
|
+ W: float64(fontSize),
|
|
|
+ H: float64(fontSize),
|
|
|
+ }, text2, gopdf.CellOption{Align: gopdf.Center | gopdf.Middle,
|
|
|
+ Border: gopdf.Left | gopdf.Right | gopdf.Bottom | gopdf.Top,
|
|
|
+ })
|
|
|
+ pdf.Cell(nil, " 满意")
|
|
|
+
|
|
|
+ var text3 = ""
|
|
|
+ if digitInfo == "3" {
|
|
|
+ text3 = "√"
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf.SetX(y + float64(fontSize*14))
|
|
|
+ pdf.SetLineWidth(LineWidth)
|
|
|
+ pdf.SetLineType("") // 线条样式
|
|
|
+ pdf.CellWithOption(&gopdf.Rect{
|
|
|
+ W: float64(fontSize),
|
|
|
+ H: float64(fontSize),
|
|
|
+ }, text3, gopdf.CellOption{Align: gopdf.Center | gopdf.Middle,
|
|
|
+ Border: gopdf.Left | gopdf.Right | gopdf.Bottom | gopdf.Top,
|
|
|
+ })
|
|
|
+ pdf.Cell(nil, " 不满意")
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func RectFill2(pdf *gopdf.GoPdf, text string, fontSize int, x, realHeight float64, digitInfo string) {
|
|
|
+ pdf.SetX(x)
|
|
|
+ pdf.Cell(nil, text)
|
|
|
+
|
|
|
+ pdf.Br(realHeight)
|
|
|
+
|
|
|
+ //textw, _ := pdf.MeasureTextWidth(text)
|
|
|
+
|
|
|
+ //y := x + textw
|
|
|
+ y := x
|
|
|
+
|
|
|
+ var LineWidth float64 = 1
|
|
|
+
|
|
|
+ var text1 = ""
|
|
|
+ if digitInfo == "1" {
|
|
|
+ text1 = "√"
|
|
|
+ }
|
|
|
+ pdf.SetX(y + float64(fontSize*2))
|
|
|
+ pdf.SetLineWidth(LineWidth)
|
|
|
+ pdf.SetLineType("") // 线条样式
|
|
|
+ pdf.CellWithOption(&gopdf.Rect{
|
|
|
+ W: float64(fontSize),
|
|
|
+ H: float64(fontSize),
|
|
|
+ }, text1, gopdf.CellOption{Align: gopdf.Center | gopdf.Middle,
|
|
|
+ Border: gopdf.Left | gopdf.Right | gopdf.Bottom | gopdf.Top,
|
|
|
+ })
|
|
|
+ pdf.Cell(nil, " 是")
|
|
|
+
|
|
|
+ var text2 = ""
|
|
|
+ if digitInfo == "2" {
|
|
|
+ text2 = "√"
|
|
|
+ }
|
|
|
+
|
|
|
+ pdf.SetX(y + float64(fontSize*9))
|
|
|
+ pdf.SetLineWidth(LineWidth)
|
|
|
+ pdf.SetLineType("") // 线条样式
|
|
|
+ pdf.CellWithOption(&gopdf.Rect{
|
|
|
+ W: float64(fontSize),
|
|
|
+ H: float64(fontSize),
|
|
|
+ }, text2, gopdf.CellOption{Align: gopdf.Center | gopdf.Middle,
|
|
|
+ Border: gopdf.Left | gopdf.Right | gopdf.Bottom | gopdf.Top,
|
|
|
+ })
|
|
|
+ pdf.Cell(nil, " 否")
|
|
|
+}
|
|
|
+
|
|
|
func Cron_Patient() {
|
|
|
|
|
|
//创建一个定时任务对象
|
|
@@ -428,7 +896,7 @@ func Send_Notice(nextTime time.Time, user Account.User_R, patient Patient.Patien
|
|
|
|
|
|
//发送短信通知
|
|
|
if patient.T_notice_message == 1 {
|
|
|
- res, err := http.SmsXSend(user.T_template_id, patient.T_phone, patient.T_name, nextTime.Format("2006年01月02日"))
|
|
|
+ res, err := submail.SmsXSend(user.T_template_id, patient.T_phone, patient.T_name, nextTime.Format("2006年01月02日"))
|
|
|
if err != nil {
|
|
|
System.Add_SysLogs_T("复诊通知", "短信通知失败", patient)
|
|
|
}
|
|
@@ -440,7 +908,8 @@ func Send_Notice(nextTime time.Time, user Account.User_R, patient Patient.Patien
|
|
|
T_type: 1,
|
|
|
T_id: res.Send_id,
|
|
|
T_remark: res.Status,
|
|
|
- T_code: res.Fee,
|
|
|
+ T_fee: res.Fee,
|
|
|
+ T_code: res.Code,
|
|
|
T_State: 1,
|
|
|
}
|
|
|
if res.Status == "error" {
|
|
@@ -456,31 +925,67 @@ func Send_Notice(nextTime time.Time, user Account.User_R, patient Patient.Patien
|
|
|
}
|
|
|
|
|
|
if patient.T_notice_phone == 1 {
|
|
|
- playInfoList := http.GetPlayInfoList(conf.VoiceCall_Template, []string{user.T_user, patient.T_name, nextTime.Format("2006/01/02")})
|
|
|
- res, err := http.VoiceNotifyAPI(conf.VoiceCall_Phone, "+86"+patient.T_phone, playInfoList)
|
|
|
+ // ----------- 华为语音通知
|
|
|
+ //playInfoList := http.GetPlayInfoList(conf.VoiceCall_Template, []string{user.T_user, patient.T_name, nextTime.Format("2006/01/02")})
|
|
|
+ //res, err := http.VoiceNotifyAPI(conf.VoiceCall_Phone, "+86"+patient.T_phone, playInfoList)
|
|
|
+ //if err != nil {
|
|
|
+ // System.Add_SysLogs_T("复诊通知", "电话通知失败", patient)
|
|
|
+ //}
|
|
|
+ //// 保存短信发送记录
|
|
|
+ //smsSend := Patient.PatientSend{
|
|
|
+ // T_uid: user.Id,
|
|
|
+ // T_pid: patient.Id,
|
|
|
+ // T_phone: patient.T_phone,
|
|
|
+ // T_type: 2,
|
|
|
+ // T_id: res.SessionId,
|
|
|
+ // T_remark: res.Resultdesc,
|
|
|
+ // T_State: 0,
|
|
|
+ //}
|
|
|
+ //if res.Resultcode != "0" {
|
|
|
+ // smsSend.T_State = 0
|
|
|
+ //}
|
|
|
+ //if res.Resultcode == "0" {
|
|
|
+ // Success = true
|
|
|
+ //}
|
|
|
+ //_, err = Patient.Add_PatientSend(smsSend)
|
|
|
+ //if err != nil {
|
|
|
+ // System.Add_SysLogs_T("复诊通知", "添加发送记录失败", patient)
|
|
|
+ //}
|
|
|
+
|
|
|
+ // ----------- 塞班语音通知
|
|
|
+ res, err := submail.VoiceXSend(patient.T_phone, user.T_user, patient.T_name, nextTime.Format("2006年01月02日"))
|
|
|
if err != nil {
|
|
|
System.Add_SysLogs_T("复诊通知", "电话通知失败", patient)
|
|
|
}
|
|
|
+
|
|
|
// 保存短信发送记录
|
|
|
- smsSend := Patient.PatientSend{
|
|
|
+ send := Patient.PatientSend{
|
|
|
T_uid: user.Id,
|
|
|
T_pid: patient.Id,
|
|
|
T_phone: patient.T_phone,
|
|
|
T_type: 2,
|
|
|
- T_id: res.SessionId,
|
|
|
- T_remark: res.Resultdesc,
|
|
|
- T_State: 0,
|
|
|
+ T_id: res.Send_id,
|
|
|
+ T_remark: res.Status,
|
|
|
+ T_fee: res.Fee,
|
|
|
+ T_code: res.Code,
|
|
|
+ T_State: 1,
|
|
|
}
|
|
|
- if res.Resultcode != "0" {
|
|
|
- smsSend.T_State = 0
|
|
|
+
|
|
|
+ _, err = Patient.Add_PatientSend(send)
|
|
|
+ if err != nil {
|
|
|
+ System.Add_SysLogs_T("复诊通知", "添加语音发送记录失败", send)
|
|
|
}
|
|
|
- if res.Resultcode == "0" {
|
|
|
+ if res.Status == "error" {
|
|
|
+ send.T_State = 0
|
|
|
+ }
|
|
|
+ if res.Status == "success" {
|
|
|
Success = true
|
|
|
}
|
|
|
- _, err = Patient.Add_PatientSend(smsSend)
|
|
|
+ _, err = Patient.Add_PatientSend(send)
|
|
|
if err != nil {
|
|
|
- System.Add_SysLogs_T("复诊通知", "添加发送记录失败", patient)
|
|
|
+ System.Add_SysLogs_T("复诊通知", "添加语音发送记录失败", send)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return Success
|