|
@@ -1960,6 +1960,253 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
|
1960
|
1960
|
|
1961
|
1961
|
}
|
1962
|
1962
|
|
|
1963
|
+func (c *PatientApiController) CheckMobileDoctorAdvice() {
|
|
1964
|
+ origin, _ := c.GetInt64("origin", 0)
|
|
1965
|
+ record_date, _ := c.GetInt64("record_date")
|
|
1966
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
1967
|
+ check_time := c.GetString("check_time")
|
|
1968
|
+ if len(check_time) <= 0 {
|
|
1969
|
+ utils.ErrorLog("check_time")
|
|
1970
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1971
|
+ return
|
|
1972
|
+ }
|
|
1973
|
+ timeLayout2 := "2006-01-02 15:04:05"
|
|
1974
|
+ loc, _ := time.LoadLocation("Local")
|
|
1975
|
+
|
|
1976
|
+ theTime, errs := time.ParseInLocation(timeLayout2, check_time, loc)
|
|
1977
|
+ fmt.Println("theTimewowowow", theTime)
|
|
1978
|
+ if errs != nil {
|
|
1979
|
+ utils.ErrorLog(errs.Error())
|
|
1980
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1981
|
+ return
|
|
1982
|
+ }
|
|
1983
|
+ if origin != 2 {
|
|
1984
|
+ groupno, _ := c.GetInt64("groupno", -1)
|
|
1985
|
+ var ids []string
|
|
1986
|
+ if groupno == 0 {
|
|
1987
|
+ advice_ids := c.GetString("advice_id")
|
|
1988
|
+ if advice_ids == "" {
|
|
1989
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1990
|
+ return
|
|
1991
|
+ } else {
|
|
1992
|
+ ids = strings.Split(advice_ids, ",")
|
|
1993
|
+ if len(ids) <= 0 {
|
|
1994
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1995
|
+ return
|
|
1996
|
+ }
|
|
1997
|
+ }
|
|
1998
|
+ }
|
|
1999
|
+ if groupno < 0 {
|
|
2000
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2001
|
+ return
|
|
2002
|
+ }
|
|
2003
|
+
|
|
2004
|
+ adminUserInfo := c.GetMobileAdminUserInfo()
|
|
2005
|
+
|
|
2006
|
+ var advice models.DoctorAdvice
|
|
2007
|
+
|
|
2008
|
+ if groupno > 0 {
|
|
2009
|
+ advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
|
2010
|
+ for _, item := range advices {
|
|
2011
|
+ if item.CheckState == 0 {
|
|
2012
|
+ advice = item
|
|
2013
|
+ }
|
|
2014
|
+
|
|
2015
|
+ //记录日志
|
|
2016
|
+ byterequest, _ := json.Marshal(advices)
|
|
2017
|
+ adviceLog := models.XtDoctorAdviceLog{
|
|
2018
|
+ UserOrgId: adminUserInfo.Org.Id,
|
|
2019
|
+ PatientId: item.PatientId,
|
|
2020
|
+ AdminUserId: adminUserInfo.AdminUser.Id,
|
|
2021
|
+ Module: 3,
|
|
2022
|
+ ErrLog: string(byterequest),
|
|
2023
|
+ Status: 1,
|
|
2024
|
+ Ctime: time.Now().Unix(),
|
|
2025
|
+ Mtime: 0,
|
|
2026
|
+ Source: "手机端核对医嘱",
|
|
2027
|
+ RecordDate: item.AdviceDate,
|
|
2028
|
+ }
|
|
2029
|
+ service.CreateDoctorAdviceLog(adviceLog)
|
|
2030
|
+ }
|
|
2031
|
+ if advice.CheckState == 1 {
|
|
2032
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceChecked)
|
|
2033
|
+ return
|
|
2034
|
+ }
|
|
2035
|
+ if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
|
|
2036
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
|
|
2037
|
+ return
|
|
2038
|
+ }
|
|
2039
|
+
|
|
2040
|
+ } else {
|
|
2041
|
+ advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
|
2042
|
+ for _, item := range advices {
|
|
2043
|
+ if item.CheckState == 0 {
|
|
2044
|
+ advice = item
|
|
2045
|
+
|
|
2046
|
+ }
|
|
2047
|
+
|
|
2048
|
+ //记录日志
|
|
2049
|
+ byterequest, _ := json.Marshal(advices)
|
|
2050
|
+ adviceLog := models.XtDoctorAdviceLog{
|
|
2051
|
+ UserOrgId: adminUserInfo.Org.Id,
|
|
2052
|
+ PatientId: item.PatientId,
|
|
2053
|
+ AdminUserId: adminUserInfo.AdminUser.Id,
|
|
2054
|
+ Module: 3,
|
|
2055
|
+ ErrLog: string(byterequest),
|
|
2056
|
+ Status: 1,
|
|
2057
|
+ Ctime: time.Now().Unix(),
|
|
2058
|
+ Mtime: 0,
|
|
2059
|
+ Source: "手机端核对医嘱",
|
|
2060
|
+ RecordDate: item.AdviceDate,
|
|
2061
|
+ }
|
|
2062
|
+ service.CreateDoctorAdviceLog(adviceLog)
|
|
2063
|
+ }
|
|
2064
|
+ if advice.CheckState == 1 {
|
|
2065
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceChecked)
|
|
2066
|
+ return
|
|
2067
|
+ }
|
|
2068
|
+ if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
|
|
2069
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
|
|
2070
|
+ return
|
|
2071
|
+ }
|
|
2072
|
+ }
|
|
2073
|
+
|
|
2074
|
+ checker := adminUserInfo.AdminUser.Id
|
|
2075
|
+
|
|
2076
|
+ advices := models.DoctorAdvice{
|
|
2077
|
+ CheckTime: theTime.Unix(),
|
|
2078
|
+ Checker: checker,
|
|
2079
|
+ UpdatedTime: time.Now().Unix(),
|
|
2080
|
+ }
|
|
2081
|
+ fmt.Println("groupnowowowowoowowow", groupno)
|
|
2082
|
+ var err error
|
|
2083
|
+ if groupno > 0 {
|
|
2084
|
+
|
|
2085
|
+ // 查询信息规挡的设置天数
|
|
2086
|
+
|
|
2087
|
+ infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
|
|
2088
|
+ if infor.ID > 0 && infor.WeekDay > 0 {
|
|
2089
|
+
|
|
2090
|
+ var cha_time int64
|
|
2091
|
+
|
|
2092
|
+ timeNowStr := time.Now().Format("2006-01-02")
|
|
2093
|
+ timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
|
|
2094
|
+
|
|
2095
|
+ //今日的日期减去设置的日期
|
|
2096
|
+ cha_time = timeNewDate.Unix() - infor.WeekDay*86400
|
|
2097
|
+
|
|
2098
|
+ if cha_time >= record_date {
|
|
2099
|
+ //查询审核是否允许
|
|
2100
|
+ infor, _ := service.GetDialysisInformationByRecordDate(patient_id, record_date, adminUserInfo.Org.Id, 4)
|
|
2101
|
+ //申请状态不允许的情况 拒绝修改
|
|
2102
|
+ if infor.ApplicationStatus != 1 {
|
|
2103
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
|
|
2104
|
+ return
|
|
2105
|
+ }
|
|
2106
|
+
|
|
2107
|
+ }
|
|
2108
|
+ }
|
|
2109
|
+ err = service.CheckDoctorAdviceByGroupNoOne(&advices, groupno, adminUserInfo.Org.Id)
|
|
2110
|
+
|
|
2111
|
+ key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
|
|
2112
|
+ redis := service.RedisClient()
|
|
2113
|
+ //清空key 值
|
|
2114
|
+ redis.Set(key, "", time.Second)
|
|
2115
|
+ keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
|
|
2116
|
+ redis.Set(keyTwo, "", time.Second)
|
|
2117
|
+ keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_doctor_advice"
|
|
2118
|
+ redis.Set(keyThree, "", time.Second)
|
|
2119
|
+ recordDate := theTime.Format("2006-01-02")
|
|
2120
|
+ keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
|
|
2121
|
+
|
|
2122
|
+ redis.Set(keyFour, "", time.Second)
|
|
2123
|
+ keyFive := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_advices_list_all"
|
|
2124
|
+ redis.Set(keyFive, "", time.Second)
|
|
2125
|
+ defer redis.Close()
|
|
2126
|
+ } else {
|
|
2127
|
+
|
|
2128
|
+ if len(ids[0]) <= 0 {
|
|
2129
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateDoctorAdviceFail)
|
|
2130
|
+ return
|
|
2131
|
+ } else {
|
|
2132
|
+ //t := time.Now().Format("2006-01-02")/**/
|
|
2133
|
+ //timeLayout2 := "2006-01-02"
|
|
2134
|
+ //loc, _ := time.LoadLocation("Local")
|
|
2135
|
+ //theTime, _ := time.ParseInLocation(timeLayout2, t, loc)
|
|
2136
|
+ // 查询信息规挡的设置天数
|
|
2137
|
+
|
|
2138
|
+ infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
|
|
2139
|
+ if infor.ID > 0 {
|
|
2140
|
+
|
|
2141
|
+ var cha_time int64
|
|
2142
|
+
|
|
2143
|
+ timeNowStr := time.Now().Format("2006-01-02")
|
|
2144
|
+ timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
|
|
2145
|
+
|
|
2146
|
+ //今日的日期减去设置的日期
|
|
2147
|
+ cha_time = timeNewDate.Unix() - infor.WeekDay*86400
|
|
2148
|
+
|
|
2149
|
+ if cha_time >= advices.AdviceDate {
|
|
2150
|
+ //查询审核是否允许
|
|
2151
|
+ infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id, 4)
|
|
2152
|
+ //申请状态不允许的情况 拒绝修改
|
|
2153
|
+ if infor.ApplicationStatus != 1 {
|
|
2154
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
|
|
2155
|
+ return
|
|
2156
|
+ }
|
|
2157
|
+
|
|
2158
|
+ }
|
|
2159
|
+ }
|
|
2160
|
+ err = service.BatchCheckOldDoctorAdvice(&advices, ids, adminUserInfo.Org.Id, advice.AdviceDate)
|
|
2161
|
+ //记录日志
|
|
2162
|
+ byterequest, _ := json.Marshal(advices)
|
|
2163
|
+ adviceLog := models.XtDoctorAdviceLog{
|
|
2164
|
+ UserOrgId: adminUserInfo.Org.Id,
|
|
2165
|
+ PatientId: advices.PatientId,
|
|
2166
|
+ AdminUserId: advices.Checker,
|
|
2167
|
+ Module: 3,
|
|
2168
|
+ ErrLog: string(byterequest),
|
|
2169
|
+ Status: 1,
|
|
2170
|
+ Ctime: time.Now().Unix(),
|
|
2171
|
+ Mtime: 0,
|
|
2172
|
+ Source: "手机端核对医嘱",
|
|
2173
|
+ RecordDate: advices.AdviceDate,
|
|
2174
|
+ }
|
|
2175
|
+ service.CreateDoctorAdviceLog(adviceLog)
|
|
2176
|
+ key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
|
|
2177
|
+ redis := service.RedisClient()
|
|
2178
|
+ //清空key 值
|
|
2179
|
+ redis.Set(key, "", time.Second)
|
|
2180
|
+ keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
|
|
2181
|
+ redis.Set(keyTwo, "", time.Second)
|
|
2182
|
+ keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_doctor_advice"
|
|
2183
|
+ redis.Set(keyThree, "", time.Second)
|
|
2184
|
+ recordDate := theTime.Format("2006-01-02")
|
|
2185
|
+ keyFour := "scheduals_" + recordDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
|
|
2186
|
+
|
|
2187
|
+ redis.Set(keyFour, "", time.Second)
|
|
2188
|
+ keyFive := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_advices_list_all"
|
|
2189
|
+ redis.Set(keyFive, "", time.Second)
|
|
2190
|
+ defer redis.Close()
|
|
2191
|
+ }
|
|
2192
|
+ }
|
|
2193
|
+
|
|
2194
|
+ if err != nil {
|
|
2195
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateDoctorAdviceFail)
|
|
2196
|
+ return
|
|
2197
|
+ }
|
|
2198
|
+
|
|
2199
|
+ advice.Checker = checker
|
|
2200
|
+ advice.CheckTime = theTime.Unix()
|
|
2201
|
+ advice.CheckState = 1
|
|
2202
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2203
|
+ "msg": "ok",
|
|
2204
|
+ "advice": advice,
|
|
2205
|
+ })
|
|
2206
|
+ }
|
|
2207
|
+ return
|
|
2208
|
+}
|
|
2209
|
+
|
1963
|
2210
|
func (c *PatientApiController) CheckDoctorAdvice() {
|
1964
|
2211
|
origin, _ := c.GetInt64("origin", 0)
|
1965
|
2212
|
record_date, _ := c.GetInt64("record_date")
|
|
@@ -2379,7 +2626,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
|
2379
|
2626
|
|
2380
|
2627
|
dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.Org.Id, id, theAssessmentDateTime)
|
2381
|
2628
|
lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribeByModeIdSix(adminUserInfo.Org.Id, id, schedual.ModeId)
|
2382
|
|
- fmt.Println("22332232o2o", lastDialysisPrescribe.Chaptalization)
|
|
2629
|
+
|
2383
|
2630
|
if schedual != nil {
|
2384
|
2631
|
// 获取透析模版
|
2385
|
2632
|
dialysisSolution, _ = service.MobileGetDialysisSolutionByModeIdSix(adminUserInfo.Org.Id, id, schedual.ModeId)
|
|
@@ -3779,6 +4026,16 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
|
3779
|
4026
|
evaluation.BeforSymptoms = befor_symptoms
|
3780
|
4027
|
|
3781
|
4028
|
}
|
|
4029
|
+
|
|
4030
|
+ if dataBody["washing_time"] != nil && reflect.TypeOf(dataBody["washing_time"]).String() == "string" {
|
|
4031
|
+ washing_time, _ := dataBody["washing_time"].(string)
|
|
4032
|
+ evaluation.WashingTime = washing_time
|
|
4033
|
+ }
|
|
4034
|
+
|
|
4035
|
+ if dataBody["warsh_count"] != nil && reflect.TypeOf(dataBody["warsh_count"]).String() == "string" {
|
|
4036
|
+ warsh_count, _ := dataBody["warsh_count"].(string)
|
|
4037
|
+ evaluation.WarshCount = warsh_count
|
|
4038
|
+ }
|
3782
|
4039
|
return
|
3783
|
4040
|
}
|
3784
|
4041
|
|